From e7c2189a3f591cc3ca572eb2fdcc42c8e36ac00a Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 28 Jan 2016 20:25:55 +0100 Subject: [PATCH] implement --list for borg extract before, borg extract always emitted the full file list at info log level. now, you need to give --list to get the full file list (consistent with borg create --list). this is currently only useful if you also use other output-generating options, e.g. --show-rc - you can now leave away --list to only get that other output. later, if extract gets more output-generating options, --list will get more useful. --- borg/archiver.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/borg/archiver.py b/borg/archiver.py index a87da416e..96993757c 100644 --- a/borg/archiver.py +++ b/borg/archiver.py @@ -318,6 +318,7 @@ def do_extract(self, args): matcher.fallback = not include_patterns + output_list = args.output_list dry_run = args.dry_run stdout = args.stdout sparse = args.sparse @@ -332,7 +333,8 @@ def do_extract(self, args): if not args.dry_run: while dirs and not item[b'path'].startswith(dirs[-1][b'path']): archive.extract_item(dirs.pop(-1), stdout=stdout) - logger.info(remove_surrogates(orig_path)) + if output_list: + logger.info(remove_surrogates(orig_path)) try: if dry_run: archive.extract_item(item, dry_run=True) @@ -1006,6 +1008,9 @@ def build_parser(self, args=None, prog=None): formatter_class=argparse.RawDescriptionHelpFormatter, help='extract archive contents') subparser.set_defaults(func=self.do_extract) + subparser.add_argument('--list', dest='output_list', + action='store_true', default=False, + help='output verbose list of items (files, dirs, ...)') subparser.add_argument('-n', '--dry-run', dest='dry_run', default=False, action='store_true', help='do not actually change any files')