Author: philip
Date: Fri Jun 25 18:57:45 2010
New Revision: 958076

URL: http://svn.apache.org/viewvc?rev=958076&view=rev
Log:
Teach the testsuite to find the pristine text via the SHA1 checksum.
SVN_EXPERIMENTAL_PRISTINE now has 4 FAILs.

* subversion/libsvn_wc/adm_files.c:
  (init_adm): Don't create the text-base directory when
   SVN_EXPERIMENTAL_PRISTINE is enabled.

* subversion/tests/cmdline/svntest/wc.py
  (text_base_path): Query db to get checksum and hence pristine path

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_files.c
    subversion/trunk/subversion/tests/cmdline/svntest/wc.py

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=958076&r1=958075&r2=958076&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Fri Jun 25 18:57:45 2010
@@ -771,8 +771,14 @@ init_adm(svn_wc__db_t *db,
 
   /** Make subdirectories. ***/
 
+#ifndef SVN_EXPERIMENTAL_PRISTINE
+  /* ### The absence of this directory is used to indicate to the
+     ### regression tests that SHA1 pristines are enabled.  This is a
+     ### temporary hack, to avoid bumping the wc format. */
+
   /* SVN_WC__ADM_TEXT_BASE */
   SVN_ERR(make_adm_subdir(local_abspath, SVN_WC__ADM_TEXT_BASE, FALSE, pool));
+#endif
 
   /* SVN_WC__ADM_PROP_BASE */
   SVN_ERR(make_adm_subdir(local_abspath, SVN_WC__ADM_PROP_BASE, FALSE, pool));

Modified: subversion/trunk/subversion/tests/cmdline/svntest/wc.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/wc.py?rev=958076&r1=958075&r2=958076&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/wc.py Fri Jun 25 18:57:45 
2010
@@ -820,8 +820,31 @@ def text_base_path(file_path):
   """Return the path to the text-base file for the versioned file
      FILE_PATH."""
   dot_svn = svntest.main.get_admin_name()
-  return os.path.join(os.path.dirname(file_path), dot_svn, 'text-base',
-                      os.path.basename(file_path) + '.svn-base')
+  parent_path, file_name = os.path.split(file_path)
+
+  ### Temporary until the wc format changes.
+  text_base_path = os.path.join(parent_path, dot_svn, 'text-base')
+  if os.path.exists(text_base_path):
+    return os.path.join(text_base_path, file_name + '.svn-base')
+
+  db_path = os.path.join(parent_path, dot_svn, 'wc.db')
+  db = svntest.sqlite3.connect(db_path)
+  c = db.cursor()
+  c.execute("""select checksum from working_node
+               where local_relpath = '""" + file_name + """'""")
+  checksum = c.fetchone()
+  if checksum is None:
+    c.execute("""select checksum from base_node
+                 where local_relpath = '""" + file_name + """'""")
+    checksum = c.fetchone()[0]
+  if checksum is not None and checksum[0:6] == "$md5 $":
+    c.execute("""select checksum from pristine
+                 where md5_checksum = '""" + checksum + """'""")
+    checksum = c.fetchone()[0]
+  if checksum is None:
+    raise svntest.Failure("No SHA1 checksum for " + file_path)
+  db.close()
+  return os.path.join(parent_path, dot_svn, 'pristine', checksum[6:])
 
 
 # ------------


Reply via email to