You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/11/30 15:12:36 UTC

svn commit: r1772051 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/conflicts.c libsvn_wc/conflicts.c libsvn_wc/wc_db.h libsvn_wc/wc_db_update_move.c tests/libsvn_client/conflicts-test.c

Author: stsp
Date: Wed Nov 30 15:12:36 2016
New Revision: 1772051

URL: http://svn.apache.org/viewvc?rev=1772051&view=rev
Log:
Revert r1771924.

Leaving nested conflicts within the tree conflict victim of an incoming
move after update does not seem to be the best approach. It is unclear how
we can make sure the victim, which is now left behind as a non-conflicted copy,
will eventually be removed to complete the incoming move.

I will try another idea next, which is to move any conflicted children into
the incoming move destination and let their conflicts be resolved there.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/conflicts.c
    subversion/trunk/subversion/libsvn_wc/conflicts.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
    subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1772051&r1=1772050&r2=1772051&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Wed Nov 30 15:12:36 2016
@@ -1900,13 +1900,9 @@ svn_wc__conflict_tree_update_moved_away_
  * Assuming DEST_ABSPATH is the correct move destination, this function
  * allows local changes to "follow" incoming moves during updates.
  *
- * Indicate in *NEW_CONFLICTS_REMAIN whether new conflicts were raised
- * while updating the incoming move.
- *
  * @since New in 1.10. */
 svn_error_t *
-svn_wc__conflict_tree_update_incoming_move(svn_boolean_t *new_conflicts_remain,
-                                           svn_wc_context_t *wc_ctx,
+svn_wc__conflict_tree_update_incoming_move(svn_wc_context_t *wc_ctx,
                                            const char *local_abspath,
                                            const char *dest_abspath,
                                            svn_cancel_func_t cancel_func,

Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1772051&r1=1772050&r2=1772051&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Wed Nov 30 15:12:36 2016
@@ -7401,8 +7401,6 @@ resolve_incoming_move_dir_merge(svn_clie
     }
   else
     {
-      svn_boolean_t new_conflicts_remain = FALSE;
-
       SVN_ERR_ASSERT(operation == svn_wc_operation_update ||
                      operation == svn_wc_operation_switch);
 
@@ -7415,34 +7413,26 @@ resolve_incoming_move_dir_merge(svn_clie
 
       if (is_modified)
         {
-          err = svn_wc__conflict_tree_update_incoming_move(
-                  &new_conflicts_remain, ctx->wc_ctx, local_abspath,
-                  moved_to_abspath, ctx->cancel_func, ctx->cancel_baton,
-                  ctx->notify_func2, ctx->notify_baton2, scratch_pool);
+          err = svn_wc__conflict_tree_update_incoming_move(ctx->wc_ctx,
+                                                           local_abspath,
+                                                           moved_to_abspath,
+                                                           ctx->cancel_func,
+                                                           ctx->cancel_baton,
+                                                           ctx->notify_func2,
+                                                           ctx->notify_baton2,
+                                                           scratch_pool);
           if (err)
             goto unlock_wc;
         }
 
-      if (new_conflicts_remain)
-        {
-          /* Clear the conflict marker on this victim, but do not delete
-           * it to allow the new conflicts to be dealt with. */
-          err = svn_wc__del_tree_conflict(ctx->wc_ctx, local_abspath,
-                                          scratch_pool);
-          if (err)
-            goto unlock_wc;
-        }
-      else
-        {
-          /* The move operation is part of our natural history. Delete the
-           * tree conflict victim (clears the tree conflict marker). */
-          err = svn_wc_delete4(ctx->wc_ctx, local_abspath, FALSE, FALSE,
-                               NULL, NULL, /* don't allow user to cancel here */
-                               NULL, NULL, /* no extra notification */
-                               scratch_pool);
-          if (err)
-            goto unlock_wc;
-        }
+      /* The move operation is part of our natural history.
+       * Delete the tree conflict victim (clears the tree conflict marker). */
+      err = svn_wc_delete4(ctx->wc_ctx, local_abspath, FALSE, FALSE,
+                           NULL, NULL, /* don't allow user to cancel here */
+                           NULL, NULL, /* no extra notification */
+                           scratch_pool);
+      if (err)
+        goto unlock_wc;
     }
 
   if (ctx->notify_func2)

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1772051&r1=1772050&r2=1772051&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Wed Nov 30 15:12:36 2016
@@ -3704,8 +3704,7 @@ svn_wc__conflict_tree_update_moved_away_
 }
 
 svn_error_t *
-svn_wc__conflict_tree_update_incoming_move(svn_boolean_t *new_conflicts_remain,
-                                           svn_wc_context_t *wc_ctx,
+svn_wc__conflict_tree_update_incoming_move(svn_wc_context_t *wc_ctx,
                                            const char *local_abspath,
                                            const char *dest_abspath,
                                            svn_cancel_func_t cancel_func,
@@ -3721,9 +3720,6 @@ svn_wc__conflict_tree_update_incoming_mo
   const apr_array_header_t *conflicts;
   svn_skel_t *conflict_skel;
 
-  if (new_conflicts_remain != NULL)
-    *new_conflicts_remain = FALSE;
-
   SVN_ERR(svn_wc__read_conflicts(&conflicts, &conflict_skel,
                                  wc_ctx->db, local_abspath,
                                  FALSE, /* no tempfiles */
@@ -3764,8 +3760,7 @@ svn_wc__conflict_tree_update_incoming_mo
                              svn_dirent_local_style(local_abspath,
                                                     scratch_pool));
 
-  SVN_ERR(svn_wc__db_update_incoming_move(new_conflicts_remain,
-                                          wc_ctx->db, local_abspath,
+  SVN_ERR(svn_wc__db_update_incoming_move(wc_ctx->db, local_abspath,
                                           dest_abspath, operation,
                                           incoming_change, local_change,
                                           cancel_func, cancel_baton,

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1772051&r1=1772050&r2=1772051&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Wed Nov 30 15:12:36 2016
@@ -3406,11 +3406,9 @@ svn_wc__db_update_moved_away_conflict_vi
 
 /* Merge local changes from tree conflict victim at LOCAL_ABSPATH into the
    directory at DEST_ABSPATH. This function requires that LOCAL_ABSPATH is
-   a directory and a tree-conflict victim. DST_ABSPATH must be a directory.
-   See also svn_wc__conflict_tree_update_incoming_move(). */
+   a directory and a tree-conflict victim. DST_ABSPATH must be a directory. */
 svn_error_t *
-svn_wc__db_update_incoming_move(svn_boolean_t *new_conflicts_remain,
-                                svn_wc__db_t *db,
+svn_wc__db_update_incoming_move(svn_wc__db_t *db,
                                 const char *local_abspath,
                                 const char *dest_abspath,
                                 svn_wc_operation_t operation,

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=1772051&r1=1772050&r2=1772051&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Wed Nov 30 15:12:36 2016
@@ -230,8 +230,6 @@ typedef struct update_move_baton_t {
 
   svn_cancel_func_t cancel_func;
   void *cancel_baton;
-
-  svn_boolean_t raised_new_conflicts;
 } update_move_baton_t;
 
 /* Per node flags for tree conflict collection */
@@ -612,7 +610,6 @@ mark_tc_on_op_root(node_move_baton_t *nm
                                               : NULL,
                                     scratch_pool, scratch_pool));
 
-  b->raised_new_conflicts = TRUE;
   SVN_ERR(update_move_list_add(b->wcroot, nmb->dst_relpath, b->db,
                                svn_wc_notify_tree_conflict,
                                new_kind,
@@ -749,7 +746,6 @@ tc_editor_add_directory(node_move_baton_
                                         NULL,
                                         scratch_pool, scratch_pool));
       nmb->skip = TRUE;
-      b->raised_new_conflicts = TRUE;
     }
   else
     {
@@ -853,7 +849,6 @@ tc_editor_incoming_add_directory(node_mo
                                         NULL,
                                         scratch_pool, scratch_pool));
       nmb->skip = TRUE;
-      b->raised_new_conflicts = TRUE;
     }
   else
     {
@@ -937,7 +932,6 @@ tc_editor_add_file(node_move_baton_t *nm
                                         NULL,
                                         scratch_pool, scratch_pool));
       nmb->skip = TRUE;
-      b->raised_new_conflicts = TRUE;
     }
   else
     {
@@ -1004,7 +998,6 @@ tc_editor_incoming_add_file(node_move_ba
                                         NULL,
                                         scratch_pool, scratch_pool));
       nmb->skip = TRUE;
-      b->raised_new_conflicts = TRUE;
       SVN_ERR(svn_io_remove_file2(content_abspath, TRUE, scratch_pool));
     }
   else
@@ -1248,8 +1241,6 @@ tc_editor_alter_directory(node_move_bato
                                       scratch_pool, scratch_pool));
     }
 
-  if (conflict_skel)
-    b->raised_new_conflicts = TRUE;
   SVN_ERR(update_move_list_add(b->wcroot, dst_relpath, b->db,
                                svn_wc_notify_update_update,
                                svn_node_dir,
@@ -1417,7 +1408,6 @@ tc_editor_alter_file(node_move_baton_t *
                                       scratch_pool, scratch_pool));
 
       work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
-      b->raised_new_conflicts = TRUE;
     }
 
   SVN_ERR(update_move_list_add(b->wcroot, dst_relpath, b->db,
@@ -1452,8 +1442,7 @@ tc_editor_update_incoming_moved_file(nod
   svn_wc_notify_state_t content_state = svn_wc_notify_state_unchanged;
   svn_skel_t *work_item, *work_items = NULL;
   svn_node_kind_t dst_kind_on_disk;
-  const char *conflict_repos_relpath;
-  const char *conflict_relpath = NULL;
+  const char *dst_repos_relpath;
   svn_boolean_t tree_conflict = FALSE;
   svn_node_kind_t dst_db_kind;
   svn_error_t *err;
@@ -1463,58 +1452,59 @@ tc_editor_update_incoming_moved_file(nod
     return SVN_NO_ERROR;
 
   err = svn_wc__db_base_get_info_internal(NULL, &dst_db_kind, NULL,
-                                          &conflict_repos_relpath,
+                                          &dst_repos_relpath,
                                           NULL, NULL, NULL, NULL, NULL, NULL,
                                           NULL, NULL, NULL, NULL, NULL,
                                           b->wcroot, dst_relpath,
                                           scratch_pool, scratch_pool);
   if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
     {
+      const char *dst_parent_relpath;
+      const char *dst_parent_repos_relpath;
+
       svn_error_clear(err);
 
       dst_db_kind = svn_node_none;
-      conflict_repos_relpath = NULL;
+      SVN_ERR(create_node_tree_conflict(&conflict_skel, nmb, dst_relpath,
+                                        svn_node_file, dst_db_kind,
+                                        svn_wc_conflict_reason_missing,
+                                        svn_wc_conflict_action_edit,
+                                        NULL, scratch_pool, scratch_pool));
+      dst_parent_relpath = svn_relpath_dirname(dst_relpath, scratch_pool);
+      SVN_ERR(svn_wc__db_base_get_info_internal(NULL, NULL, NULL,
+                                                &dst_parent_repos_relpath,
+                                                NULL, NULL, NULL, NULL, NULL,
+                                                NULL, NULL, NULL, NULL, NULL,
+                                                NULL, b->wcroot,
+                                                dst_parent_relpath,
+                                                scratch_pool, scratch_pool));
+      dst_repos_relpath = svn_relpath_join(dst_parent_repos_relpath,
+                                           svn_relpath_basename(dst_relpath,
+                                                                scratch_pool),
+                                           scratch_pool);
+      tree_conflict = TRUE;
     }
   else
     SVN_ERR(err);
 
-  if (dst_db_kind == svn_node_none || dst_db_kind != svn_node_file)
+  if ((dst_db_kind == svn_node_none || dst_db_kind != svn_node_file) &&
+      conflict_skel == NULL)
     {
-      /* Cannot apply the edit. Raise a tree conflict on the
-       * source to prevent its local changes from disappearing. */
-      SVN_ERR(svn_wc__db_depth_get_info(NULL, NULL, NULL,
-                                        &conflict_repos_relpath, NULL, NULL,
-                                        NULL, NULL, NULL, NULL, NULL, NULL,
-                                        NULL, b->wcroot, src_relpath,
-                                        b->src_op_depth,
+      SVN_ERR(create_node_tree_conflict(&conflict_skel, nmb, dst_relpath,
+                                        svn_node_file, dst_db_kind,
+                                        dst_db_kind == svn_node_none
+                                          ? svn_wc_conflict_reason_missing
+                                          : svn_wc_conflict_reason_obstructed,
+                                        svn_wc_conflict_action_edit,
+                                        NULL,
                                         scratch_pool, scratch_pool));
-      SVN_ERR(create_tree_conflict(&conflict_skel, b->wcroot, src_relpath,
-                                   svn_relpath_prefix(src_relpath,
-                                                      b->src_op_depth,
-                                                      scratch_pool),
-                                   b->db,
-                                   b->old_version, b->new_version,
-                                   b->operation,
-                                   svn_node_file, dst_db_kind,
-                                   conflict_repos_relpath,
-                                   svn_wc_conflict_reason_edited,
-                                   dst_db_kind == svn_node_none
-                                     ? svn_wc_conflict_action_delete
-                                     : svn_wc_conflict_action_replace,
-                                   NULL, scratch_pool, scratch_pool));
-
-      conflict_relpath = src_relpath;
       tree_conflict = TRUE;
     }
 
-  /* Check for an on-disk obstruction at the destination. */
   SVN_ERR(svn_io_check_path(dst_abspath, &dst_kind_on_disk, scratch_pool));
   if ((dst_kind_on_disk == svn_node_none || dst_kind_on_disk != svn_node_file)
       && conflict_skel == NULL)
     {
-      const char *dst_parent_local_relpath;
-      const char *dst_parent_repos_relpath;
-
       SVN_ERR(create_node_tree_conflict(&conflict_skel, nmb, dst_relpath,
                                         svn_node_file, dst_kind_on_disk,
                                         dst_kind_on_disk == svn_node_none
@@ -1523,19 +1513,6 @@ tc_editor_update_incoming_moved_file(nod
                                         svn_wc_conflict_action_edit,
                                         NULL,
                                         scratch_pool, scratch_pool));
-      conflict_relpath = dst_relpath;
-      dst_parent_local_relpath = svn_relpath_dirname(dst_relpath, scratch_pool);
-      SVN_ERR(svn_wc__db_base_get_info_internal(NULL, NULL, NULL,
-                                                &dst_parent_repos_relpath,
-                                                NULL, NULL, NULL, NULL, NULL,
-                                                NULL, NULL, NULL, NULL, NULL,
-                                                NULL, b->wcroot,
-                                                dst_parent_local_relpath,
-                                                scratch_pool, scratch_pool));
-      conflict_repos_relpath = svn_relpath_join(dst_parent_repos_relpath,
-                                                svn_relpath_basename(
-                                                  dst_relpath, scratch_pool),
-                                                scratch_pool);
       tree_conflict = TRUE;
     }
 
@@ -1553,7 +1530,6 @@ tc_editor_update_incoming_moved_file(nod
       apr_hash_t *actual_props;
       apr_array_header_t *propchanges;
 
-      conflict_relpath = dst_relpath;
       SVN_ERR(update_working_props(&prop_state, &conflict_skel, &propchanges,
                                    &actual_props, b, dst_relpath,
                                    &old_version, &new_version,
@@ -1612,24 +1588,16 @@ tc_editor_update_incoming_moved_file(nod
    * too. */
   if (conflict_skel)
     {
-      const char *conflict_abspath;
-
-      conflict_abspath = svn_dirent_join(b->wcroot->abspath, conflict_relpath,
-                                         scratch_pool);
-      SVN_ERR(create_conflict_markers(&work_item, conflict_abspath, b->db,
-                                      conflict_repos_relpath, conflict_skel,
+      SVN_ERR(create_conflict_markers(&work_item, dst_abspath, b->db,
+                                      dst_repos_relpath, conflict_skel,
                                       b->operation, &old_version, &new_version,
                                       svn_node_file, !tree_conflict,
                                       scratch_pool, scratch_pool));
 
       work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
-      b->raised_new_conflicts = TRUE;
     }
 
-  SVN_ERR(update_move_list_add(b->wcroot,
-                               conflict_relpath
-                                 ? conflict_relpath : dst_relpath,
-                               b->db,
+  SVN_ERR(update_move_list_add(b->wcroot, dst_relpath, b->db,
                                svn_wc_notify_update_update,
                                svn_node_file,
                                content_state,
@@ -1698,7 +1666,6 @@ tc_editor_delete(node_move_baton_t *nmb,
                                         NULL,
                                         scratch_pool, scratch_pool));
       nmb->skip = TRUE;
-      b->raised_new_conflicts = TRUE;
     }
   else
     {
@@ -1831,7 +1798,6 @@ tc_incoming_editor_delete(node_move_bato
                                         NULL,
                                         scratch_pool, scratch_pool));
       nmb->skip = TRUE;
-      b->raised_new_conflicts = TRUE;
     }
   else
     {
@@ -2632,19 +2598,18 @@ update_incoming_moved_node(node_move_bat
 
 /* The body of svn_wc__db_update_incoming_move(). */
 static svn_error_t *
-update_incoming_move(svn_boolean_t *new_conflicts_remain,
-                     svn_revnum_t *old_rev,
-                     svn_revnum_t *new_rev,
-                     svn_wc__db_t *db,
-                     svn_wc__db_wcroot_t *wcroot,
-                     const char *local_relpath,
-                     const char *dst_relpath,
-                     svn_wc_operation_t operation,
-                     svn_wc_conflict_action_t action,
-                     svn_wc_conflict_reason_t reason,
-                     svn_cancel_func_t cancel_func,
-                     void *cancel_baton,
-                     apr_pool_t *scratch_pool)
+update_incoming_move(svn_revnum_t *old_rev,
+                    svn_revnum_t *new_rev,
+                    svn_wc__db_t *db,
+                    svn_wc__db_wcroot_t *wcroot,
+                    const char *local_relpath,
+                    const char *dst_relpath,
+                    svn_wc_operation_t operation,
+                    svn_wc_conflict_action_t action,
+                    svn_wc_conflict_reason_t reason,
+                    svn_cancel_func_t cancel_func,
+                    void *cancel_baton,
+                    apr_pool_t *scratch_pool)
 {
   update_move_baton_t umb = { NULL };
   svn_wc_conflict_version_t old_version;
@@ -2742,7 +2707,6 @@ update_incoming_move(svn_boolean_t *new_
   umb.wcroot = wcroot;
   umb.cancel_func = cancel_func;
   umb.cancel_baton = cancel_baton;
-  umb.raised_new_conflicts = FALSE;
 
   /* Create a new, and empty, list for notification information. */
   SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
@@ -2763,15 +2727,11 @@ update_incoming_move(svn_boolean_t *new_
   SVN_ERR(update_incoming_moved_node(&nmb, wcroot, local_relpath, dst_relpath,
                                      scratch_pool));
 
-  if (new_conflicts_remain != NULL)
-    *new_conflicts_remain = umb.raised_new_conflicts;
-
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
-svn_wc__db_update_incoming_move(svn_boolean_t *new_conflicts_remain,
-                                svn_wc__db_t *db,
+svn_wc__db_update_incoming_move(svn_wc__db_t *db,
                                 const char *local_abspath,
                                 const char *dest_abspath,
                                 svn_wc_operation_t operation,
@@ -2798,8 +2758,7 @@ svn_wc__db_update_incoming_move(svn_bool
   dest_relpath
     = svn_dirent_skip_ancestor(wcroot->abspath, dest_abspath);
 
-  SVN_WC__DB_WITH_TXN(update_incoming_move(new_conflicts_remain,
-                                           &old_rev, &new_rev, db, wcroot,
+  SVN_WC__DB_WITH_TXN(update_incoming_move(&old_rev, &new_rev, db, wcroot,
                                            local_relpath, dest_relpath,
                                            operation, action, reason,
                                            cancel_func, cancel_baton,

Modified: subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c?rev=1772051&r1=1772050&r2=1772051&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c Wed Nov 30 15:12:36 2016
@@ -3277,8 +3277,9 @@ test_update_incoming_dir_move_with_neste
             conflict, svn_client_conflict_option_incoming_move_dir_merge,
             ctx, pool));
 
-  /* There should now be a tree conflict on the moved file,
-   * signaling an "edit vs delete or move". */
+  /* There should now be a tree conflict inside the moved directory,
+   * signaling a missing file. */
+  deleted_file = svn_relpath_join(moved_dir, "lambda" , b->pool);
   SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, deleted_file),
                                   ctx, pool, pool));
   SVN_ERR(svn_client_conflict_get_conflicted(&text_conflicted,
@@ -3289,9 +3290,9 @@ test_update_incoming_dir_move_with_neste
   SVN_TEST_INT_ASSERT(props_conflicted->nelts, 0);
   SVN_TEST_ASSERT(tree_conflicted);
   SVN_TEST_ASSERT(svn_client_conflict_get_local_change(conflict) ==
-                  svn_wc_conflict_reason_edited);
+                  svn_wc_conflict_reason_missing);
   SVN_TEST_ASSERT(svn_client_conflict_get_incoming_change(conflict) ==
-                  svn_wc_conflict_action_delete);
+                  svn_wc_conflict_action_edit);
 
   return SVN_NO_ERROR;
 }