mirror of
https://github.com/borgbackup/borg.git
synced 2026-04-27 17:18:52 -04:00
Merge pull request #3234 from ThomasWaldmann/this-archive-stats
borg create: fix stats
This commit is contained in:
commit
1fb154be06
2 changed files with 11 additions and 0 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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={
|
||||
|
|
|
|||
Loading…
Reference in a new issue