1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-24 15:12:00 +00:00

borg diff ARCH1 ARCH2

This commit is contained in:
Thomas Waldmann 2022-06-20 16:50:36 +02:00
parent b8c7c53dde
commit 75b53de37e
2 changed files with 10 additions and 10 deletions

View file

@ -1477,7 +1477,7 @@ def print_text_output(diff, path):
print_output = print_json_output if args.json_lines else print_text_output
archive1 = archive
archive2 = Archive(repository, key, manifest, args.name2,
archive2 = Archive(repository, key, manifest, args.other_name,
consider_part_files=args.consider_part_files)
can_compare_chunk_ids = archive1.metadata.get('chunker_params', False) == archive2.metadata.get(
@ -4206,10 +4206,10 @@ def define_borg_mount(parser):
help='Sort the output lines by file path.')
subparser.add_argument('--json-lines', action='store_true',
help='Format output as JSON Lines. ')
subparser.add_argument('--name', metavar='ARCHIVE1',
subparser.add_argument('name', metavar='ARCHIVE1',
type=archivename_validator(),
help='ARCHIVE1 name')
subparser.add_argument('--name2', metavar='ARCHIVE2',
subparser.add_argument('other_name', metavar='ARCHIVE2',
type=archivename_validator(),
help='ARCHIVE2 name')
subparser.add_argument('paths', metavar='PATH', nargs='*', type=str,

View file

@ -1704,14 +1704,14 @@ def test_readonly_diff(self):
with self.read_only(self.repository_path):
# verify that command normally doesn't work with read-only repo
if self.FORK_DEFAULT:
self.cmd(f'--repo={self.repository_location}', 'diff', '--name=a', '--name2=b', exit_code=EXIT_ERROR)
self.cmd(f'--repo={self.repository_location}', 'diff', 'a', 'b', exit_code=EXIT_ERROR)
else:
with pytest.raises((LockFailed, RemoteRepository.RPCError)) as excinfo:
self.cmd(f'--repo={self.repository_location}', 'diff', '--name=a', '--name=b')
self.cmd(f'--repo={self.repository_location}', 'diff', 'a', 'b')
if isinstance(excinfo.value, RemoteRepository.RPCError):
assert excinfo.value.exception_class == 'LockFailed'
# verify that command works with read-only repo when using --bypass-lock
self.cmd(f'--repo={self.repository_location}', 'diff', '--name=a', '--name2=b', '--bypass-lock')
self.cmd(f'--repo={self.repository_location}', 'diff', 'a', 'b', '--bypass-lock')
def test_readonly_export_tar(self):
self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey')
@ -4288,10 +4288,10 @@ def get_changes(filename, data):
if are_hardlinks_supported():
assert not any(get_changes('input/hardlink_target_replaced', joutput))
do_asserts(self.cmd(f'--repo={self.repository_location}', 'diff', '--name=test0', '--name2=test1a'), True)
do_asserts(self.cmd(f'--repo={self.repository_location}', 'diff', 'test0', 'test1a'), True)
# We expect exit_code=1 due to the chunker params warning
do_asserts(self.cmd(f'--repo={self.repository_location}', 'diff', '--name=test0', '--name2=test1b', exit_code=1), False)
do_json_asserts(self.cmd(f'--repo={self.repository_location}', 'diff', '--name=test0', '--name2=test1a', '--json-lines'), True)
do_asserts(self.cmd(f'--repo={self.repository_location}', 'diff', 'test0', 'test1b', exit_code=1), False)
do_json_asserts(self.cmd(f'--repo={self.repository_location}', 'diff', 'test0', 'test1a', '--json-lines'), True)
def test_sort_option(self):
self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey')
@ -4312,7 +4312,7 @@ def test_sort_option(self):
self.create_regular_file('d_file_added', size=256)
self.cmd(f'--repo={self.repository_location}', 'create', 'test1', 'input')
output = self.cmd(f'--repo={self.repository_location}', 'diff', '--name=test0', '--name2=test1',
output = self.cmd(f'--repo={self.repository_location}', 'diff', 'test0', 'test1',
'--sort')
expected = [
'a_file_removed',