Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/utils.py
Show First 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | if snapshot_context and snapshot_context["origin_info"]: | ||||
query_params["visit_id"] = snp_query_params["visit_id"] | query_params["visit_id"] = snp_query_params["visit_id"] | ||||
if "snapshot" in snp_query_params and "visit_id" not in query_params: | if "snapshot" in snp_query_params and "visit_id" not in query_params: | ||||
query_params["snapshot"] = snp_query_params["snapshot"] | query_params["snapshot"] = snp_query_params["snapshot"] | ||||
elif snapshot_context: | elif snapshot_context: | ||||
query_params = {"snapshot": snapshot_context["snapshot_id"]} | query_params = {"snapshot": snapshot_context["snapshot_id"]} | ||||
if snapshot_context["release"]: | if snapshot_context["release"]: | ||||
query_params["release"] = snapshot_context["release"] | query_params["release"] = snapshot_context["release"] | ||||
elif snapshot_context["branch"] and snapshot_context["branch"] != "HEAD": | elif snapshot_context["branch"] and snapshot_context["branch"] not in ( | ||||
"HEAD", | |||||
snapshot_context["revision_id"], | |||||
): | |||||
query_params["branch"] = snapshot_context["branch"] | query_params["branch"] = snapshot_context["branch"] | ||||
elif snapshot_context["revision_id"]: | elif snapshot_context["revision_id"]: | ||||
query_params["revision"] = snapshot_context["revision_id"] | query_params["revision"] = snapshot_context["revision_id"] | ||||
return query_params | return query_params | ||||
def gen_revision_url(revision_id, snapshot_context=None): | def gen_revision_url(revision_id, snapshot_context=None): | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 412 Lines • Show Last 20 Lines |