subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kot...@apache.org
Subject svn commit: r1762939 - in /subversion/trunk/subversion: libsvn_client/conflicts.c tests/libsvn_client/conflicts-test.c
Date Fri, 30 Sep 2016 18:25:30 GMT
Author: kotkov
Date: Fri Sep 30 18:25:30 2016
New Revision: 1762939

URL: http://svn.apache.org/viewvc?rev=1762939&view=rev
Log:
In the tree conflict resolver, do not advertise the "ignore incoming
deletion" and "accept incoming deletion" options in the incoming move vs
local file edit situation.

If we know that the incoming delete actually is a move, there are no known
cases when ignoring or accepting the deletion would prove useful.  Apart
from that, offering these options can potentially confuse the users.
("What deletion?  The resolver says the file was moved.")

* subversion/libsvn_client/conflicts.c
  (configure_option_incoming_delete_ignore,
   configure_option_incoming_delete_accept): Do not add these options
   when we know that we're dealing with an incoming move and a local
   edit situation.

* subversion/tests/libsvn_client/conflicts-test.c
  (test_merge_incoming_move_file_text_merge,
   test_update_incoming_move_file_text_merge,
   test_switch_incoming_move_file_text_merge): Test offered options
   before and after receiving the conflict details.

Modified:
    subversion/trunk/subversion/libsvn_client/conflicts.c
    subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c

Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1762939&r1=1762938&r2=1762939&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Fri Sep 30 18:25:30 2016
@@ -7490,15 +7490,22 @@ configure_option_incoming_delete_ignore(
       struct conflict_tree_incoming_delete_details *incoming_details;
       svn_boolean_t is_incoming_move;
 
-      /* If the local item was deleted and conflict details were fetched and
-       * indicate that there was no move, then this is an actual 'delete vs
-       * delete' situation. An option which ignores the incoming deletion makes
-       * no sense in that case because there is no local node to preserve. */
       incoming_details = conflict->tree_conflict_incoming_details;
       is_incoming_move = (incoming_details != NULL &&
                           incoming_details->moves != NULL);
-      if (local_change == svn_wc_conflict_reason_deleted)
+      if (local_change == svn_wc_conflict_reason_edited && is_incoming_move)
         {
+          /* An option which ignores the incoming deletion makes no sense
+           * if we know it is actually a move. */
+          return SVN_NO_ERROR;
+        }
+      else if (local_change == svn_wc_conflict_reason_deleted)
+        {
+          /* If the local item was deleted and conflict details were fetched
+           * and indicate that there was no move, then this is an actual
+           * 'delete vs delete' situation. An option which ignores the incoming
+           * deletion makes no sense in that case because there is no local
+           * node to preserve. */
           if (!is_incoming_move)
             return SVN_NO_ERROR;
         }
@@ -7553,25 +7560,40 @@ configure_option_incoming_delete_accept(
 
   if (incoming_change == svn_wc_conflict_action_delete)
     {
-      svn_client_conflict_option_t *option;
-      const char *wcroot_abspath;
-      const char *local_abspath;
+      struct conflict_tree_incoming_delete_details *incoming_details;
 
-      option = apr_pcalloc(options->pool, sizeof(*option));
-      option->pool = options->pool;
-      option->id = svn_client_conflict_option_incoming_delete_accept;
-      SVN_ERR(svn_wc__get_wcroot(&wcroot_abspath, ctx->wc_ctx,
-                                 conflict->local_abspath, scratch_pool,
-                                 scratch_pool));
-      local_abspath = svn_client_conflict_get_local_abspath(conflict);
-      option->description =
-        apr_psprintf(options->pool, _("accept the deletion of '%s'"),
-          svn_dirent_local_style(svn_dirent_skip_ancestor(wcroot_abspath,
-                                                          local_abspath),
-                                 scratch_pool));
-      option->conflict = conflict;
-      option->do_resolve_func = resolve_incoming_delete_accept;
-      APR_ARRAY_PUSH(options, const svn_client_conflict_option_t *) = option;
+      incoming_details = conflict->tree_conflict_incoming_details;
+
+      if (local_change == svn_wc_conflict_reason_edited &&
+          incoming_details != NULL && incoming_details->moves != NULL)
+        {
+          /* An option which accepts the incoming deletion makes no sense
+           * if we know it is actually a move. */
+          return SVN_NO_ERROR;
+        }
+      else
+        {
+          svn_client_conflict_option_t *option;
+          const char *wcroot_abspath;
+          const char *local_abspath;
+
+          option = apr_pcalloc(options->pool, sizeof(*option));
+          option->pool = options->pool;
+          option->id = svn_client_conflict_option_incoming_delete_accept;
+          SVN_ERR(svn_wc__get_wcroot(&wcroot_abspath, ctx->wc_ctx,
+                                     conflict->local_abspath, scratch_pool,
+                                     scratch_pool));
+          local_abspath = svn_client_conflict_get_local_abspath(conflict);
+          option->description =
+            apr_psprintf(options->pool, _("accept the deletion of '%s'"),
+              svn_dirent_local_style(svn_dirent_skip_ancestor(wcroot_abspath,
+                                                              local_abspath),
+                                     scratch_pool));
+          option->conflict = conflict;
+          option->do_resolve_func = resolve_incoming_delete_accept;
+          APR_ARRAY_PUSH(options,
+                         const svn_client_conflict_option_t *) = option;
+        }
     }
 
   return SVN_NO_ERROR;

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=1762939&r1=1762938&r2=1762939&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c Fri Sep 30 18:25:30 2016
@@ -1868,7 +1868,32 @@ test_merge_incoming_move_file_text_merge
   deleted_path = svn_relpath_join(branch_path, deleted_file_name, b->pool);
   SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, deleted_path),
                                   ctx, b->pool, b->pool));
+
+  {
+    svn_client_conflict_option_id_t expected_opts[] = {
+      svn_client_conflict_option_postpone,
+      svn_client_conflict_option_accept_current_wc_state,
+      svn_client_conflict_option_incoming_delete_ignore,
+      svn_client_conflict_option_incoming_delete_accept,
+      -1 /* end of list */
+    };
+    SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts,
+                                         b->pool));
+  }
+
   SVN_ERR(svn_client_conflict_tree_get_details(conflict, ctx, b->pool));
+
+  {
+    svn_client_conflict_option_id_t expected_opts[] = {
+      svn_client_conflict_option_postpone,
+      svn_client_conflict_option_accept_current_wc_state,
+      svn_client_conflict_option_incoming_move_file_text_merge,
+      -1 /* end of list */
+    };
+    SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts,
+                                         b->pool));
+  }
+
   SVN_ERR(svn_client_conflict_tree_resolve_by_id(
             conflict, svn_client_conflict_option_incoming_move_file_text_merge,
             ctx, b->pool));
@@ -2007,7 +2032,32 @@ test_update_incoming_move_file_text_merg
   deleted_path = svn_relpath_join(trunk_path, deleted_file_name, b->pool);
   SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, deleted_path),
                                   ctx, b->pool, b->pool));
+
+  {
+    svn_client_conflict_option_id_t expected_opts[] = {
+      svn_client_conflict_option_postpone,
+      svn_client_conflict_option_accept_current_wc_state,
+      svn_client_conflict_option_incoming_delete_ignore,
+      svn_client_conflict_option_incoming_delete_accept,
+      -1 /* end of list */
+    };
+    SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts,
+                                         b->pool));
+  }
+
   SVN_ERR(svn_client_conflict_tree_get_details(conflict, ctx, b->pool));
+
+  {
+    svn_client_conflict_option_id_t expected_opts[] = {
+      svn_client_conflict_option_postpone,
+      svn_client_conflict_option_accept_current_wc_state,
+      svn_client_conflict_option_incoming_move_file_text_merge,
+      -1 /* end of list */
+    };
+    SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts,
+                                         b->pool));
+  }
+
   SVN_ERR(svn_client_conflict_tree_resolve_by_id(
             conflict, svn_client_conflict_option_incoming_move_file_text_merge,
             ctx, b->pool));
@@ -2072,7 +2122,32 @@ test_switch_incoming_move_file_text_merg
   deleted_path = svn_relpath_join(branch_path, deleted_file_name, b->pool);
   SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, deleted_path),
                                   ctx, b->pool, b->pool));
+
+  {
+    svn_client_conflict_option_id_t expected_opts[] = {
+      svn_client_conflict_option_postpone,
+      svn_client_conflict_option_accept_current_wc_state,
+      svn_client_conflict_option_incoming_delete_ignore,
+      svn_client_conflict_option_incoming_delete_accept,
+      -1 /* end of list */
+    };
+    SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts,
+                                         b->pool));
+  }
+
   SVN_ERR(svn_client_conflict_tree_get_details(conflict, ctx, b->pool));
+
+  {
+    svn_client_conflict_option_id_t expected_opts[] = {
+      svn_client_conflict_option_postpone,
+      svn_client_conflict_option_accept_current_wc_state,
+      svn_client_conflict_option_incoming_move_file_text_merge,
+      -1 /* end of list */
+    };
+    SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts,
+                                         b->pool));
+  }
+
   SVN_ERR(svn_client_conflict_tree_resolve_by_id(
             conflict, svn_client_conflict_option_incoming_move_file_text_merge,
             ctx, b->pool));



Mime
View raw message