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

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

Author: philip
Date: Tue Dec 13 11:20:48 2011
New Revision: 1213651

URL: http://svn.apache.org/viewvc?rev=1213651&view=rev
Log:
Set NODES.moved_here on shadowed layers.  This means that moved_here
for nested moves no longer depends on the order of the moves.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_op_copy_shadowed_layer): Add parameter.
 
* subversion/libsvn_wc/copy.c
  (copy_versioned_dir): Pass parameter.

* subversion/libsvn_wc/wc_db.c
  (db_op_copy_shadowed_layer): Add parameter and use it to set moved_here.
  (op_copy_shadowed_layer_txn): Pass parameter.
  (svn_wc__db_op_copy_shadowed_layer): Add parameter, set baton member.

* subversion/tests/libsvn_wc/op-depth-test.c
  (test_wc_move): Adjust expectations, still XFAIL.
  (nested_moves_child_first): Adjust expectations, add revert test.
  (nested_moves_child_last): Adjust expectations, add revert test.
  (move_to_swap): Adjust expectations.
  (test_funcs): Mark nested_moves_child_last, move_to_swap PASS.

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

Modified: subversion/trunk/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/copy.c?rev=1213651&r1=1213650&r2=1213651&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/copy.c (original)
+++ subversion/trunk/subversion/libsvn_wc/copy.c Tue Dec 13 11:20:48 2011
@@ -435,6 +435,7 @@ copy_versioned_dir(svn_wc__db_t *db,
         SVN_ERR(svn_wc__db_op_copy_shadowed_layer(db,
                                                   child_src_abspath,
                                                   child_dst_abspath,
+                                                  is_move,
                                                   scratch_pool));
 
       if (child_status == svn_wc__db_status_normal

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1213651&r1=1213650&r2=1213651&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Dec 13 11:20:48 2011
@@ -3781,6 +3781,7 @@ db_op_copy_shadowed_layer(svn_wc__db_wcr
                           apr_int64_t repos_id,
                           const char *repos_relpath,
                           svn_revnum_t revision,
+                          svn_boolean_t is_move,
                           apr_pool_t *scratch_pool)
 {
   const apr_array_header_t *children;
@@ -3898,13 +3899,15 @@ db_op_copy_shadowed_layer(svn_wc__db_wcr
         SVN_ERR(svn_sqlite__get_statement(&stmt, src_wcroot->sdb,
                              STMT_INSERT_WORKING_NODE_COPY_FROM_BASE));
 
+      /* Perhaps we should avoid setting moved_here to 0 and leave it
+         null instead? */
       SVN_ERR(svn_sqlite__bindf(stmt, "issisti",
                         src_wcroot->wc_id, src_relpath,
                         dst_relpath,
                         dst_op_depth,
                         svn_relpath_dirname(dst_relpath, iterpool),
                         presence_map, dst_presence,
-                        (apr_int64_t)0));
+                        (apr_int64_t)(is_move ? 1 : 0)));
 
       if (src_op_depth > 0)
         SVN_ERR(svn_sqlite__bind_int64(stmt, 8, src_op_depth));
@@ -3965,7 +3968,7 @@ db_op_copy_shadowed_layer(svn_wc__db_wcr
                          src_wcroot, child_src_relpath, src_op_depth,
                          dst_wcroot, child_dst_relpath, dst_op_depth,
                          del_op_depth,
-                         repos_id, child_repos_relpath, revision,
+                         repos_id, child_repos_relpath, revision, is_move,
                          scratch_pool));
     }
 
@@ -4040,7 +4043,7 @@ op_copy_shadowed_layer_txn(void * baton,
                         ocb->src_wcroot, ocb->src_relpath, src_op_depth,
                         ocb->dst_wcroot, ocb->dst_relpath, dst_op_depth,
                         del_op_depth,
-                        repos_id, repos_relpath, revision,
+                        repos_id, repos_relpath, revision, ocb->is_move,
                         scratch_pool));
 
   return SVN_NO_ERROR;
@@ -4050,6 +4053,7 @@ svn_error_t *
 svn_wc__db_op_copy_shadowed_layer(svn_wc__db_t *db,
                                   const char *src_abspath,
                                   const char *dst_abspath,
+                                  svn_boolean_t is_move,
                                   apr_pool_t *scratch_pool)
 {
   struct op_copy_baton ocb = {0};
@@ -4069,6 +4073,7 @@ svn_wc__db_op_copy_shadowed_layer(svn_wc
                                                 scratch_pool, scratch_pool));
   VERIFY_USABLE_WCROOT(ocb.dst_wcroot);
 
+  ocb.is_move = is_move;
   ocb.work_items = NULL;
 
   /* Call with the sdb in src_wcroot. It might call itself again to

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1213651&r1=1213650&r2=1213651&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue Dec 13 11:20:48 2011
@@ -1238,6 +1238,7 @@ svn_error_t *
 svn_wc__db_op_copy_shadowed_layer(svn_wc__db_t *db,
                                   const char *src_abspath,
                                   const char *dst_abspath,
+                                  svn_boolean_t is_move,
                                   apr_pool_t *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=1213651&r1=1213650&r2=1213651&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Tue Dec 13 11:20:48 2011
@@ -1731,7 +1731,7 @@ test_wc_move(const svn_test_opts_t *opts
       { 2, "A/B",             "base-deleted", NO_COPY_FROM },
       { 2, "A/B/C",           "base-deleted", NO_COPY_FROM },
       { 2, "A/B-move",        "normal",       1, "A/B", MOVED_HERE },
-      { 2, "A/B-move/C",      "normal",       1, "A/B/C" },
+      { 2, "A/B-move/C",      "normal",       1, "A/B/C", MOVED_HERE },
       { 3, "A/B-move/C",      "base-deleted", NO_COPY_FROM },
       { 3, "A/B-move/C-move", "normal",       1, "A/B/C", MOVED_HERE },
       { 0 }
@@ -3790,7 +3790,7 @@ nested_moves_child_first(const svn_test_
       {2, "A/B",     "base-deleted", NO_COPY_FROM},
       {2, "A/B/C",   "base-deleted", NO_COPY_FROM},
       {2, "A/B2",    "normal",       1, "A/B",   MOVED_HERE},
-      {2, "A/B2/C",  "normal",       1, "A/B/C"},
+      {2, "A/B2/C",  "normal",       1, "A/B/C", MOVED_HERE},
       {3, "A/B2/C",  "base-deleted", NO_COPY_FROM},
       {3, "A/B2/C2", "normal",       1, "A/B/C", MOVED_HERE},
       {0}
@@ -3808,12 +3808,12 @@ nested_moves_child_first(const svn_test_
       {1, "A/B",     "base-deleted", NO_COPY_FROM},
       {1, "A/B/C",   "base-deleted", NO_COPY_FROM},
       {1, "A2",      "normal",       1, "A",     MOVED_HERE},
-      {1, "A2/B",    "normal",       1, "A/B"},
-      {1, "A2/B/C",  "normal",       1, "A/B/C"},
+      {1, "A2/B",    "normal",       1, "A/B",   MOVED_HERE},
+      {1, "A2/B/C",  "normal",       1, "A/B/C", MOVED_HERE},
       {2, "A2/B",    "base-deleted", NO_COPY_FROM},
       {2, "A2/B/C",  "base-deleted", NO_COPY_FROM},
       {2, "A2/B2",   "normal",       1, "A/B",   MOVED_HERE},
-      {2, "A2/B2/C", "normal",       1, "A/B/C"},
+      {2, "A2/B2/C", "normal",       1, "A/B/C", MOVED_HERE},
       {3, "A2/B2/C", "base-deleted", NO_COPY_FROM},
       {3, "A2/B2/C2","normal",       1, "A/B/C", MOVED_HERE},
       {0}
@@ -3821,6 +3821,26 @@ nested_moves_child_first(const svn_test_
     SVN_ERR(check_db_rows(&b, "", nodes));
   }
 
+  /* Revert should leave the A to A2 move */
+  SVN_ERR(wc_revert(&b, "A2/B2", svn_depth_infinity));
+  SVN_ERR(wc_revert(&b, "A2/B", svn_depth_infinity));
+  {
+    nodes_row_t nodes[] = {
+      {0, "",        "normal",       1, ""},
+      {0, "A",       "normal",       1, "A",     FALSE, "A2"},
+      {0, "A/B",     "normal",       1, "A/B"},
+      {0, "A/B/C",   "normal",       1, "A/B/C"},
+      {1, "A",       "base-deleted", NO_COPY_FROM},
+      {1, "A/B",     "base-deleted", NO_COPY_FROM},
+      {1, "A/B/C",   "base-deleted", NO_COPY_FROM},
+      {1, "A2",      "normal",       1, "A",     MOVED_HERE},
+      {1, "A2/B",    "normal",       1, "A/B",   MOVED_HERE},
+      {1, "A2/B/C",  "normal",       1, "A/B/C", MOVED_HERE},
+      {0}
+    };
+    SVN_ERR(check_db_rows(&b, "", nodes));
+  }
+
   return SVN_NO_ERROR;
 }
 
@@ -3864,8 +3884,7 @@ nested_moves_child_last(const svn_test_o
     };
     SVN_ERR(check_db_rows(&b, "", nodes));
   }
-  SVN_ERR(wc_move(&b, "A2/B", "A2/B2"));  /* ### Leaves moved-here on lines
-                                             marked XFAIL */
+  SVN_ERR(wc_move(&b, "A2/B", "A2/B2"));
   {
     nodes_row_t nodes[] = {
       {0, "",        "normal",       1, ""},
@@ -3876,8 +3895,8 @@ nested_moves_child_last(const svn_test_o
       {1, "A/B",     "base-deleted", NO_COPY_FROM},
       {1, "A/B/C",   "base-deleted", NO_COPY_FROM},
       {1, "A2",      "normal",       1, "A",     MOVED_HERE},
-      {1, "A2/B",    "normal",       1, "A/B"},               /* XFAIL */
-      {1, "A2/B/C",  "normal",       1, "A/B/C"},             /* XFAIL */
+      {1, "A2/B",    "normal",       1, "A/B",   MOVED_HERE},
+      {1, "A2/B/C",  "normal",       1, "A/B/C", MOVED_HERE},
       {2, "A2/B",    "base-deleted", NO_COPY_FROM},
       {2, "A2/B/C",  "base-deleted", NO_COPY_FROM},
       {2, "A2/B2",   "normal",       1, "A/B",   MOVED_HERE},
@@ -3886,8 +3905,7 @@ nested_moves_child_last(const svn_test_o
     };
     SVN_ERR(check_db_rows(&b, "", nodes));
   }
-  SVN_ERR(wc_move(&b, "A2/B2/C", "A2/B2/C2")); /* ### Leaves moved-here on line
-                                                  marked XFAIL */
+  SVN_ERR(wc_move(&b, "A2/B2/C", "A2/B2/C2"));
   {
     nodes_row_t nodes[] = {
       {0, "",        "normal",       1, ""},
@@ -3898,12 +3916,12 @@ nested_moves_child_last(const svn_test_o
       {1, "A/B",     "base-deleted", NO_COPY_FROM},
       {1, "A/B/C",   "base-deleted", NO_COPY_FROM},
       {1, "A2",      "normal",       1, "A",     MOVED_HERE},
-      {1, "A2/B",    "normal",       1, "A/B"},
-      {1, "A2/B/C",  "normal",       1, "A/B/C"},
+      {1, "A2/B",    "normal",       1, "A/B",   MOVED_HERE},
+      {1, "A2/B/C",  "normal",       1, "A/B/C", MOVED_HERE},
       {2, "A2/B",    "base-deleted", NO_COPY_FROM},
       {2, "A2/B/C",  "base-deleted", NO_COPY_FROM},
       {2, "A2/B2",   "normal",       1, "A/B",   MOVED_HERE},
-      {2, "A2/B2/C", "normal",       1, "A/B/C"},                /* XFAIL */
+      {2, "A2/B2/C", "normal",       1, "A/B/C", MOVED_HERE},
       {3, "A2/B2/C", "base-deleted", NO_COPY_FROM},
       {3, "A2/B2/C2","normal",       1, "A/B/C", MOVED_HERE},
       {0}
@@ -3911,6 +3929,26 @@ nested_moves_child_last(const svn_test_o
     SVN_ERR(check_db_rows(&b, "", nodes));
   }
 
+  /* Revert should leave the A to A2 move */
+  SVN_ERR(wc_revert(&b, "A2/B2", svn_depth_infinity));
+  SVN_ERR(wc_revert(&b, "A2/B", svn_depth_infinity));
+  {
+    nodes_row_t nodes[] = {
+      {0, "",        "normal",       1, ""},
+      {0, "A",       "normal",       1, "A",     FALSE, "A2"},
+      {0, "A/B",     "normal",       1, "A/B"},
+      {0, "A/B/C",   "normal",       1, "A/B/C"},
+      {1, "A",       "base-deleted", NO_COPY_FROM},
+      {1, "A/B",     "base-deleted", NO_COPY_FROM},
+      {1, "A/B/C",   "base-deleted", NO_COPY_FROM},
+      {1, "A2",      "normal",       1, "A",     MOVED_HERE},
+      {1, "A2/B",    "normal",       1, "A/B",   MOVED_HERE},
+      {1, "A2/B/C",  "normal",       1, "A/B/C", MOVED_HERE},
+      {0}
+    };
+    SVN_ERR(check_db_rows(&b, "", nodes));
+  }
+
   return SVN_NO_ERROR;
 }
 
@@ -4116,10 +4154,10 @@ move_to_swap(const svn_test_opts_t *opts
       {0, "X",   "normal",       1, "X",   FALSE, "A"},
       {0, "X/Y", "normal",       1, "X/Y", FALSE, "X/Y"},
       {1, "A",   "normal",       1, "X",   MOVED_HERE},
-      {1, "A/Y", "normal",       1, "X/Y"},                /* moved-here? */
+      {1, "A/Y", "normal",       1, "X/Y", MOVED_HERE},
       {1, "A/B", "base-deleted", NO_COPY_FROM},
       {1, "X",   "normal",       1, "A",   MOVED_HERE},
-      {1, "X/B", "normal",       1, "A/B"},                /* moved-here? */
+      {1, "X/B", "normal",       1, "A/B", MOVED_HERE},
       {1, "X/Y", "base-deleted", NO_COPY_FROM},
       {2, "A/Y", "base-deleted", NO_COPY_FROM},
       {2, "X/B", "base-deleted", NO_COPY_FROM},
@@ -4158,8 +4196,6 @@ move_to_swap(const svn_test_opts_t *opts
   SVN_ERR(wc_move(&b, "A/Y", "X/Y"));
   SVN_ERR(wc_move(&b, "X/B", "A/B"));
   
-  /* Currently XFAIL on because marked lines set moved-here.  Perhaps
-     this is correct and it should XFAIL on the earlier order?  */
   {
     nodes_row_t nodes[] = {
       {0, "",    "normal",       1, ""},
@@ -4168,10 +4204,10 @@ move_to_swap(const svn_test_opts_t *opts
       {0, "X",   "normal",       1, "X",   FALSE, "A"},
       {0, "X/Y", "normal",       1, "X/Y", FALSE, "X/Y"},
       {1, "A",   "normal",       1, "X",   MOVED_HERE},
-      {1, "A/Y", "normal",       1, "X/Y"},                /* XFAIL */
+      {1, "A/Y", "normal",       1, "X/Y", MOVED_HERE},
       {1, "A/B", "base-deleted", NO_COPY_FROM},
       {1, "X",   "normal",       1, "A",   MOVED_HERE},
-      {1, "X/B", "normal",       1, "A/B"},                /* XFAIL */
+      {1, "X/B", "normal",       1, "A/B", MOVED_HERE},
       {1, "X/Y", "base-deleted", NO_COPY_FROM},
       {2, "A/Y", "base-deleted", NO_COPY_FROM},
       {2, "X/B", "base-deleted", NO_COPY_FROM},
@@ -4465,7 +4501,7 @@ struct svn_test_descriptor_t test_funcs[
                        "incomplete_switch (issue 4040)"),
     SVN_TEST_OPTS_PASS(nested_moves_child_first,
                        "nested_moves_child_first"),
-    SVN_TEST_OPTS_XFAIL(nested_moves_child_last,
+    SVN_TEST_OPTS_PASS(nested_moves_child_last,
                        "nested_moves_child_last"),
     SVN_TEST_OPTS_XFAIL(move_in_copy,
                        "move_in_copy"),
@@ -4473,7 +4509,7 @@ struct svn_test_descriptor_t test_funcs[
                        "move_in_replace"),
     SVN_TEST_OPTS_PASS(copy_a_move,
                        "copy_a_move"),
-    SVN_TEST_OPTS_XFAIL(move_to_swap,
+    SVN_TEST_OPTS_PASS(move_to_swap,
                        "move_to_swap"),
     SVN_TEST_OPTS_PASS(revert_nested_move,
                        "revert_nested_move"),