diff options
author | TW <tw@waldmann-edv.de> | 2023-10-27 22:27:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-27 22:27:59 +0200 |
commit | b83525cd4cc5f6d99877f368db2f2a7856eaa8c3 (patch) | |
tree | c0c8f32239334c11fa4232b9241d9cfc00fd8e80 /src | |
parent | fa7a6d70958961d775ff51da55f8fba7269c5820 (diff) | |
parent | 0e3773d8c7c3a84e80810555888df20cf37938aa (diff) |
Merge pull request #7891 from ThomasWaldmann/sort-by-aliases-1.2
--sort-by: support "archive" as alias of "name", fixes #7873 (1.2-maint)
Diffstat (limited to 'src')
-rw-r--r-- | src/borg/helpers/manifest.py | 3 | ||||
-rw-r--r-- | src/borg/helpers/parseformat.py | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/borg/helpers/manifest.py b/src/borg/helpers/manifest.py index 5b595eacb..1de7e89f5 100644 --- a/src/borg/helpers/manifest.py +++ b/src/borg/helpers/manifest.py @@ -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') diff --git a/src/borg/helpers/parseformat.py b/src/borg/helpers/parseformat.py index 1e11ea61d..03e9c20a4 100644 --- a/src/borg/helpers/parseformat.py +++ b/src/borg/helpers/parseformat.py @@ -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): |