You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2022/03/18 01:02:10 UTC

svn commit: r1899015 - /subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py

Author: danielsh
Date: Fri Mar 18 01:02:10 2022
New Revision: 1899015

URL: http://svn.apache.org/viewvc?rev=1899015&view=rev
Log:
tests: Minor fix to a new helper function.

Required for the upcoming upgrade_tests.py changes.

* subversion/tests/cmdline/svntest/sandbox.py
  (Sandbox._wc_format_of): Change signature.
  (Sandbox.read_wc_formats): Don't auto-create empty wc.db files.

Modified:
    subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py

Modified: subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py?rev=1899015&r1=1899014&r2=1899015&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py Fri Mar 18 01:02:10 2022
@@ -601,10 +601,9 @@ class Sandbox:
     pass
 
   @staticmethod
-  def _wc_format_of(working_copy_root_path):
-    """Return the working copy format of the given working copy."""
-    dot_svn = svntest.main.get_admin_name()
-    db = svntest.sqlite3.connect(os.path.join(working_copy_root_path, dot_svn, 'wc.db'))
+  def _wc_format_of(wc_db_path):
+    """Return the working copy format of the given wc.db file."""
+    db = svntest.sqlite3.connect(wc_db_path)
     c = db.cursor()
     c.execute('pragma user_version;')
     found_format = c.fetchone()[0]
@@ -621,7 +620,11 @@ class Sandbox:
     ret = dict()
     for root, dirs, files in os.walk(self.wc_dir):
       if dot_svn in dirs:
-        ret[root[len(self.wc_dir)+1:]] = self._wc_format_of(root)
+        wc_db_path = os.path.join(root, dot_svn, 'wc.db')
+        # If we didn't check existence, wc.db would be auto-created if .svn
+        # exists and .svn/wc.db doesn't.
+        if os.path.exists(wc_db_path):
+          ret[root[len(self.wc_dir)+1:]] = self._wc_format_of(wc_db_path)
     # r1898536
     return ret