From b2e8a37bb98f99cb365ca45c141389f4d8655f43 Mon Sep 17 00:00:00 2001 From: Brian Pugh Date: Mon, 15 Aug 2022 10:39:15 -0700 Subject: [PATCH] combine keep and dst_files command --- belay/device.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/belay/device.py b/belay/device.py index a12bf09..64ce470 100644 --- a/belay/device.py +++ b/belay/device.py @@ -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("*")) @@ -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: