aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido G√ľnther <agx@sigxcpu.org>2008-12-05 17:49:00 +0100
committerGuido Guenther <agx@sigxcpu.org>2008-12-05 17:49:00 +0100
commitb6eb47720ccf360524cf342dcdb54505bd6cfab4 (patch)
treeb0cd2b888124a9791d8801a9060ed7c5169be632
parentcc938e949776fe7d27bfcfaed8a4e037fc6f5894 (diff)
add support for commit ids in drm-snapshot
-rw-r--r--htmlchangelog.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/htmlchangelog.py b/htmlchangelog.py
index ba96393..19abdec 100644
--- a/htmlchangelog.py
+++ b/htmlchangelog.py
@@ -8,9 +8,13 @@ import debian_bundle.changelog
_TEMPLATEDIR='templates/'
class HTMLChangelogFilter(object):
- commit_id_re = re.compile(r"(?P<s>\s+\*\s+\[)"
- +r"(?P<commitid>[a-fA-F0-9]{7,})"
- +r"(?P<e>\]\s+.*)")
+ commit_id_res = [ re.compile(r"(?P<s>\s+\*\s+\[)" # as generated by git-dch
+ +r"(?P<commitid>[a-fA-F0-9]{7,40})"
+ +r"(?P<e>\]\s+.*)"),
+ re.compile(r"(?P<s>\s+-\s+)" # drm-snapshot uses this
+ +r"(?P<commitid>[a-fA-F0-9]{7,40})"
+ +r"(?P<e>\.\.\.\s+.*)"),
+ ]
def __init__(self, vcsbrowser=None):
self.vcsbrowser=vcsbrowser
@@ -19,11 +23,13 @@ class HTMLChangelogFilter(object):
body = []
for line in changes:
line = cgi.escape(line)
- m = self.commit_id_re.match(line)
- if m:
- commitid = m.group('commitid')
- link = '<a href="%s">%s</a>' % (self.vcsbrowser.commit(commitid), commitid)
- body.append(m.group("s") + link + m.group("e"))
+ for regex in self.commit_id_res:
+ m = regex.match(line)
+ if m:
+ commitid = m.group('commitid')
+ link = '<a href="%s">%s</a>' % (self.vcsbrowser.commit(commitid), commitid)
+ body.append(m.group("s") + link + m.group("e"))
+ break
else:
body.append(line)
return "\n".join(body)