mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-01 12:45:34 +00:00
Changes on filters after feedback
This commit is contained in:
parent
bd7cc38d6e
commit
089995ef73
3 changed files with 5 additions and 9 deletions
|
@ -2616,9 +2616,9 @@ def add_archives_filters_args(subparser):
|
|||
|
||||
group = filters_group.add_mutually_exclusive_group()
|
||||
group.add_argument('--first', dest='first', metavar='N', default=0, type=int,
|
||||
help='consider first N archives after other filter args were applied')
|
||||
help='consider first N archives after other filters were applied')
|
||||
group.add_argument('--last', dest='last', metavar='N', default=0, type=int,
|
||||
help='consider last N archives after other filter args were applied')
|
||||
help='consider last N archives after other filters were applied')
|
||||
|
||||
def get_args(self, argv, cmd):
|
||||
"""usually, just returns argv, except if we deal with a ssh forced command for borg serve."""
|
||||
|
@ -2687,10 +2687,6 @@ def _get_filtered_archives(self, args, manifest):
|
|||
raise Error('The options --first, --last and --prefix can only be used on repository targets.')
|
||||
|
||||
archives = manifest.archives.list(prefix=args.prefix)
|
||||
if not archives:
|
||||
logger.critical('There are no archives.')
|
||||
self.exit_code = self.exit_code or EXIT_WARNING
|
||||
return []
|
||||
|
||||
for sortkey in reversed(args.sort_by.split(',')):
|
||||
archives.sort(key=attrgetter(sortkey))
|
||||
|
|
|
@ -143,8 +143,9 @@ def __delitem__(self, name):
|
|||
del self._archives[name]
|
||||
|
||||
def list(self, sort_by=None, reverse=False, prefix=''):
|
||||
""" Inexpensive Archive.list_archives replacement if we just need .name, .id, .ts
|
||||
Returns list of borg.helpers.ArchiveInfo instances
|
||||
"""
|
||||
Inexpensive Archive.list_archives replacement if we just need .name, .id, .ts
|
||||
Returns list of borg.helpers.ArchiveInfo instances
|
||||
"""
|
||||
archives = [x for x in self.values() if x.name.startswith(prefix)]
|
||||
if sort_by is not None:
|
||||
|
|
|
@ -1826,7 +1826,6 @@ def test_bad_filters(self):
|
|||
self.cmd('create', self.repository_location + '::test', 'input')
|
||||
self.cmd('delete', '--first', '1', '--last', '1', self.repository_location, fork=True, exit_code=2)
|
||||
|
||||
|
||||
def test_key_export_keyfile(self):
|
||||
export_file = self.output_path + '/exported'
|
||||
self.cmd('init', self.repository_location, '--encryption', 'keyfile')
|
||||
|
|
Loading…
Reference in a new issue