浏览代码

borg init -> borg rcreate

this is to complement borg rdelete, see also borg create / delete.
Thomas Waldmann 3 年之前
父节点
当前提交
d00d650d88
共有 4 个文件被更改,包括 131 次插入131 次删除
  1. 1 1
      setup_docs.py
  2. 10 10
      src/borg/archiver.py
  3. 119 119
      src/borg/testsuite/archiver.py
  4. 1 1
      src/borg/testsuite/benchmark.py

+ 1 - 1
setup_docs.py

@@ -280,7 +280,7 @@ class build_man(Command):
         'recreate': ('patterns', 'placeholders', 'compression'),
         'recreate': ('patterns', 'placeholders', 'compression'),
         'list': ('info', 'diff', 'prune', 'patterns'),
         'list': ('info', 'diff', 'prune', 'patterns'),
         'info': ('list', 'diff'),
         'info': ('list', 'diff'),
-        'init': ('create', 'delete', 'check', 'list', 'key-import', 'key-export', 'key-change-passphrase'),
+        'rcreate': ('rdelete', 'rlist', 'check', 'key-import', 'key-export', 'key-change-passphrase'),
         'key-import': ('key-export', ),
         'key-import': ('key-export', ),
         'key-export': ('key-import', ),
         'key-export': ('key-import', ),
         'mount': ('umount', 'extract'),  # Would be cooler if these two were on the same page
         'mount': ('umount', 'extract'),  # Would be cooler if these two were on the same page

+ 10 - 10
src/borg/archiver.py

@@ -472,8 +472,8 @@ class Archiver:
 
 
     @with_repository(create=True, exclusive=True, manifest=False)
     @with_repository(create=True, exclusive=True, manifest=False)
     @with_other_repository(key=True, compatibility=(Manifest.Operation.READ, ))
     @with_other_repository(key=True, compatibility=(Manifest.Operation.READ, ))
-    def do_init(self, args, repository, *, other_repository=None, other_key=None):
-        """Initialize an empty repository"""
+    def do_rcreate(self, args, repository, *, other_repository=None, other_key=None):
+        """Create a new, empty repository"""
         path = args.location.canonical_path()
         path = args.location.canonical_path()
         logger.info('Initializing repository at "%s"' % path)
         logger.info('Initializing repository at "%s"' % path)
         try:
         try:
@@ -4383,9 +4383,9 @@ class Archiver:
                                help='format output as JSON')
                                help='format output as JSON')
         define_archive_filters_group(subparser)
         define_archive_filters_group(subparser)
 
 
-        # borg init
-        init_epilog = process_epilog("""
-        This command initializes an empty repository. A repository is a filesystem
+        # borg rcreate
+        rcreate_epilog = process_epilog("""
+        This command creates a new, empty repository. A repository is a filesystem
         directory containing the deduplicated data from zero or more archives.
         directory containing the deduplicated data from zero or more archives.
 
 
         Encryption mode TLDR
         Encryption mode TLDR
@@ -4398,7 +4398,7 @@ class Archiver:
 
 
         ::
         ::
 
 
-            borg init --encryption repokey /path/to/repo
+            borg rcreate --encryption repokey /path/to/repo
 
 
         Borg will:
         Borg will:
 
 
@@ -4507,11 +4507,11 @@ class Archiver:
         Neither is inherently linked to the key derivation function, but since we were going
         Neither is inherently linked to the key derivation function, but since we were going
         to break backwards compatibility anyway we took the opportunity to fix all 3 issues at once.
         to break backwards compatibility anyway we took the opportunity to fix all 3 issues at once.
         """)
         """)
-        subparser = subparsers.add_parser('init', parents=[common_parser], add_help=False,
-                                          description=self.do_init.__doc__, epilog=init_epilog,
+        subparser = subparsers.add_parser('rcreate', parents=[common_parser], add_help=False,
+                                          description=self.do_rcreate.__doc__, epilog=rcreate_epilog,
                                           formatter_class=argparse.RawDescriptionHelpFormatter,
                                           formatter_class=argparse.RawDescriptionHelpFormatter,
-                                          help='initialize empty repository')
-        subparser.set_defaults(func=self.do_init)
+                                          help='create a new, empty repository')
+        subparser.set_defaults(func=self.do_rcreate)
         subparser.add_argument('--other-repo', metavar='SRC_REPOSITORY', dest='other_location',
         subparser.add_argument('--other-repo', metavar='SRC_REPOSITORY', dest='other_location',
                                type=location_validator(other=True), default=Location(other=True),
                                type=location_validator(other=True), default=Location(other=True),
                                help='reuse the key material from the other repository')
                                help='reuse the key material from the other repository')

文件差异内容过多而无法显示
+ 119 - 119
src/borg/testsuite/archiver.py


+ 1 - 1
src/borg/testsuite/benchmark.py

@@ -28,7 +28,7 @@ def repo_url(request, tmpdir, monkeypatch):
 
 
 @pytest.fixture(params=["none", "repokey"])
 @pytest.fixture(params=["none", "repokey"])
 def repo(request, cmd, repo_url):
 def repo(request, cmd, repo_url):
-    cmd(f'--repo={repo_url}', 'init', '--encryption', request.param)
+    cmd(f'--repo={repo_url}', 'rcreate', '--encryption', request.param)
     return repo_url
     return repo_url
 
 
 
 

部分文件因为文件数量过多而无法显示