diff --git a/swh/loader/pypi/loader.py b/swh/loader/pypi/loader.py --- a/swh/loader/pypi/loader.py +++ b/swh/loader/pypi/loader.py @@ -160,6 +160,7 @@ self._directories = [] self._revisions = [] self._load_status = 'uneventful' + self._visit_status = 'full' def fetch_data(self): """Called once per release artifact version (can be many for one @@ -247,6 +248,8 @@ branches[branch_name.encode('utf-8')] = target if release == default_release: branches[b'HEAD'] = target + if not target: + self._visit_status = 'partial' else: # Several artifacts for this release, generate a separate # pointer for each of them @@ -254,6 +257,8 @@ branch_name = 'refs/tags/%s/%s' % (release, filename) target = self.target_from_artifact(filename, sha256) branches[branch_name.encode('utf-8')] = target + if not target: + self._visit_status = 'partial' snapshot = { 'branches': branches, @@ -279,6 +284,9 @@ 'status': self._load_status, } + def visit_status(self): + return self._visit_status + if __name__ == '__main__': import logging diff --git a/swh/loader/pypi/tests/test_loader.py b/swh/loader/pypi/tests/test_loader.py --- a/swh/loader/pypi/tests/test_loader.py +++ b/swh/loader/pypi/tests/test_loader.py @@ -207,6 +207,7 @@ expected_branches) self.assertEqual(self.loader.load_status(), {'status': 'eventful'}) + self.assertEqual(self.loader.visit_status(), 'full') class PyPILoaderWithSnapshot(TestPyPILoader): @@ -306,6 +307,7 @@ self.assertEquals(expected_snapshot_id, _id) self.assertEqual(self.loader.load_status(), {'status': 'uneventful'}) + self.assertEqual(self.loader.visit_status(), 'full') class LoaderNewChangesSinceLastVisitITest(BaseLoaderITest): @@ -402,6 +404,7 @@ self.assertNotEqual(expected_snapshot_id, _id) self.assertEqual(self.loader.load_status(), {'status': 'eventful'}) + self.assertEqual(self.loader.visit_status(), 'full') class PyPILoaderWithSnapshot2(TestPyPILoader): @@ -540,3 +543,4 @@ self.assertNotEqual(expected_snapshot_id, _id) self.assertEqual(self.loader.load_status(), {'status': 'eventful'}) + self.assertEqual(self.loader.visit_status(), 'full')