mirror of https://github.com/borgbackup/borg.git
silence file listing unless --changed is present
This commit is contained in:
parent
6b265f2a53
commit
9899eaf241
|
@ -74,7 +74,8 @@ class Archiver:
|
|||
logger.warning(msg)
|
||||
|
||||
def print_file_status(self, status, path):
|
||||
logger.info("1s %s", status, remove_surrogates(path))
|
||||
if self.args.changed:
|
||||
logger.info("%1s %s" % (status, remove_surrogates(path)))
|
||||
|
||||
def do_serve(self, args):
|
||||
"""Start in server mode. This command is usually not used manually.
|
||||
|
@ -801,6 +802,8 @@ class Archiver:
|
|||
help="""toggle 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('--changed', action='store_true', dest='changed', default=False,
|
||||
help="""display which files were added to the archive""")
|
||||
subparser.add_argument('-e', '--exclude', dest='excludes',
|
||||
type=ExcludePattern, action='append',
|
||||
metavar="PATTERN", help='exclude paths matching PATTERN')
|
||||
|
@ -1171,6 +1174,7 @@ class Archiver:
|
|||
args = self.preprocess_args(args)
|
||||
parser = self.build_parser(args)
|
||||
args = parser.parse_args(args or ['-h'])
|
||||
self.args = args
|
||||
update_excludes(args)
|
||||
return args
|
||||
|
||||
|
|
|
@ -723,6 +723,27 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|||
# http://borgbackup.readthedocs.org/en/latest/faq.html#i-am-seeing-a-added-status-for-a-unchanged-file
|
||||
self.assert_in("A input/file2", output)
|
||||
|
||||
def test_create_topical(self):
|
||||
self.create_regular_file('file1', size=1024 * 80)
|
||||
self.cmd('init', self.repository_location)
|
||||
# no listing by default
|
||||
output = self.cmd('create', self.repository_location + '::test', 'input')
|
||||
self.assert_not_in('file1', output)
|
||||
# shouldn't be listed even if unchanged
|
||||
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', '--unchanged', self.repository_location + '::test1', 'input')
|
||||
#self.assert_in('file1', output)
|
||||
# should *not* list the file as changed
|
||||
#output = self.cmd('create', '--changed', self.repository_location + '::test2', 'input')
|
||||
#self.assert_not_in('file1', output)
|
||||
# change the file
|
||||
self.create_regular_file('file1', size=1024 * 100)
|
||||
# should list the file as changed
|
||||
output = self.cmd('create', '--changed', self.repository_location + '::test3', 'input')
|
||||
self.assert_in('file1', output)
|
||||
|
||||
def test_cmdline_compatibility(self):
|
||||
self.create_regular_file('file1', size=1024 * 80)
|
||||
self.cmd('init', self.repository_location)
|
||||
|
|
Loading…
Reference in New Issue