소스 검색

Merge pull request #1706 from ThomasWaldmann/remove-debug-xxx

remove debug-xxx commands, fixes #1627
TW 8 년 전
부모
커밋
a2dfe68609
4개의 변경된 파일10개의 추가작업 그리고 75개의 파일을 삭제
  1. 2 2
      docs/usage.rst
  2. 1 1
      src/borg/archive.py
  3. 0 65
      src/borg/archiver.py
  4. 7 7
      src/borg/testsuite/archiver.py

+ 2 - 2
docs/usage.rst

@@ -660,10 +660,10 @@ Miscellaneous Help
 Debug Commands
 Debug Commands
 --------------
 --------------
 
 
-There are some more commands (all starting with "debug-") which are all
+There is a ``borg debug`` command that has some subcommands which are all
 **not intended for normal use** and **potentially very dangerous** if used incorrectly.
 **not intended for normal use** and **potentially very dangerous** if used incorrectly.
 
 
-For example, ``borg debug-put-obj`` and ``borg debug-delete-obj`` will only do
+For example, ``borg debug put-obj`` and ``borg debug delete-obj`` will only do
 what their name suggests: put objects into repo / delete objects from repo.
 what their name suggests: put objects into repo / delete objects from repo.
 
 
 Please note:
 Please note:

+ 1 - 1
src/borg/archive.py

@@ -1256,7 +1256,7 @@ class ArchiveChecker:
 
 
             def report(msg, chunk_id, chunk_no):
             def report(msg, chunk_id, chunk_no):
                 cid = bin_to_hex(chunk_id)
                 cid = bin_to_hex(chunk_id)
-                msg += ' [chunk: %06d_%s]' % (chunk_no, cid)  # see debug-dump-archive-items
+                msg += ' [chunk: %06d_%s]' % (chunk_no, cid)  # see "debug dump-archive-items"
                 self.error_found = True
                 self.error_found = True
                 logger.error(msg)
                 logger.error(msg)
 
 

+ 0 - 65
src/borg/archiver.py

@@ -2467,13 +2467,6 @@ class Archiver:
         reports and debugging problems. If a traceback happens, this information is
         reports and debugging problems. If a traceback happens, this information is
         already appended at the end of the traceback.
         already appended at the end of the traceback.
         """)
         """)
-        subparser = subparsers.add_parser('debug-info', parents=[common_parser], add_help=False,
-                                          description=self.do_debug_info.__doc__,
-                                          epilog=debug_info_epilog,
-                                          formatter_class=argparse.RawDescriptionHelpFormatter,
-                                          help='show system infos for debugging / bug reports (debug)')
-        subparser.set_defaults(func=self.do_debug_info)
-
         subparser = debug_parsers.add_parser('info', parents=[common_parser], add_help=False,
         subparser = debug_parsers.add_parser('info', parents=[common_parser], add_help=False,
                                           description=self.do_debug_info.__doc__,
                                           description=self.do_debug_info.__doc__,
                                           epilog=debug_info_epilog,
                                           epilog=debug_info_epilog,
@@ -2484,16 +2477,6 @@ class Archiver:
         debug_dump_archive_items_epilog = textwrap.dedent("""
         debug_dump_archive_items_epilog = textwrap.dedent("""
         This command dumps raw (but decrypted and decompressed) archive items (only metadata) to files.
         This command dumps raw (but decrypted and decompressed) archive items (only metadata) to files.
         """)
         """)
-        subparser = subparsers.add_parser('debug-dump-archive-items', parents=[common_parser], add_help=False,
-                                          description=self.do_debug_dump_archive_items.__doc__,
-                                          epilog=debug_dump_archive_items_epilog,
-                                          formatter_class=argparse.RawDescriptionHelpFormatter,
-                                          help='dump archive items (metadata) (debug)')
-        subparser.set_defaults(func=self.do_debug_dump_archive_items)
-        subparser.add_argument('location', metavar='ARCHIVE',
-                               type=location_validator(archive=True),
-                               help='archive to dump')
-
         subparser = debug_parsers.add_parser('dump-archive-items', parents=[common_parser], add_help=False,
         subparser = debug_parsers.add_parser('dump-archive-items', parents=[common_parser], add_help=False,
                                           description=self.do_debug_dump_archive_items.__doc__,
                                           description=self.do_debug_dump_archive_items.__doc__,
                                           epilog=debug_dump_archive_items_epilog,
                                           epilog=debug_dump_archive_items_epilog,
@@ -2507,16 +2490,6 @@ class Archiver:
         debug_dump_repo_objs_epilog = textwrap.dedent("""
         debug_dump_repo_objs_epilog = textwrap.dedent("""
         This command dumps raw (but decrypted and decompressed) repo objects to files.
         This command dumps raw (but decrypted and decompressed) repo objects to files.
         """)
         """)
-        subparser = subparsers.add_parser('debug-dump-repo-objs', parents=[common_parser], add_help=False,
-                                          description=self.do_debug_dump_repo_objs.__doc__,
-                                          epilog=debug_dump_repo_objs_epilog,
-                                          formatter_class=argparse.RawDescriptionHelpFormatter,
-                                          help='dump repo objects (debug)')
-        subparser.set_defaults(func=self.do_debug_dump_repo_objs)
-        subparser.add_argument('location', metavar='REPOSITORY',
-                               type=location_validator(archive=False),
-                               help='repo to dump')
-
         subparser = debug_parsers.add_parser('dump-repo-objs', parents=[common_parser], add_help=False,
         subparser = debug_parsers.add_parser('dump-repo-objs', parents=[common_parser], add_help=False,
                                           description=self.do_debug_dump_repo_objs.__doc__,
                                           description=self.do_debug_dump_repo_objs.__doc__,
                                           epilog=debug_dump_repo_objs_epilog,
                                           epilog=debug_dump_repo_objs_epilog,
@@ -2530,20 +2503,6 @@ class Archiver:
         debug_get_obj_epilog = textwrap.dedent("""
         debug_get_obj_epilog = textwrap.dedent("""
         This command gets an object from the repository.
         This command gets an object from the repository.
         """)
         """)
-        subparser = subparsers.add_parser('debug-get-obj', parents=[common_parser], add_help=False,
-                                          description=self.do_debug_get_obj.__doc__,
-                                          epilog=debug_get_obj_epilog,
-                                          formatter_class=argparse.RawDescriptionHelpFormatter,
-                                          help='get object from repository (debug)')
-        subparser.set_defaults(func=self.do_debug_get_obj)
-        subparser.add_argument('location', metavar='REPOSITORY', nargs='?', default='',
-                               type=location_validator(archive=False),
-                               help='repository to use')
-        subparser.add_argument('id', metavar='ID', type=str,
-                               help='hex object ID to get from the repo')
-        subparser.add_argument('path', metavar='PATH', type=str,
-                               help='file to write object data into')
-
         subparser = debug_parsers.add_parser('get-obj', parents=[common_parser], add_help=False,
         subparser = debug_parsers.add_parser('get-obj', parents=[common_parser], add_help=False,
                                           description=self.do_debug_get_obj.__doc__,
                                           description=self.do_debug_get_obj.__doc__,
                                           epilog=debug_get_obj_epilog,
                                           epilog=debug_get_obj_epilog,
@@ -2561,18 +2520,6 @@ class Archiver:
         debug_put_obj_epilog = textwrap.dedent("""
         debug_put_obj_epilog = textwrap.dedent("""
         This command puts objects into the repository.
         This command puts objects into the repository.
         """)
         """)
-        subparser = subparsers.add_parser('debug-put-obj', parents=[common_parser], add_help=False,
-                                          description=self.do_debug_put_obj.__doc__,
-                                          epilog=debug_put_obj_epilog,
-                                          formatter_class=argparse.RawDescriptionHelpFormatter,
-                                          help='put object to repository (debug)')
-        subparser.set_defaults(func=self.do_debug_put_obj)
-        subparser.add_argument('location', metavar='REPOSITORY', nargs='?', default='',
-                               type=location_validator(archive=False),
-                               help='repository to use')
-        subparser.add_argument('paths', metavar='PATH', nargs='+', type=str,
-                               help='file(s) to read and create object(s) from')
-
         subparser = debug_parsers.add_parser('put-obj', parents=[common_parser], add_help=False,
         subparser = debug_parsers.add_parser('put-obj', parents=[common_parser], add_help=False,
                                           description=self.do_debug_put_obj.__doc__,
                                           description=self.do_debug_put_obj.__doc__,
                                           epilog=debug_put_obj_epilog,
                                           epilog=debug_put_obj_epilog,
@@ -2588,18 +2535,6 @@ class Archiver:
         debug_delete_obj_epilog = textwrap.dedent("""
         debug_delete_obj_epilog = textwrap.dedent("""
         This command deletes objects from the repository.
         This command deletes objects from the repository.
         """)
         """)
-        subparser = subparsers.add_parser('debug-delete-obj', parents=[common_parser], add_help=False,
-                                          description=self.do_debug_delete_obj.__doc__,
-                                          epilog=debug_delete_obj_epilog,
-                                          formatter_class=argparse.RawDescriptionHelpFormatter,
-                                          help='delete object from repository (debug)')
-        subparser.set_defaults(func=self.do_debug_delete_obj)
-        subparser.add_argument('location', metavar='REPOSITORY', nargs='?', default='',
-                               type=location_validator(archive=False),
-                               help='repository to use')
-        subparser.add_argument('ids', metavar='IDs', nargs='+', type=str,
-                               help='hex object ID(s) to delete from the repo')
-
         subparser = debug_parsers.add_parser('delete-obj', parents=[common_parser], add_help=False,
         subparser = debug_parsers.add_parser('delete-obj', parents=[common_parser], add_help=False,
                                           description=self.do_debug_delete_obj.__doc__,
                                           description=self.do_debug_delete_obj.__doc__,
                                           epilog=debug_delete_obj_epilog,
                                           epilog=debug_delete_obj_epilog,

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

@@ -1547,7 +1547,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         self.cmd('init', self.repository_location)
         self.cmd('init', self.repository_location)
         self.cmd('create', self.repository_location + '::test', 'input')
         self.cmd('create', self.repository_location + '::test', 'input')
         with changedir('output'):
         with changedir('output'):
-            output = self.cmd('debug-dump-archive-items', self.repository_location + '::test')
+            output = self.cmd('debug', 'dump-archive-items', self.repository_location + '::test')
         output_dir = sorted(os.listdir('output'))
         output_dir = sorted(os.listdir('output'))
         assert len(output_dir) > 0 and output_dir[0].startswith('000000_')
         assert len(output_dir) > 0 and output_dir[0].startswith('000000_')
         assert 'Done.' in output
         assert 'Done.' in output
@@ -1557,7 +1557,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         self.cmd('init', self.repository_location)
         self.cmd('init', self.repository_location)
         self.cmd('create', self.repository_location + '::test', 'input')
         self.cmd('create', self.repository_location + '::test', 'input')
         with changedir('output'):
         with changedir('output'):
-            output = self.cmd('debug-dump-repo-objs', self.repository_location)
+            output = self.cmd('debug', 'dump-repo-objs', self.repository_location)
         output_dir = sorted(os.listdir('output'))
         output_dir = sorted(os.listdir('output'))
         assert len(output_dir) > 0 and output_dir[0].startswith('000000_')
         assert len(output_dir) > 0 and output_dir[0].startswith('000000_')
         assert 'Done.' in output
         assert 'Done.' in output
@@ -1567,18 +1567,18 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         data = b'some data'
         data = b'some data'
         hexkey = sha256(data).hexdigest()
         hexkey = sha256(data).hexdigest()
         self.create_regular_file('file', contents=data)
         self.create_regular_file('file', contents=data)
-        output = self.cmd('debug-put-obj', self.repository_location, 'input/file')
+        output = self.cmd('debug', 'put-obj', self.repository_location, 'input/file')
         assert hexkey in output
         assert hexkey in output
-        output = self.cmd('debug-get-obj', self.repository_location, hexkey, 'output/file')
+        output = self.cmd('debug', 'get-obj', self.repository_location, hexkey, 'output/file')
         assert hexkey in output
         assert hexkey in output
         with open('output/file', 'rb') as f:
         with open('output/file', 'rb') as f:
             data_read = f.read()
             data_read = f.read()
         assert data == data_read
         assert data == data_read
-        output = self.cmd('debug-delete-obj', self.repository_location, hexkey)
+        output = self.cmd('debug', 'delete-obj', self.repository_location, hexkey)
         assert "deleted" in output
         assert "deleted" in output
-        output = self.cmd('debug-delete-obj', self.repository_location, hexkey)
+        output = self.cmd('debug', 'delete-obj', self.repository_location, hexkey)
         assert "not found" in output
         assert "not found" in output
-        output = self.cmd('debug-delete-obj', self.repository_location, 'invalid')
+        output = self.cmd('debug', 'delete-obj', self.repository_location, 'invalid')
         assert "is invalid" in output
         assert "is invalid" in output
 
 
     def test_init_interrupt(self):
     def test_init_interrupt(self):