1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 02:08:54 +00:00

fix reversed archive ordering with --last

This commit is contained in:
Marian Beermann 2017-07-02 22:39:21 +02:00
parent c624e715ad
commit 51c1c22c1f

View file

@ -231,10 +231,13 @@ def list(self, sort_by=(), reverse=False, glob=None, first=None, last=None):
archives = [x for x in self.values() if regex.match(x.name) is not None] archives = [x for x in self.values() if regex.match(x.name) is not None]
for sortkey in reversed(sort_by): for sortkey in reversed(sort_by):
archives.sort(key=attrgetter(sortkey)) archives.sort(key=attrgetter(sortkey))
if reverse or last: if reverse:
archives.reverse() archives.reverse()
n = first or last or len(archives) if first:
return archives[:n] archives = archives[:first]
elif last:
archives = archives[len(archives) - last:]
return archives
def list_considering(self, args): def list_considering(self, args):
""" """