Commits

Mike Bayer committed 07158d2

fixes

  • Participants
  • Parent commits cdd256a

Comments (0)

Files changed (2)

 A `Sphinx <http://sphinx.pocoo.org/>`_ extension to generate changelog files.
 
 This is an experimental, possibly-not-useful extension that's used by the
-`SQLAlchemy <http://www.sqlalchemy.org>_` project and related projects.
+`SQLAlchemy <http://www.sqlalchemy.org>`_ project and related projects.
 
 Configuration
 =============
 
 A sample configuration in ``conf.py`` looks like this::
 
-	extensions = [
-				# changelog extension
+    extensions = [
+                # changelog extension
                 'changelog',
 
                 # your other sphinx extensions
 
 
     # section names - optional
-	changelog_sections = ["general", "rendering", "tests"]
+    changelog_sections = ["general", "rendering", "tests"]
 
-	# tags to sort on inside of sections - also optional
-	changelog_inner_tag_sort = ["feature", "bug"]
+    # tags to sort on inside of sections - also optional
+    changelog_inner_tag_sort = ["feature", "bug"]
 
-	# how to render changelog links - these are plain
-	# python string templates, ticket/pullreq/changeset number goes
-	# in "%s"
-	changelog_render_ticket = "http://bitbucket.org/myusername/myproject/issue/%s"
-	changelog_render_pullreq = "http://bitbucket.org/myusername/myproject/pullrequest/%s"
-	changelog_render_changeset = "http://bitbucket.org/myusername/myproject/changeset/%s"
+    # how to render changelog links - these are plain
+    # python string templates, ticket/pullreq/changeset number goes
+    # in "%s"
+    changelog_render_ticket = "http://bitbucket.org/myusername/myproject/issue/%s"
+    changelog_render_pullreq = "http://bitbucket.org/myusername/myproject/pullrequest/%s"
+    changelog_render_changeset = "http://bitbucket.org/myusername/myproject/changeset/%s"
 
 Usage
 =====
 
 Changelog introduces the ``changelog`` and ``change`` directives::
 
-	====================
-	Changelog for 1.5.6
-	====================
+    ====================
+    Changelog for 1.5.6
+    ====================
 
-	.. changelog::
-	    :version: 1.5.6
-	    :released: Sun Oct 12 2008
+    .. changelog::
+        :version: 1.5.6
+        :released: Sun Oct 12 2008
 
-	    .. change::
-	        :tags: general
-	        :tickets: 27
+        .. change::
+            :tags: general
+            :tickets: 27
 
-	      Improved the frobnozzle.
+          Improved the frobnozzle.
 
-	    .. change::
-	        :tags: rendering, tests
-	        :pullreq: 8
-	        :changeset: a9d7cc0b56c2
+        .. change::
+            :tags: rendering, tests
+            :pullreq: 8
+            :changeset: a9d7cc0b56c2
 
-	      Rendering tests now correctly render.
+          Rendering tests now correctly render.
 
 
 With the above markup, the changes above will be rendered into document sections
 
 A "compoound tag" can also be used, if the configuration has a section like this::
 
-	changelog_sections = ["orm declarative", "orm"]
+    changelog_sections = ["orm declarative", "orm"]
 
 Then change entries which contain both the ``orm`` and ``declarative`` tags will be
 grouped under a section called ``orm declarative``, followed by the ``orm`` section where
 The ``:ticket:`` directive will make use of the ``changelog_render_ticket`` markup
 to render a ticket link::
 
-	:ticket:`456`
+    :ticket:`456`
 
 
 

File util/changelog_to_rst.py

 import re
 import textwrap
 
+# this is a history file generated from "hg log".
+# it's parsed for "tag: <sometag>" in order to get the dates
+# for releases.   It relates a tag to a release in CHANGELOG
+# using the form tag_X_Y_Z -> X.Y.Z.
 TAGFILE = "all_my_tags.txt"
 
 def read_dates():
     lines = open(TAGFILE).readlines()
     tags = {}
     for line in lines:
-        if line.startswith("tag:"):
+        if line.startswith("changeset:"):
+            tag = None
+        elif line.startswith("tag:"):
             tag = re.match(r'tag:\s+(.+)', line).group(1)
-        elif line.startswith("date:"):
+        elif line.startswith("date:") and tag is not None:
             date, year = re.match(r'date:\s+(\w+ \w+ \d+) \d+:\d+:\d+ (\d+)', line).group(1, 2)
 
             digits = re.findall(r"(?:^|_)(\d+)", tag)
                 if current_output_file:
                     current_output_file.close()
                 current_major_version = major_version
-                cfile = "source/changelog_%s.rst" % major_version.replace(".", "")
+                cfile = "changelog_%s.rst" % major_version.replace(".", "")
                 print "writing %s" % cfile
                 current_output_file = open(cfile, 'w')
                 current_output_file.write("""