当前位置: 首页>>代码示例>>Python>>正文


Python committers.CommitterList类代码示例

本文整理汇总了Python中webkitpy.common.config.committers.CommitterList的典型用法代码示例。如果您正苦于以下问题:Python CommitterList类的具体用法?Python CommitterList怎么用?Python CommitterList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CommitterList类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _assign_bug_to_last_patch_attacher

    def _assign_bug_to_last_patch_attacher(self, bug_id):
        committers = CommitterList()
        bug = self._tool.bugs.fetch_bug(bug_id)
        if not bug.is_unassigned():
            assigned_to_email = bug.assigned_to_email()
            log("Bug %s is already assigned to %s (%s)." % (bug_id, assigned_to_email, committers.committer_by_email(assigned_to_email)))
            return

        reviewed_patches = bug.reviewed_patches()
        if not reviewed_patches:
            log("Bug %s has no non-obsolete patches, ignoring." % bug_id)
            return

        # We only need to do anything with this bug if one of the r+'d patches does not have a valid committer (cq+ set).
        if self._patches_have_commiters(reviewed_patches):
            log("All reviewed patches on bug %s already have commit-queue+, ignoring." % bug_id)
            return

        latest_patch = reviewed_patches[-1]
        attacher_email = latest_patch.attacher_email()
        committer = committers.committer_by_email(attacher_email)
        if not committer:
            log("Attacher %s is not a committer.  Bug %s likely needs commit-queue+." % (attacher_email, bug_id))
            return

        reassign_message = "Attachment %s was posted by a committer and has review+, assigning to %s for commit." % (latest_patch.id(), committer.full_name)
        self._tool.bugs.reassign_bug(bug_id, committer.bugzilla_email(), reassign_message)
开发者ID:Moondee,项目名称:Artemis,代码行数:27,代码来源:upload.py

示例2: _assert_fuzz_match

 def _assert_fuzz_match(self, text, name_of_expected_contributor, expected_distance):
     committers = CommitterList()
     contributors, distance = committers.contributors_by_fuzzy_match(text)
     if type(name_of_expected_contributor) is list:
         expected_names = name_of_expected_contributor
     else:
         expected_names = [name_of_expected_contributor] if name_of_expected_contributor else []
     self.assertEqual(([contributor.full_name for contributor in contributors], distance), (expected_names, expected_distance))
开发者ID:,项目名称:,代码行数:8,代码来源:

示例3: __init__

 def __init__(self, options=None):
     options = options or []
     options += [
         make_option("--max-commit-age", action="store", dest="max_commit_age", type="int", default=9, help="Specify maximum commit age to consider (in months)."),
     ]
     options = sorted(options, cmp=lambda a, b: cmp(a._long_opts, b._long_opts))
     super(AbstractCommitLogCommand, self).__init__(options=options)
     # FIXME: This should probably be on the tool somewhere.
     self._committer_list = CommitterList()
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:9,代码来源:suggestnominations.py

示例4: _validate

    def _validate(self, watch_list):
        cc_definitions_set = self._rule_definitions_as_set(watch_list.cc_rules)
        messages_definitions_set = self._rule_definitions_as_set(watch_list.message_rules)
        self._verify_all_definitions_are_used(watch_list, cc_definitions_set.union(messages_definitions_set))

        self._validate_definitions(cc_definitions_set, self._CC_RULES, watch_list)
        self._validate_definitions(messages_definitions_set, self._MESSAGE_RULES, watch_list)

        accounts = CommitterList()
        for cc_rule in watch_list.cc_rules:
            # Copy the instructions since we'll be remove items from the original list and
            # modifying a list while iterating through it leads to undefined behavior.
            intructions_copy = cc_rule.instructions()[:]
            for email in intructions_copy:
                if not accounts.contributor_by_email(email):
                    cc_rule.remove_instruction(email)
                    self._log_error("The email alias %s which is in the watchlist is not listed as a contributor in committers.py" % email)
                    continue
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:18,代码来源:watchlistparser.py

示例5: __init__

    def __init__(self):
        options = [
            make_option("--committer-minimum", action="store", dest="committer_minimum", type="int", default=10, help="Specify minimum patch count for Committer nominations."),
            make_option("--reviewer-minimum", action="store", dest="reviewer_minimum", type="int", default=80, help="Specify minimum patch count for Reviewer nominations."),
            make_option("--max-commit-age", action="store", dest="max_commit_age", type="int", default=9, help="Specify max commit age to consider for nominations (in months)."),
            make_option("--show-commits", action="store_true", dest="show_commits", default=False, help="Show commit history with nomination suggestions."),
        ]

        AbstractDeclarativeCommand.__init__(self, options=options)
        # FIXME: This should probably be on the tool somewhere.
        self._committer_list = CommitterList()
开发者ID:BrianGFlores,项目名称:android_external_svmp_fbstream,代码行数:11,代码来源:suggestnominations.py

示例6: AbstractCommitLogCommand

class AbstractCommitLogCommand(Command):
    _leading_indent_regexp = re.compile(r"^[ ]{4}", re.MULTILINE)
    _reviewed_by_regexp = re.compile(ChangeLogEntry.reviewed_by_regexp, re.MULTILINE)
    _patch_by_regexp = re.compile(r'^Patch by (?P<name>.+?)\s+<(?P<email>[^<>]+)> on (?P<date>\d{4}-\d{2}-\d{2})$', re.MULTILINE)
    _committer_regexp = re.compile(r'^Author: (?P<email>\S+)\s+<[^>]+>$', re.MULTILINE)
    _date_regexp = re.compile(r'^Date:   (?P<date>\d{4}-\d{2}-\d{2}) (?P<time>\d{2}:\d{2}:\d{2}) [\+\-]\d{4}$', re.MULTILINE)
    _revision_regexp = re.compile(r'^git-svn-id: http://svn.webkit.org/repository/webkit/[email protected](?P<svnid>\d+) (?P<gitid>[0-9a-f\-]{36})$', re.MULTILINE)

    def __init__(self, options=None):
        options = options or []
        options += [
            make_option("--max-commit-age", action="store", dest="max_commit_age", type="int", default=9, help="Specify maximum commit age to consider (in months)."),
        ]
        options = sorted(options, cmp=lambda a, b: cmp(a._long_opts, b._long_opts))
        super(AbstractCommitLogCommand, self).__init__(options=options)
        # FIXME: This should probably be on the tool somewhere.
        self._committer_list = CommitterList()

    def _init_options(self, options):
        self.verbose = options.verbose
        self.max_commit_age = options.max_commit_age

    # FIXME: This should move to scm.py
    def _recent_commit_messages(self):
        git_log = self._tool.executive.run_command(['git', 'log', '--date=iso', '--since="%s months ago"' % self.max_commit_age])
        messages = re.compile(r"^commit \w{40}$", re.MULTILINE).split(git_log)[1:]  # Ignore the first message which will be empty.
        for message in messages:
            # Unindent all the lines
            (message, _) = self._leading_indent_regexp.subn("", message)
            yield message.lstrip()  # Remove any leading newlines from the log message.

    def _author_name_from_email(self, email):
        contributor = self._committer_list.contributor_by_email(email)
        return contributor.full_name if contributor else None

    def _contributor_from_email(self, email):
        contributor = self._committer_list.contributor_by_email(email)
        return contributor if contributor else None

    def _parse_commit_message(self, commit_message):
        committer_match = self._committer_regexp.search(commit_message)
        if not committer_match:
            raise CommitLogError

        committer_email = committer_match.group('email')
        if not committer_email:
            raise CommitLogError

        committer = self._contributor_from_email(committer_email)
        if not committer:
            raise CommitLogError

        commit_date_match = self._date_regexp.search(commit_message)
        if not commit_date_match:
            raise CommitLogError
        commit_date = commit_date_match.group('date')

        revision_match = self._revision_regexp.search(commit_message)
        if not revision_match:
            raise CommitLogError
        revision = revision_match.group('svnid')

        # Look for "Patch by" line first, which is used for non-committer contributors;
        # otherwise, use committer info determined above.
        author_match = self._patch_by_regexp.search(commit_message)
        if not author_match:
            author_match = committer_match

        author_email = author_match.group('email')
        if not author_email:
            author_email = committer_email

        author_name = author_match.group('name') if 'name' in author_match.groupdict() else None
        if not author_name:
            author_name = self._author_name_from_email(author_email)
        if not author_name:
            raise CommitLogError

        contributor = self._contributor_from_email(author_email)
        if contributor and author_name != contributor.full_name and contributor.full_name:
            author_name = contributor.full_name

        reviewer_match = self._reviewed_by_regexp.search(commit_message)
        if not reviewer_match:
            raise CommitLogMissingReviewer
        reviewers = reviewer_match.group('reviewer')

        return {
            'committer': committer,
            'commit_date': commit_date,
            'revision': revision,
            'author_email': author_email,
            'author_name': author_name,
            'contributor': contributor,
            'reviewers': reviewers,
        }
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:96,代码来源:suggestnominations.py

示例7: test_committer_lookup

    def test_committer_lookup(self):
        committer = Committer('Test One', '[email protected]', 'one')
        reviewer = Reviewer('Test Two', ['[email protected]', '[email protected]', '[email protected]'])
        committer_list = CommitterList(committers=[committer], reviewers=[reviewer])

        # Test valid committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_email('[email protected]'), committer)
        self.assertEqual(committer_list.reviewer_by_email('[email protected]'), reviewer)
        self.assertEqual(committer_list.committer_by_email('[email protected]'), reviewer)
        self.assertEqual(committer_list.committer_by_email('[email protected]'), reviewer)
        self.assertEqual(committer_list.reviewer_by_email('[email protected]'), reviewer)

        # Test valid committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_name("Test One"), committer)
        self.assertEqual(committer_list.committer_by_name("Test Two"), reviewer)
        self.assertEqual(committer_list.committer_by_name("Test Three"), None)

        # Test that the first email is assumed to be the Bugzilla email address (for now)
        self.assertEqual(committer_list.committer_by_email('[email protected]').bugzilla_email(), '[email protected]')

        # Test that a known committer is not returned during reviewer lookup
        self.assertEqual(committer_list.reviewer_by_email('[email protected]'), None)

        # Test that unknown email address fail both committer and reviewer lookup
        self.assertEqual(committer_list.committer_by_email('[email protected]'), None)
        self.assertEqual(committer_list.reviewer_by_email('[email protected]'), None)

        # Test that emails returns a list.
        self.assertEqual(committer.emails, ['[email protected]'])

        self.assertEqual(committer.irc_nickname, 'one')

        # Test that committers returns committers and reviewers and reviewers() just reviewers.
        self.assertEqual(committer_list.committers(), [committer, reviewer])
        self.assertEqual(committer_list.reviewers(), [reviewer])
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:35,代码来源:committers_unittest.py

示例8: SuggestNominations

class SuggestNominations(AbstractDeclarativeCommand):
    name = "suggest-nominations"
    help_text = "Suggest contributors for committer/reviewer nominations"

    def __init__(self):
        options = [
            make_option("--committer-minimum", action="store", dest="committer_minimum", type="int", default=10, help="Specify minimum patch count for Committer nominations."),
            make_option("--reviewer-minimum", action="store", dest="reviewer_minimum", type="int", default=80, help="Specify minimum patch count for Reviewer nominations."),
            make_option("--max-commit-age", action="store", dest="max_commit_age", type="int", default=9, help="Specify max commit age to consider for nominations (in months)."),
            make_option("--show-commits", action="store_true", dest="show_commits", default=False, help="Show commit history with nomination suggestions."),
        ]

        AbstractDeclarativeCommand.__init__(self, options=options)
        # FIXME: This should probably be on the tool somewhere.
        self._committer_list = CommitterList()

    _counters_by_name = {}
    _counters_by_email = {}

    def _init_options(self, options):
        self.committer_minimum = options.committer_minimum
        self.reviewer_minimum = options.reviewer_minimum
        self.max_commit_age = options.max_commit_age
        self.show_commits = options.show_commits
        self.verbose = options.verbose

    # FIXME: This should move to scm.py
    def _recent_commit_messages(self):
        git_log = self._tool.executive.run_command(['git', 'log', '--since="%s months ago"' % self.max_commit_age])
        match_git_svn_id = re.compile(r"\n\n    git-svn-id:.*\n", re.MULTILINE)
        match_get_log_lines = re.compile(r"^\S.*\n", re.MULTILINE)
        match_leading_indent = re.compile(r"^[ ]{4}", re.MULTILINE)

        messages = re.split(r"commit \w{40}", git_log)[1:]  # Ignore the first message which will be empty.
        for message in messages:
            # Remove any lines from git and unindent all the lines
            (message, _) = match_git_svn_id.subn("", message)
            (message, _) = match_get_log_lines.subn("", message)
            (message, _) = match_leading_indent.subn("", message)
            yield message.lstrip()  # Remove any leading newlines from the log message.

    # e.g. Patch by Eric Seidel <[email protected]> on 2011-09-15
    patch_by_regexp = r'^Patch by (?P<name>.+?)\s+<(?P<email>[^<>]+)> on (?P<date>\d{4}-\d{2}-\d{2})$'

    def _count_recent_patches(self):
        # This entire block could be written as a map/reduce over the messages.
        for message in self._recent_commit_messages():
            # FIXME: This should use ChangeLogEntry to do the entire parse instead
            # of grabbing at its regexps.
            dateline_match = re.match(ChangeLogEntry.date_line_regexp, message, re.MULTILINE)
            if not dateline_match:
                # Modern commit messages don't just dump the ChangeLog entry, but rather
                # have a special Patch by line for non-committers.
                dateline_match = re.search(self.patch_by_regexp, message, re.MULTILINE)
                if not dateline_match:
                    continue

            author_email = dateline_match.group("email")
            if not author_email:
                continue

            # We only care about reviewed patches, so make sure it has a valid reviewer line.
            reviewer_match = re.search(ChangeLogEntry.reviewed_by_regexp, message, re.MULTILINE)
            # We might also want to validate the reviewer name against the committer list.
            if not reviewer_match or not reviewer_match.group("reviewer"):
                continue

            author_name = dateline_match.group("name")
            if not author_name:
                continue

            if re.search("([^a-zA-Z]and[^a-zA-Z])|(,)|(@)", author_name):
                # This entry seems to have multiple reviewers, or invalid characters, so reject it.
                continue

            svn_id_match = re.search(ChangeLogEntry.svn_id_regexp, message, re.MULTILINE)
            if svn_id_match:
                svn_id = svn_id_match.group("svnid")
            if not svn_id_match or not svn_id:
                svn_id = "unknown"
            commit_date = dateline_match.group("date")

            # See if we already have a contributor with this name or email
            counter_by_name = self._counters_by_name.get(author_name)
            counter_by_email = self._counters_by_email.get(author_email)
            if counter_by_name:
                if counter_by_email:
                    if counter_by_name != counter_by_email:
                        # Merge these two counters  This is for the case where we had
                        # John Smith ([email protected]) and Jonathan Smith ([email protected])
                        # and just found a John Smith ([email protected]).  Now we know the
                        # two names are the same person
                        counter_by_name['names'] |= counter_by_email['names']
                        counter_by_name['emails'] |= counter_by_email['emails']
                        counter_by_name['count'] += counter_by_email.get('count', 0)
                        self._counters_by_email[author_email] = counter_by_name
                else:
                    # Add email to the existing counter
                    self._counters_by_email[author_email] = counter_by_name
                    counter_by_name['emails'] |= set([author_email])
#.........这里部分代码省略.........
开发者ID:BrianGFlores,项目名称:android_external_svmp_fbstream,代码行数:101,代码来源:suggestnominations.py

示例9: test_committer_lookup

    def test_committer_lookup(self):
        committer = Committer('Test One', '[email protected]', 'one')
        reviewer = Reviewer('Test Two', ['[email protected]', '[email protected]', '[email protected]'])
        contributor = Contributor('Test Three', ['[email protected]'], 'three')
        contributor_with_two_nicknames = Contributor('Other Four', ['[email protected]', '[email protected]'], ['four', 'otherfour'])
        contributor_with_same_email_username = Contributor('Yet Another Four', ['[email protected]'], ['yetanotherfour'])
        committer_list = CommitterList(committers=[committer], reviewers=[reviewer],
            contributors=[contributor, contributor_with_two_nicknames, contributor_with_same_email_username])

        # Test valid committer, reviewer and contributor lookup
        self.assertEqual(committer_list.committer_by_email('[email protected]'), committer)
        self.assertEqual(committer_list.reviewer_by_email('[email protected]'), reviewer)
        self.assertEqual(committer_list.committer_by_email('[email protected]'), reviewer)
        self.assertEqual(committer_list.committer_by_email('[email protected]'), reviewer)
        self.assertEqual(committer_list.reviewer_by_email('[email protected]'), reviewer)
        self.assertEqual(committer_list.contributor_by_email('[email protected]'), contributor)

        # Test valid committer, reviewer and contributor lookup
        self.assertEqual(committer_list.committer_by_name("Test One"), committer)
        self.assertEqual(committer_list.committer_by_name("Test Two"), reviewer)
        self.assertIsNone(committer_list.committer_by_name("Test Three"))
        self.assertEqual(committer_list.contributor_by_name("Test Three"), contributor)
        self.assertEqual(committer_list.contributor_by_name("test one"), committer)
        self.assertEqual(committer_list.contributor_by_name("test two"), reviewer)
        self.assertEqual(committer_list.contributor_by_name("test three"), contributor)

        # Test that the first email is assumed to be the Bugzilla email address (for now)
        self.assertEqual(committer_list.committer_by_email('[email protected]').bugzilla_email(), '[email protected]')

        # Test that a known committer is not returned during reviewer lookup
        self.assertIsNone(committer_list.reviewer_by_email('[email protected]'))
        self.assertIsNone(committer_list.reviewer_by_email('[email protected]'))
        # and likewise that a known contributor is not returned for committer lookup.
        self.assertIsNone(committer_list.committer_by_email('[email protected]'))

        # Test that unknown email address fail both committer and reviewer lookup
        self.assertIsNone(committer_list.committer_by_email('[email protected]'))
        self.assertIsNone(committer_list.reviewer_by_email('[email protected]'))

        # Test that emails returns a list.
        self.assertEqual(committer.emails, ['[email protected]'])

        self.assertEqual(committer.irc_nicknames, ['one'])
        self.assertEqual(committer_list.contributor_by_irc_nickname('one'), committer)
        self.assertEqual(committer_list.contributor_by_irc_nickname('three'), contributor)
        self.assertEqual(committer_list.contributor_by_irc_nickname('four'), contributor_with_two_nicknames)
        self.assertEqual(committer_list.contributor_by_irc_nickname('otherfour'), contributor_with_two_nicknames)

        # Test that the lists returned are are we expect them.
        self.assertEqual(committer_list.contributors(), [contributor, contributor_with_two_nicknames, contributor_with_same_email_username, committer, reviewer])
        self.assertEqual(committer_list.committers(), [committer, reviewer])
        self.assertEqual(committer_list.reviewers(), [reviewer])

        self.assertEqual(committer_list.contributors_by_search_string('test'), [contributor, committer, reviewer])
        self.assertEqual(committer_list.contributors_by_search_string('rad'), [reviewer])
        self.assertEqual(committer_list.contributors_by_search_string('Two'), [reviewer])
        self.assertEqual(committer_list.contributors_by_search_string('otherfour'), [contributor_with_two_nicknames])
        self.assertEqual(committer_list.contributors_by_search_string('*otherfour*'), [contributor_with_two_nicknames, contributor_with_same_email_username])

        self.assertEqual(committer_list.contributors_by_email_username("one"), [committer])
        self.assertEqual(committer_list.contributors_by_email_username("four"), [])
        self.assertEqual(committer_list.contributors_by_email_username("otherfour"), [contributor_with_two_nicknames, contributor_with_same_email_username])
开发者ID:,项目名称:,代码行数:62,代码来源:

示例10: MockCommitMessage

# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from .commitinfo import CommitInfo

# FIXME: These imports are wrong, we should use a shared MockCommittersList.
from webkitpy.common.config.committers import CommitterList
from webkitpy.common.net.bugzilla.bugzilla_mock import _mock_reviewers
from webkitpy.common.system.filesystem_mock import MockFileSystem


class MockCommitMessage(object):
    def message(self):
        return "This is a fake commit message that is at least 50 characters."


committer_list = CommitterList()

mock_revisions = {
    1: CommitInfo(852, "[email protected]", {
        "bug_id": 50000,
        "author_name": "Adam Barth",
        "author_email": "[email protected]",
        "author": committer_list.contributor_by_email("[email protected]"),
        "reviewer_text": "Darin Adler",
        "reviewer": committer_list.committer_by_name("Darin Adler"),
        "changed_files": [
            "path/to/file",
            "another/file",
        ],
        "bug_description": "Example description of bug 50000.",
    }),
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:31,代码来源:checkout_mock.py


注:本文中的webkitpy.common.config.committers.CommitterList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。