Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-lister
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine R. Dumont
swh-lister
Commits
fdb42023
Verified
Commit
fdb42023
authored
3 years ago
by
Antoine R. Dumont
Browse files
Options
Downloads
Patches
Plain Diff
gitlab: Allow ingestion of hg_git origins as hg ones
Related to T3581#70593
parent
4e4edee4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
swh/lister/gitlab/lister.py
+4
-8
4 additions, 8 deletions
swh/lister/gitlab/lister.py
swh/lister/gitlab/tests/test_lister.py
+4
-5
4 additions, 5 deletions
swh/lister/gitlab/tests/test_lister.py
with
8 additions
and
13 deletions
swh/lister/gitlab/lister.py
+
4
−
8
View file @
fdb42023
...
...
@@ -23,7 +23,8 @@ from swh.scheduler.model import ListedOrigin
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 @@ class GitLabLister(Lister[GitLabListerState, PageResult]):
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
"
]),
)
...
...
This diff is collapsed.
Click to expand it.
swh/lister/gitlab/tests/test_lister.py
+
4
−
5
View file @
fdb42023
...
...
@@ -12,7 +12,7 @@ import pytest
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 @@ def test_lister_gitlab_heptapod(datadir, swh_scheduler, requests_mock):
)
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment