summaryrefslogtreecommitdiff
path: root/hosts/vidhar
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/vidhar')
-rwxr-xr-xhosts/vidhar/borg/copy.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py
index cbd12469..23c45fcf 100755
--- a/hosts/vidhar/borg/copy.py
+++ b/hosts/vidhar/borg/copy.py
@@ -51,13 +51,13 @@ def read_repo(path):
51 return res 51 return res
52 52
53class ToSync: 53class ToSync:
54 to_sync = None 54 to_sync = set()
55 55
56 def __iter__(self): 56 def __iter__(self):
57 return self 57 return self
58 58
59 def __next__(self): 59 def __next__(self):
60 if to_sync: 60 if self.to_sync:
61 return self.to_sync.pop() 61 return self.to_sync.pop()
62 62
63 while True: 63 while True:
@@ -68,12 +68,11 @@ class ToSync:
68 print(err, file=stderr) 68 print(err, file=stderr)
69 continue 69 continue
70 70
71 self.to_sync = set()
72 for entry in src: 71 for entry in src:
73 if entry['name'] not in {dst_entry['name'] for dst_entry in dst} and not entry['name'].endswith('.checkpoint'): 72 if entry['name'] not in {dst_entry['name'] for dst_entry in dst} and not entry['name'].endswith('.checkpoint'):
74 self.to_sync.add(entry) 73 self.to_sync.add(entry)
75 74
76 if to_sync: 75 if self.to_sync:
77 return self.to_sync.pop() 76 return self.to_sync.pop()
78 77
79 raise StopIteration 78 raise StopIteration