1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-23 16:26:29 +00:00

Fix "All archives" output for attic info

Closes #183
This commit is contained in:
Jonas Borgström 2015-04-19 23:45:05 +02:00
parent 04d50c7141
commit dd0c69ac32
3 changed files with 10 additions and 6 deletions

View file

@ -7,6 +7,7 @@ Version 0.16
------------
(bugfix release, released on X)
- Fix "All archives" output for attic info. (#183)
- More user friendly error message when repository key file is not found (#236)
- Fix parsing of iso 8601 timestamps with zero microseconds (#282)

View file

@ -207,7 +207,7 @@ def save(self, name=None):
def calc_stats(self, cache):
def add(id):
count, size, csize = self.cache.chunks[id]
count, size, csize = cache.chunks[id]
stats.update(size, csize, count == 1)
self.cache.chunks[id] = count - 1, size, csize
def add_file_chunks(chunks):

View file

@ -93,11 +93,7 @@ def create(self):
with open(os.path.join(self.path, 'files'), 'w') as fd:
pass # empty file
def open(self):
if not os.path.isdir(self.path):
raise Exception('%s Does not look like an Attic cache' % self.path)
self.lock = UpgradableLock(os.path.join(self.path, 'config'), exclusive=True)
self.rollback()
def _do_open(self):
self.config = RawConfigParser()
self.config.read(os.path.join(self.path, 'config'))
if self.config.getint('cache', 'version') != 1:
@ -110,6 +106,12 @@ def open(self):
self.chunks = ChunkIndex.read(os.path.join(self.path, 'chunks').encode('utf-8'))
self.files = None
def open(self):
if not os.path.isdir(self.path):
raise Exception('%s Does not look like an Attic cache' % self.path)
self.lock = UpgradableLock(os.path.join(self.path, 'config'), exclusive=True)
self.rollback()
def close(self):
if self.lock:
self.lock.release()
@ -181,6 +183,7 @@ def rollback(self):
if os.path.exists(os.path.join(self.path, 'txn.tmp')):
shutil.rmtree(os.path.join(self.path, 'txn.tmp'))
self.txn_active = False
self._do_open()
def sync(self):
"""Initializes cache by fetching and reading all archive indicies