Author: julianfoad
Date: Fri Jul 30 10:04:38 2010
New Revision: 980716

URL: http://svn.apache.org/viewvc?rev=980716&view=rev
Log:
Don't delete pristine texts while there are items in the work queue, because
the work queue might contain references to those texts.  This fixes the
regression test basic_tests 52 and two swig-rb tests that have been failing
in this way for some time.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_pristine_remove): If the work queue is not empty, don't delete
    the pristine text.

* subversion/tests/cmdline/basic_tests.py
  (delete_and_add_same_file): Tweak comments.
  (test_list): Remove "XFail" from delete_and_add_same_file.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/tests/cmdline/basic_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=980716&r1=980715&r2=980716&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Jul 30 10:04:38 2010
@@ -2727,6 +2727,21 @@ svn_wc__db_pristine_remove(svn_wc__db_t 
                               scratch_pool, scratch_pool));
   VERIFY_USABLE_PDH(pdh);
 
+  /* If the work queue is not empty, don't delete any pristine text because
+   * the work queue may contain a reference to it. */
+  {
+    svn_sqlite__stmt_t *stmt;
+    svn_boolean_t have_row;
+
+    SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+                                      STMT_LOOK_FOR_WORK));
+    SVN_ERR(svn_sqlite__step(&have_row, stmt));
+    SVN_ERR(svn_sqlite__reset(stmt));
+
+    if (have_row)
+      return SVN_NO_ERROR;
+  }
+
   /* Find whether the SHA-1 (or the MD-5) is referenced; set IS_REFERENCED. */
   {
     const svn_checksum_t *md5_checksum;

Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=980716&r1=980715&r2=980716&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Fri Jul 30 
10:04:38 2010
@@ -2521,7 +2521,7 @@ def meta_correct_library_being_used(sbox
                                      expected_output, [], '--version')
 
 def delete_and_add_same_file(sbox):
-  "delete and add the same file in one commit"
+  "delete and add a file with the same content in one commit"
   sbox.build()
 
   wc_dir = sbox.wc_dir
@@ -2543,7 +2543,8 @@ def delete_and_add_same_file(sbox):
   expected_status.remove('iota')
   expected_status.add({ 'iota2':  Item(status='  ', wc_rev='2')})
 
-  # Currently this commit fails with a
+  # At one time the commit post-processing used to fail with "Pristine text
+  # not found".
   svntest.actions.run_and_verify_commit(wc_dir,
                                         expected_output,
                                         expected_status,
@@ -2609,7 +2610,7 @@ test_list = [ None,
               delete_from_url_with_spaces,
               SkipUnless(meta_correct_library_being_used,
                          svntest.main.is_ra_type_dav),
-              XFail(delete_and_add_same_file),
+              delete_and_add_same_file,
              ]
 
 if __name__ == '__main__':


Reply via email to