Changeset View
Changeset View
Standalone View
Standalone View
swh/web/api/views/vault.py
Show First 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | .. http:post:: /api/1/vault/git-bare/(swhid)/ | ||||
through a GET request. | through a GET request. | ||||
Once the cooking task has been executed, the resulting git-bare archive | Once the cooking task has been executed, the resulting git-bare archive | ||||
can be downloaded using the dedicated endpoint | can be downloaded using the dedicated endpoint | ||||
:http:get:`/api/1/vault/git-bare/(swhid)/raw/`. | :http:get:`/api/1/vault/git-bare/(swhid)/raw/`. | ||||
Then to import the revision in the current directory, use:: | Then to import the revision in the current directory, use:: | ||||
$ tar -xzf path/to/swh:1:rev:*.git_bare.tar.gz | $ tar -xf path/to/swh:1:rev:*.git.tar | ||||
$ git clone swh:1:rev:*.git new_repository | $ git clone swh:1:rev:*.git new_repository | ||||
(replace ``swh:1:rev:*`` with the SWHID of the requested revision) | (replace ``swh:1:rev:*`` with the SWHID of the requested revision) | ||||
This will create a directory called ``new_repository``, which is a git | This will create a directory called ``new_repository``, which is a git | ||||
repository containing the requested objects. | repository containing the requested objects. | ||||
:param string swhid: the revision's permanent identifier | :param string swhid: the revision's permanent identifier | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | def api_vault_fetch_revision_git_bare(request, swhid): | ||||
""" | """ | ||||
res = api_lookup( | res = api_lookup( | ||||
archive.vault_fetch, | archive.vault_fetch, | ||||
"git_bare", | "git_bare", | ||||
CoreSWHID.from_string(swhid), | CoreSWHID.from_string(swhid), | ||||
notfound_msg="Cooked archive for {} not found.".format(swhid), | notfound_msg="Cooked archive for {} not found.".format(swhid), | ||||
request=request, | request=request, | ||||
) | ) | ||||
fname = "{}.git_bare.tar.gz".format(swhid) | fname = "{}.git.tar".format(swhid) | ||||
response = HttpResponse(res, content_type="application/gzip") | response = HttpResponse(res, content_type="application/gzip") | ||||
response["Content-disposition"] = "attachment; filename={}".format(fname) | response["Content-disposition"] = "attachment; filename={}".format(fname) | ||||
return response | return response |