mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-24 23:13:25 +00:00
Use \n for the {NL} format specifier
\n is automatically converted on write to the platform-dependent os.linesep. Using os.linesep instead of \n means that on Windows, the line ending becomes "\r\r\n". Also switches mentions of {LF} to {NL} in code and docs.
This commit is contained in:
parent
d32ae512a8
commit
66a407ff9f
4 changed files with 6 additions and 6 deletions
|
@ -34,7 +34,7 @@ Outputs a script that copies all archives from repo1 to repo2:
|
|||
|
||||
::
|
||||
|
||||
for A T in `borg list --format='{archive} {time:%Y-%m-%dT%H:%M:%S}{LF}'`
|
||||
for A T in `borg list --format='{archive} {time:%Y-%m-%dT%H:%M:%S}{NL}'`
|
||||
do
|
||||
echo "borg -r repo1 export-tar --tar-format=BORG $A - | borg -r repo2 import-tar --timestamp=$T $A -"
|
||||
done
|
||||
|
|
|
@ -593,8 +593,8 @@ class BaseFormatter:
|
|||
"TAB": "\t",
|
||||
"CR": "\r",
|
||||
"NUL": "\0",
|
||||
"NEWLINE": os.linesep,
|
||||
"NL": os.linesep,
|
||||
"NEWLINE": "\n",
|
||||
"NL": "\n", # \n is automatically converted to os.linesep on write
|
||||
}
|
||||
|
||||
def get_item_data(self, item):
|
||||
|
|
|
@ -71,7 +71,7 @@ def test_missing_file_chunk(self):
|
|||
self.assert_in("New missing file chunk detected", output)
|
||||
self.cmd(f"--repo={self.repository_location}", "check", exit_code=0)
|
||||
output = self.cmd(
|
||||
f"--repo={self.repository_location}", "list", "archive1", "--format={health}#{path}{LF}", exit_code=0
|
||||
f"--repo={self.repository_location}", "list", "archive1", "--format={health}#{path}{NL}", exit_code=0
|
||||
)
|
||||
self.assert_in("broken#", output)
|
||||
# check that the file in the old archives has now a different chunk list without the killed chunk
|
||||
|
@ -104,7 +104,7 @@ def test_missing_file_chunk(self):
|
|||
self.fail("should not happen")
|
||||
# list is also all-healthy again
|
||||
output = self.cmd(
|
||||
f"--repo={self.repository_location}", "list", "archive1", "--format={health}#{path}{LF}", exit_code=0
|
||||
f"--repo={self.repository_location}", "list", "archive1", "--format={health}#{path}{NL}", exit_code=0
|
||||
)
|
||||
self.assert_not_in("broken#", output)
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ def test_cache_files(self):
|
|||
def test_chunks_archive(self):
|
||||
self.cmd(f"--repo={self.repository_location}", "create", "test1", "input")
|
||||
# Find ID of test1 so we can corrupt it later :)
|
||||
target_id = self.cmd(f"--repo={self.repository_location}", "rlist", "--format={id}{LF}").strip()
|
||||
target_id = self.cmd(f"--repo={self.repository_location}", "rlist", "--format={id}{NL}").strip()
|
||||
self.cmd(f"--repo={self.repository_location}", "create", "test2", "input")
|
||||
|
||||
# Force cache sync, creating archive chunks of test1 and test2 in chunks.archive.d
|
||||
|
|
Loading…
Reference in a new issue