Changeset 51888 in webkit
- Timestamp:
- Dec 8, 2009 11:51:39 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r51880 r51888 1 2009-12-08 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 run_command and ScriptError should move into processutils.py 6 https://bugs.webkit.org/show_bug.cgi?id=32305 7 8 Turns out there are a zillion callers to run_command. 9 10 * Scripts/modules/commands/download.py: 11 * Scripts/modules/commands/early_warning_system.py: 12 * Scripts/modules/commands/queues.py: 13 * Scripts/modules/landingsequence.py: 14 * Scripts/modules/logging_unittest.py: 15 * Scripts/modules/processutils.py: 16 * Scripts/modules/scm.py: 17 * Scripts/modules/scm_unittest.py: 18 * Scripts/modules/workqueue.py: 19 * Scripts/modules/workqueue_unittest.py: 20 1 21 2009-12-08 Kevin Watters <kevinwatters@gmail.com> 2 22 -
trunk/WebKitTools/Scripts/modules/commands/download.py
r51750 r51888 41 41 from modules.logging import error, log 42 42 from modules.multicommandtool import Command 43 from modules. scmimport ScriptError43 from modules.processutils import ScriptError 44 44 45 45 -
trunk/WebKitTools/Scripts/modules/commands/early_warning_system.py
r51746 r51888 29 29 30 30 from modules.commands.queues import AbstractReviewQueue 31 from modules. scmimport ScriptError31 from modules.processutils import ScriptError 32 32 from modules.webkitport import WebKitPort 33 33 -
trunk/WebKitTools/Scripts/modules/commands/queues.py
r51746 r51888 39 39 from modules.multicommandtool import Command 40 40 from modules.patchcollection import PatchCollection, PersistentPatchCollection, PersistentPatchCollectionDelegate 41 from modules.processutils import run_and_throw_if_fail 42 from modules.scm import ScriptError 41 from modules.processutils import run_and_throw_if_fail, ScriptError 43 42 from modules.statusbot import StatusBot 44 43 from modules.workqueue import WorkQueue, WorkQueueDelegate -
trunk/WebKitTools/Scripts/modules/landingsequence.py
r51749 r51888 31 31 from modules.comments import bug_comment_from_commit_text 32 32 from modules.logging import log 33 from modules.scm import ScriptError, CheckoutNeedsUpdate 33 from modules.processutils import ScriptError 34 from modules.scm import CheckoutNeedsUpdate 34 35 from modules.webkitport import WebKitPort 35 36 from modules.workqueue import WorkQueue -
trunk/WebKitTools/Scripts/modules/logging_unittest.py
r48762 r51888 34 34 35 35 from modules.logging import * 36 from modules. scmimport ScriptError36 from modules.processutils import ScriptError 37 37 38 38 class LoggingTest(unittest.TestCase): -
trunk/WebKitTools/Scripts/modules/processutils.py
r51435 r51888 34 34 35 35 from modules.logging import tee 36 from modules.scm import ScriptError 36 37 # FIXME: These methods could all be unified into one! 38 39 class ScriptError(Exception): 40 def __init__(self, message=None, script_args=None, exit_code=None, output=None, cwd=None): 41 if not message: 42 message = 'Failed to run "%s"' % script_args 43 if exit_code: 44 message += " exit_code: %d" % exit_code 45 if cwd: 46 message += " cwd: %s" % cwd 47 48 Exception.__init__(self, message) 49 self.script_args = script_args # 'args' is already used by Exception 50 self.exit_code = exit_code 51 self.output = output 52 self.cwd = cwd 53 54 def message_with_output(self, output_limit=500): 55 if self.output: 56 if output_limit and len(self.output) > output_limit: 57 return "%s\nLast %s characters of output:\n%s" % (self, output_limit, self.output[-output_limit:]) 58 return "%s\n%s" % (self, self.output) 59 return str(self) 60 61 def default_error_handler(error): 62 raise error 63 64 def ignore_error(error): 65 pass 37 66 38 67 def run_command_with_teed_output(args, teed_output): … … 46 75 return child_process.poll() 47 76 teed_output.write(output_line) 77 78 def run_command(args, cwd=None, input=None, error_handler=default_error_handler, return_exit_code=False, return_stderr=True): 79 if hasattr(input, 'read'): # Check if the input is a file. 80 stdin = input 81 string_to_communicate = None 82 else: 83 stdin = subprocess.PIPE if input else None 84 string_to_communicate = input 85 if return_stderr: 86 stderr = subprocess.STDOUT 87 else: 88 stderr = None 89 process = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE, stderr=stderr, cwd=cwd) 90 output = process.communicate(string_to_communicate)[0] 91 exit_code = process.wait() 92 if exit_code: 93 script_error = ScriptError(script_args=args, exit_code=exit_code, output=output, cwd=cwd) 94 error_handler(script_error) 95 if return_exit_code: 96 return exit_code 97 return output 48 98 49 99 def run_and_throw_if_fail(args, quiet=False): -
trunk/WebKitTools/Scripts/modules/scm.py
r51729 r51888 37 37 from modules.changelogs import ChangeLog 38 38 from modules.logging import error, log 39 from modules.processutils import run_command, ScriptError, default_error_handler, ignore_error 39 40 40 41 def detect_scm_system(path): … … 79 80 80 81 81 class ScriptError(Exception):82 def __init__(self, message=None, script_args=None, exit_code=None, output=None, cwd=None):83 if not message:84 message = 'Failed to run "%s"' % script_args85 if exit_code:86 message += " exit_code: %d" % exit_code87 if cwd:88 message += " cwd: %s" % cwd89 90 Exception.__init__(self, message)91 self.script_args = script_args # 'args' is already used by Exception92 self.exit_code = exit_code93 self.output = output94 self.cwd = cwd95 96 def message_with_output(self, output_limit=500):97 if self.output:98 if output_limit and len(self.output) > output_limit:99 return "%s\nLast %s characters of output:\n%s" % (self, output_limit, self.output[-output_limit:])100 return "%s\n%s" % (self, self.output)101 return str(self)102 103 104 82 class CheckoutNeedsUpdate(ScriptError): 105 83 def __init__(self, script_args, exit_code, output, cwd): 106 84 ScriptError.__init__(self, script_args=script_args, exit_code=exit_code, output=output, cwd=cwd) 107 85 108 109 def default_error_handler(error):110 raise error111 86 112 87 def commit_error_handler(error): … … 115 90 default_error_handler(error) 116 91 117 def ignore_error(error):118 pass119 92 120 93 class SCM: … … 124 97 self.dryrun = dryrun 125 98 126 @staticmethod127 def run_command(args, cwd=None, input=None, error_handler=default_error_handler, return_exit_code=False, return_stderr=True):128 if hasattr(input, 'read'): # Check if the input is a file.129 stdin = input130 string_to_communicate = None131 else:132 stdin = subprocess.PIPE if input else None133 string_to_communicate = input134 if return_stderr:135 stderr = subprocess.STDOUT136 else:137 stderr = None138 process = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE, stderr=stderr, cwd=cwd)139 output = process.communicate(string_to_communicate)[0]140 exit_code = process.wait()141 if exit_code:142 script_error = ScriptError(script_args=args, exit_code=exit_code, output=output, cwd=cwd)143 error_handler(script_error)144 if return_exit_code:145 return exit_code146 return output147 148 99 def scripts_directory(self): 149 100 return os.path.join(self.checkout_root, "WebKitTools", "Scripts") … … 154 105 def ensure_clean_working_directory(self, force_clean): 155 106 if not force_clean and not self.working_directory_is_clean(): 156 print self.run_command(self.status_command(), error_handler=ignore_error)107 print run_command(self.status_command(), error_handler=ignore_error) 157 108 raise ScriptError(message="Working directory has modifications, pass --force-clean or --no-clean to continue.") 158 109 … … 180 131 args.append('--force') 181 132 182 self.run_command(args, input=curl_process.stdout)133 run_command(args, input=curl_process.stdout) 183 134 184 135 def run_status_and_extract_filenames(self, status_command, status_regexp): 185 136 filenames = [] 186 for line in self.run_command(status_command).splitlines():137 for line in run_command(status_command).splitlines(): 187 138 match = re.search(status_regexp, line) 188 139 if not match: … … 322 273 def value_from_svn_info(cls, path, field_name): 323 274 svn_info_args = ['svn', 'info', path] 324 info_output = cls.run_command(svn_info_args).rstrip()275 info_output = run_command(svn_info_args).rstrip() 325 276 match = re.search("^%s: (?P<value>.+)$" % field_name, info_output, re.MULTILINE) 326 277 if not match: … … 350 301 def svn_version(self): 351 302 if not self.cached_version: 352 self.cached_version = self.run_command(['svn', '--version', '--quiet'])303 self.cached_version = run_command(['svn', '--version', '--quiet']) 353 304 354 305 return self.cached_version 355 306 356 307 def working_directory_is_clean(self): 357 return self.run_command(['svn', 'diff']) == ""308 return run_command(['svn', 'diff']) == "" 358 309 359 310 def clean_working_directory(self): 360 self.run_command(['svn', 'revert', '-R', '.'])311 run_command(['svn', 'revert', '-R', '.']) 361 312 362 313 def status_command(self): … … 378 329 379 330 def create_patch(self): 380 return self.run_command(self.script_path("svn-create-patch"), cwd=self.checkout_root, return_stderr=False)331 return run_command(self.script_path("svn-create-patch"), cwd=self.checkout_root, return_stderr=False) 381 332 382 333 def diff_for_revision(self, revision): 383 return self.run_command(['svn', 'diff', '-c', str(revision)])334 return run_command(['svn', 'diff', '-c', str(revision)]) 384 335 385 336 def _repository_url(self): … … 391 342 log("WARNING: svn merge has been known to take more than 10 minutes to complete. It is recommended you use git for rollouts.") 392 343 log("Running '%s'" % " ".join(svn_merge_args)) 393 self.run_command(svn_merge_args)344 run_command(svn_merge_args) 394 345 395 346 def revert_files(self, file_paths): 396 self.run_command(['svn', 'revert'] + file_paths)347 run_command(['svn', 'revert'] + file_paths) 397 348 398 349 def commit_with_message(self, message): … … 400 351 # Return a string which looks like a commit so that things which parse this output will succeed. 401 352 return "Dry run, no commit.\nCommitted revision 0." 402 return self.run_command(['svn', 'commit', '-m', message], error_handler=commit_error_handler)353 return run_command(['svn', 'commit', '-m', message], error_handler=commit_error_handler) 403 354 404 355 def svn_commit_log(self, svn_revision): 405 356 svn_revision = self.strip_r_from_svn_revision(str(svn_revision)) 406 return self.run_command(['svn', 'log', '--non-interactive', '--revision', svn_revision]);357 return run_command(['svn', 'log', '--non-interactive', '--revision', svn_revision]); 407 358 408 359 def last_svn_commit_log(self): … … 418 369 @classmethod 419 370 def in_working_directory(cls, path): 420 return cls.run_command(['git', 'rev-parse', '--is-inside-work-tree'], cwd=path, error_handler=ignore_error).rstrip() == "true"371 return run_command(['git', 'rev-parse', '--is-inside-work-tree'], cwd=path, error_handler=ignore_error).rstrip() == "true" 421 372 422 373 @classmethod 423 374 def find_checkout_root(cls, path): 424 375 # "git rev-parse --show-cdup" would be another way to get to the root 425 (checkout_root, dot_git) = os.path.split( cls.run_command(['git', 'rev-parse', '--git-dir'], cwd=path))376 (checkout_root, dot_git) = os.path.split(run_command(['git', 'rev-parse', '--git-dir'], cwd=path)) 426 377 # If we were using 2.6 # checkout_root = os.path.relpath(checkout_root, path) 427 378 if not os.path.isabs(checkout_root): # Sometimes git returns relative paths … … 435 386 436 387 def discard_local_commits(self): 437 self.run_command(['git', 'reset', '--hard', 'trunk'])388 run_command(['git', 'reset', '--hard', 'trunk']) 438 389 439 390 def local_commits(self): 440 return self.run_command(['git', 'log', '--pretty=oneline', 'HEAD...trunk']).splitlines()391 return run_command(['git', 'log', '--pretty=oneline', 'HEAD...trunk']).splitlines() 441 392 442 393 def rebase_in_progress(self): … … 444 395 445 396 def working_directory_is_clean(self): 446 return self.run_command(['git', 'diff-index', 'HEAD']) == ""397 return run_command(['git', 'diff-index', 'HEAD']) == "" 447 398 448 399 def clean_working_directory(self): 449 400 # Could run git clean here too, but that wouldn't match working_directory_is_clean 450 self.run_command(['git', 'reset', '--hard', 'HEAD'])401 run_command(['git', 'reset', '--hard', 'HEAD']) 451 402 # Aborting rebase even though this does not match working_directory_is_clean 452 403 if self.rebase_in_progress(): 453 self.run_command(['git', 'rebase', '--abort'])404 run_command(['git', 'rebase', '--abort']) 454 405 455 406 def status_command(self): … … 469 420 470 421 def create_patch(self): 471 return self.run_command(['git', 'diff', '--binary', 'HEAD'])422 return run_command(['git', 'diff', '--binary', 'HEAD']) 472 423 473 424 @classmethod 474 425 def git_commit_from_svn_revision(cls, revision): 475 426 # git svn find-rev always exits 0, even when the revision is not found. 476 return cls.run_command(['git', 'svn', 'find-rev', 'r%s' % revision]).rstrip()427 return run_command(['git', 'svn', 'find-rev', 'r%s' % revision]).rstrip() 477 428 478 429 def diff_for_revision(self, revision): … … 488 439 # I think this will always fail due to ChangeLogs. 489 440 # FIXME: We need to detec specific failure conditions and handle them. 490 self.run_command(['git', 'revert', '--no-commit', git_commit], error_handler=ignore_error)441 run_command(['git', 'revert', '--no-commit', git_commit], error_handler=ignore_error) 491 442 492 443 # Fix any ChangeLogs if necessary. 493 444 changelog_paths = self.modified_changelogs() 494 445 if len(changelog_paths): 495 self.run_command([self.script_path('resolve-ChangeLogs')] + changelog_paths)446 run_command([self.script_path('resolve-ChangeLogs')] + changelog_paths) 496 447 497 448 def revert_files(self, file_paths): 498 self.run_command(['git', 'checkout', 'HEAD'] + file_paths)449 run_command(['git', 'checkout', 'HEAD'] + file_paths) 499 450 500 451 def commit_with_message(self, message): … … 504 455 def svn_commit_log(self, svn_revision): 505 456 svn_revision = self.strip_r_from_svn_revision(svn_revision) 506 return self.run_command(['git', 'svn', 'log', '-r', svn_revision])457 return run_command(['git', 'svn', 'log', '-r', svn_revision]) 507 458 508 459 def last_svn_commit_log(self): 509 return self.run_command(['git', 'svn', 'log', '--limit=1'])460 return run_command(['git', 'svn', 'log', '--limit=1']) 510 461 511 462 # Git-specific methods: 512 463 513 464 def create_patch_from_local_commit(self, commit_id): 514 return self.run_command(['git', 'diff', '--binary', commit_id + "^.." + commit_id])465 return run_command(['git', 'diff', '--binary', commit_id + "^.." + commit_id]) 515 466 516 467 def create_patch_since_local_commit(self, commit_id): 517 return self.run_command(['git', 'diff', '--binary', commit_id])468 return run_command(['git', 'diff', '--binary', commit_id]) 518 469 519 470 def commit_locally_with_message(self, message): 520 self.run_command(['git', 'commit', '--all', '-F', '-'], input=message)471 run_command(['git', 'commit', '--all', '-F', '-'], input=message) 521 472 522 473 def push_local_commits_to_server(self): … … 524 475 # Return a string which looks like a commit so that things which parse this output will succeed. 525 476 return "Dry run, no remote commit.\nCommitted r0" 526 return self.run_command(['git', 'svn', 'dcommit'], error_handler=commit_error_handler)477 return run_command(['git', 'svn', 'dcommit'], error_handler=commit_error_handler) 527 478 528 479 # This function supports the following argument formats: … … 541 492 raise ScriptError(message="'...' is not supported (found in '%s'). Did you mean '..'?" % commitish) 542 493 elif '..' in commitish: 543 commit_ids += reversed( self.run_command(['git', 'rev-list', commitish]).splitlines())494 commit_ids += reversed(run_command(['git', 'rev-list', commitish]).splitlines()) 544 495 else: 545 496 # Turn single commits or branch or tag names into commit ids. 546 commit_ids += self.run_command(['git', 'rev-parse', '--revs-only', commitish]).splitlines()497 commit_ids += run_command(['git', 'rev-parse', '--revs-only', commitish]).splitlines() 547 498 return commit_ids 548 499 549 500 def commit_message_for_local_commit(self, commit_id): 550 commit_lines = self.run_command(['git', 'cat-file', 'commit', commit_id]).splitlines()501 commit_lines = run_command(['git', 'cat-file', 'commit', commit_id]).splitlines() 551 502 552 503 # Skip the git headers. … … 559 510 560 511 def files_changed_summary_for_commit(self, commit_id): 561 return self.run_command(['git', 'diff-tree', '--shortstat', '--no-commit-id', commit_id])512 return run_command(['git', 'diff-tree', '--shortstat', '--no-commit-id', commit_id]) -
trunk/WebKitTools/Scripts/modules/scm_unittest.py
r51590 r51888 39 39 40 40 from datetime import date 41 from modules.scm import detect_scm_system, SCM, ScriptError, CheckoutNeedsUpdate, ignore_error, commit_error_handler42 41 from modules.scm import detect_scm_system, SCM, CheckoutNeedsUpdate, commit_error_handler 42 from modules.processutils import run_command, ignore_error, ScriptError 43 43 44 44 # Eventually we will want to write tests which work for both scms. (like update_webkit, changed_files, etc.) 45 45 # Perhaps through some SCMTest base-class which both SVNTest and GitTest inherit from. 46 46 47 def run(args, cwd=None): 48 return SCM.run_command(args, cwd=cwd) 49 47 # FIXME: This should be unified into one of the processutils.py commands! 50 48 def run_silent(args, cwd=None): 51 49 process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd) … … 76 74 test_file.flush() 77 75 78 run (['svn', 'add', 'test_file'])79 run (['svn', 'commit', '--quiet', '--message', 'initial commit'])76 run_command(['svn', 'add', 'test_file']) 77 run_command(['svn', 'commit', '--quiet', '--message', 'initial commit']) 80 78 81 79 test_file.write("test2") 82 80 test_file.flush() 83 81 84 run (['svn', 'commit', '--quiet', '--message', 'second commit'])82 run_command(['svn', 'commit', '--quiet', '--message', 'second commit']) 85 83 86 84 test_file.write("test3\n") 87 85 test_file.flush() 88 86 89 run (['svn', 'commit', '--quiet', '--message', 'third commit'])87 run_command(['svn', 'commit', '--quiet', '--message', 'third commit']) 90 88 91 89 test_file.write("test4\n") 92 90 test_file.close() 93 91 94 run (['svn', 'commit', '--quiet', '--message', 'fourth commit'])92 run_command(['svn', 'commit', '--quiet', '--message', 'fourth commit']) 95 93 96 94 # svn does not seem to update after commit as I would expect. 97 run (['svn', 'update'])95 run_command(['svn', 'update']) 98 96 99 97 @classmethod … … 104 102 # git svn complains if we don't pass --pre-1.5-compatible, not sure why: 105 103 # Expected FS format '2'; found format '3' at /usr/local/libexec/git-core//git-svn line 1477 106 run (['svnadmin', 'create', '--pre-1.5-compatible', test_object.svn_repo_path])104 run_command(['svnadmin', 'create', '--pre-1.5-compatible', test_object.svn_repo_path]) 107 105 108 106 # Create a test svn checkout 109 107 test_object.svn_checkout_path = tempfile.mkdtemp(suffix="svn_test_checkout") 110 run (['svn', 'checkout', '--quiet', test_object.svn_repo_url, test_object.svn_checkout_path])108 run_command(['svn', 'checkout', '--quiet', test_object.svn_repo_url, test_object.svn_checkout_path]) 111 109 112 110 cls._setup_test_commits(test_object) … … 114 112 @classmethod 115 113 def tear_down(cls, test_object): 116 run (['rm', '-rf', test_object.svn_repo_path])117 run (['rm', '-rf', test_object.svn_checkout_path])114 run_command(['rm', '-rf', test_object.svn_repo_path]) 115 run_command(['rm', '-rf', test_object.svn_checkout_path]) 118 116 119 117 # For testing the SCM baseclass directly. … … 127 125 def test_run_command_with_pipe(self): 128 126 input_process = subprocess.Popen(['echo', 'foo\nbar'], stdout=subprocess.PIPE, stderr=self.dev_null) 129 self.assertEqual( SCM.run_command(['grep', 'bar'], input=input_process.stdout), "bar\n")127 self.assertEqual(run_command(['grep', 'bar'], input=input_process.stdout), "bar\n") 130 128 131 129 # Test the non-pipe case too: 132 self.assertEqual( SCM.run_command(['grep', 'bar'], input="foo\nbar"), "bar\n")130 self.assertEqual(run_command(['grep', 'bar'], input="foo\nbar"), "bar\n") 133 131 134 132 command_returns_non_zero = ['/bin/sh', '--invalid-option'] … … 136 134 input_process = subprocess.Popen(command_returns_non_zero, stdout=subprocess.PIPE, stderr=self.dev_null) 137 135 self.assertTrue(input_process.poll() != 0) 138 self.assertRaises(ScriptError, SCM.run_command, ['grep', 'bar'], input=input_process.stdout)136 self.assertRaises(ScriptError, run_command, ['grep', 'bar'], input=input_process.stdout) 139 137 140 138 # Test when the run_command process fails. 141 139 input_process = subprocess.Popen(['echo', 'foo\nbar'], stdout=subprocess.PIPE, stderr=self.dev_null) # grep shows usage and calls exit(2) when called w/o arguments. 142 self.assertRaises(ScriptError, SCM.run_command, command_returns_non_zero, input=input_process.stdout)140 self.assertRaises(ScriptError, run_command, command_returns_non_zero, input=input_process.stdout) 143 141 144 142 def test_error_handlers(self): … … 149 147 """ 150 148 command_does_not_exist = ['does_not_exist', 'invalid_option'] 151 self.assertRaises(OSError, SCM.run_command, command_does_not_exist)152 self.assertRaises(OSError, SCM.run_command, command_does_not_exist, error_handler=ignore_error)149 self.assertRaises(OSError, run_command, command_does_not_exist) 150 self.assertRaises(OSError, run_command, command_does_not_exist, error_handler=ignore_error) 153 151 154 152 command_returns_non_zero = ['/bin/sh', '--invalid-option'] 155 self.assertRaises(ScriptError, SCM.run_command, command_returns_non_zero)153 self.assertRaises(ScriptError, run_command, command_returns_non_zero) 156 154 # Check if returns error text: 157 self.assertTrue( SCM.run_command(command_returns_non_zero, error_handler=ignore_error))155 self.assertTrue(run_command(command_returns_non_zero, error_handler=ignore_error)) 158 156 159 157 self.assertRaises(CheckoutNeedsUpdate, commit_error_handler, ScriptError(output=git_failure_message)) … … 366 364 """ 367 365 write_into_file_at_path('ChangeLog', first_entry) 368 run (['svn', 'add', 'ChangeLog'])369 run (['svn', 'commit', '--quiet', '--message', 'ChangeLog commit'])366 run_command(['svn', 'add', 'ChangeLog']) 367 run_command(['svn', 'commit', '--quiet', '--message', 'ChangeLog commit']) 370 368 371 369 # Patch files were created against just 'first_entry'. … … 373 371 changelog_contents = "%s\n%s" % (intermediate_entry, first_entry) 374 372 write_into_file_at_path('ChangeLog', changelog_contents) 375 run (['svn', 'commit', '--quiet', '--message', 'Intermediate commit'])373 run_command(['svn', 'commit', '--quiet', '--message', 'Intermediate commit']) 376 374 377 375 self._setup_webkittools_scripts_symlink(self.scm) … … 398 396 test_file_path = os.path.join(test_dir_path, 'test_file2') 399 397 write_into_file_at_path(test_file_path, 'test content') 400 run (['svn', 'add', 'test_dir'])398 run_command(['svn', 'add', 'test_dir']) 401 399 402 400 # create_patch depends on 'svn-create-patch', so make a dummy version. … … 443 441 def test_apply_svn_patch(self): 444 442 scm = detect_scm_system(self.svn_checkout_path) 445 patch = self._create_patch(run (['svn', 'diff', '-r4:3']))443 patch = self._create_patch(run_command(['svn', 'diff', '-r4:3'])) 446 444 self._setup_webkittools_scripts_symlink(scm) 447 445 scm.apply_patch(patch) … … 449 447 def test_apply_svn_patch_force(self): 450 448 scm = detect_scm_system(self.svn_checkout_path) 451 patch = self._create_patch(run (['svn', 'diff', '-r2:4']))449 patch = self._create_patch(run_command(['svn', 'diff', '-r2:4'])) 452 450 self._setup_webkittools_scripts_symlink(scm) 453 451 self.assertRaises(ScriptError, scm.apply_patch, patch, force=True) … … 478 476 479 477 def _tear_down_git_clone_of_svn_repository(self): 480 run (['rm', '-rf', self.git_checkout_path])478 run_command(['rm', '-rf', self.git_checkout_path]) 481 479 482 480 def setUp(self): … … 498 496 svn_test_file = os.path.join(self.svn_checkout_path, 'test_file') 499 497 write_into_file_at_path(svn_test_file, "svn_checkout") 500 run (['svn', 'commit', '--message', 'commit to conflict with git commit'], cwd=self.svn_checkout_path)498 run_command(['svn', 'commit', '--message', 'commit to conflict with git commit'], cwd=self.svn_checkout_path) 501 499 502 500 git_test_file = os.path.join(self.git_checkout_path, 'test_file') 503 501 write_into_file_at_path(git_test_file, "git_checkout") 504 run (['git', 'commit', '-a', '-m', 'commit to be thrown away by rebase abort'])502 run_command(['git', 'commit', '-a', '-m', 'commit to be thrown away by rebase abort']) 505 503 506 504 # --quiet doesn't make git svn silent, so use run_silent to redirect output … … 534 532 actual_commits = scm.commit_ids_from_commitish_arguments([commit_range]) 535 533 expected_commits = [] 536 expected_commits += reversed(run (['git', 'rev-list', commit_range]).splitlines())534 expected_commits += reversed(run_command(['git', 'rev-list', commit_range]).splitlines()) 537 535 538 536 self.assertEqual(actual_commits, expected_commits) … … 540 538 def test_apply_git_patch(self): 541 539 scm = detect_scm_system(self.git_checkout_path) 542 patch = self._create_patch(run (['git', 'diff', 'HEAD..HEAD^']))540 patch = self._create_patch(run_command(['git', 'diff', 'HEAD..HEAD^'])) 543 541 self._setup_webkittools_scripts_symlink(scm) 544 542 scm.apply_patch(patch) … … 546 544 def test_apply_git_patch_force(self): 547 545 scm = detect_scm_system(self.git_checkout_path) 548 patch = self._create_patch(run (['git', 'diff', 'HEAD~2..HEAD']))546 patch = self._create_patch(run_command(['git', 'diff', 'HEAD~2..HEAD'])) 549 547 self._setup_webkittools_scripts_symlink(scm) 550 548 self.assertRaises(ScriptError, scm.apply_patch, patch, force=True) … … 569 567 file_contents = ''.join(map(chr, range(256))) 570 568 write_into_file_at_path(test_file_path, file_contents) 571 run (['git', 'add', test_file_name])569 run_command(['git', 'add', test_file_name]) 572 570 patch = scm.create_patch() 573 571 self.assertTrue(re.search(r'\nliteral 0\n', patch)) … … 575 573 576 574 # Check if we can apply the created patch. 577 run (['git', 'rm', '-f', test_file_name])575 run_command(['git', 'rm', '-f', test_file_name]) 578 576 self._setup_webkittools_scripts_symlink(scm) 579 577 self.scm.apply_patch(self._create_patch(patch)) … … 582 580 # Check if we can create a patch from a local commit. 583 581 write_into_file_at_path(test_file_path, file_contents) 584 run (['git', 'add', test_file_name])585 run (['git', 'commit', '-m', 'binary diff'])582 run_command(['git', 'add', test_file_name]) 583 run_command(['git', 'commit', '-m', 'binary diff']) 586 584 patch_from_local_commit = scm.create_patch_from_local_commit('HEAD') 587 585 self.assertTrue(re.search(r'\nliteral 0\n', patch_from_local_commit)) -
trunk/WebKitTools/Scripts/modules/workqueue.py
r51622 r51888 36 36 37 37 from modules.logging import log, OutputTee 38 from modules. scmimport ScriptError38 from modules.processutils import ScriptError 39 39 from modules.statusbot import StatusBot 40 40 -
trunk/WebKitTools/Scripts/modules/workqueue_unittest.py
r51277 r51888 33 33 import unittest 34 34 35 from modules. scmimport ScriptError35 from modules.processutils import ScriptError 36 36 from modules.workqueue import WorkQueue, WorkQueueDelegate 37 37
Note: See TracChangeset
for help on using the changeset viewer.