[tor-commits] [tor/master] format_changelog.py: learn about the ReleaseNotes format

nickm at torproject.org nickm at torproject.org
Sun Oct 19 16:45:20 UTC 2014


commit 1405fbcc5862388b859d975ff7b8f95350d46240
Author: Nick Mathewson <nickm at torproject.org>
Date:   Sun Oct 19 11:47:16 2014 -0400

    format_changelog.py: learn about the ReleaseNotes format
---
 scripts/maint/format_changelog.py |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/scripts/maint/format_changelog.py b/scripts/maint/format_changelog.py
index f67e89b..32a3d74 100755
--- a/scripts/maint/format_changelog.py
+++ b/scripts/maint/format_changelog.py
@@ -156,10 +156,13 @@ TP_SECHEAD = 3
 TP_ITEMFIRST = 4
 TP_ITEMBODY = 5
 TP_END = 6
+TP_PREHEAD = 7
 
 def head_parser(line):
-    if re.match(r'^[A-Z]', line):
+    if re.match(r'^Changes in', line):
         return TP_MAINHEAD
+    elif re.match(r'^[A-Za-z]', line):
+        return TP_PREHEAD
     elif re.match(r'^  o ', line):
         return TP_SECHEAD
     elif re.match(r'^\s*$', line):
@@ -178,11 +181,14 @@ def body_parser(line):
         return TP_BLANK
     elif re.match(r'^Changes in', line):
         return TP_END
+    elif re.match(r'^\s+\S', line):
+        return TP_HEADTEXT
     else:
         print "Weird line %r"%line
 
 class ChangeLog(object):
     def __init__(self):
+        self.prehead = []
         self.mainhead = None
         self.headtext = []
         self.curgraf = None
@@ -197,6 +203,9 @@ class ChangeLog(object):
             assert not self.mainhead
             self.mainhead = line
 
+        elif tp == TP_PREHEAD:
+            self.prehead.append(line)
+
         elif tp == TP_HEADTEXT:
             if self.curgraf is None:
                 self.curgraf = []
@@ -250,6 +259,9 @@ class ChangeLog(object):
                               subsequent_indent=" "*indent2))
 
     def dump(self):
+        if self.prehead:
+            self.dumpGraf(self.prehead, 0)
+            print
         print self.mainhead
         for par in self.headtext:
             self.dumpGraf(par, 2)





More information about the tor-commits mailing list