Changeset View
Changeset View
Standalone View
Standalone View
swh/web/api/views/vault.py
Show First 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | .. http:get:: /api/1/vault/flat/(swhid)/raw/ | ||||
Fetch the cooked archive for a flat bundle. | Fetch the cooked archive for a flat bundle. | ||||
See :http:get:`/api/1/vault/flat/(swhid)/` to get more | See :http:get:`/api/1/vault/flat/(swhid)/` to get more | ||||
details on 'flat' bundle cooking. | details on 'flat' bundle cooking. | ||||
:param string swhid: the SWHID of the object to cook | :param string swhid: the SWHID of the object to cook | ||||
:resheader Content-Type: application/octet-stream | :resheader Content-Type: application/gzip | ||||
:statuscode 200: no error | :statuscode 200: no error | ||||
:statuscode 404: requested directory did not receive any cooking | :statuscode 404: requested directory did not receive any cooking | ||||
request yet (in case of GET) or can not be found in the archive | request yet (in case of GET) or can not be found in the archive | ||||
(in case of POST) | (in case of POST) | ||||
""" | """ | ||||
res = api_lookup( | res = api_lookup( | ||||
archive.vault_fetch, | archive.vault_fetch, | ||||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | .. http:get:: /api/1/vault/gitfast/(swhid)/raw/ | ||||
Fetch the cooked gitfast archive for a revision. | Fetch the cooked gitfast archive for a revision. | ||||
See :http:get:`/api/1/vault/gitfast/(swhid)/` to get more | See :http:get:`/api/1/vault/gitfast/(swhid)/` to get more | ||||
details on gitfast cooking. | details on gitfast cooking. | ||||
:param string rev_id: the revision's sha1 identifier | :param string rev_id: the revision's sha1 identifier | ||||
:resheader Content-Type: application/octet-stream | :resheader Content-Type: application/gzip | ||||
:statuscode 200: no error | :statuscode 200: no error | ||||
:statuscode 404: requested directory did not receive any cooking | :statuscode 404: requested directory did not receive any cooking | ||||
request yet (in case of GET) or can not be found in the archive | request yet (in case of GET) or can not be found in the archive | ||||
(in case of POST) | (in case of POST) | ||||
""" | """ | ||||
res = api_lookup( | res = api_lookup( | ||||
archive.vault_fetch, | archive.vault_fetch, | ||||
▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | .. http:get:: /api/1/vault/git-bare/(swhid)/raw/ | ||||
Fetch the cooked git-bare archive for a revision. | Fetch the cooked git-bare archive for a revision. | ||||
See :http:get:`/api/1/vault/git-bare/(swhid)/` to get more | See :http:get:`/api/1/vault/git-bare/(swhid)/` to get more | ||||
details on git-bare cooking. | details on git-bare cooking. | ||||
:param string swhid: the revision's permanent identifier | :param string swhid: the revision's permanent identifier | ||||
:resheader Content-Type: application/octet-stream | :resheader Content-Type: application/x-tar | ||||
:statuscode 200: no error | :statuscode 200: no error | ||||
:statuscode 404: requested directory did not receive any cooking | :statuscode 404: requested directory did not receive any cooking | ||||
request yet (in case of GET) or can not be found in the archive | request yet (in case of GET) or can not be found in the archive | ||||
(in case of POST) | (in case of POST) | ||||
""" | """ | ||||
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.tar".format(swhid) | fname = "{}.git.tar".format(swhid) | ||||
response = HttpResponse(res, content_type="application/gzip") | response = HttpResponse(res, content_type="application/x-tar") | ||||
response["Content-disposition"] = "attachment; filename={}".format( | response["Content-disposition"] = "attachment; filename={}".format( | ||||
fname.replace(":", "_") | fname.replace(":", "_") | ||||
) | ) | ||||
return response | return response |