scm.add() doesn't work properly with svn 1.7
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 May 2012 02:05:10 +0000 (02:05 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 May 2012 02:05:10 +0000 (02:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86779

Reviewed by Ojan Vafai.

The code relied on '.svn' directories being present
in order to tell if a directory had already been added to the
repository; this is no longer true in SVN 1.7.

* Scripts/webkitpy/common/checkout/scm/scm.py:
(SCM):
(SCM.in_working_directory):
* Scripts/webkitpy/common/checkout/scm/svn.py:
(SVN):
(SVN.in_working_directory):

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

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

index c420ad3..a1cb1c7 100644 (file)
@@ -1,3 +1,21 @@
+2012-05-17  Dirk Pranke  <dpranke@chromium.org>
+
+        scm.add() doesn't work properly with svn 1.7
+        https://bugs.webkit.org/show_bug.cgi?id=86779
+
+        Reviewed by Ojan Vafai.
+
+        The code relied on '.svn' directories being present
+        in order to tell if a directory had already been added to the
+        repository; this is no longer true in SVN 1.7.
+
+        * Scripts/webkitpy/common/checkout/scm/scm.py:
+        (SCM):
+        (SCM.in_working_directory):
+        * Scripts/webkitpy/common/checkout/scm/svn.py:
+        (SVN):
+        (SVN.in_working_directory):
+
 2012-05-17  Jon Lee  <jonlee@apple.com>
 
         Update Apple buildbots to prioritize latest changelists
index cbce361..9ff9e5f 100644 (file)
@@ -133,8 +133,8 @@ class SCM:
     def _subclass_must_implement():
         raise NotImplementedError("subclasses must implement")
 
-    @staticmethod
-    def in_working_directory(path):
+    @classmethod
+    def in_working_directory(cls, path):
         SCM._subclass_must_implement()
 
     def find_checkout_root(path):
index af03f8d..6d3c3c1 100644 (file)
@@ -82,9 +82,16 @@ class SVN(SCM, SVNRepository):
         else:
             self._patch_directories = patch_directories
 
-    @staticmethod
-    def in_working_directory(path):
-        return os.path.isdir(os.path.join(path, '.svn'))
+    @classmethod
+    def in_working_directory(cls, path):
+        if os.path.isdir(os.path.join(path, '.svn')):
+            # This is a fast shortcut for svn info that is usually correct for SVN < 1.7,
+            # but doesn't work for SVN >= 1.7.
+            return True
+
+        svn_info_args = [cls.executable_name, 'info', path]
+        exit_code = Executive().run_command(svn_info_args, return_exit_code=True)
+        return (exit_code == 0)
 
     def find_uuid(self, path):
         if not self.in_working_directory(path):