mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-03 18:27:01 +00:00
list: files->items, clarifications
This commit is contained in:
parent
7cce650a38
commit
abb0a20d4f
3 changed files with 15 additions and 16 deletions
|
@ -42,7 +42,7 @@ archive_progress
|
|||
|
||||
progress_message
|
||||
A message-based progress information with no concrete progress information, just a message
|
||||
saying what is currently worked on.
|
||||
saying what is currently being worked on.
|
||||
|
||||
operation
|
||||
unique, opaque integer ID of the operation
|
||||
|
@ -209,7 +209,7 @@ array under the *archives* key, while :ref:`borg_create` returns a single archiv
|
|||
Both formats contain a *name* key with the archive name, the *id* key with the hexadecimal archive ID,
|
||||
and the *start* key with the start timestamp.
|
||||
|
||||
info and create further have:
|
||||
*borg info* and *borg create* further have:
|
||||
|
||||
end
|
||||
End timestamp
|
||||
|
@ -250,11 +250,8 @@ Example of a simple archive listing (``borg list --last 1 --json``)::
|
|||
{
|
||||
"archives": [
|
||||
{
|
||||
"archive": "2017-02-27T21:21:51",
|
||||
"barchive": "2017-02-27T21:21:51",
|
||||
"id": "80cd07219ad725b3c5f665c1dcf119435c4dee1647a560ecac30f8d40221a46a",
|
||||
"name": "2017-02-27T21:21:51",
|
||||
"time": "Mon, 2017-02-27 21:21:52",
|
||||
"name": "host-system-backup-2017-02-27",
|
||||
"start": "Mon, 2017-02-27 21:21:52"
|
||||
}
|
||||
],
|
||||
|
@ -287,7 +284,7 @@ The same archive with more information (``borg info --last 1 --json``)::
|
|||
"limits": {
|
||||
"max_archive_size": 0.0001330855110409714
|
||||
},
|
||||
"name": "2017-02-27T21:21:51",
|
||||
"name": "host-system-backup-2017-02-27",
|
||||
"start": "Mon, 2017-02-27 21:21:52",
|
||||
"stats": {
|
||||
"compressed_size": 1880961894,
|
||||
|
@ -322,7 +319,7 @@ The same archive with more information (``borg info --last 1 --json``)::
|
|||
.. rubric:: File listings
|
||||
|
||||
Listing the contents of an archive can produce *a lot* of JSON. Each item (file, directory, ...) is described
|
||||
by one object in the *files* array of the :ref:`borg_list` output. Refer to the *borg list* documentation for
|
||||
by one object in the *items* array of the :ref:`borg_list` output. Refer to the *borg list* documentation for
|
||||
the available keys and their meaning.
|
||||
|
||||
Example (excerpt)::
|
||||
|
@ -336,7 +333,7 @@ Example (excerpt)::
|
|||
"last_modified": "Mon, 2017-02-27 21:21:58",
|
||||
"location": "/home/user/repository"
|
||||
},
|
||||
"files": [
|
||||
"items": [
|
||||
{
|
||||
"type": "d",
|
||||
"mode": "drwxr-xr-x",
|
||||
|
|
|
@ -1617,11 +1617,13 @@ def __init__(self, format):
|
|||
|
||||
def get_item_data(self, archive):
|
||||
return {
|
||||
# *name* is the key used by borg-info for the archive name, this makes the formats more compatible
|
||||
'name': remove_surrogates(archive.name),
|
||||
'barchive': archive.name,
|
||||
'archive': remove_surrogates(archive.name),
|
||||
'id': bin_to_hex(archive.id),
|
||||
'time': format_time(to_localtime(archive.ts)),
|
||||
# *start* is the key used by borg-info for this timestamp, this makes the formats more compatible
|
||||
'start': format_time(to_localtime(archive.ts)),
|
||||
}
|
||||
|
||||
|
@ -1726,7 +1728,7 @@ def begin(self):
|
|||
begin = json_dump(basic_json_data(self.archive.manifest))
|
||||
begin, _, _ = begin.rpartition('\n}') # remove last closing brace, we want to extend the object
|
||||
begin += ',\n'
|
||||
begin += ' "files": [\n'
|
||||
begin += ' "items": [\n'
|
||||
return begin
|
||||
|
||||
def end(self):
|
||||
|
|
|
@ -1535,17 +1535,17 @@ def test_list_json(self):
|
|||
|
||||
list_archive = json.loads(self.cmd('list', '--json', self.repository_location + '::test'))
|
||||
assert list_repo['repository'] == list_archive['repository']
|
||||
files = list_archive['files']
|
||||
assert len(files) == 2
|
||||
file1 = files[1]
|
||||
items = list_archive['items']
|
||||
assert len(items) == 2
|
||||
file1 = items[1]
|
||||
assert file1['path'] == 'input/file1'
|
||||
assert file1['size'] == 81920
|
||||
|
||||
list_archive = json.loads(self.cmd('list', '--json', '--format={sha256}', self.repository_location + '::test'))
|
||||
assert list_repo['repository'] == list_archive['repository']
|
||||
files = list_archive['files']
|
||||
assert len(files) == 2
|
||||
file1 = files[1]
|
||||
items = list_archive['items']
|
||||
assert len(items) == 2
|
||||
file1 = items[1]
|
||||
assert file1['path'] == 'input/file1'
|
||||
assert file1['sha256'] == 'b2915eb69f260d8d3c25249195f2c8f4f716ea82ec760ae929732c0262442b2b'
|
||||
|
||||
|
|
Loading…
Reference in a new issue