Changeset 51001 in webkit


Ignore:
Timestamp:
Nov 15, 2009 3:24:34 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2009-11-15 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

Add bugzilla-tool check-style
https://bugs.webkit.org/show_bug.cgi?id=31515

  • Scripts/bugzilla-tool:
  • Scripts/modules/bugzilla.py:
Location:
trunk/WebKitTools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r50973 r51001  
     12009-11-15  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add bugzilla-tool check-style
     6        https://bugs.webkit.org/show_bug.cgi?id=31515
     7
     8        * Scripts/bugzilla-tool:
     9        * Scripts/modules/bugzilla.py:
     10
    1112009-11-13  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    212
  • trunk/WebKitTools/Scripts/bugzilla-tool

    r50570 r51001  
    136136
    137137
     138class CheckStyleOnBug(Command):
     139    def __init__(self):
     140        options = WebKitLandingScripts.cleaning_options()
     141        Command.__init__(self, 'Runs check-webkit-style on the r? patches on a bug', 'BUGID', options=options)
     142
     143    @classmethod
     144    def check_style(cls, bug_id, patch, options, tool):
     145        tool.scm().update_webkit()
     146        log("Checking style for patch %s from bug %s." % (patch['id'], bug_id))
     147        try:
     148            tool.scm().apply_patch(patch)
     149            WebKitLandingScripts.run_webkit_script("check-webkit-style")
     150        except ScriptError, e:
     151            log("Patch failed to apply and check style")
     152            log(e.output)
     153
     154        tool.scm().ensure_clean_working_directory(True)
     155
     156    def execute(self, options, args, tool):
     157        bug_id = args[0]
     158        patches = tool.bugs.fetch_unreviewed_patches_from_bug(bug_id)
     159
     160        WebKitLandingScripts.setup_for_landing(tool.scm(), options)
     161
     162        for patch in patches:
     163            self.check_style(bug_id, patch, options, tool)
     164
     165
    138166class ApplyPatchesFromBug(Command):
    139167    def __init__(self):
     
    813841            { 'name' : 'land-diff', 'object' : LandAndUpdateBug() },
    814842            { 'name' : 'land-patches', 'object' : LandPatchesFromBugs() },
     843            { 'name' : 'check-style', 'object' : CheckStyleOnBug() },
    815844            { 'name' : 'commit-message', 'object' : CommitMessageForCurrentDiff() },
    816845            { 'name' : 'obsolete-attachments', 'object' : ObsoleteAttachmentsOnBug() },
  • trunk/WebKitTools/Scripts/modules/bugzilla.py

    r50602 r51001  
    164164    def _parse_attachment_flag(self, element, flag_name, attachment, result_key):
    165165        flag = element.find('flag', attrs={'name' : flag_name})
    166         if flag and flag['status'] == '+':
    167             attachment[result_key] = flag['setter']
     166        if flag:
     167            attachment[flag_name] = flag['status']
     168            if flag['status'] == '+':
     169                attachment[result_key] = flag['setter']
    168170
    169171    def _parse_attachment_element(self, element, bug_id):
     
    233235    def _validate_committer(self, patch, reject_invalid_patches):
    234236        return self._validate_setter_email(patch, 'committer', self.committers.committer_by_email, self.reject_patch_from_commit_queue, reject_invalid_patches)
     237
     238    def fetch_unreviewed_patches_from_bug(self, bug_id):
     239        unreviewed_patches = []
     240        for attachment in self.fetch_attachments_from_bug(bug_id):
     241            if attachment.get('review') == '?' and not attachment['is_obsolete']:
     242                unreviewed_patches.append(attachment)
     243        return unreviewed_patches
    235244
    236245    def fetch_reviewed_patches_from_bug(self, bug_id, reject_invalid_patches=False):
  • trunk/WebKitTools/Scripts/modules/scm.py

    r49931 r51001  
    169169        # We should detect and handle that case.
    170170        curl_process = subprocess.Popen(['curl', '--location', '--silent', '--show-error', patch['url']], stdout=subprocess.PIPE)
    171         args = [self.script_path('svn-apply'), '--reviewer', patch['reviewer']]
     171        args = [self.script_path('svn-apply')]
     172        if patch.get('reviewer'):
     173            args += ['--reviewer', patch['reviewer']]
    172174        if force:
    173175            args.append('--force')
Note: See TracChangeset for help on using the changeset viewer.