aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-07-17 09:31:32 -0400
committerNick Mathewson <nickm@torproject.org>2020-07-17 09:31:32 -0400
commit09601c3c4d468fdafa7aa290dd2b2949bdc5e7e0 (patch)
tree78e0feaa820a6fcef7c306541ca5ced8216b92b8 /scripts
parent07f3345e11530b14c719f8a776f15b943d2fef91 (diff)
downloadtor-09601c3c4d468fdafa7aa290dd2b2949bdc5e7e0.tar.gz
tor-09601c3c4d468fdafa7aa290dd2b2949bdc5e7e0.zip
Use gitlab-friendly URLs when formatting changelogs as HTML
Our old https://bugs.torproject.org/nnnn URLs only work for bugs numbered before 40000. Newer gitlab bugs need to have specific projects mentioned. This patch assumes that bugs are in tpo/core/tor by default, but allows us to refer to several other projects by saying e.g. "chutney#40002" if we want.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/maint/format_changelog.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/scripts/maint/format_changelog.py b/scripts/maint/format_changelog.py
index b37ece04c0..93ab56e257 100755
--- a/scripts/maint/format_changelog.py
+++ b/scripts/maint/format_changelog.py
@@ -405,10 +405,31 @@ class ChangeLog(object):
self.dumpEndOfSections()
self.dumpEndOfChangelog()
+# Map from issue prefix to pair of (visible prefix, url prefix)
+ISSUE_PREFIX_MAP = {
+ "" : ( "", "tpo/core/tor" ),
+ "tor#" : ( "", "tpo/core/tor" ),
+ "chutney#" : ( "chutney#", "tpo/core/chutney" ),
+ "torspec#" : ( "torspec#", "tpo/core/torspec" ),
+ "trunnel#" : ( "trunnel#", "tpo/core/trunnel" ),
+ "torsocks#" : ( "torsocks#", "tpo/core/torsocks"),
+}
+
# Let's turn bugs to html.
-BUG_PAT = re.compile('(bug|ticket|issue|feature)\s+(\d{4,5})', re.I)
+BUG_PAT = re.compile('(bug|ticket|issue|feature)\s+([\w/]+#)?(\d{4,6})', re.I)
def bug_html(m):
- return "%s <a href='https://bugs.torproject.org/%s'>%s</a>" % (m.group(1), m.group(2), m.group(2))
+ kind = m.group(1)
+ prefix = m.group(2) or ""
+ bugno = m.group(3)
+ try:
+ disp_prefix, url_prefix = ISSUE_PREFIX_MAP[prefix]
+ except KeyError:
+ print("Can't figure out URL for {}{}".formt(prefix,bugno),
+ file=sys.stderr)
+ return "{} {}{}".format(kind, prefix, bugno)
+
+ return "{} <a href='https://bugs.torproject.org/{}/{}'>{}{}</a>".format(
+ kind, url_prefix, bugno, disp_prefix, bugno)
class HTMLChangeLog(ChangeLog):
def __init__(self, *args, **kwargs):