You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/04/20 22:56:20 UTC

svn commit: r1095509 - in /subversion/trunk/subversion: libsvn_wc/wc_db.c tests/libsvn_wc/op-depth-test.c

Author: rhuijben
Date: Wed Apr 20 20:56:20 2011
New Revision: 1095509

URL: http://svn.apache.org/viewvc?rev=1095509&view=rev
Log:
Fix a copy over deletion issue identified by philipm.

This issue could only be triggered in the specific case identified here:
copying a node over a deletion of itself (same repos_relpath and revision)

* subversion/libsvn_wc/wc_db.c
  (op_depth_for_copy): We never want to return an op_depth lower then our
    current working layer, as that would hide the copy below our current
    node.

* subversion/tests/libsvn_wc/op-depth-test.c
  (test_funcs): Remove XFail from test_child_replace_with_same_origin.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1095509&r1=1095508&r2=1095509&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Apr 20 20:56:20 2011
@@ -2870,6 +2870,7 @@ op_depth_for_copy(apr_int64_t *op_depth,
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
   apr_int64_t incomplete_op_depth = -1;
+  apr_int64_t min_op_depth = 1; /* Never touch BASE */
 
   *op_depth = relpath_depth(local_relpath);
   *np_op_depth = -1;
@@ -2885,8 +2886,10 @@ op_depth_for_copy(apr_int64_t *op_depth,
     {
       svn_wc__db_status_t status = svn_sqlite__column_token(stmt, 1,
                                                             presence_map);
+
+      min_op_depth = svn_sqlite__column_int64(stmt, 0);
       if (status == svn_wc__db_status_incomplete)
-        incomplete_op_depth = svn_sqlite__column_int64(stmt, 0);
+        incomplete_op_depth = min_op_depth;
     }
   SVN_ERR(svn_sqlite__reset(stmt));
 
@@ -2905,6 +2908,12 @@ op_depth_for_copy(apr_int64_t *op_depth,
       if (err)
         SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
 
+      if (parent_op_depth < min_op_depth)
+        {
+          /* We want to create a copy; not overwrite the lower layers */
+          return SVN_NO_ERROR;
+        }
+
       if (status == svn_wc__db_status_added
           && ((incomplete_op_depth < 0)
               || (incomplete_op_depth == parent_op_depth)))

Modified: subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c?rev=1095509&r1=1095508&r2=1095509&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Wed Apr 20 20:56:20 2011
@@ -2952,7 +2952,7 @@ struct svn_test_descriptor_t test_funcs[
                        "test_children_of_replaced_dir"),
     SVN_TEST_OPTS_PASS(test_op_delete,
                        "test_op_delete"),
-    SVN_TEST_OPTS_XFAIL(test_child_replace_with_same_origin,
+    SVN_TEST_OPTS_PASS(test_child_replace_with_same_origin,
                        "test_child_replace_with_same"),
     SVN_TEST_NULL
   };