[pypy-commit] pypy default: add a test which automatically checks that branches are documented as soon as they are merged. For now, whatsnew-1.9.rst contains empty documentation for all the branches merged since 1.8: everyone please briefly document what the branch did

antocuni noreply at buildbot.pypy.org
Tue May 15 14:45:04 CEST 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r55103:b9d226fcf4d9
Date: 2012-05-15 14:44 +0200
http://bitbucket.org/pypy/pypy/changeset/b9d226fcf4d9/

Log:	add a test which automatically checks that branches are documented
	as soon as they are merged. For now, whatsnew-1.9.rst contains empty
	documentation for all the branches merged since 1.8: everyone please
	briefly document what the branch did

diff --git a/pypy/doc/test/test_whatsnew.py b/pypy/doc/test/test_whatsnew.py
new file mode 100644
--- /dev/null
+++ b/pypy/doc/test/test_whatsnew.py
@@ -0,0 +1,80 @@
+import py
+import pypy
+from commands import getoutput
+ROOT = py.path.local(pypy.__file__).dirpath().dirpath()
+
+
+def parse_doc(s):
+    startrev = None
+    branches = set()
+    def parseline(line):
+        _, value = line.split(':', 1)
+        return value.strip()
+    #
+    for line in s.splitlines():
+        if line.startswith('.. startrev:'):
+            startrev = parseline(line)
+        elif line.startswith('.. branch:'):
+            branches.add(parseline(line))
+    return startrev, branches
+
+def get_merged_branches(path, startrev, endrev):
+    # X = take all the merges which are descendants of startrev and are on default
+    # revset = all the parents of X which are not on default
+    # ===>
+    # revset contains all the branches which have been merged to default since
+    # startrev
+    revset = 'parents(%s::%s and \
+                      merge() and \
+                      branch(default)) and \
+              not branch(default)' % (startrev, endrev)
+    cmd = r"hg log -R '%s' -r '%s' --template '{branches}\n'" % (path, revset)
+    out = getoutput(cmd)
+    branches = set(map(str.strip, out.splitlines()))
+    return branches
+
+
+def test_parse_doc():
+    s = """
+=====
+Title
+=====
+
+.. startrev: 12345
+
+bla bla bla bla
+
+.. branch: foobar
+
+xxx yyy zzz
+
+.. branch: hello
+
+qqq www ttt
+"""
+    startrev, branches = parse_doc(s)
+    assert startrev == '12345'
+    assert branches == set(['foobar', 'hello'])
+
+def test_get_merged_branches():
+    branches = get_merged_branches(ROOT, 'f34f0c11299f', '79770e0c2f93')
+    assert branches == set(['numpy-indexing-by-arrays-bool',
+                            'better-jit-hooks-2',
+                            'numpypy-ufuncs'])
+
+def test_whatsnew():
+    doc = ROOT.join('pypy', 'doc')
+    whatsnew_list = doc.listdir('whatsnew-*.rst')
+    whatsnew_list.sort()
+    last_whatsnew = whatsnew_list[-1].read()
+    startrev, documented = parse_doc(last_whatsnew)
+    merged = get_merged_branches(ROOT, startrev, '')
+    not_documented = merged.difference(documented)
+    not_merged = documented.difference(merged)
+    print 'Branches merged but not documented:'
+    print '\n'.join(not_documented)
+    print
+    print 'Branches documented but not merged:'
+    print '\n'.join(not_merged)
+    print
+    assert not not_documented and not not_merged
diff --git a/pypy/doc/whatsnew-1.9.rst b/pypy/doc/whatsnew-1.9.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/whatsnew-1.9.rst
@@ -0,0 +1,49 @@
+======================
+What's new in PyPy 1.9
+======================
+
+.. this is the revision just after the creation of the release-1.8.x branch
+.. startrev: a4261375b359
+
+.. branch: array_equal
+.. branch: better-jit-hooks-2
+.. branch: exception-cannot-occur
+.. branch: faster-heapcache
+.. branch: faster-str-decode-escape
+.. branch: float-bytes
+.. branch: float-bytes-2
+.. branch: jit-frame-counter
+.. branch: kill-geninterp
+.. branch: kqueue
+.. branch: kwargsdict-strategy
+.. branch: matrixmath-dot
+.. branch: merge-2.7.2
+.. branch: ndmin
+.. branch: newindex
+.. branch: non-null-threadstate
+.. branch: numppy-flatitter
+.. branch: numpy-back-to-applevel
+.. branch: numpy-concatenate
+.. branch: numpy-indexing-by-arrays-bool
+.. branch: numpy-record-dtypes
+.. branch: numpy-single-jitdriver
+.. branch: numpy-ufuncs2
+.. branch: numpy-ufuncs3
+.. branch: numpypy-issue1137
+.. branch: numpypy-out
+.. branch: numpypy-shape-bug
+.. branch: numpypy-ufuncs
+.. branch: pytest
+.. branch: revive-dlltool
+.. branch: safe-getargs-freelist
+.. branch: sanitize-finally-stack
+.. branch: set-strategies
+.. branch: speedup-list-comprehension
+.. branch: stdlib-unification
+.. branch: step-one-xrange
+.. branch: string-NUL
+.. branch: win32-cleanup
+.. branch: win32-cleanup2
+.. branch: win32-cleanup_2
+.. branch: win64-stage1
+.. branch: zlib-mem-pressure


More information about the pypy-commit mailing list