Changeset 55131 in webkit
- Timestamp:
- Feb 23, 2010 1:31:04 AM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r55123 r55131 1 2010-02-23 Daniel Bates <dbates@rim.com> 2 3 Reviewed by Eric Seidel. 4 5 https://bugs.webkit.org/show_bug.cgi?id=34439 6 7 Prompts a person for their SVN username if not already cached (by Subversion). 8 9 Currently, webkit-patch is unable to commit to the SVN repo. unless the 10 WebKit SVN username is already cached (from of a prior commit by hand) 11 because "svn commit" (called by webkit-patch) defaults to using the system 12 login name unless the username is already cached or specified on the 13 command line. 14 15 * Scripts/webkitpy/scm.py: Added methods SVN.has_authorization_for_realm and 16 modified SVN.commit_with_message to call it. Added optional username parameter 17 to method SVN.commit_with_message. 18 * Scripts/webkitpy/scm_unittest.py: Added unit test methods: SVNTest.test_commit_with_username, 19 SVNTest.test_has_authorization_for_realm, and SVNTest.test_not_have_authorization_for_realm. 20 1 21 2010-02-22 Dirk Pranke <dpranke@chromium.org> 2 22 -
trunk/WebKitTools/Scripts/webkitpy/scm.py
r53609 r55131 37 37 from webkitpy.changelogs import ChangeLog 38 38 from webkitpy.executive import Executive, run_command, ScriptError 39 from webkitpy.user import User 39 40 from webkitpy.webkit_logging import error, log 40 41 … … 257 258 258 259 class SVN(SCM): 260 # FIXME: We should move these values to a WebKit-specific config. file. 261 svn_server_host = "svn.webkit.org" 262 svn_server_realm = "<http://svn.webkit.org:80> Mac OS Forge" 263 259 264 def __init__(self, cwd, dryrun=False): 260 265 SCM.__init__(self, cwd, dryrun) … … 300 305 return "^Committed revision (?P<svn_revision>\d+)\.$" 301 306 307 def has_authorization_for_realm(self, realm=svn_server_realm, home_directory=os.getenv("HOME")): 308 # Assumes find and grep are installed. 309 if not os.path.isdir(os.path.join(home_directory, ".subversion")): 310 return False 311 find_args = ["find", ".subversion", "-type", "f", "-exec", "grep", "-q", realm, "{}", ";", "-print"]; 312 find_output = run_command(find_args, cwd=home_directory, error_handler=Executive.ignore_error).rstrip() 313 return find_output and os.path.isfile(os.path.join(home_directory, find_output)) 314 302 315 def svn_version(self): 303 316 if not self.cached_version: … … 348 361 run_command(['svn', 'revert'] + file_paths) 349 362 350 def commit_with_message(self, message ):363 def commit_with_message(self, message, username): 351 364 if self.dryrun: 352 365 # Return a string which looks like a commit so that things which parse this output will succeed. 353 366 return "Dry run, no commit.\nCommitted revision 0." 354 return run_command(['svn', 'commit', '-m', message], error_handler=commit_error_handler) 367 svn_commit_args = ["svn", "commit"] 368 if not username and not self.has_authorization_for_realm(): 369 username = User.prompt("%s login: " % self.svn_server_host, repeat=5) 370 if not username: 371 raise Exception("You need to specify the username on %s to perform the commit as." % self.svn_server_host) 372 if username: 373 svn_commit_args.extend(["--username", username]) 374 svn_commit_args.extend(["-m", message]) 375 return run_command(svn_commit_args, error_handler=commit_error_handler) 355 376 356 377 def svn_commit_log(self, svn_revision): -
trunk/WebKitTools/Scripts/webkitpy/scm_unittest.py
r53609 r55131 40 40 from datetime import date 41 41 from webkitpy.executive import Executive, run_command, ScriptError 42 from webkitpy.scm import detect_scm_system, SCM, CheckoutNeedsUpdate, commit_error_handler42 from webkitpy.scm import detect_scm_system, SCM, SVN, CheckoutNeedsUpdate, commit_error_handler 43 43 from webkitpy.bugzilla import Attachment # FIXME: This should not be needed 44 44 … … 181 181 # Tests which both GitTest and SVNTest should run. 182 182 # FIXME: There must be a simpler way to add these w/o adding a wrapper method to both subclasses 183 def _shared_test_commit_with_message(self ):183 def _shared_test_commit_with_message(self, username): 184 184 write_into_file_at_path('test_file', 'more test content') 185 commit_text = self.scm.commit_with_message( 'another test commit')185 commit_text = self.scm.commit_with_message("another test commit", username) 186 186 self.assertEqual(self.scm.svn_revision_from_commit_text(commit_text), '5') 187 187 188 188 self.scm.dryrun = True 189 189 write_into_file_at_path('test_file', 'still more test content') 190 commit_text = self.scm.commit_with_message( 'yet another test commit')190 commit_text = self.scm.commit_with_message("yet another test commit", username) 191 191 self.assertEqual(self.scm.svn_revision_from_commit_text(commit_text), '0') 192 192 … … 460 460 self._shared_test_commit_with_message() 461 461 462 def test_commit_with_username(self): 463 self._shared_test_commit_with_message("dbates@webkit.org") 464 465 def test_has_authorization_for_realm(self): 466 scm = detect_scm_system(self.svn_checkout_path) 467 fake_home_dir = tempfile.mkdtemp(suffix="fake_home_dir") 468 svn_config_dir_path = os.path.join(fake_home_dir, ".subversion") 469 os.mkdir(svn_config_dir_path) 470 fake_webkit_auth_file = os.path.join(svn_config_dir_path, "fake_webkit_auth_file") 471 write_into_file_at_path(fake_webkit_auth_file, SVN.svn_server_realm) 472 self.assertTrue(scm.has_authorization_for_realm(home_directory=fake_home_dir)) 473 os.remove(fake_webkit_auth_file) 474 os.rmdir(svn_config_dir_path) 475 os.rmdir(fake_home_dir) 476 477 def test_not_have_authorization_for_realm(self): 478 scm = detect_scm_system(self.svn_checkout_path) 479 fake_home_dir = tempfile.mkdtemp(suffix="fake_home_dir") 480 svn_config_dir_path = os.path.join(fake_home_dir, ".subversion") 481 os.mkdir(svn_config_dir_path) 482 self.assertFalse(scm.has_authorization_for_realm(home_directory=fake_home_dir)) 483 os.rmdir(svn_config_dir_path) 484 os.rmdir(fake_home_dir) 485 462 486 def test_reverse_diff(self): 463 487 self._shared_test_reverse_diff()
Note: See TracChangeset
for help on using the changeset viewer.