mirror of https://github.com/borgbackup/borg.git
rename print_info to print_verbose
better name as it is only outputting if verbose flag is set.
This commit is contained in:
parent
6abf7621c1
commit
b3b4db427c
|
@ -59,7 +59,7 @@ class Archiver:
|
||||||
self.exit_code = EXIT_WARNING # we do not terminate here, so it is a warning
|
self.exit_code = EXIT_WARNING # we do not terminate here, so it is a warning
|
||||||
logger.warning(msg)
|
logger.warning(msg)
|
||||||
|
|
||||||
def print_info(self, msg, *args):
|
def print_verbose(self, msg, *args):
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
msg = args and msg % args or msg
|
msg = args and msg % args or msg
|
||||||
logger.info(msg)
|
logger.info(msg)
|
||||||
|
@ -151,7 +151,7 @@ class Archiver:
|
||||||
self.print_warning('%s: %s', path, e)
|
self.print_warning('%s: %s', path, e)
|
||||||
else:
|
else:
|
||||||
status = '-'
|
status = '-'
|
||||||
self.print_info("%1s %s", status, remove_surrogates(path))
|
self.print_verbose("%1s %s", status, remove_surrogates(path))
|
||||||
continue
|
continue
|
||||||
path = os.path.normpath(path)
|
path = os.path.normpath(path)
|
||||||
if args.one_file_system:
|
if args.one_file_system:
|
||||||
|
@ -252,7 +252,7 @@ class Archiver:
|
||||||
status = '-' # dry run, item was not backed up
|
status = '-' # dry run, item was not backed up
|
||||||
# output ALL the stuff - it can be easily filtered using grep.
|
# output ALL the stuff - it can be easily filtered using grep.
|
||||||
# even stuff considered unchanged might be interesting.
|
# even stuff considered unchanged might be interesting.
|
||||||
self.print_info("%1s %s", status, remove_surrogates(path))
|
self.print_verbose("%1s %s", status, remove_surrogates(path))
|
||||||
|
|
||||||
def do_extract(self, args):
|
def do_extract(self, args):
|
||||||
"""Extract archive contents"""
|
"""Extract archive contents"""
|
||||||
|
@ -280,7 +280,7 @@ class Archiver:
|
||||||
if not args.dry_run:
|
if not args.dry_run:
|
||||||
while dirs and not item[b'path'].startswith(dirs[-1][b'path']):
|
while dirs and not item[b'path'].startswith(dirs[-1][b'path']):
|
||||||
archive.extract_item(dirs.pop(-1), stdout=stdout)
|
archive.extract_item(dirs.pop(-1), stdout=stdout)
|
||||||
self.print_info(remove_surrogates(orig_path))
|
self.print_verbose(remove_surrogates(orig_path))
|
||||||
try:
|
try:
|
||||||
if dry_run:
|
if dry_run:
|
||||||
archive.extract_item(item, dry_run=True)
|
archive.extract_item(item, dry_run=True)
|
||||||
|
@ -366,7 +366,7 @@ class Archiver:
|
||||||
else:
|
else:
|
||||||
archive = None
|
archive = None
|
||||||
operations = FuseOperations(key, repository, manifest, archive)
|
operations = FuseOperations(key, repository, manifest, archive)
|
||||||
self.print_info("Mounting filesystem")
|
self.print_verbose("Mounting filesystem")
|
||||||
try:
|
try:
|
||||||
operations.mount(args.mountpoint, args.options, args.foreground)
|
operations.mount(args.mountpoint, args.options, args.foreground)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
|
@ -469,12 +469,12 @@ class Archiver:
|
||||||
to_delete = [a for a in archives if a not in keep]
|
to_delete = [a for a in archives if a not in keep]
|
||||||
stats = Statistics()
|
stats = Statistics()
|
||||||
for archive in keep:
|
for archive in keep:
|
||||||
self.print_info('Keeping archive: %s' % format_archive(archive))
|
self.print_verbose('Keeping archive: %s' % format_archive(archive))
|
||||||
for archive in to_delete:
|
for archive in to_delete:
|
||||||
if args.dry_run:
|
if args.dry_run:
|
||||||
self.print_info('Would prune: %s' % format_archive(archive))
|
self.print_verbose('Would prune: %s' % format_archive(archive))
|
||||||
else:
|
else:
|
||||||
self.print_info('Pruning archive: %s' % format_archive(archive))
|
self.print_verbose('Pruning archive: %s' % format_archive(archive))
|
||||||
Archive(repository, key, manifest, archive.name, cache).delete(stats)
|
Archive(repository, key, manifest, archive.name, cache).delete(stats)
|
||||||
if to_delete and not args.dry_run:
|
if to_delete and not args.dry_run:
|
||||||
manifest.write()
|
manifest.write()
|
||||||
|
|
Loading…
Reference in New Issue