Author: philip
Date: Fri Oct 22 11:38:54 2010
New Revision: 1026303

URL: http://svn.apache.org/viewvc?rev=1026303&view=rev
Log:
Delete should only rewrite the op_depth of some working nodes and no
base nodes.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_CHILDREN_OP_DEPTH_RECURSIVE): Rename to ...
  (STMT_SELECT_WORKING_OP_DEPTH_RECURSIVE): ... this, select presence, add
   condition.

* subversion/libsvn_wc/wc_db.c
  (copy_working_from_base): Don't update op_depth for excluded nodes.

* subversion/tests/cmdline/basic_tests.py
  (delete_child_parent_update): Expect a tree conflict.
  (test_list): Remove XFail.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/tests/cmdline/basic_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1026303&r1=1026302&r2=1026303&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Oct 22 11:38:54 
2010
@@ -480,11 +480,12 @@ WHERE wc_id = ?1 AND local_relpath = ?2;
   AND op_depth = (SELECT MAX(op_depth) FROM nodes
                   WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0);
 
--- STMT_SELECT_CHILDREN_OP_DEPTH_RECURSIVE
-SELECT local_relpath, op_depth FROM nodes as node
+-- STMT_SELECT_WORKING_OP_DEPTH_RECURSIVE
+SELECT local_relpath, op_depth, presence FROM nodes as node
 WHERE wc_id = ?1 AND local_relpath LIKE ?2 ESCAPE '#'
   AND op_depth = (SELECT MAX(op_depth) FROM nodes
-                  WHERE wc_id = node.wc_id
+                  WHERE op_depth > 0
+                    AND wc_id = node.wc_id
                     AND local_relpath = node.local_relpath);
 
 -- STMT_UPDATE_OP_DEPTH

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1026303&r1=1026302&r2=1026303&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Oct 22 11:38:54 2010
@@ -802,16 +802,23 @@ copy_working_from_base(void *baton,
      ### only gets written once. */
   like_arg = construct_like_arg(piwb->local_relpath, scratch_pool);
   SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
-                                    STMT_SELECT_CHILDREN_OP_DEPTH_RECURSIVE));
+                                    STMT_SELECT_WORKING_OP_DEPTH_RECURSIVE));
   SVN_ERR(svn_sqlite__bindf(stmt, "is", piwb->wc_id, like_arg));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   nodes = apr_array_make(scratch_pool, 10, sizeof(struct relpath_op_depth_t 
*));
   while (have_row)
     {
-      struct relpath_op_depth_t *rod = apr_palloc(scratch_pool, sizeof(*rod));
-      rod->local_relpath = svn_sqlite__column_text(stmt, 0, scratch_pool);
-      rod->op_depth = svn_sqlite__column_int64(stmt, 1);
-      APR_ARRAY_PUSH(nodes, struct relpath_op_depth_t *) = rod;
+      int op_depth = svn_sqlite__column_int64(stmt, 1);
+      svn_wc__db_status_t status = svn_sqlite__column_token(stmt, 2,
+                                                            presence_map);
+      if (status != svn_wc__db_status_excluded)
+        {
+          struct relpath_op_depth_t *rod = apr_palloc(scratch_pool,
+                                                      sizeof(*rod));
+          rod->local_relpath = svn_sqlite__column_text(stmt, 0, scratch_pool);
+          rod->op_depth = op_depth;
+          APR_ARRAY_PUSH(nodes, struct relpath_op_depth_t *) = rod;
+        }
       SVN_ERR(svn_sqlite__step(&have_row, stmt));
     }
   SVN_ERR(svn_sqlite__reset(stmt));

Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1026303&r1=1026302&r2=1026303&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Fri Oct 22 
11:38:54 2010
@@ -2575,13 +2575,14 @@ def delete_child_parent_update(sbox):
   svntest.main.run_svn(wc_dir, 'rm', sbox.ospath('A/B/E'))
   expected_status.tweak('A/B/E', 'A/B/E/beta', status='D ')
 
-  # This fails because A/B/E/alpha shows up as deleted.
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
   expected_disk = svntest.main.greek_state.copy()
   expected_disk.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E')
 
-  # This fails with an assert that A/B/E/alpha has no base node.
+  # This produces a tree-conflict
+  expected_status.tweak(wc_rev=2)
+  expected_status.tweak('A/B/E', treeconflict='C')
   svntest.actions.run_and_verify_update(wc_dir,
                                         [],
                                         expected_disk,
@@ -2649,7 +2650,7 @@ test_list = [ None,
               SkipUnless(meta_correct_library_being_used,
                          svntest.main.is_ra_type_dav),
               delete_and_add_same_file,
-              XFail(delete_child_parent_update),
+              delete_child_parent_update,
              ]
 
 if __name__ == '__main__':


Reply via email to