Skip to content

Commit 3409d80

Browse files
committed
fix(sftp_sync): update default comparison mode to 'size' and enhance parameter documentation
1 parent 0a02249 commit 3409d80

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

.husky/hash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
php-proxy-hunter a95d3ba93b4225d03
1+
php-proxy-hunter a4d27a75b908d600f

src/vps/sftp_sync.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,25 @@ def sync_remote_to_local(
5757
remote_root: str,
5858
local_root: str,
5959
delete_extra: bool = False,
60-
compare: str = "mtime",
60+
compare: str = "size",
6161
dry_run: bool = False,
6262
time_tolerance: float = 1.0,
6363
) -> None:
6464
"""Sync remote -> local.
6565
66-
- compare: "mtime" (default), "size", or "mtime+size".
66+
Parameters
67+
- sftp: an active Paramiko SFTPClient.
68+
- remote_root: remote file or directory root on the server.
69+
- local_root: destination local directory.
6770
- delete_extra: if True, remove local files not present remotely.
68-
- dry_run: if True, only print planned actions.
71+
- compare: comparison mode controlling when files are downloaded:
72+
* "mtime": download when remote modification time is newer than local by more than `time_tolerance` seconds.
73+
* "size": download when the remote and local file sizes differ.
74+
* "mtime+size": download when either size differs or remote mtime is newer than local by more than `time_tolerance`.
75+
The default is "size".
76+
- dry_run: if True, only print planned actions without performing them.
77+
- time_tolerance: float number of seconds used to tolerate small mtime
78+
differences when using "mtime" or "mtime+size".
6979
"""
7080
if sftp is None:
7181
raise RuntimeError("SFTP client not initialized.")

0 commit comments

Comments
 (0)