diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-11-06 11:51:50 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-11-06 11:51:50 +0000 |
commit | 452dee9d2e5e1d1ae13a45a5bb2854f7903e445c (patch) | |
tree | e8b0d05941236f6fd9dd988c5e9a021dad164e5b | |
parent | ee286a74d3fdf4c65f5dd1f80c02d5d23aa0a481 (diff) | |
download | obnam-452dee9d2e5e1d1ae13a45a5bb2854f7903e445c.tar.gz |
Make --quiet stop end-of-backup statistics to stdout
-rw-r--r-- | NEWS | 8 | ||||
-rw-r--r-- | obnamlib/backup_progress.py | 53 | ||||
-rw-r--r-- | obnamlib/plugins/backup_plugin.py | 3 |
3 files changed, 38 insertions, 26 deletions
@@ -8,6 +8,14 @@ development, called `green-albatross`. It is **NOT** meant for real use. It is likely to change in incompatible ways without warning. Do not use it unless you're willing to lose your backup. +Version 1.18.1, released 2015-11-06 +--------------------------------- + +Bug fixes: + +* The `--quiet` option now disables the statistics reports at the end + of a backup run. + Version 1.18, released 2015-11-04 --------------------------------- diff --git a/obnamlib/backup_progress.py b/obnamlib/backup_progress.py index 6b98c8fd..97129b9d 100644 --- a/obnamlib/backup_progress.py +++ b/obnamlib/backup_progress.py @@ -93,7 +93,7 @@ class BackupProgress(object): def update_progress_with_removed_checkpoint(self, gen): self._ts['checkpoint'] = gen - def report_stats(self, output, fs): + def report_stats(self, output, fs, quiet): duration = time.time() - self.started duration_string = obnamlib.humanise_duration(duration) @@ -147,27 +147,30 @@ class BackupProgress(object): scanned_amount, scanned_unit = obnamlib.humanise_size( self.scanned_bytes) - output.write( - 'Backed up %d files (of %d found), containing %.1f %s.\n' % - (self.backed_up_count, - self.file_count, - scanned_amount, - scanned_unit)) - output.write( - 'Uploaded %.1f %s file data in %s at %.1f %s average speed.\n' % - (chunk_amount, - chunk_unit, - duration_string, - speed_amount, - speed_unit)) - output.write( - 'Total download amount %.1f %s.\n' % - (dl_amount, - dl_unit)) - output.write( - 'Total upload amount %.1f %s. Overhead was %.1f %s (%.1f %%).\n' % - (ul_amount, - ul_unit, - overhead_amount, - overhead_unit, - overhead_percent)) + if not quiet: + output.write( + 'Backed up %d files (of %d found), containing %.1f %s.\n' % + (self.backed_up_count, + self.file_count, + scanned_amount, + scanned_unit)) + output.write( + 'Uploaded %.1f %s file data in %s at %.1f %s ' + 'average speed.\n' % + (chunk_amount, + chunk_unit, + duration_string, + speed_amount, + speed_unit)) + output.write( + 'Total download amount %.1f %s.\n' % + (dl_amount, + dl_unit)) + output.write( + 'Total upload amount %.1f %s. ' + 'Overhead was %.1f %s (%.1f %%).\n' % + (ul_amount, + ul_unit, + overhead_amount, + overhead_unit, + overhead_percent)) diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py index 62790b28..d5783135 100644 --- a/obnamlib/plugins/backup_plugin.py +++ b/obnamlib/plugins/backup_plugin.py @@ -305,7 +305,8 @@ class BackupPlugin(obnamlib.ObnamPlugin): self.progress.clear() self.progress.finish() - self.progress.report_stats(self.app.output, self.repo.get_fs()) + self.progress.report_stats( + self.app.output, self.repo.get_fs(), self.app.settings['quiet']) logging.info('Backup finished.') self.app.hooks.call('backup-finished', args, self.progress) |