Added shallow diff option
This commit is contained in:
parent
036a20cd27
commit
aa990d4141
2 changed files with 13 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue