Skip to content

Comments

feat(bin/oli): support cp to dir#6140

Merged
Xuanwo merged 24 commits intoapache:mainfrom
asukaminato0721:oli-cp-dir
May 14, 2025
Merged

feat(bin/oli): support cp to dir#6140
Xuanwo merged 24 commits intoapache:mainfrom
asukaminato0721:oli-cp-dir

Conversation

@asukaminato0721
Copy link
Contributor

@asukaminato0721 asukaminato0721 commented May 1, 2025

Which issue does this PR close?

Closes #2795.
part of #422.

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@asukaminato0721 asukaminato0721 changed the title cp dir feat(bin/oli): support cp to dir May 1, 2025
@asukaminato0721
Copy link
Contributor Author

No cargo test in CI...

@asukaminato0721 asukaminato0721 marked this pull request as ready for review May 1, 2025 19:15
@asukaminato0721 asukaminato0721 requested a review from Xuanwo as a code owner May 1, 2025 19:15
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels May 1, 2025
@yihong0618
Copy link
Contributor

I think we can drop obvious commnets

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels May 11, 2025
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels May 11, 2025
@asukaminato0721 asukaminato0721 requested a review from xxchan May 11, 2025 19:11
@xxchan xxchan requested a review from Copilot May 12, 2025 06:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the CI workflow for the bin/oli directory to support the "cp to dir" feature, ensuring that code linting and tests are executed in the CI process.

  • Renames the CI job from "check_clippy" to "check_clippy_and_test"
  • Adds a caching step using the sccache-action to speed up build times
  • Combines cargo clippy and test executions with sccache environment support

Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Others LGTM

@asukaminato0721 asukaminato0721 marked this pull request as draft May 12, 2025 16:33
@xxchan
Copy link
Member

xxchan commented May 13, 2025

@asukaminato0721 Would you like to try the testing style with #6174? I'm fine to either merge that one before or after this PR

@asukaminato0721
Copy link
Contributor Author

aha, I know the reason now, I enable the cargo test in CI.

@asukaminato0721 asukaminato0721 marked this pull request as ready for review May 13, 2025 11:48
@asukaminato0721
Copy link
Contributor Author

I can't understand

cargo test
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.33s
     Running unittests src/lib.rs (target/debug/deps/oli-e6bc33088fff7ae4)

running 7 tests
test config::tests::test_load_from_env ... ok
test config::tests::test_parse_s3_location3 ... ok
test config::tests::test_load_from_toml ... ok
test config::tests::test_load_config_from_file_and_env ... ok
test config::tests::test_parse_fs_location ... ok
test config::tests::test_parse_s3_location2 ... ok
test config::tests::test_parse_s3_location ... ok

test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/bin/oli.rs (target/debug/deps/oli-598fecbf05f25d6d)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/integration/main.rs (target/debug/deps/integration-fd61fe36475b972e)

running 14 tests
test cp::test_basic_cp ... ok
test cat::test_basic_cat ... ok
test cat::test_cat_for_path_in_current_dir ... ok
test ls::test_basic_ls ... ok
test cp::test_cp_file_to_existing_dir ... ok
test cp::test_cp_for_path_in_current_dir ... ok
test cp::test_recursive_cp_dir_to_new_dir ... ok
test stat::test_basic_stat ... ok
test mv::test_basic_mv ... ok
test mv::test_move_a_file_to_a_dir ... ok
test stat::test_stat_for_path_in_current_dir ... ok
test rm::test_basic_rm ... ok
test rm::test_rm_for_path_in_current_dir ... ok
test mv::test_mv_with_recursive ... ok

test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.20s

   Doc-tests oli

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

@asukaminato0721 asukaminato0721 requested a review from xxchan May 13, 2025 12:20
@asukaminato0721
Copy link
Contributor Author

seems that the size of folder diffs.

@xxchan
Copy link
Member

xxchan commented May 13, 2025

seems that the size of folder diffs.

maybe we can ignore size of folder

@asukaminato0721
Copy link
Contributor Author

well...

────────────┬───────────────────────────────────────────────────────────────────
    1     1 │ exit_code: 0
    2     2 │ ----- stdout -----
    3     3 │ [TEMP_DIR]/
    4     4 │ dst_3.txt
          5 │+dst_1.txt
    5     6 │ dst_2.txt
    6       │-dst_1.txt
    7     7 │ 
    8     8 │ ----- stderr -----
────────────┴───────────────────────────────────────────────────────────────────

@asukaminato0721
Copy link
Contributor Author

another problem is that

+-----------------------------------------------+
| Path                     Type   Content       |
+===============================================+
| [TEMP_DIR]               DIR                  |
| [TEMP_DIR]/dest_root     DIR                  |
| [TEMP_DIR]/dest_dir      DIR                  |
| [TEMP_DIR]/file1.txt     FILE   file1_content |
| [TEMP_DIR]/file3.txt     FILE   file3_content |
| [TEMP_DIR]/sub_dir       DIR                  |
| [TEMP_DIR]/file2.txt     FILE   file2_content |
| [TEMP_DIR]/source_root   DIR                  |
| [TEMP_DIR]/source_dir    DIR                  |
| [TEMP_DIR]/file1.txt     FILE   file1_content |
| [TEMP_DIR]/file3.txt     FILE   file3_content |
| [TEMP_DIR]/sub_dir       DIR                  |
| [TEMP_DIR]/file2.txt     FILE   file2_content |
+-----------------------------------------------+

this is not good, since the src and dst become the same.

@asukaminato0721
Copy link
Contributor Author

+----------------------------------------------------------------------------+
| Path                                                  Type   Content       |
+============================================================================+
| [TEMP_DIR]                                            DIR                  |
| [TEMP_DIR]/dest_root                                  DIR                  |
| [TEMP_DIR]/dest_root/dest_dir                         DIR                  |
| [TEMP_DIR]/dest_root/dest_dir/file1.txt               FILE   file1_content |
| [TEMP_DIR]/dest_root/dest_dir/file3.txt               FILE   file3_content |
| [TEMP_DIR]/dest_root/dest_dir/sub_dir                 DIR                  |
| [TEMP_DIR]/dest_root/dest_dir/sub_dir/file2.txt       FILE   file2_content |
| [TEMP_DIR]/source_root                                DIR                  |
| [TEMP_DIR]/source_root/source_dir                     DIR                  |
| [TEMP_DIR]/source_root/source_dir/file1.txt           FILE   file1_content |
| [TEMP_DIR]/source_root/source_dir/file3.txt           FILE   file3_content |
| [TEMP_DIR]/source_root/source_dir/sub_dir             DIR                  |
| [TEMP_DIR]/source_root/source_dir/sub_dir/file2.txt   FILE   file2_content |
+----------------------------------------------------------------------------+

now pretty well.

@asukaminato0721
Copy link
Contributor Author

ping @xxchan

@xxchan
Copy link
Member

xxchan commented May 13, 2025

+----------------------------------------------------------------------------+
| Path                                                  Type   Content       |
+============================================================================+
| [TEMP_DIR]                                            DIR                  |
| [TEMP_DIR]/dest_root                                  DIR                  |
| [TEMP_DIR]/dest_root/dest_dir                         DIR                  |
| [TEMP_DIR]/dest_root/dest_dir/file1.txt               FILE   file1_content |
| [TEMP_DIR]/dest_root/dest_dir/file3.txt               FILE   file3_content |
| [TEMP_DIR]/dest_root/dest_dir/sub_dir                 DIR                  |
| [TEMP_DIR]/dest_root/dest_dir/sub_dir/file2.txt       FILE   file2_content |
| [TEMP_DIR]/source_root                                DIR                  |
| [TEMP_DIR]/source_root/source_dir                     DIR                  |
| [TEMP_DIR]/source_root/source_dir/file1.txt           FILE   file1_content |
| [TEMP_DIR]/source_root/source_dir/file3.txt           FILE   file3_content |
| [TEMP_DIR]/source_root/source_dir/sub_dir             DIR                  |
| [TEMP_DIR]/source_root/source_dir/sub_dir/file2.txt   FILE   file2_content |
+----------------------------------------------------------------------------+

now pretty well.

Ideally we can have sth like [TEMP_DIR1], [TEMP_DIR2], but I guess this is not achievable via regexp? The workaround above (only 1 tempdir as root) looks fine to me. Alternatively, maybe we use named tempdir and only replaces the common prefix of the path? 🤔

@asukaminato0721 asukaminato0721 requested a review from xxchan May 13, 2025 19:39
Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 14, 2025
@Xuanwo
Copy link
Member

Xuanwo commented May 14, 2025

Thank you @asukaminato0721 for working on this and thank you @xxchan for the review!

@Xuanwo Xuanwo merged commit 1b953a5 into apache:main May 14, 2025
16 checks passed
@asukaminato0721 asukaminato0721 deleted the oli-cp-dir branch May 14, 2025 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: oli: copy to directory

4 participants