diff --git a/requirements-swh.txt b/requirements-swh.txt --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -1,5 +1,5 @@ swh.core >= 0.0.7 -swh.loader.core >= 0.5.2 +swh.loader.core >= 0.5.5 swh.model >= 0.4.0 swh.scheduler >= 0.0.39 swh.storage >= 0.10.0 diff --git a/swh/loader/git/tests/test_from_disk.py b/swh/loader/git/tests/test_from_disk.py --- a/swh/loader/git/tests/test_from_disk.py +++ b/swh/loader/git/tests/test_from_disk.py @@ -12,7 +12,7 @@ from unittest import TestCase -from swh.model.model import Snapshot, SnapshotBranch, TargetType +from swh.model.model import Snapshot from swh.model.hashutil import hash_to_bytes from swh.loader.git.from_disk import GitLoaderFromDisk, GitLoaderFromArchive @@ -29,25 +29,25 @@ SNAPSHOT1 = { "id": SNAPSHOT_ID, "branches": { - "HEAD": {"target": "refs/heads/master", "target_type": "alias",}, - "refs/heads/master": { - "target": "2f01f5ca7e391a2f08905990277faf81e709a649", + b"HEAD": {"target": b"refs/heads/master", "target_type": "alias",}, + b"refs/heads/master": { + "target": hash_to_bytes("2f01f5ca7e391a2f08905990277faf81e709a649"), "target_type": "revision", }, - "refs/heads/branch1": { - "target": "b0a77609903f767a2fd3d769904ef9ef68468b87", + b"refs/heads/branch1": { + "target": hash_to_bytes("b0a77609903f767a2fd3d769904ef9ef68468b87"), "target_type": "revision", }, - "refs/heads/branch2": { - "target": "bd746cd1913721b269b395a56a97baf6755151c2", + b"refs/heads/branch2": { + "target": hash_to_bytes("bd746cd1913721b269b395a56a97baf6755151c2"), "target_type": "revision", }, - "refs/tags/branch2-after-delete": { - "target": "bd746cd1913721b269b395a56a97baf6755151c2", + b"refs/tags/branch2-after-delete": { + "target": hash_to_bytes("bd746cd1913721b269b395a56a97baf6755151c2"), "target_type": "revision", }, - "refs/tags/branch2-before-delete": { - "target": "1135e94ccf73b5f9bd6ef07b3fa2c5cc60bba69b", + b"refs/tags/branch2-before-delete": { + "target": hash_to_bytes("1135e94ccf73b5f9bd6ef07b3fa2c5cc60bba69b"), "target_type": "revision", }, }, @@ -313,21 +313,7 @@ # Generate the expected snapshot from SNAPSHOT1 (which is the original # state of the git repo)... - branches = {} - - for branch_name, branch_dict in SNAPSHOT1["branches"].items(): - target_type_name = branch_dict["target_type"] - target_obj = branch_dict["target"] - - if target_type_name != "alias": - target = bytes.fromhex(target_obj) - else: - target = target_obj.encode() - - branch = SnapshotBranch( - target=target, target_type=TargetType(target_type_name) - ) - branches[branch_name.encode()] = branch + branches = SNAPSHOT1["branches"].copy() # ... and the unfiltered_branches, which are all pointing to the same # commit as "refs/heads/master".