Fixing AuthenticationError when running test-webkitpy as a non-committer.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jan 2013 03:18:36 +0000 (03:18 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jan 2013 03:18:36 +0000 (03:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=106420

Patch by Tim 'mithro' Ansell <mithro@mithis.com> on 2013-01-10
Reviewed by Eric Seidel.

* Scripts/webkitpy/common/checkout/scm/git.py:
(Git.push_local_commits_to_server):
* Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
* Scripts/webkitpy/common/checkout/scm/svn.py:
(SVNRepository):
(SVNRepository.has_authorization_for_realm):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139399 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/common/checkout/scm/git.py
Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py
Tools/Scripts/webkitpy/common/checkout/scm/svn.py

index a49d40e..2b07431 100644 (file)
@@ -1,3 +1,17 @@
+2013-01-10  Tim 'mithro' Ansell  <mithro@mithis.com>
+
+        Fixing AuthenticationError when running test-webkitpy as a non-committer.
+        https://bugs.webkit.org/show_bug.cgi?id=106420
+
+        Reviewed by Eric Seidel.
+
+        * Scripts/webkitpy/common/checkout/scm/git.py:
+        (Git.push_local_commits_to_server):
+        * Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
+        * Scripts/webkitpy/common/checkout/scm/svn.py:
+        (SVNRepository):
+        (SVNRepository.has_authorization_for_realm):
+
 2013-01-10  Christophe Dumez  <christophe.dumez@intel.com>
 
         [EFL][jhbuild] Use tarballs for gstreamer instead of git
index e8f14de..6b8f38f 100644 (file)
@@ -452,8 +452,8 @@ class Git(SCM, SVNRepository):
 
     def push_local_commits_to_server(self, username=None, password=None):
         dcommit_command = ['svn', 'dcommit']
-        if (not username or not password) and not self.has_authorization_for_realm(SVN.svn_server_realm):
-            raise AuthenticationError(SVN.svn_server_host, prompt_for_password=True)
+        if (not username or not password) and not self.has_authorization_for_realm(self.svn_server_realm):
+            raise AuthenticationError(self.svn_server_host, prompt_for_password=True)
         if username:
             dcommit_command.extend(["--username", username])
         output = self._run_git(dcommit_command, error_handler=commit_error_handler, input=password)
index 4feb430..e5ddce0 100644 (file)
@@ -125,7 +125,7 @@ def _git_diff(*args):
 
 
 # Exists to share svn repository creation code between the git and svn tests
-class SVNTestRepository:
+class SVNTestRepository(object):
     @classmethod
     def _svn_add(cls, path):
         run_command(["svn", "add", path])
@@ -626,6 +626,7 @@ class SVNTest(SCMTest):
         SVNTestRepository.setup(self)
         os.chdir(self.svn_checkout_path)
         self.scm = detect_scm_system(self.svn_checkout_path)
+        self.scm.svn_server_realm = None
         # For historical reasons, we test some checkout code here too.
         self.checkout = Checkout(self.scm)
 
@@ -714,7 +715,7 @@ Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA==
         self._shared_test_commit_with_message("dbates@webkit.org")
 
     def test_commit_without_authorization(self):
-        self.scm.has_authorization_for_realm = lambda realm: False
+        self.scm.svn_server_realm = SVN.svn_server_realm
         self.assertRaises(AuthenticationError, self._shared_test_commit_with_message)
 
     def test_has_authorization_for_realm_using_credentials_with_passtype(self):
@@ -1004,7 +1005,7 @@ class GitTest(SCMTest):
 
     def test_head_svn_revision(self):
         scm = detect_scm_system(self.untracking_checkout_path)
-        # If we cloned a git repo tracking an SVG repo, this would give the same result as
+        # If we cloned a git repo tracking an SVN repo, this would give the same result as
         # self._shared_test_head_svn_revision().
         self.assertEqual(scm.head_svn_revision(), '')
 
@@ -1038,6 +1039,7 @@ class GitSVNTest(SCMTest):
         SVNTestRepository.setup(self)
         self._setup_git_checkout()
         self.scm = detect_scm_system(self.git_checkout_path)
+        self.scm.svn_server_realm = None
         # For historical reasons, we test some checkout code here too.
         self.checkout = Checkout(self.scm)
 
index 1323b70..c8c0bc9 100644 (file)
@@ -43,8 +43,15 @@ _log = logging.getLogger(__name__)
 
 
 # A mixin class that represents common functionality for SVN and Git-SVN.
-class SVNRepository:
+class SVNRepository(object):
+    # FIXME: These belong in common.config.urls
+    svn_server_host = "svn.webkit.org"
+    svn_server_realm = "<http://svn.webkit.org:80> Mac OS Forge"
+
     def has_authorization_for_realm(self, realm, home_directory=os.getenv("HOME")):
+        # If we are working on a file:// repository realm will be None
+        if realm is None:
+            return True
         # ignore false positives for methods implemented in the mixee class. pylint: disable-msg=E1101
         # Assumes find and grep are installed.
         if not os.path.isdir(os.path.join(home_directory, ".subversion")):
@@ -63,9 +70,6 @@ class SVNRepository:
 
 
 class SVN(SCM, SVNRepository):
-    # FIXME: These belong in common.config.urls
-    svn_server_host = "svn.webkit.org"
-    svn_server_realm = "<http://svn.webkit.org:80> Mac OS Forge"
 
     executable_name = "svn"