From b6eb47720ccf360524cf342dcdb54505bd6cfab4 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 5 Dec 2008 17:49:00 +0100 Subject: add support for commit ids in drm-snapshot --- htmlchangelog.py | 22 ++++++++++++++-------- 1 file 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+\[)" - +r"(?P[a-fA-F0-9]{7,})" - +r"(?P\]\s+.*)") + commit_id_res = [ re.compile(r"(?P\s+\*\s+\[)" # as generated by git-dch + +r"(?P[a-fA-F0-9]{7,40})" + +r"(?P\]\s+.*)"), + re.compile(r"(?P\s+-\s+)" # drm-snapshot uses this + +r"(?P[a-fA-F0-9]{7,40})" + +r"(?P\.\.\.\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 = '%s' % (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 = '%s' % (self.vcsbrowser.commit(commitid), commitid) + body.append(m.group("s") + link + m.group("e")) + break else: body.append(line) return "\n".join(body) -- cgit v1.2.3