Merge pull request #3234 from ThomasWaldmann/this-archive-stats

borg create: fix stats
This commit is contained in:
TW 2017-11-04 18:01:23 +01:00 committed by GitHub
commit 1fb154be06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -65,6 +65,16 @@ class Statistics:
if unique:
self.usize += csize
def __add__(self, other):
if not isinstance(other, Statistics):
raise TypeError('can only add Statistics objects')
stats = Statistics(self.output_json)
stats.osize = self.osize + other.osize
stats.csize = self.csize + other.csize
stats.usize = self.usize + other.usize
stats.nfiles = self.nfiles + other.nfiles
return stats
summary = "{label:15} {stats.osize_fmt:>20s} {stats.csize_fmt:>20s} {stats.usize_fmt:>20s}"
def __str__(self):

View file

@ -482,6 +482,7 @@ class Archiver:
if args.progress:
archive.stats.show_progress(final=True)
args.stats |= args.json
archive.stats += fso.stats
if args.stats:
if args.json:
json_print(basic_json_data(manifest, cache=cache, extra={