Author: philip
Date: Mon Dec 10 15:28:32 2012
New Revision: 1419520

URL: http://svn.apache.org/viewvc?rev=1419520&view=rev
Log:
If resolve adds a directory when following a move have it
extend any parent delete.

* subversion/libsvn_wc/wc_db_update_move.c
  (tc_editor_add_directory): Extend parent delete.
  (update_moved_away_dir): Add boolean parameter, invoke editor for adds.
  (update_moved_away_subtree): Add boolean parameter.

* subversion/tests/libsvn_wc/op-depth-test.c
  (move_update): Extend.

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

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c?rev=1419520&r1=1419519&r2=1419520&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Mon Dec 10 
15:28:32 2012
@@ -82,7 +82,15 @@ tc_editor_add_directory(void *baton,
                         svn_revnum_t replaces_rev,
                         apr_pool_t *scratch_pool)
 {
-  return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, NULL);
+  struct tc_editor_baton *b = baton;
+  int op_depth = relpath_depth(b->move_root_dst_relpath);
+
+  SVN_ERR(svn_wc__db_extend_parent_delete(b->wcroot, relpath, svn_kind_dir,
+                                          op_depth, scratch_pool));
+
+  /* ### TODO check for, and flag, tree conflict */
+
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *
@@ -676,6 +684,7 @@ update_moved_away_file(svn_editor_t *tc_
  */
 static svn_error_t *
 update_moved_away_dir(svn_editor_t *tc_editor,
+                      svn_boolean_t add,
                       const char *src_relpath,
                       const char *dst_relpath,
                       const char *move_root_dst_relpath,
@@ -684,6 +693,14 @@ update_moved_away_dir(svn_editor_t *tc_e
                       svn_wc__db_wcroot_t *wcroot,
                       apr_pool_t *scratch_pool)
 {
+  if (add)
+    /* ### TODO children and props */
+    SVN_ERR(svn_editor_add_directory(tc_editor, dst_relpath,
+                                     apr_array_make(scratch_pool, 0,
+                                                    sizeof (const char *)),
+                                     apr_hash_make(scratch_pool),
+                                     move_root_dst_revision));
+
   /* ### notify */
 
   /* ### update prop content if changed */
@@ -697,6 +714,7 @@ update_moved_away_dir(svn_editor_t *tc_e
  */
 static svn_error_t *
 update_moved_away_subtree(svn_editor_t *tc_editor,
+                          svn_boolean_t add,
                           const char *src_relpath,
                           const char *dst_relpath,
                           int src_op_depth,
@@ -710,7 +728,7 @@ update_moved_away_subtree(svn_editor_t *
   apr_pool_t *iterpool;
   apr_hash_index_t *hi;
 
-  SVN_ERR(update_moved_away_dir(tc_editor, src_relpath, dst_relpath,
+  SVN_ERR(update_moved_away_dir(tc_editor, add, src_relpath, dst_relpath,
                                 move_root_dst_relpath,
                                 move_root_dst_revision,
                                 db, wcroot, scratch_pool));
@@ -759,7 +777,7 @@ update_moved_away_subtree(svn_editor_t *
         }
       else if (*src_kind == svn_kind_dir)
         {
-          SVN_ERR(update_moved_away_subtree(tc_editor,
+          SVN_ERR(update_moved_away_subtree(tc_editor, is_add,
                                             child_src_relpath,
                                             child_dst_relpath,
                                             src_op_depth,
@@ -891,7 +909,8 @@ drive_tree_conflict_editor(svn_editor_t 
                                    dst_relpath, old_version->peg_rev,
                                    db, wcroot, scratch_pool));
   else if (old_version->node_kind == svn_node_dir)
-    SVN_ERR(update_moved_away_subtree(tc_editor, src_relpath, dst_relpath,
+    SVN_ERR(update_moved_away_subtree(tc_editor, FALSE,
+                                      src_relpath, dst_relpath,
                                       src_op_depth,
                                       dst_relpath, old_version->peg_rev,
                                       db, wcroot, scratch_pool));

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=1419520&r1=1419519&r2=1419520&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Mon Dec 10 
15:28:32 2012
@@ -4365,6 +4365,10 @@ move_update(const svn_test_opts_t *opts,
   SVN_ERR(sbox_wc_add(&b, "X/h"));
   SVN_ERR(sbox_wc_commit(&b, ""));
 
+  /* r5: Add a subtree 'A/B/C' */
+  SVN_ERR(sbox_wc_mkdir(&b, "A/B/C"));
+  SVN_ERR(sbox_wc_commit(&b, ""));
+
   SVN_ERR(sbox_wc_update(&b, "", 1));
 
   /* A is single-revision so A2 is a single-revision copy */
@@ -4585,6 +4589,41 @@ move_update(const svn_test_opts_t *opts,
     SVN_ERR(check_db_rows(&b, "", nodes));
   }
 
+  SVN_ERR(sbox_wc_update(&b, "", 5));
+  SVN_ERR(sbox_wc_resolve(&b, "A", svn_wc_conflict_choose_mine_conflict));
+  {
+    nodes_row_t nodes[] = {
+      {0, "",         "normal",       5, ""},
+      {0, "A",        "normal",       5, "A"},
+      {0, "A/B",      "normal",       5, "A/B"},
+      {0, "A/B/f",    "normal",       5, "A/B/f"},
+      {0, "A/B/g",    "normal",       5, "A/B/g"},
+      {0, "A/B/C",    "normal",       5, "A/B/C"},
+      {0, "X",        "normal",       5, "X"},
+      {0, "X/f",      "normal",       5, "X/f"},
+      {0, "X/g",      "normal",       5, "X/g"},
+      {0, "X/h",      "normal",       5, "X/h"},
+      {1, "A",        "base-deleted", NO_COPY_FROM, "A2"},
+      {1, "A/B",      "base-deleted", NO_COPY_FROM},
+      {1, "A/B/f",    "base-deleted", NO_COPY_FROM},
+      {1, "A/B/g",    "base-deleted", NO_COPY_FROM},
+      {1, "A/B/C",    "base-deleted", NO_COPY_FROM},
+      {1, "A2",       "normal",       5, "A", MOVED_HERE},
+      {1, "A2/B",     "normal",       5, "A/B", MOVED_HERE},
+      {1, "A2/B/f",   "normal",       5, "A/B/f", MOVED_HERE},
+      {1, "A2/B/g",   "normal",       5, "A/B/g", MOVED_HERE},
+      {1, "A2/B/C",   "normal",       5, "A/B/C", MOVED_HERE},
+      {2, "A2/B",     "normal",       4, "X"},
+      {2, "A2/B/f",   "normal",       4, "X/f"},
+      {2, "A2/B/g",   "normal",       4, "X/g"},
+      {2, "A2/B/h",   "normal",       4, "X/h"},
+      {2, "A2/B/C",   "base-deleted", NO_COPY_FROM},
+      {0}
+    };
+    SVN_ERR(check_db_rows(&b, "", nodes));
+  }
+
+
   return SVN_NO_ERROR;
 }
 


Reply via email to