Changeset 143033 in webkit


Ignore:
Timestamp:
Feb 15, 2013 12:45:54 PM (11 years ago)
Author:
zandobersek@gmail.com
Message:

webkit-patch suggest-reviewers should limit itself to 5 reviewers
https://bugs.webkit.org/show_bug.cgi?id=107528

Reviewed by Eric Seidel.

  • Scripts/webkitpy/common/checkout/checkout.py:

(Checkout.suggested_reviewers): Iterate through the sorted commit info list,
scraping reviewers from the commit information and in the end producing a list
of reviewers that's sorted from the most to least recent activity of any reviewer
that has reviewed or authored patches for the changed files.

  • Scripts/webkitpy/tool/commands/queries.py:

(SuggestReviewers): Use the SuggestReviewers step instead of reimplementing much of
the same logic.
(SuggestReviewers._prepare_state): Force the reviewer suggestion because the option
defaults to False.

  • Scripts/webkitpy/tool/steps/suggestreviewers.py:

(SuggestReviewers.run): Only list the first five suggested reviewers, now printed out
on a single line. Only ask for CC-ing the suggested reviewers to the bug if the
bug ID is located in the command's state.

Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r143025 r143033  
     12013-02-15  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        webkit-patch suggest-reviewers should limit itself to 5 reviewers
     4        https://bugs.webkit.org/show_bug.cgi?id=107528
     5
     6        Reviewed by Eric Seidel.
     7
     8        * Scripts/webkitpy/common/checkout/checkout.py:
     9        (Checkout.suggested_reviewers): Iterate through the sorted commit info list,
     10        scraping reviewers from the commit information and in the end producing a list
     11        of reviewers that's sorted from the most to least recent activity of any reviewer
     12        that has reviewed or authored patches for the changed files.
     13        * Scripts/webkitpy/tool/commands/queries.py:
     14        (SuggestReviewers): Use the SuggestReviewers step instead of reimplementing much of
     15        the same logic.
     16        (SuggestReviewers._prepare_state): Force the reviewer suggestion because the option
     17        defaults to False.
     18        * Scripts/webkitpy/tool/steps/suggestreviewers.py:
     19        (SuggestReviewers.run): Only list the first five suggested reviewers, now printed out
     20        on a single line.  Only ask for CC-ing the suggested reviewers to the bug if the
     21        bug ID is located in the command's state.
     22
    1232013-02-15  Pablo Flouret  <pablof@motorola.com>
    224
  • trunk/Tools/Scripts/webkitpy/common/checkout/checkout.py

    r135912 r143033  
    136136    def suggested_reviewers(self, git_commit, changed_files=None):
    137137        changed_files = self.modified_non_changelogs(git_commit, changed_files)
    138         commit_infos = self.recent_commit_infos_for_files(changed_files)
    139         reviewers = [commit_info.reviewer() for commit_info in commit_infos if commit_info.reviewer()]
    140         reviewers.extend([commit_info.author() for commit_info in commit_infos if commit_info.author() and commit_info.author().can_review])
    141         return sorted(set(reviewers))
     138        commit_infos = sorted(self.recent_commit_infos_for_files(changed_files), key=lambda info: info.revision(), reverse=True)
     139        reviewers = filter(lambda person: person and person.can_review, sum(map(lambda info: [info.reviewer(), info.author()], commit_infos), []))
     140        unique_reviewers = reduce(lambda suggestions, reviewer: suggestions + [reviewer if reviewer not in suggestions else None], reviewers, [])
     141        return filter(lambda reviewer: reviewer, unique_reviewers)
    142142
    143143    def bug_id_for_this_commit(self, git_commit, changed_files=None):
  • trunk/Tools/Scripts/webkitpy/tool/commands/queries.py

    r137184 r143033  
    4545from webkitpy.common.system.crashlogs import CrashLogs
    4646from webkitpy.common.system.user import User
     47from webkitpy.tool.commands.abstractsequencedcommand import AbstractSequencedCommand
    4748from webkitpy.tool.grammar import pluralize
    4849from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     
    5354
    5455
    55 class SuggestReviewers(AbstractDeclarativeCommand):
     56class SuggestReviewers(AbstractSequencedCommand):
    5657    name = "suggest-reviewers"
    5758    help_text = "Suggest reviewers for a patch based on recent changes to the modified files."
    58 
    59     def __init__(self):
    60         options = [
    61             steps.Options.git_commit,
    62         ]
    63         AbstractDeclarativeCommand.__init__(self, options=options)
    64 
    65     def execute(self, options, args, tool):
    66         reviewers = tool.checkout().suggested_reviewers(options.git_commit)
    67         print "\n".join([reviewer.full_name for reviewer in reviewers])
     59    steps = [
     60        steps.SuggestReviewers,
     61    ]
     62
     63    def _prepare_state(self, options, args, tool):
     64        options.suggest_reviewers = True
    6865
    6966
  • trunk/Tools/Scripts/webkitpy/tool/steps/suggestreviewers.py

    r70274 r143033  
    4343            return
    4444
    45         reviewers = self._tool.checkout().suggested_reviewers(self._options.git_commit, self._changed_files(state))
     45        reviewers = self._tool.checkout().suggested_reviewers(self._options.git_commit, self._changed_files(state))[:5]
    4646        print "The following reviewers have recently modified files in your patch:"
    47         print "\n".join([reviewer.full_name for reviewer in reviewers])
     47        print ", ".join([reviewer.full_name for reviewer in reviewers])
     48
     49        if not state.get('bug_id'):
     50            return
    4851        if not self._tool.user.confirm("Would you like to CC them?"):
    4952            return
Note: See TracChangeset for help on using the changeset viewer.