summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoren Hansen <soren.hansen@rackspace.com>2010-12-07 20:54:11 +0000
committerTarmac <>2010-12-07 20:54:11 +0000
commitdd9de2b1fb93cc8bcfe5912a69d8b5cc88de1b11 (patch)
treef19d3a4e10eb75c627d039c713e74d1306168ab7
parentc7f582e81605140d8d3a06667103737bee91960b (diff)
parentbf34529e75022451f3833552df0e807139d0e498 (diff)
downloadnova-dd9de2b1fb93cc8bcfe5912a69d8b5cc88de1b11.tar.gz
nova-dd9de2b1fb93cc8bcfe5912a69d8b5cc88de1b11.tar.xz
nova-dd9de2b1fb93cc8bcfe5912a69d8b5cc88de1b11.zip
Make sure Authors check also works for pending merges (otherwise stuff can get merged that will make the next merge fail this check).
-rw-r--r--nova/tests/misc_unittest.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/nova/tests/misc_unittest.py b/nova/tests/misc_unittest.py
index 856060afa..667c63ad0 100644
--- a/nova/tests/misc_unittest.py
+++ b/nova/tests/misc_unittest.py
@@ -15,7 +15,6 @@
# under the License.
import os
-import subprocess
from nova import test
from nova.utils import parse_mailmap, str_dict_replace
@@ -24,18 +23,23 @@ from nova.utils import parse_mailmap, str_dict_replace
class ProjectTestCase(test.TrialTestCase):
def test_authors_up_to_date(self):
if os.path.exists('../.bzr'):
- log_cmd = subprocess.Popen(["bzr", "log", "-n0"],
- stdout=subprocess.PIPE)
- changelog = log_cmd.communicate()[0]
+ contributors = set()
+
mailmap = parse_mailmap('../.mailmap')
- contributors = set()
- for l in changelog.split('\n'):
- l = l.strip()
- if (l.startswith('author:') or l.startswith('committer:')
- and not l == 'committer: Tarmac'):
- email = l.split(' ')[-1]
- contributors.add(str_dict_replace(email, mailmap))
+ import bzrlib.workingtree
+ tree = bzrlib.workingtree.WorkingTree.open('..')
+ tree.lock_read()
+ parents = tree.get_parent_ids()
+ g = tree.branch.repository.get_graph()
+ for p in parents[1:]:
+ rev_ids = [r for r, _ in g.iter_ancestry(parents)
+ if r != "null:"]
+ revs = tree.branch.repository.get_revisions(rev_ids)
+ for r in revs:
+ for author in r.get_apparent_authors():
+ email = author.split(' ')[-1]
+ contributors.add(str_dict_replace(email, mailmap))
authors_file = open('../Authors', 'r').read()