Make sure Authors check also works for pending merges (otherwise stuff can get merged that will make the next merge fail this check).
This commit is contained in:
@@ -15,7 +15,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from nova import test
|
from nova import test
|
||||||
from nova.utils import parse_mailmap, str_dict_replace
|
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):
|
class ProjectTestCase(test.TrialTestCase):
|
||||||
def test_authors_up_to_date(self):
|
def test_authors_up_to_date(self):
|
||||||
if os.path.exists('../.bzr'):
|
if os.path.exists('../.bzr'):
|
||||||
log_cmd = subprocess.Popen(["bzr", "log", "-n0"],
|
contributors = set()
|
||||||
stdout=subprocess.PIPE)
|
|
||||||
changelog = log_cmd.communicate()[0]
|
|
||||||
mailmap = parse_mailmap('../.mailmap')
|
mailmap = parse_mailmap('../.mailmap')
|
||||||
|
|
||||||
contributors = set()
|
import bzrlib.workingtree
|
||||||
for l in changelog.split('\n'):
|
tree = bzrlib.workingtree.WorkingTree.open('..')
|
||||||
l = l.strip()
|
tree.lock_read()
|
||||||
if (l.startswith('author:') or l.startswith('committer:')
|
parents = tree.get_parent_ids()
|
||||||
and not l == 'committer: Tarmac'):
|
g = tree.branch.repository.get_graph()
|
||||||
email = l.split(' ')[-1]
|
for p in parents[1:]:
|
||||||
contributors.add(str_dict_replace(email, mailmap))
|
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()
|
authors_file = open('../Authors', 'r').read()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user