def test_authors_up_to_date(self): topdir = os.path.normpath(os.path.dirname(__file__) + '/../../') missing = set() contributors = set() mailmap = utils.parse_mailmap(os.path.join(topdir, '.mailmap')) authors_file = open(os.path.join(topdir, 'Authors'), 'r').read().lower() if 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.lower() + '>' contributors.add(utils.str_dict_replace(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)
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, '.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(str_dict_replace(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)
def test_authors_up_to_date(self): if os.path.exists('.bzr'): contributors = set() mailmap = parse_mailmap('.mailmap') import bzrlib.workingtree tree = bzrlib.workingtree.WorkingTree.open('.') tree.lock_read() try: 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() missing = set() 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) finally: tree.unlock()
def run(self): if os.path.isdir('.bzr'): # We're in a bzr branch env = os.environ.copy() env['BZR_PLUGIN_PATH'] = os.path.abspath('./bzrplugins') log_cmd = subprocess.Popen(["bzr", "log", "--novalog"], stdout=subprocess.PIPE, env=env) changelog = log_cmd.communicate()[0] mailmap = parse_mailmap() with open("ChangeLog", "w") as changelog_file: changelog_file.write(str_dict_replace(changelog, mailmap)) sdist.run(self)
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(str_dict_replace(email, mailmap)) finally: tree.unlock() elif os.path.exists(os.path.join(topdir, '.git')): import git repo = git.Repo(topdir) for commit in repo.head.commit.iter_parents(): email = commit.author.email if email is None: email = commit.author.name if 'nova-core' in email: continue if email.split(' ')[-1] == '<>': email = email.split(' ')[-2] email = '<' + email + '>' contributors.add(str_dict_replace(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)
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(str_dict_replace(email, mailmap)) finally: tree.unlock() elif os.path.exists(os.path.join(topdir, '.git')): import git repo = git.Repo(topdir) for commit in repo.head.commit.iter_parents(): email = commit.author.email if email is None: email = commit.author.name if 'nova-core' in email: continue if email.split(' ')[-1] == '<>': email = email.split(' ')[-2] email = '<' + email + '>' contributors.add(str_dict_replace(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)