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 2013/02/06 18:15:27 UTC

svn commit: r1443077 - in /subversion/trunk/subversion: libsvn_wc/update_editor.c libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db.h libsvn_wc/wc_db_private.h libsvn_wc/wc_db_update_move.c tests/libsvn_wc/op-depth-test.c

Author: philip
Date: Wed Feb  6 17:15:26 2013
New Revision: 1443077

URL: http://svn.apache.org/viewvc?rev=1443077&view=rev
Log:
Raise move-edit tree-conflicts for updates anchored inside a move.
don't allow move-updating for mixed-revision or subtree-switched
source.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_base_moved_to): Add moved away root parameter.

* subversion/libsvn_wc/wc_db_private.h
  (svn_wc__db_op_depth_moved_to): Add moved away root parameter.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_op_depth_moved_to, svn_wc__db_base_moved_to): Add moved
   away root parameter.

* subversion/libsvn_wc/update_editor.c
  (complete_conflict): Change parameter to an edit baton.
  (mark_directory_edited, mark_file_edited, delete_entry,
   add_directory, close_directory, add_file, change_file_prop,
   close_file, check_tree_conflict): Adjust call.
  (check_tree_conflict): Add forward declaration.
  (open_root): Raise move-edit tree conflict.

* subversion/libsvn_wc/wc_db_update_move.c
  (check_tree_conflict, resolve_break_moved_away): Adjust call.
  (suitable_for_move): New.
  (update_moved_away_conflict_victim): Check for suitable source.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_REPOS_PATH_REVISION): New.

* subversion/tests/libsvn_wc/op-depth-test.c
  (update_within_move): New.
  (test_funcs): Add new test.

Modified:
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/libsvn_wc/wc_db_private.h
    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/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1443077&r1=1443076&r2=1443077&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Wed Feb  6 17:15:26 2013
@@ -859,7 +859,7 @@ make_file_baton(struct file_baton **f_p,
  */
 static svn_error_t *
 complete_conflict(svn_skel_t *conflict,
-                  const struct dir_baton *pb,
+                  const struct edit_baton *eb,
                   const char *local_abspath,
                   const char *old_repos_relpath,
                   svn_revnum_t old_revision,
@@ -869,7 +869,6 @@ complete_conflict(svn_skel_t *conflict,
                   apr_pool_t *result_pool,
                   apr_pool_t *scratch_pool)
 {
-  const struct edit_baton *eb = pb->edit_baton;
   svn_wc_conflict_version_t *original_version;
   svn_wc_conflict_version_t *target_version;
   svn_boolean_t is_complete;
@@ -934,7 +933,7 @@ mark_directory_edited(struct dir_baton *
     {
       /* We have a (delayed) tree conflict to install */
 
-      SVN_ERR(complete_conflict(db->edit_conflict, db->parent_baton,
+      SVN_ERR(complete_conflict(db->edit_conflict, db->edit_baton,
                                 db->local_abspath,
                                 db->old_repos_relpath, db->old_revision,
                                 db->new_relpath,
@@ -969,7 +968,7 @@ mark_file_edited(struct file_baton *fb, 
     {
       /* We have a (delayed) tree conflict to install */
 
-      SVN_ERR(complete_conflict(fb->edit_conflict, fb->dir_baton,
+      SVN_ERR(complete_conflict(fb->edit_conflict, fb->edit_baton,
                                 fb->local_abspath, fb->old_repos_relpath,
                                 fb->old_revision, fb->new_relpath,
                                 svn_node_file, svn_node_file,
@@ -1163,6 +1162,17 @@ set_target_revision(void *edit_baton,
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+check_tree_conflict(svn_skel_t **pconflict,
+                    struct edit_baton *eb,
+                    const char *local_abspath,
+                    svn_wc__db_status_t working_status,
+                    svn_boolean_t exists_in_repos,
+                    svn_node_kind_t expected_kind,
+                    svn_wc_conflict_action_t action,
+                    apr_pool_t *result_pool,
+                    apr_pool_t *scratch_pool);
+
 /* An svn_delta_editor_t function. */
 static svn_error_t *
 open_root(void *edit_baton,
@@ -1221,8 +1231,50 @@ open_root(void *edit_baton,
                                db->pool, pool));
 
   if (have_work)
-    db->shadowed = TRUE; /* Needed for the close_directory() on the root, to
-                            make sure it doesn't use the ACTUAL tree */
+    {
+      const char *moved_away_root_abspath;
+
+      SVN_ERR(svn_wc__db_base_moved_to(NULL, NULL, &moved_away_root_abspath,
+                                       NULL, eb->db, db->local_abspath,
+                                       pool, pool));
+      if (moved_away_root_abspath)
+        {
+          /* This is an update anchored inside a move. We need to
+             raise a move-edit tree-conflict on the move root to
+             update the move destination. */
+          svn_skel_t *tree_conflict = svn_wc__conflict_skel_create(pool);
+
+          SVN_ERR(svn_wc__conflict_skel_add_tree_conflict(
+                    tree_conflict, eb->db, moved_away_root_abspath,
+                    svn_wc_conflict_reason_moved_away,
+                    svn_wc_conflict_action_edit,
+                    moved_away_root_abspath, pool, pool));
+
+          if (strcmp(db->local_abspath, moved_away_root_abspath))
+            {
+              /* This is some parent of the edit root, we won't be
+                 handling it again so raise the conflict now. */
+              SVN_ERR(complete_conflict(tree_conflict, eb,
+                                        moved_away_root_abspath,
+                                        db->old_repos_relpath,
+                                        db->old_revision, db->new_relpath,
+                                        svn_node_dir, svn_node_dir,
+                                        pool, pool));
+              SVN_ERR(svn_wc__db_op_mark_conflict(eb->db,
+                                                  moved_away_root_abspath,
+                                                  tree_conflict,
+                                                  NULL, pool));
+              do_notification(eb, moved_away_root_abspath, svn_node_dir,
+                              svn_wc_notify_tree_conflict, pool);
+            }
+          else
+            db->edit_conflict = tree_conflict;
+        }
+
+
+      db->shadowed = TRUE; /* Needed for the close_directory() on the root, to
+                              make sure it doesn't use the ACTUAL tree */
+    }
 
   if (*eb->target_basename == '\0')
     {
@@ -1433,7 +1485,7 @@ check_tree_conflict(svn_skel_t **pconfli
         else
           {
             /* The node is locally replaced but could also be moved-away. */
-            SVN_ERR(svn_wc__db_base_moved_to(NULL, NULL,
+            SVN_ERR(svn_wc__db_base_moved_to(NULL, NULL, NULL,
                                              &moved_away_op_root_abspath,
                                              eb->db, local_abspath,
                                              scratch_pool, scratch_pool));
@@ -1447,7 +1499,7 @@ check_tree_conflict(svn_skel_t **pconfli
 
       case svn_wc__db_status_deleted:
         {
-          SVN_ERR(svn_wc__db_base_moved_to(NULL, NULL,
+          SVN_ERR(svn_wc__db_base_moved_to(NULL, NULL, NULL,
                                            &moved_away_op_root_abspath,
                                            eb->db, local_abspath,
                                            scratch_pool, scratch_pool));
@@ -1835,7 +1887,7 @@ delete_entry(const char *path,
         SVN_ERR_MALFUNCTION();  /* other reasons are not expected here */
     }
 
-  SVN_ERR(complete_conflict(tree_conflict, pb, local_abspath, repos_relpath,
+  SVN_ERR(complete_conflict(tree_conflict, eb, local_abspath, repos_relpath,
                             old_revision, NULL,
                             (kind == svn_kind_dir)
                                 ? svn_node_dir
@@ -2202,7 +2254,7 @@ add_directory(const char *path,
     }
 
   if (tree_conflict)
-    SVN_ERR(complete_conflict(tree_conflict, pb, db->local_abspath,
+    SVN_ERR(complete_conflict(tree_conflict, eb, db->local_abspath,
                               db->old_repos_relpath, db->old_revision,
                               db->new_relpath,
                               svn__node_kind_from_kind(wc_kind),
@@ -2778,7 +2830,7 @@ close_directory(void *dir_baton,
           svn_skel_t *work_item;
 
           SVN_ERR(complete_conflict(conflict_skel,
-                                    db->parent_baton,
+                                    db->edit_baton,
                                     db->local_abspath,
                                     db->old_repos_relpath,
                                     db->old_revision,
@@ -3298,7 +3350,7 @@ add_file(const char *path,
   if (tree_conflict != NULL)
     {
       SVN_ERR(complete_conflict(tree_conflict,
-                                fb->dir_baton,
+                                fb->edit_baton,
                                 fb->local_abspath,
                                 fb->old_repos_relpath,
                                 fb->old_revision,
@@ -3668,7 +3720,7 @@ change_file_prop(void *file_baton,
                                      NULL,
                                      fb->pool, scratch_pool));
 
-          SVN_ERR(complete_conflict(fb->edit_conflict, fb->dir_baton,
+          SVN_ERR(complete_conflict(fb->edit_conflict, fb->edit_baton,
                                     fb->local_abspath, fb->old_repos_relpath,
                                     fb->old_revision, fb->new_relpath,
                                     svn_node_file, svn_node_file,
@@ -4378,7 +4430,7 @@ close_file(void *file_baton,
   if (conflict_skel)
     {
       SVN_ERR(complete_conflict(conflict_skel,
-                                fb->dir_baton,
+                                fb->edit_baton,
                                 fb->local_abspath,
                                 fb->old_repos_relpath,
                                 fb->old_revision,

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1443077&r1=1443076&r2=1443077&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Wed Feb  6 17:15:26 2013
@@ -1531,6 +1531,13 @@ WHERE n.wc_id = ?1
 SELECT 1 FROM NODES
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > ?3 AND op_depth < ?4
 
+-- STMT_SELECT_REPOS_PATH_REVISION
+SELECT local_relpath, repos_path, revision FROM nodes
+WHERE wc_id = ?1
+  AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+  AND op_depth = 0
+ORDER BY local_relpath
+
 /* ------------------------------------------------------------------------- */
 
 /* Queries for verification. */

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1443077&r1=1443076&r2=1443077&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Feb  6 17:15:26 2013
@@ -11496,6 +11496,9 @@ svn_wc__db_follow_moved_to(apr_array_hea
    the move of LOCAL_RELPATH. This may be equal to *MOVED_TO_RELPATH
    if LOCAL_RELPATH is the root of the move.
 
+   *MOVED_AWAY_ROOT_RELPATH: the root of the move source.  For
+   moves inside a delete this will be different from *OP_ROOT_RELPATH.
+
    *OP_ROOT_RELPATH: the root of the source layer that contains the
    move.  For moves inside deletes this is the root of the delete, for
    other moves this is the root of the move.
@@ -11504,10 +11507,12 @@ svn_wc__db_follow_moved_to(apr_array_hea
 
      MOVED_TO_RELPATH is X/C
      MOVED_TO_OP_ROOT_RELPATH is X
+     MOVED_AWAY_OP_ROOT_RELPATH is A/B
      OP_ROOT_RELPATH is A/B
 
-   If A is then deleted the MOVED_TO_RELPATH and MOVED_TO_OP_ROOT_RELPATH
-   remain the same but OP_ROOT_RELPATH changes to A.
+   If A is then deleted the MOVED_TO_RELPATH, MOVED_TO_OP_ROOT_RELPATH
+   and MOVED_AWAY_ROOT_RELPATH remain the same but OP_ROOT_RELPATH
+   changes to A.
 
    ### Think about combining with scan_deletion?  Also with
    ### scan_addition to get moved-to for replaces?  Do we need to
@@ -11516,6 +11521,7 @@ svn_wc__db_follow_moved_to(apr_array_hea
 svn_error_t *
 svn_wc__db_op_depth_moved_to(const char **moved_to_relpath,
                              const char **moved_to_op_root_relpath,
+                             const char **moved_away_root_relpath,
                              const char **op_root_relpath,
                              int op_depth,
                              svn_wc__db_wcroot_t *wcroot,
@@ -11528,7 +11534,8 @@ svn_wc__db_op_depth_moved_to(const char 
   int delete_op_depth;
   const char *relpath = local_relpath;
 
-  *moved_to_relpath = *moved_to_op_root_relpath = *op_root_relpath = NULL;
+  *moved_to_relpath = *moved_to_op_root_relpath = NULL;
+  *moved_away_root_relpath = *op_root_relpath = NULL;
 
   do
     {
@@ -11541,13 +11548,15 @@ svn_wc__db_op_depth_moved_to(const char 
           delete_op_depth = svn_sqlite__column_int(stmt, 0);
           *moved_to_op_root_relpath = svn_sqlite__column_text(stmt, 3,
                                                               result_pool);
+          if (*moved_to_op_root_relpath)
+            *moved_away_root_relpath = apr_pstrdup(result_pool, relpath);
         }
       SVN_ERR(svn_sqlite__reset(stmt));
       if (!*moved_to_op_root_relpath)
         relpath = svn_relpath_dirname(relpath, scratch_pool);
     }
   while (!*moved_to_op_root_relpath
-        && have_row && delete_op_depth < relpath_depth(relpath));
+        && have_row && delete_op_depth <= relpath_depth(relpath));
 
   if (*moved_to_op_root_relpath)
     {
@@ -11569,6 +11578,7 @@ svn_wc__db_op_depth_moved_to(const char 
 svn_error_t *
 svn_wc__db_base_moved_to(const char **moved_to_abspath,
                          const char **moved_to_op_root_abspath,
+                         const char **moved_away_root_abspath,
                          const char **op_root_abspath,
                          svn_wc__db_t *db,
                          const char *local_abspath,
@@ -11577,7 +11587,8 @@ svn_wc__db_base_moved_to(const char **mo
 {
   svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
-  const char *moved_to_relpath, *moved_to_op_root_relpath, *op_root_relpath;
+  const char *moved_to_relpath, *moved_to_op_root_relpath;
+  const char *moved_away_root_relpath, *op_root_relpath;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
@@ -11587,6 +11598,7 @@ svn_wc__db_base_moved_to(const char **mo
 
   SVN_WC__DB_WITH_TXN(svn_wc__db_op_depth_moved_to(&moved_to_relpath,
                                                    &moved_to_op_root_relpath,
+                                                   &moved_away_root_relpath,
                                                    &op_root_relpath,
                                                    0 /* BASE op-depth */,
                                                    wcroot, local_relpath,
@@ -11605,6 +11617,13 @@ svn_wc__db_base_moved_to(const char **mo
       ? svn_dirent_join(wcroot->abspath, moved_to_relpath, result_pool)
       : NULL;
 
+  if (moved_away_root_abspath)
+    *moved_away_root_abspath
+      = moved_away_root_relpath
+      ? svn_dirent_join(wcroot->abspath, moved_away_root_relpath,
+                        result_pool)
+      : NULL;
+
   if (op_root_abspath)
     *op_root_abspath
       = op_root_relpath

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1443077&r1=1443076&r2=1443077&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Wed Feb  6 17:15:26 2013
@@ -3274,6 +3274,7 @@ svn_wc__db_update_moved_away_conflict_vi
 svn_error_t *
 svn_wc__db_base_moved_to(const char **moved_to_abspath,
                          const char **moved_to_op_root_abspath,
+                         const char **moved_away_op_root_abspath,
                          const char **op_root_abspath,
                          svn_wc__db_t *db,
                          const char *local_abspath,

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_private.h?rev=1443077&r1=1443076&r2=1443077&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_private.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_private.h Wed Feb  6 17:15:26 2013
@@ -412,6 +412,7 @@ svn_wc__db_retract_parent_delete(svn_wc_
 svn_error_t *
 svn_wc__db_op_depth_moved_to(const char **moved_to_relpath,
                              const char **moved_to_op_root_relpath,
+                             const char **moved_away_root_relpath,
                              const char **op_root_relpath,
                              int op_depth,
                              svn_wc__db_wcroot_t *wcroot,

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=1443077&r1=1443076&r2=1443077&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Wed Feb  6 17:15:26 2013
@@ -369,7 +369,7 @@ check_tree_conflict(svn_boolean_t *is_co
   int op_depth;
   const char *conflict_root_relpath = local_relpath;
   const char *moved_to_relpath, *moved_to_op_root_relpath;
-  const char *moved_away_op_root_relpath;
+  const char *moved_away_root_relpath, *moved_away_op_root_relpath;
 
   if (b->conflict_root_relpath)
     {
@@ -411,6 +411,7 @@ check_tree_conflict(svn_boolean_t *is_co
 
   SVN_ERR(svn_wc__db_op_depth_moved_to(&moved_to_relpath,
                                        &moved_to_op_root_relpath,
+                                       &moved_away_root_relpath,
                                        &moved_away_op_root_relpath,
                                        dst_op_depth,
                                        b->wcroot, conflict_root_relpath,
@@ -1712,6 +1713,62 @@ drive_tree_conflict_editor(svn_editor_t 
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+suitable_for_move(svn_wc__db_wcroot_t *wcroot,
+                  const char *local_relpath,
+                  apr_pool_t *scratch_pool)
+{
+  svn_sqlite__stmt_t *stmt;
+  svn_boolean_t have_row;
+  svn_revnum_t revision;
+  const char *repos_relpath;
+  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_SELECT_BASE_NODE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  if (have_row)
+    {
+      revision = svn_sqlite__column_revnum(stmt, 4);
+      repos_relpath = svn_sqlite__column_text(stmt, 1, scratch_pool);
+    }
+  SVN_ERR(svn_sqlite__reset(stmt));
+  if (!have_row)
+    return SVN_NO_ERROR; /* Return an error? */
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_SELECT_REPOS_PATH_REVISION));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  while (have_row)
+    {
+      svn_revnum_t node_revision = svn_sqlite__column_revnum(stmt, 2);
+      const char *relpath = svn_sqlite__column_text(stmt, 0, NULL);
+
+      svn_pool_clear(iterpool);
+
+      relpath = svn_relpath_skip_ancestor(local_relpath, relpath);
+      relpath = svn_relpath_join(repos_relpath, relpath, iterpool);
+
+      if (revision != node_revision
+          || strcmp(relpath, svn_sqlite__column_text(stmt, 1, NULL)))
+        return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
+                                 svn_sqlite__reset(stmt),
+                      _("The tree '%s' is not single-revision and unswitched"),
+                        svn_dirent_local_style(svn_dirent_join(wcroot->abspath,
+                                                               local_relpath,
+                                                               scratch_pool),
+                                               scratch_pool));
+      SVN_ERR(svn_sqlite__step(&have_row, stmt));
+    }
+  SVN_ERR(svn_sqlite__reset(stmt));
+
+  svn_pool_destroy(iterpool);
+
+  return SVN_NO_ERROR;
+}
+
 /* The body of svn_wc__db_update_moved_away_conflict_victim(), which see.
  */
 static svn_error_t *
@@ -1736,7 +1793,7 @@ update_moved_away_conflict_victim(svn_sk
   struct tc_editor_baton *tc_editor_baton;
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
-  const char *dummy1, *dummy2;
+  const char *dummy1, *dummy2, *dummy3;
   int src_op_depth;
 
   /* ### assumes wc write lock already held */
@@ -1744,7 +1801,7 @@ update_moved_away_conflict_victim(svn_sk
   /* Construct editor baton. */
   tc_editor_baton = apr_pcalloc(scratch_pool, sizeof(*tc_editor_baton));
   SVN_ERR(svn_wc__db_op_depth_moved_to(
-            &dummy1, &tc_editor_baton->move_root_dst_relpath, &dummy2,
+            &dummy1, &tc_editor_baton->move_root_dst_relpath, &dummy2, &dummy3,
             relpath_depth(moved_away_op_root_relpath) - 1,
             wcroot, victim_relpath, scratch_pool, scratch_pool));
   if (tc_editor_baton->move_root_dst_relpath == NULL)
@@ -1782,6 +1839,9 @@ update_moved_away_conflict_victim(svn_sk
                                                scratch_pool),
                                scratch_pool));
 
+  if (src_op_depth == 0)
+    SVN_ERR(suitable_for_move(wcroot, victim_relpath, scratch_pool));
+
   /* Create a new, and empty, list for notification information. */
   SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
                                       STMT_CREATE_UPDATE_MOVE_LIST));
@@ -2053,11 +2113,13 @@ resolve_break_moved_away(svn_wc__db_wcro
                          const char *local_relpath,
                          apr_pool_t *scratch_pool)
 {
-  const char *dummy, *moved_to_op_root_relpath, *op_root_relpath;
+  const char *dummy, *moved_to_op_root_relpath;
+  const char *moved_away_root_relpath, *op_root_relpath;
   svn_sqlite__stmt_t *stmt;
   int dst_op_depth;
 
   SVN_ERR(svn_wc__db_op_depth_moved_to(&dummy, &moved_to_op_root_relpath,
+                                       &moved_away_root_relpath,
                                        &op_root_relpath,
                                        relpath_depth(local_relpath) - 1,
                                        wcroot, local_relpath,

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=1443077&r1=1443076&r2=1443077&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Wed Feb  6 17:15:26 2013
@@ -6322,6 +6322,74 @@ layered_moved_to(const svn_test_opts_t *
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+update_within_move(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_test__sandbox_t b;
+  svn_error_t *err;
+
+  SVN_ERR(svn_test__sandbox_create(&b, "update_within_move", opts, pool));
+
+  SVN_ERR(sbox_wc_mkdir(&b, "A"));
+  SVN_ERR(sbox_wc_mkdir(&b, "A/B"));
+  SVN_ERR(sbox_wc_mkdir(&b, "A/B/C"));
+  SVN_ERR(sbox_wc_commit(&b, ""));
+  SVN_ERR(sbox_wc_mkdir(&b, "A/B/C/D"));
+  SVN_ERR(sbox_wc_commit(&b, ""));
+  SVN_ERR(sbox_wc_update(&b, "", 1));
+
+  SVN_ERR(sbox_wc_move(&b, "A", "X"));
+  SVN_ERR(sbox_wc_update(&b, "A/B/C", 2));
+  {
+    nodes_row_t nodes[] = {
+      {0, "",        "normal",       1, ""},
+      {0, "A",       "normal",       1, "A"},
+      {0, "A/B",     "normal",       1, "A/B"},
+      {0, "A/B/C",   "normal",       2, "A/B/C"},
+      {0, "A/B/C/D", "normal",       2, "A/B/C/D"},
+      {1, "A",       "base-deleted", NO_COPY_FROM, "X"},
+      {1, "A/B",     "base-deleted", NO_COPY_FROM},
+      {1, "A/B/C",   "base-deleted", NO_COPY_FROM},
+      {1, "A/B/C/D", "base-deleted", NO_COPY_FROM},
+      {1, "X",       "normal",       1, "A", MOVED_HERE},
+      {1, "X/B",     "normal",       1, "A/B", MOVED_HERE},
+      {1, "X/B/C",   "normal",       1, "A/B/C", MOVED_HERE},
+      {0}
+    };
+    SVN_ERR(check_db_rows(&b, "", nodes));
+  }
+
+  /* Can't resolve mixed-revision source to mine-conflict. */
+  err = sbox_wc_resolve(&b, "A", svn_depth_empty,
+                        svn_wc_conflict_choose_mine_conflict);
+  SVN_ERR_ASSERT(err && err->apr_err == SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE);
+  svn_error_clear(err);
+
+  SVN_ERR(sbox_wc_resolve(&b, "A", svn_depth_empty,
+                          svn_wc_conflict_choose_merged));
+  {
+    nodes_row_t nodes[] = {
+      {0, "",        "normal",       1, ""},
+      {0, "A",       "normal",       1, "A"},
+      {0, "A/B",     "normal",       1, "A/B"},
+      {0, "A/B/C",   "normal",       2, "A/B/C"},
+      {0, "A/B/C/D", "normal",       2, "A/B/C/D"},
+      {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, "A/B/C/D", "base-deleted", NO_COPY_FROM},
+      {1, "X",       "normal",       1, "A"},
+      {1, "X/B",     "normal",       1, "A/B"},
+      {1, "X/B/C",   "normal",       1, "A/B/C"},
+      {0}
+    };
+    SVN_ERR(check_db_rows(&b, "", nodes));
+  }
+
+
+  return SVN_NO_ERROR;
+}
+
 /* ---------------------------------------------------------------------- */
 /* The list of test functions */
 
@@ -6440,5 +6508,7 @@ struct svn_test_descriptor_t test_funcs[
                        "move_replace"),
     SVN_TEST_OPTS_PASS(layered_moved_to,
                        "layered_moved_to"),
+    SVN_TEST_OPTS_PASS(update_within_move,
+                       "update_within_move"),
     SVN_TEST_NULL
   };