Browse Source

borg diff ARCH1 ARCH2

Thomas Waldmann 3 years ago
parent
commit
75b53de37e
2 changed files with 10 additions and 10 deletions
  1. 3 3
      src/borg/archiver.py
  2. 7 7
      src/borg/testsuite/archiver.py

+ 3 - 3
src/borg/archiver.py

@@ -1477,7 +1477,7 @@ class Archiver:
         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 @@ class Archiver:
                                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,

+ 7 - 7
src/borg/testsuite/archiver.py

@@ -1704,14 +1704,14 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         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 @@ class DiffArchiverTestCase(ArchiverTestCaseBase):
             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 @@ class DiffArchiverTestCase(ArchiverTestCaseBase):
         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',