Added shallow diff option

This commit is contained in:
R Dittberner 2026-03-05 17:48:13 +01:00
parent 036a20cd27
commit aa990d4141
2 changed files with 13 additions and 3 deletions

View file

@ -30,6 +30,12 @@ parser.add_argument(
action="store_true",
help="List affected files without copying or deleting",
)
parser.add_argument(
"-s",
"--shallow-diff",
action="store_true",
help="Use filecmp.cmp() shallow mode for file diff (faster, but might miss changes or generate false positives)",
)
args = parser.parse_args()
@ -58,7 +64,7 @@ def get_files(path):
def main():
startstring = " FOLDER-SYNC 1.0 "
startstring = " FOLDER-SYNC 0.1.3 "
if not args.quiet:
print(
len(startstring) * "=" + "\n" + startstring + "\n" + len(startstring) * "="
@ -90,7 +96,11 @@ def main():
for path in source:
if path not in target:
new.append(path)
elif not filecmp.cmp(os.path.join(inpath, path), os.path.join(outpath, path)):
elif not filecmp.cmp(
os.path.join(inpath, path),
os.path.join(outpath, path),
shallow=args.shallow_diff,
):
changed.append(path)
# Check for file deletions

View file

@ -1,6 +1,6 @@
[project]
name = "DataPuller"
version = "0.1.2"
version = "0.1.3"
description = "rsync but worse"
requires-python = ">=3.13"
dependencies = []