Browse Source

Merge pull request #4208 from ThomasWaldmann/remove-deprecated

remove deprecated commands/options
TW 6 years ago
parent
commit
e05866074d
5 changed files with 15 additions and 47 deletions
  1. 7 0
      docs/changes.rst
  2. 0 1
      setup_docs.py
  3. 3 28
      src/borg/archiver.py
  4. 2 8
      src/borg/cache.py
  5. 3 10
      src/borg/testsuite/archiver.py

+ 7 - 0
docs/changes.rst

@@ -146,6 +146,13 @@ Compatibility notes:
   The behaviours have been swapped (so "mtime" is human, "isomtime" is ISO-like),
   and the default is now "mtime".
   "isomtime" is now a real ISO-8601 format ("T" between date and time, not a space).
+- removed deprecated-since-long stuff (deprecated since):
+
+  - command "borg change-passphrase" (2017-02), use "borg key ..."
+  - option "--keep-tag-files" (2017-01), use "--keep-exclude-tags"
+  - option "--list-format" (2017-10), use "--format"
+  - option "--ignore-inode" (2017-09), use "--files-cache" w/o "inode"
+  - option "--no-files-cache" (2017-09), use "--files-cache=disabled"
 
 New features:
 

+ 0 - 1
setup_docs.py

@@ -288,7 +288,6 @@ class build_man(Command):
         'break-lock': 'lock',
         'with-lock': 'lock',
 
-        'change-passphrase': 'key',
         'key_change-passphrase': 'key',
         'key_export': 'key',
         'key_import': 'key',

+ 3 - 28
src/borg/archiver.py

@@ -142,8 +142,6 @@ def with_repository(fake=False, invert_fake=False, create=False, lock=True,
                         assert_secure(repository, kwargs['manifest'], self.lock_wait)
                 if cache:
                     with Cache(repository, kwargs['key'], kwargs['manifest'],
-                               do_files=getattr(args, 'cache_files', False),
-                               ignore_inode=getattr(args, 'ignore_inode', False),
                                progress=getattr(args, 'progress', False), lock_wait=self.lock_wait,
                                cache_mode=getattr(args, 'files_cache_mode', DEFAULT_FILES_CACHE_MODE)) as cache_:
                         return method(self, args, repository=repository, cache=cache_, **kwargs)
@@ -306,11 +304,6 @@ class Archiver:
             logger.info('Key location: %s', key.find_key())
         return EXIT_SUCCESS
 
-    def do_change_passphrase_deprecated(self, args):
-        logger.warning('"borg change-passphrase" is deprecated and will be removed in Borg 1.2.\n'
-                       'Use "borg key change-passphrase" instead.')
-        return self.do_change_passphrase(args)
-
     @with_repository(lock=False, exclusive=False, manifest=False, cache=False)
     def do_key_export(self, args, repository):
         """Export the repository key for backup"""
@@ -517,9 +510,9 @@ class Archiver:
         t0_monotonic = time.monotonic()
         logger.info('Creating archive at "%s"' % args.location.orig)
         if not dry_run:
-            with Cache(repository, key, manifest, do_files=args.cache_files, progress=args.progress,
+            with Cache(repository, key, manifest, progress=args.progress,
                        lock_wait=self.lock_wait, permit_adhoc_cache=args.no_cache_sync,
-                       cache_mode=args.files_cache_mode, ignore_inode=args.ignore_inode) as cache:
+                       cache_mode=args.files_cache_mode) as cache:
                 archive = Archive(repository, key, manifest, args.location.archive, cache=cache,
                                   create=True, checkpoint_interval=args.checkpoint_interval,
                                   numeric_owner=args.numeric_owner, noatime=args.noatime, noctime=args.noctime,
@@ -2271,10 +2264,6 @@ class Archiver:
     def preprocess_args(self, args):
         deprecations = [
             # ('--old', '--new' or None, 'Warning: "--old" has been deprecated. Use "--new" instead.'),
-            ('--list-format', '--format', 'Warning: "--list-format" has been deprecated. Use "--format" instead.'),
-            ('--keep-tag-files', '--keep-exclude-tags', 'Warning: "--keep-tag-files" has been deprecated. Use "--keep-exclude-tags" instead.'),
-            ('--ignore-inode', None, 'Warning: "--ignore-inode" has been deprecated. Use "--files-cache=ctime,size" or "...=mtime,size" instead.'),
-            ('--no-files-cache', None, 'Warning: "--no-files-cache" has been deprecated. Use "--files-cache=disabled" instead.'),
         ]
         for i, arg in enumerate(args[:]):
             for old_name, new_name, warning in deprecations:
@@ -2493,7 +2482,7 @@ class Archiver:
                            action='append', type=str,
                            help='exclude directories that are tagged by containing a filesystem object with '
                                 'the given NAME')
-                add_option('--keep-exclude-tags', '--keep-tag-files', dest='keep_exclude_tags',
+                add_option('--keep-exclude-tags', dest='keep_exclude_tags',
                            action='store_true',
                            help='if tag objects are specified with ``--exclude-if-present``, '
                                 'don\'t omit the tag objects themselves from the backup archive')
@@ -2925,16 +2914,6 @@ class Archiver:
         subparser.add_argument('location', metavar='REPOSITORY', nargs='?', default='',
                                type=location_validator(archive=False))
 
-        # Borg 1.0 alias for change passphrase (without the "key" subcommand)
-        subparser = subparsers.add_parser('change-passphrase', parents=[common_parser], add_help=False,
-                                          description=self.do_change_passphrase.__doc__,
-                                          epilog=change_passphrase_epilog,
-                                          formatter_class=argparse.RawDescriptionHelpFormatter,
-                                          help='change repository passphrase')
-        subparser.set_defaults(func=self.do_change_passphrase_deprecated)
-        subparser.add_argument('location', metavar='REPOSITORY', nargs='?', default='',
-                               type=location_validator(archive=False))
-
         migrate_to_repokey_epilog = process_epilog("""
         This command migrates a repository from passphrase mode (removed in Borg 1.0)
         to repokey mode.
@@ -3111,8 +3090,6 @@ class Archiver:
                                help='output stats as JSON. Implies ``--stats``.')
         subparser.add_argument('--no-cache-sync', dest='no_cache_sync', action='store_true',
                                help='experimental: do not synchronize the cache. Implies not using the files cache.')
-        subparser.add_argument('--no-files-cache', dest='cache_files', action='store_false',
-                               help='do not load/update the file metadata cache used to detect unchanged files')
         subparser.add_argument('--stdin-name', metavar='NAME', dest='stdin_name', default='stdin',
                                help='use NAME in archive for stdin data (default: "stdin")')
 
@@ -3133,8 +3110,6 @@ class Archiver:
                               help='do not store birthtime (creation date) into archive')
         fs_group.add_argument('--nobsdflags', dest='nobsdflags', action='store_true',
                               help='do not read and store bsdflags (e.g. NODUMP, IMMUTABLE) into archive')
-        fs_group.add_argument('--ignore-inode', dest='ignore_inode', action='store_true',
-                              help='ignore inode data in the file metadata cache used to detect unchanged files.')
         fs_group.add_argument('--files-cache', metavar='MODE', dest='files_cache_mode',
                               type=FilesCacheMode, default=DEFAULT_FILES_CACHE_MODE_UI,
                               help='operate files cache in MODE. default: %s' % DEFAULT_FILES_CACHE_MODE_UI)

+ 2 - 8
src/borg/cache.py

@@ -357,14 +357,8 @@ class Cache:
             os.remove(config)  # kill config first
             shutil.rmtree(path)
 
-    def __new__(cls, repository, key, manifest, path=None, sync=True, do_files=False, warn_if_unencrypted=True,
-                progress=False, lock_wait=None, permit_adhoc_cache=False, cache_mode=DEFAULT_FILES_CACHE_MODE,
-                ignore_inode=False):
-
-        if not do_files and 'd' not in cache_mode:
-            cache_mode = 'd'
-        elif ignore_inode and 'i' in cache_mode:
-            cache_mode = ''.join(set(cache_mode) - set('i'))
+    def __new__(cls, repository, key, manifest, path=None, sync=True, warn_if_unencrypted=True,
+                progress=False, lock_wait=None, permit_adhoc_cache=False, cache_mode=DEFAULT_FILES_CACHE_MODE):
 
         def local():
             return LocalCache(repository=repository, key=key, manifest=manifest, path=path, sync=sync,

+ 3 - 10
src/borg/testsuite/archiver.py

@@ -1203,11 +1203,6 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         self.assert_equal(sorted(os.listdir('output/input/taggedall')),
                           ['.NOBACKUP1', '.NOBACKUP2', CACHE_TAG_NAME, ])
 
-    def test_exclude_keep_tagged_deprecation(self):
-        self.cmd('init', '--encryption=repokey', self.repository_location)
-        output_warn = self.cmd('create', '--exclude-caches', '--keep-tag-files', self.repository_location + '::test', src_dir)
-        self.assert_in('--keep-tag-files" has been deprecated.', output_warn)
-
     def test_exclude_keep_tagged(self):
         self._create_test_keep_tagged()
         self.cmd('create', '--exclude-if-present', '.NOBACKUP1', '--exclude-if-present', '.NOBACKUP2',
@@ -1555,7 +1550,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
     def test_unknown_feature_on_change_passphrase(self):
         print(self.cmd('init', '--encryption=repokey', self.repository_location))
         self.add_unknown_feature(Manifest.Operation.CHECK)
-        self.cmd_raises_unknown_feature(['change-passphrase', self.repository_location])
+        self.cmd_raises_unknown_feature(['key', 'change-passphrase', self.repository_location])
 
     def test_unknown_feature_on_read(self):
         print(self.cmd('init', '--encryption=repokey', self.repository_location))
@@ -1891,8 +1886,6 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         self.cmd('init', '--encryption=repokey', self.repository_location)
         test_archive = self.repository_location + '::test'
         self.cmd('create', test_archive, src_dir)
-        output_warn = self.cmd('list', '--list-format', '-', test_archive)
-        self.assert_in('--list-format" has been deprecated.', output_warn)
         output_1 = self.cmd('list', test_archive)
         output_2 = self.cmd('list', '--format', '{mode} {user:6} {group:6} {size:8d} {mtime} {path}{extra}{NEWLINE}', test_archive)
         output_3 = self.cmd('list', '--format', '{mtime:%s} {path}{NL}', test_archive)
@@ -2082,7 +2075,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         self.cmd('init', '--encryption=repokey', self.repository_location)
         os.environ['BORG_NEW_PASSPHRASE'] = 'newpassphrase'
         # here we have both BORG_PASSPHRASE and BORG_NEW_PASSPHRASE set:
-        self.cmd('change-passphrase', self.repository_location)
+        self.cmd('key', 'change-passphrase', self.repository_location)
         os.environ['BORG_PASSPHRASE'] = 'newpassphrase'
         self.cmd('list', self.repository_location)
 
@@ -2885,7 +2878,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02
             ['info', path + '::test'],
             ['key', 'export', path, 'exported'],
             ['key', 'import', path, 'import'],
-            ['change-passphrase', path],
+            ['key', 'change-passphrase', path],
             ['break-lock', path],
         ]
         for args in cmds: