cgit: rewrite the CGit lister

Simplify the code:
- do only inherit from ListerBase
- implement HTTP queries directly using requests
- get rid of convoluted code

Make the origin_url gathered from the git repo's "project" page instead of
building it from the 'url_prefix' hack. Now, the lister WILL make substancially
more requests, since it will make one request per listed git repo, but
the provided origin_url should be pretty reliable now.

When several url are provided as clonable URLs, choose the http/https one first,
otherwise, choose the first one of the list.

Add proper tests for the cgit lister.

Also, get rid of the 'time_updated' column in the model.
This commit is contained in:
David Douard 2019-08-30 16:48:44 +02:00
parent e0ce68377d
commit 3816b4d3bf
29 changed files with 2386 additions and 299 deletions

View file

@ -61,7 +61,6 @@ def test_get_lister_override():
listers = {
'gitlab': ('api_baseurl', 'https://gitlab.uni/api/v4/'),
'phabricator': ('forge_url', 'https://somewhere.org'),
'cgit': ('url_prefix', 'https://some-cgit.eu/'),
}
# check the override ends up defined in the lister
@ -87,8 +86,6 @@ def test_get_lister_override():
# then the default base url is used
default_url = DEFAULT_BASEURLS[lister_name]
if isinstance(default_url, tuple): # cgit implementation detail...
default_url = default_url[1]
assert getattr(lst, url_key) == default_url
assert 'priority' not in lst.config