diff --git a/swh/loader/mercurial/hgutil.py b/swh/loader/mercurial/hgutil.py --- a/swh/loader/mercurial/hgutil.py +++ b/swh/loader/mercurial/hgutil.py @@ -83,6 +83,10 @@ default_rev_alias = None at_bookmark = all_bookmarks.get(b"@") if at_bookmark is not None: + import pdb + + pdb.set_trace() + bookmark_at_branch = repo[at_bookmark].branch() if branch_tips.get(bookmark_at_branch) is not None: default_rev_alias = b"bookmarks/@" @@ -100,9 +104,16 @@ for branch in branches_with_one_head: del branch_open_heads[branch] + # for bookmarks, the ids listed are not aligned with the rest, it's human + # readable id as bytes string instead of bytes string. Hence the extra mapping. + branch_bookmarks = { + branch: HgNodeId(bytes.fromhex(node_id.decode())) + for branch, node_id in all_bookmarks.items() + } + return BranchingInfo( tips=branch_tips, - bookmarks=all_bookmarks, + bookmarks=branch_bookmarks, open_heads=branch_open_heads, closed_heads=branch_closed_heads, default_branch_alias=default_rev_alias, diff --git a/swh/loader/mercurial/tests/test_from_disk.py b/swh/loader/mercurial/tests/test_from_disk.py --- a/swh/loader/mercurial/tests/test_from_disk.py +++ b/swh/loader/mercurial/tests/test_from_disk.py @@ -725,9 +725,8 @@ assert visit_status2.snapshot == visit_status.snapshot -@pytest.mark.xfail -def test_loader_missing_hgnodeid_mapping(swh_storage, datadir, tmp_path): - """TODO: Analyze this issue and update the comment about the proper behavior. +def test_loader_repository_with_bookmark_information(swh_storage, datadir, tmp_path): + """Repository with bookmark information should be ingested correctly """ archive_name = "anomad-d"