extract: --progress: Calculating size

This commit is contained in:
Marian Beermann 2016-08-21 17:35:00 +02:00
parent 4d214e2503
commit e7d44cec39
2 changed files with 5 additions and 1 deletions

View File

@ -456,6 +456,8 @@ class Archiver:
filter = self.build_filter(matcher, item_is_hardlink_master, strip_components)
if progress:
progress_logger = logging.getLogger(ProgressIndicatorPercent.LOGGER)
progress_logger.info('Calculating size')
extracted_size = sum(item.file_size() for item in archive.iter_items(filter))
pi = ProgressIndicatorPercent(total=extracted_size, msg='Extracting files %5.1f%%', step=0.1)
else:

View File

@ -1105,6 +1105,8 @@ def yes(msg=None, false_msg=None, true_msg=None, default_msg=None,
class ProgressIndicatorPercent:
LOGGER = 'borg.output.progress'
def __init__(self, total, step=5, start=0, same_line=True, msg="%3.0f%%"):
"""
Percentage-based progress indicator
@ -1122,7 +1124,7 @@ class ProgressIndicatorPercent:
self.msg = msg
self.same_line = same_line
self.handler = None
self.logger = logging.getLogger('borg.output.progress')
self.logger = logging.getLogger(self.LOGGER)
# If there are no handlers, set one up explicitly because the
# terminator and propagation needs to be set. If there are,