diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-17 13:54:37 +0100 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-17 13:54:37 +0100 |
| commit | 957110f6549c2917d0f47951923d454891d6fdb3 (patch) | |
| tree | 3597ed2b8e9dd95365c32b03d5892620738e9d1c /hosts | |
| parent | 2823c030a44b510a4e7db883f53dc825cb4abc55 (diff) | |
| download | nixos-957110f6549c2917d0f47951923d454891d6fdb3.tar nixos-957110f6549c2917d0f47951923d454891d6fdb3.tar.gz nixos-957110f6549c2917d0f47951923d454891d6fdb3.tar.bz2 nixos-957110f6549c2917d0f47951923d454891d6fdb3.tar.xz nixos-957110f6549c2917d0f47951923d454891d6fdb3.zip | |
vidhar: ...
Diffstat (limited to 'hosts')
| -rwxr-xr-x | hosts/vidhar/borg/copy.py | 7 |
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 | ||
| 53 | class ToSync: | 53 | class 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 |
