diff --git a/swh/lister/gitlab/lister.py b/swh/lister/gitlab/lister.py --- a/swh/lister/gitlab/lister.py +++ b/swh/lister/gitlab/lister.py @@ -23,7 +23,8 @@ logger = logging.getLogger(__name__) -IGNORED_DVCS = ("hg_git",) +# Some instance provides hg_git type which can be ingested as hg origins +VCS_MAPPING = {"hg_git": "hg"} @dataclass @@ -207,15 +208,10 @@ repositories = page_result.repositories if page_result.repositories else [] for repo in repositories: visit_type = repo.get("vcs_type", "git") - url = repo["http_url_to_repo"] - if visit_type in IGNORED_DVCS: - logger.warning( - "Ignoring origin %s with type '%s'", url, visit_type, - ) - continue + visit_type = VCS_MAPPING.get(visit_type, visit_type) yield ListedOrigin( lister_id=self.lister_obj.id, - url=url, + url=repo["http_url_to_repo"], visit_type=visit_type, last_update=iso8601.parse_date(repo["last_activity_at"]), ) diff --git a/swh/lister/gitlab/tests/test_lister.py b/swh/lister/gitlab/tests/test_lister.py --- a/swh/lister/gitlab/tests/test_lister.py +++ b/swh/lister/gitlab/tests/test_lister.py @@ -12,7 +12,7 @@ from requests.status_codes import codes from swh.lister import USER_AGENT -from swh.lister.gitlab.lister import IGNORED_DVCS, GitLabLister, _parse_id_after +from swh.lister.gitlab.lister import GitLabLister, _parse_id_after from swh.lister.pattern import ListerStats from swh.lister.tests.test_utils import assert_sleep_calls from swh.lister.utils import WAIT_EXP_BASE @@ -69,11 +69,10 @@ ) listed_result = lister.run() - expected_nb_origins = 0 + expected_nb_origins = len(response) + for entry in response: - if entry["vcs_type"] in IGNORED_DVCS: - continue - expected_nb_origins += 1 + assert entry["vcs_type"] in ("hg", "hg_git") assert listed_result == ListerStats(pages=1, origins=expected_nb_origins)