mirror of
https://github.com/rclone/rclone.git
synced 2024-11-30 04:23:48 +08:00
3a50f35df9
Allows rclone sync to accept the same output file flags as rclone check, for the purpose of writing results to a file. A new --dest-after option is also supported, which writes a list file using the same ListFormat flags as lsf (including customizable options for hash, modtime, etc.) Conceptually it is similar to rsync's --itemize-changes, but not identical -- it should output an accurate list of what will be on the destination after the sync. Note that it has a few limitations, and certain scenarios are not currently supported: --max-duration / CutoffModeHard --compare-dest / --copy-dest (because equal() is called multiple times for the same file) server-side moves of an entire dir at once (because we never get the individual file objects in the dir) High-level retries, because there would be dupes Possibly some error scenarios that didn't come up on the tests Note also that each file is logged during the sync, as opposed to after, so it is most useful as a predictor of what SHOULD happen to each file (which may or may not match what actually DID.) Only rclone sync is currently supported -- support for copy and move may be added in the future.
48 lines
2.3 KiB
Plaintext
48 lines
2.3 KiB
Plaintext
# tests whether rclone check and rclone sync output exactly the same file lists.
|
|
|
|
# Filling src and dst with makefiles:
|
|
exec rclone test makefiles $SRC --seed 0
|
|
exec rclone test makefiles $DST --seed 1
|
|
exec rclone test makefiles $SRC --seed 2
|
|
exec rclone test makefiles $DST --seed 2
|
|
|
|
# running rclone check for baseline test:
|
|
# error is expected here:
|
|
! exec rclone check $SRC $DST --match $WORK/CHECKmatch.txt --combined $WORK/CHECKcombined.txt --missing-on-src $WORK/CHECKmissingonsrc.txt --missing-on-dst $WORK/CHECKmissingondst.txt --error $WORK/CHECKerr.txt --differ $WORK/CHECKdiffer.txt -q
|
|
|
|
# running sync with output files:
|
|
exec rclone sync $SRC $DST --match $WORK/SYNCmatch.txt --combined $WORK/SYNCcombined.txt --missing-on-src $WORK/SYNCmissingonsrc.txt --missing-on-dst $WORK/SYNCmissingondst.txt --error $WORK/SYNCerr.txt --differ $WORK/SYNCdiffer.txt
|
|
|
|
# sorting them by line and diffing:
|
|
exec sort $WORK/CHECKmatch.txt -o $WORK/CHECKmatch.txt
|
|
exec sort $WORK/CHECKcombined.txt -o $WORK/CHECKcombined.txt
|
|
exec sort $WORK/CHECKmissingonsrc.txt -o $WORK/CHECKmissingonsrc.txt
|
|
exec sort $WORK/CHECKmissingondst.txt -o $WORK/CHECKmissingondst.txt
|
|
exec sort $WORK/CHECKerr.txt -o $WORK/CHECKerr.txt
|
|
exec sort $WORK/CHECKdiffer.txt -o $WORK/CHECKdiffer.txt
|
|
|
|
exec sort $WORK/SYNCmatch.txt -o $WORK/SYNCmatch.txt
|
|
exec sort $WORK/SYNCcombined.txt -o $WORK/SYNCcombined.txt
|
|
exec sort $WORK/SYNCmissingonsrc.txt -o $WORK/SYNCmissingonsrc.txt
|
|
exec sort $WORK/SYNCmissingondst.txt -o $WORK/SYNCmissingondst.txt
|
|
exec sort $WORK/SYNCerr.txt -o $WORK/SYNCerr.txt
|
|
exec sort $WORK/SYNCdiffer.txt -o $WORK/SYNCdiffer.txt
|
|
|
|
# diff match check vs. sync:
|
|
cmp $WORK/CHECKmatch.txt $WORK/SYNCmatch.txt
|
|
# diff combined check vs. sync:
|
|
cmp $WORK/CHECKcombined.txt $WORK/SYNCcombined.txt
|
|
# diff missingonsrc check vs. sync:
|
|
cmp $WORK/CHECKmissingonsrc.txt $WORK/SYNCmissingonsrc.txt
|
|
# diff missingondst check vs. sync:
|
|
cmp $WORK/CHECKmissingondst.txt $WORK/SYNCmissingondst.txt
|
|
# diff error check vs. sync:
|
|
cmp $WORK/CHECKerr.txt $WORK/SYNCerr.txt
|
|
# diff differ check vs. sync:
|
|
cmp $WORK/CHECKdiffer.txt $WORK/SYNCdiffer.txt
|
|
|
|
# verify accuracy
|
|
exec rclone check $SRC $DST
|
|
exec diff -rya --suppress-common-lines $SRC $DST
|
|
[!windows] exec rsync -aEvhPu $SRC/ $WORK/rsyncDst
|
|
[!windows] exec rclone check $DST $WORK/rsyncDst |