diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-05-24 13:38:36 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-05-24 13:38:36 +0200 |
commit | ea06d76a6e3d7199250035dbb5d17e13bd5be671 (patch) | |
tree | 8067b2006aa9f5c5826409c0d373edd1e94db2ba | |
parent | 44f4c089bff7ed1fafe0be0458c2cac2bf2ae308 (diff) | |
download | obnam-ea06d76a6e3d7199250035dbb5d17e13bd5be671.tar.gz |
Fix chunk removal at commit time to handle chunks not in shared trees
-rw-r--r-- | obnamlib/repo.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/obnamlib/repo.py b/obnamlib/repo.py index 97f28989..649f5fe8 100644 --- a/obnamlib/repo.py +++ b/obnamlib/repo.py @@ -555,11 +555,17 @@ class Repository(object): def remove_chunks(chunk_ids): for chunk_id in chunk_ids: - checksum = self.chunklist.get_checksum(chunk_id) - self.chunksums.remove(checksum, chunk_id, - self.current_client_id) - if not self.chunksums.chunk_is_used(checksum, chunk_id): + try: + checksum = self.chunklist.get_checksum(chunk_id) + except KeyError: + # No checksum, therefore it can't be shared, therefore + # we can remove it. self.remove_chunk(chunk_id) + else: + self.chunksums.remove(checksum, chunk_id, + self.current_client_id) + if not self.chunksums.chunk_is_used(checksum, chunk_id): + self.remove_chunk(chunk_id) def remove_gens(genids): if self.new_generation is None: |