Author: stsp
Date: Mon Dec 12 15:24:45 2011
New Revision: 1213275

URL: http://svn.apache.org/viewvc?rev=1213275&view=rev
Log:
On the moves-scan-log branch, add prompts for "incoming move vs. local
move" tree conflicts to the conflict callback.

This is definitely not the final revision of the conflict prompt interface
for these cases. None of the new options actually do anything useful yet.

* subversion/include/svn_wc.h
  (svn_wc_conflict_description2_t): Remove 'incoming_move'. It was unused
   as of now and is not needed. The only way to get at the incoming move
   is to scan the log. The incoming move cannot be known in advance yet.

* subversion/svn/conflict-callbacks.c
  (svn_cl__conflict_handler): Add a prompt menu for conflicts involving an
   incoming move.

* subversion/libsvn_wc/update_editor.c
  (delete_entry): Slightly rework the loop logic which invokes the conflict
   callback in case of incoming delete vs. local delete/move.
   If a move is found scanning the log invoke the conflict callback with
   an updated tree-conflict description that identifies the incoming change
   as a move. Add a couple of no-op cases for possible resolutions received
   from the callback.

Modified:
    subversion/branches/moves-scan-log/subversion/include/svn_wc.h
    subversion/branches/moves-scan-log/subversion/libsvn_wc/update_editor.c
    subversion/branches/moves-scan-log/subversion/svn/conflict-callbacks.c

Modified: subversion/branches/moves-scan-log/subversion/include/svn_wc.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/include/svn_wc.h?rev=1213275&r1=1213274&r2=1213275&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/subversion/include/svn_wc.h (original)
+++ subversion/branches/moves-scan-log/subversion/include/svn_wc.h Mon Dec 12 
15:24:45 2011
@@ -1858,11 +1858,6 @@ typedef struct svn_wc_conflict_descripti
    * @since New in 1.8. */
   apr_array_header_t *suggested_moves;
 
-  /** The incoming move in case of an incoming move vs. local move tree
-   * conflict.
-   * @since New in 1.8. */
-  svn_wc_repos_move_info_t *incoming_move;
-
   /* Remember to adjust svn_wc__conflict_description2_dup()
    * if you add new fields to this struct. */
 } svn_wc_conflict_description2_t;

Modified: 
subversion/branches/moves-scan-log/subversion/libsvn_wc/update_editor.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/libsvn_wc/update_editor.c?rev=1213275&r1=1213274&r2=1213275&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/subversion/libsvn_wc/update_editor.c 
(original)
+++ subversion/branches/moves-scan-log/subversion/libsvn_wc/update_editor.c Mon 
Dec 12 15:24:45 2011
@@ -2130,7 +2130,7 @@ delete_entry(const char *path,
     {
       svn_wc_conflict_result_t *result;
 
-      do
+      while (1)
         {
           SVN_ERR(eb->conflict_func(&result, tree_conflict,
                                     eb->conflict_baton,
@@ -2140,6 +2140,9 @@ delete_entry(const char *path,
                                     NULL, _("Conflict callback violated API:"
                                             " returned no results"));
 
+          if (result->choice == svn_wc_conflict_choose_postpone)
+            break;
+
           if (result->choice == svn_wc_conflict_choose_scan_log_for_moves)
             {
               /* Scan revision log for server-side moves */
@@ -2149,6 +2152,12 @@ delete_entry(const char *path,
               SVN_ERR(find_applicable_moves(
                         &tree_conflict->suggested_moves, eb,
                         local_abspath, scratch_pool, scratch_pool));
+
+              if (tree_conflict->suggested_moves->nelts > 0)
+                {
+                  /* Assume an incoming move vs. local delete/move conflict. */
+                  tree_conflict->action = svn_wc_conflict_action_move_away;
+                }
               continue;
             }
 
@@ -2183,13 +2192,13 @@ delete_entry(const char *path,
 
                   /* Incoming move vs. local move tree conflict. */
                   tree_conflict->action = svn_wc_conflict_action_move_away;
-                  tree_conflict->incoming_move = result->incoming_move;
+                  break;
                 }
               else if (tree_conflict->reason == svn_wc_conflict_reason_deleted)
                 {
                   /* Incoming move vs. local delete tree conflict. */
                   tree_conflict->action = svn_wc_conflict_action_move_away;
-                  tree_conflict->incoming_move = result->incoming_move;
+                  break;
                 }
 
               /* Now that the precise nature of the conflict is known, invoke
@@ -2201,11 +2210,13 @@ delete_entry(const char *path,
           if (result->choice == 
svn_wc_conflict_choose_new_incoming_move_target)
             {
               /* ### TODO */
+              break;
             }
 
           if (result->choice == svn_wc_conflict_choose_new_local_move_target)
             {
               /* ### TODO */
+              break;
             }
 
           if (moved_to_abspath &&
@@ -2232,13 +2243,21 @@ delete_entry(const char *path,
                   svn_wc_conflict_reason_moved_away_and_edited;
               else
                 tree_conflict = NULL; /* discard conflict */
+              break;
+            }
+
+          if (result->choice == svn_wc_conflict_choose_mine_conflict)
+            {
+              /* ### TODO */
+              break;
+            }
+
+          if (result->choice == svn_wc_conflict_choose_theirs_conflict)
+            {
+              /* ### TODO */
+              break;
             }
         }
-      while (tree_conflict &&
-             result->choice != svn_wc_conflict_choose_incoming_move &&
-             result->choice != svn_wc_conflict_choose_new_local_move_target &&
-             result->choice != svn_wc_conflict_choose_delete_is_delete &&
-             result->choice != svn_wc_conflict_choose_postpone);
     }
 
   if (tree_conflict != NULL)

Modified: subversion/branches/moves-scan-log/subversion/svn/conflict-callbacks.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/svn/conflict-callbacks.c?rev=1213275&r1=1213274&r2=1213275&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/subversion/svn/conflict-callbacks.c 
(original)
+++ subversion/branches/moves-scan-log/subversion/svn/conflict-callbacks.c Mon 
Dec 12 15:24:45 2011
@@ -987,6 +987,104 @@ svn_cl__conflict_handler(svn_wc_conflict
         }
     }
 
+  else if (desc->kind == svn_wc_conflict_kind_tree &&
+           desc->action == svn_wc_conflict_action_move_away)
+    {
+      const char *answer;
+      const char *prompt;
+      const char *readable_desc;
+      const char *help_text;
+      svn_wc_repos_move_info_t *move;
+
+      SVN_ERR(svn_cl__get_human_readable_tree_conflict_description(
+               &readable_desc, desc, scratch_pool));
+      SVN_ERR(svn_cmdline_fprintf(
+                   stderr, subpool,
+                   _("Tree conflict on '%s'\n   > %s\n"),
+                   /* ### TODO: show the local move, too */
+                   svn_cl__local_style_skip_ancestor(b->path_prefix,
+                                                     desc->local_abspath,
+                                                     scratch_pool),
+                   readable_desc));
+
+      if (desc->server_sends_moves_as_copy_plus_delete)
+        SVN_ERR(pick_move(&move, desc->suggested_moves, b->pb,
+                          subpool));
+      else
+        return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+                                 _("This client only supports servers which "
+                                   "send moves as copy+delete, but the server "
+                                   "does not send moves as copy+delete"));
+
+      prompt = _("Select: (p) postpone, (mc) mine-conflict,\n"
+                 "        (tc) theirs-conflict, (ci) change-incoming,\n"
+                 "        (cl) change-local, (h) help: ");
+      if (desc->reason == svn_wc_conflict_reason_moved_away ||
+          desc->reason == svn_wc_conflict_reason_moved_here)
+        help_text = 
+          _("  (p)  postpone        - resolve the conflict later\n"
+            "  (mc) mine-conflict   - use incoming move\n"
+            "  (tc) theirs-conflict - use local move\n"
+            "  (ci) change-incoming - change incoming move target\n"
+            "  (cl) change-local    - change local move target\n"
+            "  (h)  help            - show this help\n\n");
+      else if (desc->reason == svn_wc_conflict_reason_deleted)
+        help_text = 
+          _("  (p)  postpone        - resolve the conflict later\n"
+            "  (mc) mine-conflict   - delete the item\n"
+            "  (tc) theirs-conflict - move the item\n"
+            "  (h)  help            - show this help\n\n");
+
+      while (1)
+        {
+          svn_pool_clear(subpool);
+
+          SVN_ERR(svn_cmdline_prompt_user2(&answer, prompt, b->pb, subpool));
+
+          if (strcmp(answer, "h") == 0 || strcmp(answer, "?") == 0)
+            {
+              SVN_ERR(svn_cmdline_fprintf(stderr, subpool, "%s", help_text));
+              continue;
+            }
+          if (strcmp(answer, "p") == 0 || strcmp(answer, ":-P") == 0)
+            {
+              (*result)->choice = svn_wc_conflict_choose_postpone;
+              break;
+            }
+          if (strcmp(answer, "mc") == 0 || strcmp(answer, "X-)") == 0)
+            {
+              (*result)->choice = svn_wc_conflict_choose_mine_conflict;
+              break;
+            }
+          if (strcmp(answer, "ci") == 0)
+            {
+              /* ### TODO: Needs a user-friendly UI. Tab-completion? */
+              prompt = _("Please type the new incoming move target path: ");
+              SVN_ERR(svn_cmdline_prompt_user2(&answer, prompt, b->pb,
+                                               subpool));
+              (*result)->new_incoming_move_target = answer;
+              (*result)->choice =
+                svn_wc_conflict_choose_new_incoming_move_target;
+              break;
+            }
+          if (strcmp(answer, "tc") == 0 || strcmp(answer, "X-(") == 0)
+            {
+              (*result)->choice = svn_wc_conflict_choose_theirs_conflict;
+              break;
+            }
+          if (strcmp(answer, "cl") == 0)
+            {
+              /* ### TODO: Needs a user-friendly UI. Tab-completion? */
+              prompt = _("Please type the new local move target path: ");
+              SVN_ERR(svn_cmdline_prompt_user2(&answer, prompt, b->pb,
+                                               subpool));
+              (*result)->new_local_move_target = answer;
+              (*result)->choice = svn_wc_conflict_choose_new_local_move_target;
+              break;
+            }
+        }
+    }
+
   else /* other types of conflicts -- do nothing about them. */
     {
       (*result)->choice = svn_wc_conflict_choose_postpone;


Reply via email to