-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: megfile sync #491
base: main
Are you sure you want to change the base?
Conversation
bbtfr
commented
Jan 25, 2025
•
edited
Loading
edited
- 每个文件拷贝完打印一下完成,可以通过 --verbose 开启
- 扫描文件改为在线程里完成,这样可以边扫边拷,对大量小文件比较友好
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #491 +/- ##
==========================================
- Coverage 99.98% 99.95% -0.04%
==========================================
Files 44 44
Lines 6391 6409 +18
==========================================
+ Hits 6390 6406 +16
- Misses 1 3 +2 ☔ View full report in Codecov by Sentry. |
f3c7407
to
a221c73
Compare
@@ -69,10 +71,13 @@ def cli(debug, log_level): | |||
|
|||
|
|||
def safe_cli(): # pragma: no cover | |||
debug = options.get("debug", False) | |||
if not debug: | |||
signal.signal(signal.SIGINT, signal.SIG_DFL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加上这句使得 Ctrl+C 总是能立刻关掉任务
CLI 里有些地方很多地方用了多线程,Ctrl+C 半天关不掉
) | ||
@click.option("-G", "--no-progress-bar", is_flag=True, help="Do not show progress bar.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里有个不向前兼容更新,把 --progress-bar
改成 --no-progress-bar
之前这个设成啥都会有进度条,只是有没有 total 的区别,感觉有歧义
@@ -404,7 +404,7 @@ def _smart_sync_single_file(items: dict): | |||
force = items["force"] | |||
overwrite = items["overwrite"] | |||
|
|||
content_path = os.path.relpath(src_file_path, start=src_root_path) | |||
content_path = smart_relpath(src_file_path, start=src_root_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是个 bugfix,不用 smart_relpath 会导致 alias 拼路径拼错
@@ -438,6 +438,8 @@ def _smart_sync_single_file(items: dict): | |||
callback=copy_callback, | |||
followlinks=followlinks, | |||
) | |||
elif callback: | |||
callback(src_file_path, src_file_stat.size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
跳过的文件也能在进度条上体现
d1f66bb
to
574a659
Compare
ae8c450
to
8f848c4
Compare
8f848c4
to
8086eb7
Compare