예제 #1
0
    def test_authors_up_to_date(self):
        topdir = os.path.normpath(os.path.dirname(__file__) + '/../../')
        missing = set()
        contributors = set()
        mailmap = parse_mailmap(os.path.join(topdir, '.mailmap'))
        authors_file = open(os.path.join(topdir, 'Authors'), 'r').read()

        if os.path.exists(os.path.join(topdir, '.bzr')):
            import bzrlib.workingtree
            tree = bzrlib.workingtree.WorkingTree.open(topdir)
            tree.lock_read()
            try:
                parents = tree.get_parent_ids()
                g = tree.branch.repository.get_graph()
                for p in parents:
                    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(canonicalize_emails(email,
                                                                 mailmap))
            finally:
                tree.unlock()

        elif os.path.exists(os.path.join(topdir, '.git')):
            for email in commands.getoutput('git log --format=%ae').split():
                if not email:
                    continue
                if "jenkins" in email and "openstack.org" in email:
                    continue
                email = '<' + email + '>'
                contributors.add(canonicalize_emails(email, mailmap))
        else:
            return

        for contributor in contributors:
            if contributor == 'nova-core':
                continue
            if not contributor in authors_file:
                missing.add(contributor)

        self.assertTrue(len(missing) == 0,
                        '%r not listed in Authors' % missing)
예제 #2
0
파일: test_setup.py 프로젝트: bhuvan/nova
 def test_mailmap_with_noname(self):
     with open(self.mailmap, 'w') as mm_fh:
         mm_fh.write("<*****@*****.**> <*****@*****.**>\n")
     self.assertEqual({'<*****@*****.**>': '<*****@*****.**>'},
                     parse_mailmap(self.mailmap))