Changes on filters after feedback

This commit is contained in:
Frank Sachsenheim 2016-09-30 20:01:59 +02:00
parent bd7cc38d6e
commit 089995ef73
3 changed files with 5 additions and 9 deletions

View File

@ -2616,9 +2616,9 @@ class Archiver:
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 @@ class Archiver:
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))

View File

@ -143,7 +143,8 @@ class Archives(abc.MutableMapping):
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
"""
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)]

View File

@ -1826,7 +1826,6 @@ class ArchiverTestCase(ArchiverTestCaseBase):
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')