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 00:23:37 UTC

svn commit: r1899012 - in /subversion/trunk/subversion/tests/cmdline: svntest/sandbox.py upgrade_tests.py

Author: danielsh
Date: Fri Mar 18 00:23:37 2022
New Revision: 1899012

URL: http://svn.apache.org/viewvc?rev=1899012&view=rev
Log:
tests: Prepare for verifying format numbers of external working copies.

Needed for SVN-4890 as well as for upgrade_tests.py basic_upgrade_1_0()
and upgrade_1_0_with_externals() (see r1899011).

* subversion/tests/cmdline/svntest/sandbox.py
  (read_wc_format): Rename to..
  (_wc_format_of): .. this new staticmethod.  Change signature.
  (read_wc_formats): New.
    Handles all .svn dirs rather than just the top-level one.

* subversion/tests/cmdline/upgrade_tests.py
  (check_format): Update caller.
    For now, the additional returned information is ignored.

Modified:
    subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
    subversion/trunk/subversion/tests/cmdline/upgrade_tests.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=1899012&r1=1899011&r2=1899012&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py Fri Mar 18 00:23:37 2022
@@ -600,15 +600,31 @@ class Sandbox:
                        self.read_only and "true" or "false"))
     pass
 
-  def read_wc_format(self):
+  @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(self.wc_dir, dot_svn, 'wc.db'))
+    db = svntest.sqlite3.connect(os.path.join(working_copy_root_path, dot_svn, 'wc.db'))
     c = db.cursor()
     c.execute('pragma user_version;')
     found_format = c.fetchone()[0]
     db.close()
     return found_format
 
+  def read_wc_formats(self):
+    """Return a dictionary mapping working copy root paths relative to wc_dir
+    to their format numbers.
+
+    The return value will always contain an empty string key.
+    """
+    dot_svn = svntest.main.get_admin_name()
+    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)
+    # r1898536
+    return ret
+
 def is_url(target):
   return (target.startswith('^/')
           or target.startswith('file://')

Modified: subversion/trunk/subversion/tests/cmdline/upgrade_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/upgrade_tests.py?rev=1899012&r1=1899011&r2=1899012&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/upgrade_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/upgrade_tests.py Fri Mar 18 00:23:37 2022
@@ -102,8 +102,8 @@ def replace_sbox_repo_with_tarfile(sbox,
   shutil.move(os.path.join(extract_dir, dir), sbox.repo_dir)
 
 def check_format(sbox, expected_format):
-  found_format = sbox.read_wc_format()
-  if found_format != expected_format:
+  formats = sbox.read_wc_formats()
+  if formats[''] != expected_format:
     raise svntest.Failure("found format '%d'; expected '%d'; in wc '%s'" %
                           (found_format, expected_format, sbox.wc_dir))