remove support for barchive placeholder

not needed any more as the archive name is now validated pure text.
This commit is contained in:
Thomas Waldmann 2022-12-12 19:00:58 +01:00
parent 1517db07ec
commit 1e2741ad3d
No known key found for this signature in database
GPG Key ID: 243ACFA951F78E01
4 changed files with 5 additions and 9 deletions

View File

@ -114,7 +114,6 @@ class RListMixIn:
help="Format output as JSON. " help="Format output as JSON. "
"The form of ``--format`` is ignored, " "The form of ``--format`` is ignored, "
"but keys used in it are added to the JSON output. " "but keys used in it are added to the JSON output. "
"Some keys are always present. Note: JSON can only represent text. " "Some keys are always present. Note: JSON can only represent text.",
'A "barchive" key is therefore not available.',
) )
define_archive_filters_group(subparser) define_archive_filters_group(subparser)

View File

@ -616,7 +616,7 @@ class BaseFormatter:
return ( return (
"- NEWLINE: OS dependent line separator\n" "- NEWLINE: OS dependent line separator\n"
"- NL: alias of NEWLINE\n" "- NL: alias of NEWLINE\n"
"- NUL: NUL character for creating print0 / xargs -0 like output, see barchive and bpath keys below\n" "- NUL: NUL character for creating print0 / xargs -0 like output, see bpath key below\n"
"- SPACE\n" "- SPACE\n"
"- TAB\n" "- TAB\n"
"- CR\n" "- CR\n"
@ -626,9 +626,8 @@ class BaseFormatter:
class ArchiveFormatter(BaseFormatter): class ArchiveFormatter(BaseFormatter):
KEY_DESCRIPTIONS = { KEY_DESCRIPTIONS = {
"archive": "archive name interpreted as text (might be missing non-text characters, see barchive)", "archive": "archive name",
"name": 'alias of "archive"', "name": 'alias of "archive"',
"barchive": "verbatim archive name, can contain any character except NUL",
"comment": "archive comment", "comment": "archive comment",
# *start* is the key used by borg-info for this timestamp, this makes the formats more compatible # *start* is the key used by borg-info for this timestamp, this makes the formats more compatible
"start": "time (start) of creation of the archive", "start": "time (start) of creation of the archive",
@ -640,7 +639,7 @@ class ArchiveFormatter(BaseFormatter):
"username": "username of user who created this archive", "username": "username of user who created this archive",
} }
KEY_GROUPS = ( KEY_GROUPS = (
("archive", "name", "barchive", "comment", "id"), ("archive", "name", "comment", "id"),
("start", "time", "end", "command_line"), ("start", "time", "end", "command_line"),
("hostname", "username"), ("hostname", "username"),
) )
@ -713,7 +712,6 @@ class ArchiveFormatter(BaseFormatter):
{ {
"name": remove_surrogates(archive_info.name), "name": remove_surrogates(archive_info.name),
"archive": remove_surrogates(archive_info.name), "archive": remove_surrogates(archive_info.name),
"barchive": archive_info.name,
"id": bin_to_hex(archive_info.id), "id": bin_to_hex(archive_info.id),
"time": self.format_time(archive_info.ts), "time": self.format_time(archive_info.ts),
"start": self.format_time(archive_info.ts), "start": self.format_time(archive_info.ts),

View File

@ -35,8 +35,6 @@ class ArchiverTestCase(ArchiverTestCaseBase):
self.assertEqual(output_1, output_2) self.assertEqual(output_1, output_2)
output_1 = self.cmd(f"--repo={self.repository_location}", "rlist", "--short") output_1 = self.cmd(f"--repo={self.repository_location}", "rlist", "--short")
self.assertEqual(output_1, "test-1\ntest-2\n") self.assertEqual(output_1, "test-1\ntest-2\n")
output_1 = self.cmd(f"--repo={self.repository_location}", "rlist", "--format", "{barchive}/")
self.assertEqual(output_1, "test-1/test-2/")
output_3 = self.cmd(f"--repo={self.repository_location}", "rlist", "--format", "{name} {comment}{NL}") output_3 = self.cmd(f"--repo={self.repository_location}", "rlist", "--format", "{name} {comment}{NL}")
self.assert_in("test-1 comment 1\n", output_3) self.assert_in("test-1 comment 1\n", output_3)
self.assert_in("test-2 comment 2\n", output_3) self.assert_in("test-2 comment 2\n", output_3)

View File

@ -81,6 +81,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
for got_archive, expected_archive in zip(got["archives"], expected["archives"]): for got_archive, expected_archive in zip(got["archives"], expected["archives"]):
del got_archive["id"] del got_archive["id"]
del expected_archive["id"] del expected_archive["id"]
del expected_archive["barchive"]
# timestamps: # timestamps:
# borg 1.2 transformed to local time and had microseconds = 0, no tzoffset # borg 1.2 transformed to local time and had microseconds = 0, no tzoffset
# borg 2 uses an utc timestamp, with microseconds and with tzoffset # borg 2 uses an utc timestamp, with microseconds and with tzoffset