Changeset 47069 in webkit
- Timestamp:
- Aug 11, 2009 3:33:31 PM (15 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r47066 r47069 1 2009-08-11 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 bugzilla-tool: Re-factor shared landing logic into helper class to share more code 6 https://bugs.webkit.org/show_bug.cgi?id=28193 7 8 Added new WebKitLandingScripts class to hold this shared logic. 9 Also added a view_source_url function to move more webkit-specific urls out of bugzilla-tool core. 10 11 * Scripts/bugzilla-tool: 12 1 13 2009-08-11 Kenneth Rohde Christiansen <kenneth@webkit.org> 2 14 -
trunk/WebKitTools/Scripts/bugzilla-tool
r47005 r47069 57 57 return "%d %s" % (count, noun) 58 58 59 def view_source_url(revision_number): 60 return "http://trac.webkit.org/changeset/%s" % revision_number 61 59 62 # These could be put in some sort of changelogs.py. 60 63 def latest_changelog_entry(changelog_path): … … 216 219 match = re.search(scm.commit_success_regexp(), commit_text, re.MULTILINE) 217 220 svn_revision = match.group('svn_revision') 218 commit_text += ("\n http://trac.webkit.org/changeset/%s" % svn_revision)221 commit_text += ("\n%s" % view_source_url(svn_revision)) 219 222 return commit_text 223 224 225 class WebKitLandingScripts: 226 @staticmethod 227 def cleaning_options(): 228 return [ 229 make_option("--force-clean", action="store_true", dest="force_clean", default=False, help="Clean working directory before applying patches (removes local changes and commits)"), 230 make_option("--no-clean", action="store_false", dest="clean", default=True, help="Don't check if the working directory is clean before applying patches"), 231 ] 232 233 @staticmethod 234 def land_options(): 235 return [ 236 make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing."), 237 make_option("--no-build", action="store_false", dest="build", default=True, help="Commit without building first, implies --no-test."), 238 make_option("--no-test", action="store_false", dest="test", default=True, help="Commit without running run-webkit-tests."), 239 make_option("--quiet", action="store_true", dest="quiet", default=False, help="Produce less console output."), 240 make_option("--commit-queue", action="store_true", dest="commit_queue", default=False, help="Run in commit queue mode (no user interaction)."), 241 ] 242 243 @staticmethod 244 def run_and_throw_if_fail(args, quiet=False): 245 child_stdout = subprocess.PIPE if quiet else None 246 child_process = subprocess.Popen(args, stdout=child_stdout) 247 if child_process.stdout: 248 child_process.communicate() 249 return_code = child_process.wait() 250 if return_code: 251 raise ScriptError("%s failed with exit code %d" % (" ".join(args), return_code)) 252 253 # We might need to pass scm into this function for scm.checkout_root 254 @staticmethod 255 def webkit_script_path(script_name): 256 return os.path.join("WebKitTools", "Scripts", script_name) 257 258 @classmethod 259 def run_webkit_script(cls, script_name, quiet=False): 260 print "Running WebKit Script " + script_name 261 cls.run_and_throw_if_fail(cls.webkit_script_path(script_name), quiet) 262 263 @classmethod 264 def build_webkit(cls, quiet=False): 265 cls.run_webkit_script("build-webkit", quiet) 266 267 @classmethod 268 def run_webkit_tests(cls, launch_safari, quiet=False): 269 args = [cls.webkit_script_path("run-webkit-tests")] 270 if not launch_safari: 271 args.append("--no-launch-safari") 272 if quiet: 273 args.append("--quiet") 274 cls.run_and_throw_if_fail(args) 275 276 @staticmethod 277 def setup_for_landing(scm, options): 278 os.chdir(scm.checkout_root) 279 scm.ensure_no_local_commits(options.force_clean) 280 if options.clean: 281 scm.ensure_clean_working_directory(options.force_clean) 282 283 @classmethod 284 def build_and_commit(cls, scm, options): 285 if options.build: 286 cls.build_webkit(quiet=options.quiet) 287 if options.test: 288 cls.run_webkit_tests(launch_safari=not options.commit_queue, quiet=options.quiet) 289 commit_message = commit_message_for_this_commit(scm) 290 commit_log = scm.commit_with_message(commit_message.message()) 291 return bug_comment_from_commit_text(scm, commit_log) 220 292 221 293 … … 224 296 options = [ 225 297 make_option("-r", "--reviewer", action="store", type="string", dest="reviewer", help="Update ChangeLogs to say Reviewed by REVIEWER."), 226 make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing."),227 make_option("--no-build", action="store_false", dest="build", default=True, help="Commit without building first, implies --no-test."),228 make_option("--no-test", action="store_false", dest="test", default=True, help="Commit without running run-webkit-tests."),229 make_option("--quiet", action="store_true", dest="quiet", default=False, help="Produce less console output."),230 make_option("--commit-queue", action="store_true", dest="commit_queue", default=False, help="Run in commit queue mode (no user interaction)."),231 298 ] 299 options += WebKitLandingScripts.land_options() 232 300 Command.__init__(self, 'Lands the current working directory diff and updates the bug if provided.', '[BUGID]', options=options) 233 301 … … 263 331 self.update_changelogs_with_reviewer(options.reviewer, bug_id, tool) 264 332 265 comment_text = LandPatchesFromBugs.build_and_commit(tool.scm(), options)333 comment_text = WebKitLandingScripts.build_and_commit(tool.scm(), options) 266 334 if bug_id: 267 335 log("Updating bug %s" % bug_id) … … 279 347 class LandPatchesFromBugs(Command): 280 348 def __init__(self): 281 options = [ 282 make_option("--force-clean", action="store_true", dest="force_clean", default=False, help="Clean working directory before applying patches (removes local changes and commits)"), 283 make_option("--no-clean", action="store_false", dest="clean", default=True, help="Don't check if the working directory is clean before applying patches"), 284 make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing."), 285 make_option("--no-build", action="store_false", dest="build", default=True, help="Commit without building first, implies --no-test."), 286 make_option("--no-test", action="store_false", dest="test", default=True, help="Commit without running run-webkit-tests."), 287 make_option("--quiet", action="store_true", dest="quiet", default=False, help="Produce less console output."), 288 make_option("--commit-queue", action="store_true", dest="commit_queue", default=False, help="Run in commit queue mode (no user interaction)."), 289 ] 349 options = WebKitLandingScripts.cleaning_options() 350 options += WebKitLandingScripts.land_options() 290 351 Command.__init__(self, 'Lands all patches on a bug optionally testing them first', 'BUGID', options=options) 291 292 @staticmethod293 def run_and_throw_if_fail(args, quiet=False):294 child_stdout = subprocess.PIPE if quiet else None295 child_process = subprocess.Popen(args, stdout=child_stdout)296 if child_process.stdout:297 child_process.communicate()298 return_code = child_process.wait()299 if return_code:300 raise ScriptError("%s failed with exit code %d" % (" ".join(args), return_code))301 302 # We might need to pass scm into this function for scm.checkout_root303 @staticmethod304 def webkit_script_path(script_name):305 return os.path.join("WebKitTools", "Scripts", script_name)306 307 @classmethod308 def run_webkit_script(cls, script_name, quiet=False):309 print "Running WebKit Script " + script_name310 cls.run_and_throw_if_fail(cls.webkit_script_path(script_name), quiet)311 312 @classmethod313 def build_webkit(cls, quiet=False):314 cls.run_webkit_script("build-webkit", quiet)315 316 @classmethod317 def run_webkit_tests(cls, launch_safari, quiet=False):318 args = [cls.webkit_script_path("run-webkit-tests")]319 if not launch_safari:320 args.append("--no-launch-safari")321 if quiet:322 args.append("--quiet")323 cls.run_and_throw_if_fail(args)324 325 @staticmethod326 def setup_for_landing(scm, options):327 os.chdir(scm.checkout_root)328 scm.ensure_no_local_commits(options.force_clean)329 if options.clean:330 scm.ensure_clean_working_directory(options.force_clean)331 332 @classmethod333 def build_and_commit(cls, scm, options):334 if options.build:335 cls.build_webkit(quiet=options.quiet)336 if options.test:337 cls.run_webkit_tests(launch_safari=not options.commit_queue, quiet=options.quiet)338 commit_message = commit_message_for_this_commit(scm)339 commit_log = scm.commit_with_message(commit_message.message())340 return bug_comment_from_commit_text(scm, commit_log)341 352 342 353 @classmethod … … 347 358 tool.scm().update_webkit() # Update before every patch in case the tree has changed 348 359 tool.scm().apply_patch(patch, force=options.commit_queue) 349 comment_text = cls.build_and_commit(tool.scm(), options)360 comment_text = WebKitLandingScripts.build_and_commit(tool.scm(), options) 350 361 tool.bugs.clear_attachment_review_flag(patch['id'], comment_text) 351 362 … … 376 387 log("Landing %s from %s." % (pluralize("patch", patch_count), pluralize("bug", len(args)))) 377 388 378 self.setup_for_landing(tool.scm(), options)389 WebKitLandingScripts.setup_for_landing(tool.scm(), options) 379 390 380 391 for bug_id in bugs_to_patches.keys():
Note: See TracChangeset
for help on using the changeset viewer.