Changeset 47111 in webkit
- Timestamp:
- Aug 12, 2009 9:26:19 AM (15 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r47109 r47111 1 2009-08-11 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 bugzilla-tool : various improvements for running the commit-queue 6 https://bugs.webkit.org/show_bug.cgi?id=28199 7 8 Make run_and_throw_if_fail silence STDERR as well as STDIN. 9 I also changed run_and_throw_if_fail to use the /dev/null trick instead of .communicate() to avoid ever buffering the out 10 Change a few "print" statements to "log" so they appear in the output. 11 Changed all string + uses to use string formatting instead (this is less error prone as it will automatically convert non 12 Added a little more logging so that --quiet mode is easier to understand. 13 Changed clear_attachment_review_flag to clear_attachment_flags and made it clear the commit-queue flag as well. 14 Added the ability for bugzilla-tool to reject patches from the commit-queue when they fail to compile/apply/etc. 15 Added _find_select_element_for_flag to make the code for finding flag <select> elements clearer. 16 Made curl call (downloading patch files) quieter. 17 18 * Scripts/bugzilla-tool: 19 * Scripts/modules/bugzilla.py: 20 * Scripts/modules/scm.py: 21 1 22 2009-08-11 Eric Seidel <eric@webkit.org> 2 23 -
trunk/WebKitTools/Scripts/bugzilla-tool
r47069 r47111 243 243 @staticmethod 244 244 def run_and_throw_if_fail(args, quiet=False): 245 child_stdout = subprocess.PIPE if quiet else None246 child_ process = subprocess.Popen(args, stdout=child_stdout)247 if child_process.stdout: 248 child_process.communicate()245 # Passing None will use the default input/outputs 246 child_output = open(os.devnull, "w") if quiet else None 247 248 child_process = subprocess.Popen(args, stdout=child_output, stderr=child_output) 249 249 return_code = child_process.wait() 250 251 if child_output: 252 child_output.close() 253 250 254 if return_code: 251 255 raise ScriptError("%s failed with exit code %d" % (" ".join(args), return_code)) … … 258 262 @classmethod 259 263 def run_webkit_script(cls, script_name, quiet=False): 260 print "Running WebKit Script " + script_name264 log("Running %s" % script_name) 261 265 cls.run_and_throw_if_fail(cls.webkit_script_path(script_name), quiet) 262 266 … … 357 361 for patch in patches: 358 362 tool.scm().update_webkit() # Update before every patch in case the tree has changed 363 log("Applying %s from bug %s." % (patch['id'], bug_id)) 359 364 tool.scm().apply_patch(patch, force=options.commit_queue) 360 365 comment_text = WebKitLandingScripts.build_and_commit(tool.scm(), options) 361 tool.bugs.clear_attachment_ review_flag(patch['id'], comment_text)366 tool.bugs.clear_attachment_flags(patch['id'], comment_text) 362 367 363 368 if options.close_bug: 364 369 tool.bugs.close_bug_as_fixed(bug_id, "All reviewed patches have been landed. Closing bug.") 365 370 except ScriptError, e: 371 tool.bugs.reject_patch_from_commit_queue(patch['id'], e) 366 372 # We should add a comment to the bug, and r- the patch on failure 367 373 error(e) … … 379 385 else: 380 386 patches = tool.bugs.fetch_reviewed_patches_from_bug(bug_id) 381 if not len(patches): 382 log("No reviewed patches found on %s." % bug_id) 383 continue 384 patch_count += len(patches) 385 bugs_to_patches[bug_id] = patches 387 388 patches_found = len(patches) 389 log("%s found on %s." % (pluralize("reviewed patch", patches_found), bug_id)) 390 391 patch_count += patches_found 392 if patches_found: 393 bugs_to_patches[bug_id] = patches 386 394 387 395 log("Landing %s from %s." % (pluralize("patch", patch_count), pluralize("bug", len(args)))) … … 545 553 def prompt_for_bug_title_and_comment(self): 546 554 bug_title = raw_input("Bug title: ") 547 print ("Bug comment (hit ^D on blank line to end):")555 print "Bug comment (hit ^D on blank line to end):" 548 556 lines = sys.stdin.readlines() 549 557 sys.stdin.seek(0, os.SEEK_END) -
trunk/WebKitTools/Scripts/modules/bugzilla.py
r46755 r47111 96 96 def read_config(key): 97 97 # Need a way to read from svn too 98 config_process = subprocess.Popen("git config --get bugzilla. " +key, stdout=subprocess.PIPE, shell=True)98 config_process = subprocess.Popen("git config --get bugzilla.%s" % key, stdout=subprocess.PIPE, shell=True) 99 99 value = config_process.communicate()[0] 100 100 return_code = config_process.wait() … … 142 142 action_param = "" 143 143 if action and action != "view": 144 action_param = "&action= " +action144 action_param = "&action=%s" % action 145 145 return "%sattachment.cgi?id=%s%s" % (self.bug_server_url, attachment_id, action_param) 146 146 … … 171 171 def fetch_attachments_from_bug(self, bug_id): 172 172 bug_url = self.bug_url_for_bug_id(bug_id, xml=True) 173 log("Fetching: " +bug_url)173 log("Fetching: %s" % bug_url) 174 174 175 175 page = urllib2.urlopen(bug_url) … … 258 258 return 259 259 260 self.browser.open( self.bug_server_url + "attachment.cgi?action=enter&bugid=" + bug_id)260 self.browser.open("%sattachment.cgi?action=enter&bugid=%s" % (self.bug_server_url, bug_id)) 261 261 self.browser.select_form(name="entryform") 262 262 self.browser['description'] = description … … 318 318 bug_id = self._check_create_bug_response(response.read()) 319 319 log("Bug %s created." % bug_id) 320 log( self.bug_server_url + "show_bug.cgi?id=" + bug_id)320 log("%sshow_bug.cgi?id=%s" % (self.bug_server_url, bug_id)) 321 321 return bug_id 322 322 323 def clear_attachment_review_flag(self, attachment_id, additional_comment_text=None): 324 self.authenticate() 325 326 comment_text = "Clearing review flag on attachment: %s" % attachment_id 323 def _find_select_element_for_flag(self, flag_name): 324 # FIXME: This will break if we ever re-order attachment flags 325 if flag_name == "review": 326 return self.browser.find_control(type='select', nr=0) 327 if flag_name == "commit-queue": 328 return self.browser.find_control(type='select', nr=1) 329 raise Exception("Don't know how to find flag named \"%s\"" % flag_name) 330 331 def clear_attachment_flags(self, attachment_id, additional_comment_text=None): 332 self.authenticate() 333 334 comment_text = "Clearing flags on attachment: %s" % attachment_id 327 335 if additional_comment_text: 328 comment_text += "\n\n " +additional_comment_text336 comment_text += "\n\n%s" % additional_comment_text 329 337 log(comment_text) 330 338 … … 335 343 self.browser.select_form(nr=1) 336 344 self.browser.set_value(comment_text, name='comment', nr=0) 337 self.browser.find_control(type='select', nr=0).value = ("X",) 345 self._find_select_element_for_flag('review').value = ("X",) 346 self._find_select_element_for_flag('commit-queue').value = ("X",) 347 self.browser.submit() 348 349 # FIXME: We need a way to test this on a live bugzilla instance. 350 def reject_patch_from_commit_queue(self, attachment_id, additional_comment_text=None): 351 self.authenticate() 352 353 comment_text = "Rejecting patch %s from commit-queue. This patch will require manual commit." % attachment_id 354 if additional_comment_text: 355 comment_text += "\n\n%s" % additional_comment_text 356 log(comment_text) 357 358 if self.dryrun: 359 return 360 361 self.browser.open(self.attachment_url_for_id(attachment_id, 'edit')) 362 self.browser.select_form(nr=1) 363 self.browser.set_value(comment_text, name='comment', nr=0) 364 self._find_select_element_for_flag('commit-queue').value = ("-",) 338 365 self.browser.submit() 339 366 … … 350 377 self.browser.find_control('isobsolete').items[0].selected = True 351 378 # Also clear any review flag (to remove it from review/commit queues) 352 self.browser.find_control(type='select', nr=0).value = ("X",) 379 self._find_select_element_for_flag('review').value = ("X",) 380 self._find_select_element_for_flag('commit-queue').value = ("X",) 353 381 if comment_text: 354 382 log(comment_text) -
trunk/WebKitTools/Scripts/modules/scm.py
r47005 r47111 124 124 # It's possible that the patch was not made from the root directory. 125 125 # We should detect and handle that case. 126 curl_process = subprocess.Popen(['curl', patch['url']], stdout=subprocess.PIPE)126 curl_process = subprocess.Popen(['curl', '--silent', '--show-error', patch['url']], stdout=subprocess.PIPE) 127 127 args = [self.script_path('svn-apply'), '--reviewer', patch['reviewer']] 128 128 if force:
Note: See TracChangeset
for help on using the changeset viewer.