mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-26 07:53:58 +00:00
Added fingerprint and number of files to sats/info output
This commit is contained in:
parent
2c328be1b1
commit
996fd10f8f
3 changed files with 8 additions and 3 deletions
|
@ -125,6 +125,7 @@ def cb(chunk, error, id):
|
||||||
for id, size, csize in item['chunks']:
|
for id, size, csize in item['chunks']:
|
||||||
count, _, _ = self.cache.chunks[id]
|
count, _, _ = self.cache.chunks[id]
|
||||||
stats.update(size, csize, count==1)
|
stats.update(size, csize, count==1)
|
||||||
|
stats.nfiles += 1
|
||||||
self.cache.chunks[id] = count - 1, size, csize
|
self.cache.chunks[id] = count - 1, size, csize
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
@ -333,6 +334,7 @@ def process_file(self, path, st, cache):
|
||||||
cache.memorize_file(path_hash, st, ids)
|
cache.memorize_file(path_hash, st, ids)
|
||||||
item = {'path': safe_path, 'chunks': chunks}
|
item = {'path': safe_path, 'chunks': chunks}
|
||||||
item.update(self.stat_attrs(st, path))
|
item.update(self.stat_attrs(st, path))
|
||||||
|
self.stats.nfiles += 1
|
||||||
self.add_item(item)
|
self.add_item(item)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -82,6 +82,7 @@ def do_create(self, args):
|
||||||
diff = t - t0
|
diff = t - t0
|
||||||
print '-' * 40
|
print '-' * 40
|
||||||
print 'Archive name: %s' % args.archive.archive
|
print 'Archive name: %s' % args.archive.archive
|
||||||
|
print 'Archive fingerprint: %s' % archive.hash.encode('hex')
|
||||||
print 'Start time: %s' % t0.strftime('%c')
|
print 'Start time: %s' % t0.strftime('%c')
|
||||||
print 'End time: %s' % t.strftime('%c')
|
print 'End time: %s' % t.strftime('%c')
|
||||||
print 'Duration: %.2f (%s)' % (diff.total_seconds(), format_timedelta(diff))
|
print 'Duration: %.2f (%s)' % (diff.total_seconds(), format_timedelta(diff))
|
||||||
|
@ -219,10 +220,11 @@ def do_info(self, args):
|
||||||
cache = Cache(store, key)
|
cache = Cache(store, key)
|
||||||
archive = Archive(store, key, args.archive.archive, cache=cache)
|
archive = Archive(store, key, args.archive.archive, cache=cache)
|
||||||
stats = archive.calc_stats(cache)
|
stats = archive.calc_stats(cache)
|
||||||
print 'Name:', archive.metadata['name']
|
print 'Name:', archive.name
|
||||||
|
print 'Fingerprint: %s' % archive.hash.encode('hex')
|
||||||
print 'Hostname:', archive.metadata['hostname']
|
print 'Hostname:', archive.metadata['hostname']
|
||||||
print 'Username:', archive.metadata['username']
|
print 'Username:', archive.metadata['username']
|
||||||
print 'Time:', archive.metadata['time']
|
print 'Time:', to_localtime(archive.ts).strftime('%c')
|
||||||
print 'Command line:', ' '.join(archive.metadata['cmdline'])
|
print 'Command line:', ' '.join(archive.metadata['cmdline'])
|
||||||
stats.print_()
|
stats.print_()
|
||||||
return self.exit_code
|
return self.exit_code
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
class Statistics(object):
|
class Statistics(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.osize = self.csize = self.usize = 0
|
self.osize = self.csize = self.usize = self.nfiles = 0
|
||||||
|
|
||||||
def update(self, size, csize, unique):
|
def update(self, size, csize, unique):
|
||||||
self.osize += size
|
self.osize += size
|
||||||
|
@ -25,6 +25,7 @@ def update(self, size, csize, unique):
|
||||||
self.usize += csize
|
self.usize += csize
|
||||||
|
|
||||||
def print_(self):
|
def print_(self):
|
||||||
|
print 'Number of files: %d' % self.nfiles
|
||||||
print 'Original size: %d (%s)' % (self.osize, format_file_size(self.osize))
|
print 'Original size: %d (%s)' % (self.osize, format_file_size(self.osize))
|
||||||
print 'Compressed size: %s (%s)'% (self.csize, format_file_size(self.csize))
|
print 'Compressed size: %s (%s)'% (self.csize, format_file_size(self.csize))
|
||||||
print 'Unique data: %d (%s)' % (self.usize, format_file_size(self.usize))
|
print 'Unique data: %d (%s)' % (self.usize, format_file_size(self.usize))
|
||||||
|
|
Loading…
Reference in a new issue