diff --git a/swh/loader/svn/loader.py b/swh/loader/svn/loader.py --- a/swh/loader/svn/loader.py +++ b/swh/loader/svn/loader.py @@ -46,17 +46,6 @@ DEFAULT_BRANCH = b"HEAD" -def build_swh_snapshot(revision_id, branch=DEFAULT_BRANCH): - """Build a swh snapshot from the revision id, origin url, and visit. - - """ - return Snapshot( - branches={ - branch: SnapshotBranch(target=revision_id, target_type=TargetType.REVISION) - } - ) - - TEMPORARY_DIR_PREFIX_PATTERN = "swh.loader.svn." @@ -575,7 +564,13 @@ """ if revision: # Priority to the revision - snap = build_swh_snapshot(revision.id) + snap = Snapshot( + branches={ + DEFAULT_BRANCH: SnapshotBranch( + target=revision.id, target_type=TargetType.REVISION + ) + } + ) elif snapshot: # Fallback to prior snapshot snap = snapshot else: diff --git a/swh/loader/svn/tests/test_loader.py b/swh/loader/svn/tests/test_loader.py --- a/swh/loader/svn/tests/test_loader.py +++ b/swh/loader/svn/tests/test_loader.py @@ -14,25 +14,10 @@ ) from swh.loader.svn.loader import ( - DEFAULT_BRANCH, SvnLoader, SvnLoaderFromRemoteDump, - build_swh_snapshot, ) from swh.model.hashutil import hash_to_bytes -from swh.model.model import Snapshot - - -def test_build_swh_snapshot(): - rev_id = hash_to_bytes("3f51abf3b3d466571be0855dfa67e094f9ceff1b") - snap = build_swh_snapshot(rev_id) - - assert isinstance(snap, Snapshot) - - expected_snapshot = Snapshot.from_dict( - {"branches": {DEFAULT_BRANCH: {"target": rev_id, "target_type": "revision",}}} - ) - assert snap == expected_snapshot GOURMET_SNAPSHOT = hash_to_bytes("889cacc2731e3312abfb2b1a0c18ade82a949e07")