Changeset 51019 in webkit
- Timestamp:
- Nov 16, 2009 2:34:46 AM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r51018 r51019 1 2009-11-16 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Implement a StyleQueue 6 https://bugs.webkit.org/show_bug.cgi?id=31537 7 8 The first iteration of the style queue only produces output locally. 9 There is also a limit of 10 patches because it's not that useful to 10 iterate through the entire review queue at this point. We can remove 11 the limit later. 12 13 * Scripts/bugzilla-tool: 14 * Scripts/modules/bugzilla.py: 15 1 16 2009-11-16 Adam Barth <abarth@webkit.org> 2 17 -
trunk/WebKitTools/Scripts/bugzilla-tool
r51018 r51019 698 698 699 699 700 class LandPatchesFromCommitQueue(Command, WorkQueueDelegate): 701 def __init__(self): 700 class AbstractQueue(Command, WorkQueueDelegate): 701 def __init__(self, name): 702 self._name = name 702 703 options = [ 703 704 make_option("--no-confirm", action="store_false", dest="confirm", default=True, help="Do not ask the user for confirmation before running the queue. Dangerous!"), 704 705 make_option("--status-host", action="store", type="string", dest="status_host", default=StatusBot.default_host, help="Do not ask the user for confirmation before running the queue. Dangerous!"), 705 706 ] 706 Command.__init__(self, 'Run the commit queue.', options=options)707 Command.__init__(self, 'Run the %s.' % self._name, options=options) 707 708 708 709 def queue_log_path(self): 709 return ' commit_queue.log'710 return '%s.log' % self._name 710 711 711 712 def work_logs_directory(self): 712 return ' commit_queue_logs'713 return '%s-logs' % self._name 713 714 714 715 def status_host(self): … … 716 717 717 718 def begin_work_queue(self): 718 log("CAUTION: commit-queue will discard all local changes in %s" % self.tool.scm().checkout_root)719 log("CAUTION: %s will discard all local changes in %s" % (self._name, self.tool.scm().checkout_root)) 719 720 if self.options.confirm: 720 721 response = raw_input("Are you sure? Type 'yes' to continue: ") 721 722 if (response != 'yes'): 722 723 error("User declined.") 723 log("Running WebKit Commit Queue. %s" % datetime.now().strftime(WorkQueue.log_date_format))724 log("Running WebKit %s. %s" % (self._name, datetime.now().strftime(WorkQueue.log_date_format))) 724 725 725 726 def should_continue_work_queue(self): 726 727 return True 728 729 def next_work_item(self): 730 raise NotImplementedError, "subclasses must implement" 731 732 def should_proceed_with_work_item(self, work_item): 733 raise NotImplementedError, "subclasses must implement" 734 735 def process_work_item(self, work_item): 736 raise NotImplementedError, "subclasses must implement" 737 738 def handle_unexpected_error(self, work_item, message): 739 raise NotImplementedError, "subclasses must implement" 740 741 @staticmethod 742 def run_bugzilla_tool(args): 743 bugzilla_tool_path = __file__ # re-execute this script 744 bugzilla_tool_args = [bugzilla_tool_path] + args 745 WebKitLandingScripts.run_and_throw_if_fail(bugzilla_tool_args) 746 747 def execute(self, options, args, tool): 748 self.options = options 749 self.tool = tool 750 work_queue = WorkQueue(self) 751 work_queue.run() 752 753 754 class CommitQueue(AbstractQueue): 755 def __init__(self): 756 AbstractQueue.__init__(self, "commit-queue") 727 757 728 758 def next_work_item(self): … … 743 773 744 774 def process_work_item(self, bug_id): 745 bugzilla_tool_path = __file__ # re-execute this script 746 bugzilla_tool_args = [bugzilla_tool_path, 'land-patches', '--force-clean', '--commit-queue', '--quiet', bug_id] 747 WebKitLandingScripts.run_and_throw_if_fail(bugzilla_tool_args) 775 self.run_bugzilla_tool(['land-patches', '--force-clean', '--commit-queue', '--quiet', bug_id]) 748 776 749 777 def handle_unexpected_error(self, bug_id, message): … … 760 788 self.tool.bugs.reject_patch_from_commit_queue(bug_id, message) 761 789 762 def execute(self, options, args, tool): 763 self.options = options 764 self.tool = tool 765 work_queue = WorkQueue(self) 766 work_queue.run() 790 791 class StyleQueue(AbstractQueue): 792 def __init__(self): 793 self.patches = [] 794 AbstractQueue.__init__(self, "style-queue") 795 796 def next_work_item(self): 797 if not len(self.patches): 798 self.patches = self.tool.bugs.fetch_patches_from_review_queue(limit=10) 799 if not len(self.patches): 800 return None 801 patch_ids = map(lambda patch: patch['id'], self.patches) 802 log("%s in review queue [%s]" % (pluralize('patch', len(self.patches)), ", ".join(patch_ids))) 803 return self.patches.pop(0)['bug_id'] 804 805 def should_proceed_with_work_item(self, bug_id): 806 return (True, "Checking style for bug %s." % bug_id, bug_id) 807 808 def process_work_item(self, bug_id): 809 self.run_bugzilla_tool(['check-style', '--force-clean', bug_id]) 810 811 def handle_unexpected_error(self, bug_id, message): 812 log(message) 813 767 814 768 815 class NonWrappingEpilogIndentedHelpFormatter(IndentedHelpFormatter): … … 805 852 { 'name' : 'post-commits', 'object' : PostCommitsAsPatchesToBug() }, 806 853 { 'name' : 'tree-status', 'object' : CheckTreeStatus() }, 807 { 'name' : 'commit-queue', 'object' : LandPatchesFromCommitQueue() }, 854 { 'name' : 'commit-queue', 'object' : CommitQueue() }, 855 { 'name' : 'style-queue', 'object' : StyleQueue() }, 808 856 { 'name' : 'rollout', 'object' : RolloutCommit() }, 809 857 ] -
trunk/WebKitTools/Scripts/modules/bugzilla.py
r51016 r51019 305 305 return patches_to_land 306 306 307 def fetch_bug_ids_from_review_queue(self): 308 review_queue_url = self.bug_server_url + "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=review?" 309 310 page = urllib2.urlopen(review_queue_url) 311 soup = BeautifulSoup(page) 312 313 bug_ids = [] 314 # Grab the cells in the first column (which happens to be the bug ids) 315 for bug_link_cell in soup('td', "first-child"): # tds with the class "first-child" 316 bug_link = bug_link_cell.find("a") 317 bug_ids.append(bug_link.string) # the contents happen to be the bug id 318 319 return bug_ids 320 321 def fetch_patches_from_review_queue(self, limit): 322 patches_to_review = [] 323 for bug_id in self.fetch_bug_ids_from_review_queue(): 324 if len(patches_to_review) >= limit: 325 break 326 patches = self.fetch_unreviewed_patches_from_bug(bug_id) 327 patches_to_review += patches 328 return patches_to_review 329 307 330 def authenticate(self): 308 331 if self.authenticated:
Note: See TracChangeset
for help on using the changeset viewer.