diff --git a/swh/web/common/identifiers.py b/swh/web/common/identifiers.py --- a/swh/web/common/identifiers.py +++ b/swh/web/common/identifiers.py @@ -162,16 +162,11 @@ query_dict["snapshot"] = hash_to_hex(swhid_parsed.visit.object_id) if swhid_parsed.anchor: - if swhid_parsed.anchor.object_type == ObjectType.REVISION: - # check if the anchor revision is the tip of a branch - branch_name = archive.lookup_snapshot_branch_name_from_tip_revision( - hash_to_hex(swhid_parsed.visit.object_id), - hash_to_hex(swhid_parsed.anchor.object_id), - ) - if branch_name: - query_dict["branch"] = branch_name - elif object_type != ObjectType.REVISION: - query_dict["revision"] = hash_to_hex(swhid_parsed.anchor.object_id) + if ( + swhid_parsed.anchor.object_type == ObjectType.REVISION + and object_type != ObjectType.REVISION + ): + query_dict["revision"] = hash_to_hex(swhid_parsed.anchor.object_id) elif swhid_parsed.anchor.object_type == ObjectType.RELEASE: release = archive.lookup_release( @@ -180,13 +175,6 @@ if release: query_dict["release"] = release["name"] - if object_type == ObjectType.REVISION and "release" not in query_dict: - branch_name = archive.lookup_snapshot_branch_name_from_tip_revision( - hash_to_hex(swhid_parsed.visit.object_id), hash_to_hex(object_id) - ) - if branch_name: - query_dict["branch"] = branch_name - # browsing content or directory without snapshot context elif ( object_type in (ObjectType.CONTENT, ObjectType.DIRECTORY) diff --git a/swh/web/tests/common/test_identifiers.py b/swh/web/tests/common/test_identifiers.py --- a/swh/web/tests/common/test_identifiers.py +++ b/swh/web/tests/common/test_identifiers.py @@ -556,22 +556,7 @@ query_params["release"] = snapshot_context["release"] else: obj_context["anchor"] = gen_swhid(REVISION, snapshot_context["revision_id"]) - if ( - snapshot_context["branch"] - and snapshot_context["branch"] != snapshot_context["revision_id"] - ): - branch = snapshot_context["branch"] - if branch == "HEAD": - for b in snapshot_context["branches"]: - if ( - b["revision"] == snapshot_context["revision_id"] - and b["name"] != "HEAD" - ): - branch = b["name"] - break - - query_params["branch"] = branch - elif object_type != REVISION: + if object_type != REVISION: query_params["revision"] = snapshot_context["revision_id"] if path: