Skip to content

Commit

Permalink
combine keep and dst_files command
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianPugh committed Aug 15, 2022
1 parent be0effa commit b2e8a37
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions belay/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,6 @@ def sync(
elif isinstance(keep, str):
keep = [keep]
keep = [x if x[0] == "/" else "/" + x for x in keep]
if keep:
self(f"for x in {repr(keep)}:\n all_files.discard(x)")

# Sort so that folder creation comes before file sending.
src_objects = sorted(folder.rglob("*"))
Expand All @@ -333,7 +331,9 @@ def sync(
src_files.append(src_object)
dst_files = [f"/{src.relative_to(folder)}" for src in src_files]
dst_dirs = [f"/{src.relative_to(folder)}" for src in src_dirs]
self(f"for x in {repr(dst_files)}:\n all_files.discard(x)")
keep = [x for x in keep if x not in dst_files]
if dst_files + keep:
self(f"for x in {repr(dst_files + keep)}:\n all_files.discard(x)")

# Try and make all remote dirs
if dst_dirs:
Expand Down

0 comments on commit b2e8a37

Please sign in to comment.