aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido G√ľnther <agx@sigxcpu.org>2008-11-07 11:04:26 +0100
committerGuido Guenther <agx@sigxcpu.org>2008-11-07 11:04:26 +0100
commitba08fae3fd0158fb41651d74f97916021ccfb172 (patch)
tree5b9f0bc7b3fbe896a679b6861a9d6851961e236f
add vcsbrowser wrapper
-rw-r--r--vcsbrowsers.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/vcsbrowsers.py b/vcsbrowsers.py
new file mode 100644
index 0000000..fd29005
--- /dev/null
+++ b/vcsbrowsers.py
@@ -0,0 +1,36 @@
+# convenience wrappers to construct links
+# into the webinterfaces of different VCSs
+
+class VCSBrowser:
+ def __init__(self, url):
+ self.url = url.rstrip('/')
+
+ def commit(self, commtid):
+ raise NotImplemented
+
+ def branch(self, branch):
+ raise NotImplemented
+
+
+class GitWebBrowser(VCSBrowser):
+ """
+ URLs for gitweb:
+ e.g. http://git.debian.org/?p=pkg-libvirt/gtk-vnc.git
+ """
+ def commit(self, commitid):
+ return "%s;a=commit;h=%s" % (self.url, commitid)
+
+ def branch(self, branch):
+ return "%s;a=shortlog;h=refs/heads/%s" % (self.url, branch)
+
+
+class HgBrowser(VCSBrowser):
+ """
+ URLs for Mercurial:
+ e.g. http://hg.et.redhat.com/virt/applications/virtinst--devel
+ """
+
+ def commit(self, commitid):
+ return "%s?cs=%s" % (self.url, commitid)
+
+