mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 01:06:50 +00:00
Merge pull request #553 from ThomasWaldmann/list-option
add --list option for borg create
This commit is contained in:
commit
34142adcb0
2 changed files with 9 additions and 5 deletions
|
@ -80,7 +80,7 @@ def print_warning(self, msg, *args):
|
|||
logger.warning(msg)
|
||||
|
||||
def print_file_status(self, status, path):
|
||||
if self.output_filter is None or status in self.output_filter:
|
||||
if self.output_list and (self.output_filter is None or status in self.output_filter):
|
||||
logger.info("%1s %s", status, remove_surrogates(path))
|
||||
|
||||
def do_serve(self, args):
|
||||
|
@ -129,6 +129,7 @@ def do_change_passphrase(self, args):
|
|||
def do_create(self, args):
|
||||
"""Create new archive"""
|
||||
self.output_filter = args.output_filter
|
||||
self.output_list = args.output_list
|
||||
dry_run = args.dry_run
|
||||
t0 = datetime.now()
|
||||
if not dry_run:
|
||||
|
@ -858,6 +859,9 @@ def build_parser(self, args=None, prog=None):
|
|||
help="""show progress display while creating the archive, showing Original,
|
||||
Compressed and Deduplicated sizes, followed by the Number of files seen
|
||||
and the path being processed, default: %(default)s""")
|
||||
subparser.add_argument('--list', dest='output_list',
|
||||
action='store_true', default=False,
|
||||
help='output verbose list of items (files, dirs, ...)')
|
||||
subparser.add_argument('--filter', dest='output_filter', metavar='STATUSCHARS',
|
||||
help='only display items with the given status characters')
|
||||
subparser.add_argument('-e', '--exclude', dest='excludes',
|
||||
|
|
|
@ -762,11 +762,11 @@ def test_file_status(self):
|
|||
os.utime('input/file1', (now - 5, now - 5)) # 5 seconds ago
|
||||
self.create_regular_file('file2', size=1024 * 80)
|
||||
self.cmd('init', self.repository_location)
|
||||
output = self.cmd('create', '-v', self.repository_location + '::test', 'input')
|
||||
output = self.cmd('create', '-v', '--list', self.repository_location + '::test', 'input')
|
||||
self.assert_in("A input/file1", output)
|
||||
self.assert_in("A input/file2", output)
|
||||
# should find first file as unmodified
|
||||
output = self.cmd('create', '-v', self.repository_location + '::test1', 'input')
|
||||
output = self.cmd('create', '-v', '--list', self.repository_location + '::test1', 'input')
|
||||
self.assert_in("U input/file1", output)
|
||||
# this is expected, although surprising, for why, see:
|
||||
# http://borgbackup.readthedocs.org/en/latest/faq.html#i-am-seeing-a-added-status-for-a-unchanged-file
|
||||
|
@ -785,7 +785,7 @@ def test_create_topical(self):
|
|||
output = self.cmd('create', self.repository_location + '::test0', 'input')
|
||||
self.assert_not_in('file1', output)
|
||||
# should list the file as unchanged
|
||||
output = self.cmd('create', '-v', '--filter=U', self.repository_location + '::test1', 'input')
|
||||
output = self.cmd('create', '-v', '--list', '--filter=U', self.repository_location + '::test1', 'input')
|
||||
self.assert_in('file1', output)
|
||||
# should *not* list the file as changed
|
||||
output = self.cmd('create', '-v', '--filter=AM', self.repository_location + '::test2', 'input')
|
||||
|
@ -793,7 +793,7 @@ def test_create_topical(self):
|
|||
# change the file
|
||||
self.create_regular_file('file1', size=1024 * 100)
|
||||
# should list the file as changed
|
||||
output = self.cmd('create', '-v', '--filter=AM', self.repository_location + '::test3', 'input')
|
||||
output = self.cmd('create', '-v', '--list', '--filter=AM', self.repository_location + '::test3', 'input')
|
||||
self.assert_in('file1', output)
|
||||
|
||||
def test_cmdline_compatibility(self):
|
||||
|
|
Loading…
Reference in a new issue