Skip to content

Commit

Permalink
Merge pull request #7891 from ThomasWaldmann/sort-by-aliases-1.2
Browse files Browse the repository at this point in the history
--sort-by: support "archive" as alias of "name", fixes #7873 (1.2-maint)
  • Loading branch information
ThomasWaldmann authored Oct 27, 2023
2 parents fa7a6d7 + 0e3773d commit b83525c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/borg/helpers/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class MandatoryFeatureUnsupported(Error):

ArchiveInfo = namedtuple('ArchiveInfo', 'name id ts')

AI_HUMAN_SORT_KEYS = ['timestamp'] + list(ArchiveInfo._fields)
# timestamp is a replacement for ts, archive is an alias for name (see SortBySpec)
AI_HUMAN_SORT_KEYS = ['timestamp', 'archive'] + list(ArchiveInfo._fields)
AI_HUMAN_SORT_KEYS.remove('ts')


Expand Down
2 changes: 1 addition & 1 deletion src/borg/helpers/parseformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def SortBySpec(text):
for token in text.split(','):
if token not in AI_HUMAN_SORT_KEYS:
raise argparse.ArgumentTypeError('Invalid sort key: %s' % token)
return text.replace('timestamp', 'ts')
return text.replace('timestamp', 'ts').replace('archive', 'name')


def format_file_size(v, precision=2, sign=False, iec=False):
Expand Down

0 comments on commit b83525c

Please sign in to comment.