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,10 @@ 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", "hg": "hg"} +# By default gitlab instances mainly list git origins +DEFAULT_VCS_TYPE = "git" @dataclass @@ -206,13 +209,10 @@ repositories = page_result.repositories if page_result.repositories else [] for repo in repositories: - visit_type = repo.get("vcs_type", "git") + visit_type = VCS_MAPPING.get( + repo.get("vcs_type", DEFAULT_VCS_TYPE), DEFAULT_VCS_TYPE + ) url = repo["http_url_to_repo"] - if visit_type in IGNORED_DVCS: - logger.warning( - "Ignoring origin %s with type '%s'", url, visit_type, - ) - continue yield ListedOrigin( lister_id=self.lister_obj.id, url=url, 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 VCS_MAPPING, 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 VCS_MAPPING[entry["vcs_type"]] == "hg" assert listed_result == ListerStats(pages=1, origins=expected_nb_origins)