aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)