1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-23 16:26:29 +00:00

Merge pull request #944 from ThomasWaldmann/fix-942

prune: fix bad validator, fixes #942
This commit is contained in:
TW 2016-04-19 00:50:45 +02:00
commit 3060332f06

View file

@ -565,11 +565,13 @@ def do_info(self, args, repository, manifest, key, archive, cache):
@with_repository()
def do_prune(self, args, repository, manifest, key):
"""Prune repository archives according to specified rules"""
archives = manifest.list_archive_infos(sort_by='ts', reverse=True) # just a ArchiveInfo list
if args.hourly + args.daily + args.weekly + args.monthly + args.yearly == 0 and args.within is None:
self.print_error('At least one of the "keep-within", "keep-hourly", "keep-daily", "keep-weekly", '
'"keep-monthly" or "keep-yearly" settings must be specified')
if not any((args.hourly, args.daily,
args.weekly, args.monthly, args.yearly, args.within)):
self.print_error('At least one of the "keep-within", "keep-last", '
'"keep-hourly", "keep-daily", '
'"keep-weekly", "keep-monthly" or "keep-yearly" settings must be specified.')
return self.exit_code
archives = manifest.list_archive_infos(sort_by='ts', reverse=True) # just a ArchiveInfo list
if args.prefix:
archives = [archive for archive in archives if archive.name.startswith(args.prefix)]
keep = []