diff options
author | Guido Günther <agx@sigxcpu.org> | 2021-06-08 19:03:22 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2021-06-08 19:03:22 +0200 |
commit | 741072c5dfa6f74fe834886b42fd1801c66bbd10 (patch) | |
tree | 42d4a63551bd051618ac7a096bd6ba63f91dee02 | |
parent | fe7d07cf55977e3a0c49130488ddaf39655a0dc2 (diff) |
Support salsa.debian.org
We misdetected the URL format and hence created broken links
-rw-r--r-- | vcsbrowsers.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/vcsbrowsers.py b/vcsbrowsers.py index ba33cb1..2e082a6 100644 --- a/vcsbrowsers.py +++ b/vcsbrowsers.py @@ -14,6 +14,24 @@ class VCSBrowser(object): def branch(self, branch): raise NotImplemented +class GitlabBrowser(VCSBrowser): + """ + Gitlab based repo browser + + URLs for gitlab: + e.g. http://salsa.debian.org/libvirt-team/libvirt.git + """ + repotype = "gitweb" + + def __init__(self, url): + VCSBrowser.__init__(self, url) + + @classmethod + def check(cls, url): + return True if 'https://salsa.debian.org/' in url else False + + def commit(self, commitid): + return "%s/commit/%s" % (self.url, commitid) class GitWebBrowser(VCSBrowser): """ @@ -59,7 +77,7 @@ def guess_git_repo(url): >>> guess_git_repo("http://example.com/bar/foo").repotype 'cgit' """ - for repotype in [CGitBrowser, GitWebBrowser]: + for repotype in [GitlabBrowser, CGitBrowser, GitWebBrowser]: if repotype.check(url): return repotype(url) return CGitBrowser(url) |