Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/svn/tests/test_loader.py
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | def test_loader_svn_2_visits_no_change(swh_config, datadir, tmp_path): | ||||
assert visit_status1.date < visit_status2.date | assert visit_status1.date < visit_status2.date | ||||
assert visit_status1.snapshot == visit_status2.snapshot | assert visit_status1.snapshot == visit_status2.snapshot | ||||
stats = get_stats(loader.storage) | stats = get_stats(loader.storage) | ||||
assert stats["origin_visit"] == 1 + 1 # computed twice the same snapshot | assert stats["origin_visit"] == 1 + 1 # computed twice the same snapshot | ||||
assert stats["snapshot"] == 1 | assert stats["snapshot"] == 1 | ||||
# even starting from previous revision... | # even starting from previous revision... | ||||
revs = list( | start_revision = loader.storage.revision_get( | ||||
loader.storage.revision_get( | |||||
[hash_to_bytes("95edacc8848369d6fb1608e887d6d2474fd5224f")] | [hash_to_bytes("95edacc8848369d6fb1608e887d6d2474fd5224f")] | ||||
) | )[0] | ||||
) | |||||
start_revision = revs[0] | |||||
assert start_revision is not None | assert start_revision is not None | ||||
loader = SvnLoader(repo_url, swh_revision=start_revision) | loader = SvnLoader(repo_url, swh_revision=start_revision) | ||||
assert loader.load() == {"status": "uneventful"} | assert loader.load() == {"status": "uneventful"} | ||||
stats = get_stats(loader.storage) | stats = get_stats(loader.storage) | ||||
assert stats["origin_visit"] == 2 + 1 | assert stats["origin_visit"] == 2 + 1 | ||||
# ... with no change in repository, this yields the same snapshot | # ... with no change in repository, this yields the same snapshot | ||||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | def test_loader_svn_visit_start_from_revision(swh_config, datadir, tmp_path): | ||||
visit_status1 = assert_last_visit_matches( | visit_status1 = assert_last_visit_matches( | ||||
loader.storage, | loader.storage, | ||||
repo_initial_url, | repo_initial_url, | ||||
status="full", | status="full", | ||||
type="svn", | type="svn", | ||||
snapshot=GOURMET_SNAPSHOT.id, | snapshot=GOURMET_SNAPSHOT.id, | ||||
) | ) | ||||
revs = list( | start_revision = loader.storage.revision_get( | ||||
loader.storage.revision_get( | |||||
[hash_to_bytes("95edacc8848369d6fb1608e887d6d2474fd5224f")] | [hash_to_bytes("95edacc8848369d6fb1608e887d6d2474fd5224f")] | ||||
) | )[0] | ||||
) | |||||
start_revision = revs[0] | |||||
assert start_revision is not None | assert start_revision is not None | ||||
archive_path = os.path.join(datadir, "pkg-gourmet-with-updates.tgz") | archive_path = os.path.join(datadir, "pkg-gourmet-with-updates.tgz") | ||||
repo_updated_url = prepare_repository_from_archive( | repo_updated_url = prepare_repository_from_archive( | ||||
archive_path, "pkg-gourmet", tmp_path | archive_path, "pkg-gourmet", tmp_path | ||||
) | ) | ||||
# we'll start from start_revision | # we'll start from start_revision | ||||
▲ Show 20 Lines • Show All 330 Lines • Show Last 20 Lines |