Reading Document Snapshot Contents
Reading a Document Snapshot as a File or Folder
As of 2023, to read the contents of a document snapshot into a local file or folder, you need to use Git directly. If a document succession is archived, the document snapshots can be viewed online.
A document snapshot can be either a file or a directory. After running the command:
hidos dsi --editions branch_name
a SWHID and edition number will be listed for each document snapshot.
A SWHID starts with swh:1:cnt:
or swh:1:dir:
for files and directories,
respectively.
If the document snapshot is in the Software Heritage Archive, you can append the SWHID
to https://archive.softwareheritage.org/
to view the document snapshot.
To read a document snapshot locally, you can use Git.
The last part of a SWHID,
which is the suffix following swh:1:cnt:
or swh:1:dir:
,
is a Git hash.
By using the displayed Git hash listed for an edition (output by hidos dsi --editions
),
you can use Git to output the document snapshot:
git show <hash>
If the document snapshot is a file, the file contents will be output. For a directory, a listing of contained files will be printed. To output a file inside the directory given its path, use the following command:
git show <hash>:<path>