1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-22 15:57:15 +00:00

Fixed archive delete bug.

This commit is contained in:
Jonas Borgström 2010-03-29 21:40:09 +02:00
parent 42ff0a850b
commit eedf969f67

View file

@ -1,5 +1,4 @@
import os import os
import sys
import hashlib import hashlib
import zlib import zlib
import cPickle import cPickle
@ -32,6 +31,7 @@ def add_chunk(self, id, sum, csize, osize):
def open(self, name): def open(self, name):
archive = cPickle.loads(zlib.decompress(self.store.get(NS_ARCHIVES, name))) archive = cPickle.loads(zlib.decompress(self.store.get(NS_ARCHIVES, name)))
self.items = archive['items'] self.items = archive['items']
self.name = archive['name']
for i, (id, sum, csize, osize) in enumerate(archive['chunks']): for i, (id, sum, csize, osize) in enumerate(archive['chunks']):
self.chunk_idx[i] = id self.chunk_idx[i] = id
@ -82,7 +82,8 @@ def delete(self, cache):
for item in self.items: for item in self.items:
if item['type'] == 'FILE': if item['type'] == 'FILE':
for c in item['chunks']: for c in item['chunks']:
cache.chunk_decref(c) id = self.chunk_idx[c]
cache.chunk_decref(id)
self.store.commit() self.store.commit()
cache.archives.remove(self.name) cache.archives.remove(self.name)
cache.save() cache.save()