subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1387602 - /subversion/trunk/subversion/svn/conflict-callbacks.c
Date Wed, 19 Sep 2012 14:16:56 GMT
Author: stsp
Date: Wed Sep 19 14:16:55 2012
New Revision: 1387602

URL: http://svn.apache.org/viewvc?rev=1387602&view=rev
Log:
In the interactive conflict resolver, split logic for handling text conflicts
from logic for handling property conflicts. This causes some code duplication,
however it allows us to fine-tune conflict prompt menus for each case more
easily. Furthermore, I expect the menus to divert further once support
for interactively resolving individual property conflicts is added.

The prompt for property conflicts is totally messed up right now.
In my testing it shows up like this:

 They want to change the property value to 'Trying to add new property 'foo'
 but the property already exists.
 <<<<<<< (local property value)
 bzzt=======
 bar>>>>>>> (incoming property value)
 ', you want to delete the property.

Seriously? Seems to be a regression on trunk that's so far gone undetected :(

Many options offered during property resolution simply printed a 'this option
is invalid' error. Users will rightly wonder why invalid options are being
offered in the first place, so remove them.

* subversion/svn/conflict-callbacks.c
  (svn_cl__conflict_handler): Factor out code for text/prop conflicts into ...
  (handle_text_conflict, handle_prop_conflict): ... these new helpers.
   Rename subpool to scratch_pool. Remove options from the menu in
   handle_prop_conflict() that currently don't apply to property conflicts.

Modified:
    subversion/trunk/subversion/svn/conflict-callbacks.c

Modified: subversion/trunk/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/conflict-callbacks.c?rev=1387602&r1=1387601&r2=1387602&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/conflict-callbacks.c (original)
+++ subversion/trunk/subversion/svn/conflict-callbacks.c Wed Sep 19 14:16:55 2012
@@ -265,6 +265,444 @@ launch_resolver(svn_boolean_t *performed
   return SVN_NO_ERROR;
 }
 
+/* Ask the user what to do about the text conflict described by DESC.
+ * Return the answer in RESULT. B is the conflict baton for this
+ * conflict resolution session.
+ * SCRATCH_POOL is used for temporary allocations. */
+static svn_error_t *
+handle_text_conflict(svn_wc_conflict_result_t *result,
+                     const svn_wc_conflict_description2_t *desc,
+                     svn_cl__conflict_baton_t *b,
+                     apr_pool_t *scratch_pool)
+{
+  const char *answer;
+  char *prompt;
+  svn_boolean_t diff_allowed = FALSE;
+  /* Have they done something that might have affected the merged
+     file (so that we need to save a .edited copy)? */
+  svn_boolean_t performed_edit = FALSE;
+  /* Have they done *something* (edit, look at diff, etc) to
+     give them a rational basis for choosing (r)esolved? */
+  svn_boolean_t knows_something = FALSE;
+
+  SVN_ERR_ASSERT(desc->kind == svn_wc_conflict_kind_text);
+
+  SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                              _("Conflict discovered in file '%s'.\n"),
+                              svn_cl__local_style_skip_ancestor(
+                                b->path_prefix, desc->local_abspath,
+                                scratch_pool)));
+
+  /* Diffing can happen between base and merged, to show conflict
+     markers to the user (this is the typical 3-way merge
+     scenario), or if no base is available, we can show a diff
+     between mine and theirs. */
+  if ((desc->merged_file && desc->base_abspath)
+      || (!desc->base_abspath && desc->my_abspath && desc->their_abspath))
+    diff_allowed = TRUE;
+
+  while (TRUE)
+    {
+      svn_pool_clear(scratch_pool);
+
+      prompt = apr_pstrdup(scratch_pool, _("Select: (p) postpone"));
+
+      if (diff_allowed)
+        {
+          prompt = apr_pstrcat(scratch_pool, prompt,
+                               _(", (df) diff-full, (e) edit, (m) merge"),
+                               (char *)NULL);
+
+          if (knows_something)
+            prompt = apr_pstrcat(scratch_pool, prompt, _(", (r) resolved"),
+                                 (char *)NULL);
+
+          if (! desc->is_binary)
+            prompt = apr_pstrcat(scratch_pool, prompt,
+                                 _(",\n        (mc) mine-conflict, "
+                                   "(tc) theirs-conflict"),
+                                 (char *)NULL);
+        }
+      else
+        {
+          if (knows_something)
+            prompt = apr_pstrcat(scratch_pool, prompt, _(", (r) resolved"),
+                                 (char *)NULL);
+          prompt = apr_pstrcat(scratch_pool, prompt,
+                               _(",\n        "
+                                 "(mf) mine-full, (tf) theirs-full"),
+                               (char *)NULL);
+        }
+
+      prompt = apr_pstrcat(scratch_pool, prompt, ",\n        ", (char *)NULL);
+      prompt = apr_pstrcat(scratch_pool, prompt,
+                           _("(s) show all options: "),
+                           (char *)NULL);
+
+      SVN_ERR(svn_cmdline_prompt_user2(&answer, prompt, b->pb, scratch_pool));
+
+      if (strcmp(answer, "s") == 0)
+        {
+          /* These are used in svn_cl__accept_from_word(). */
+          SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+          _("\n"
+            "  (e)  edit             - change merged file in an editor\n"
+            "  (df) diff-full        - show all changes made to merged "
+                                      "file\n"
+            "  (r)  resolved         - accept merged version of file\n"
+            "\n"
+            "  (dc) display-conflict - show all conflicts "
+                                      "(ignoring merged version)\n"
+            "  (mc) mine-conflict    - accept my version for all "
+                                      "conflicts (same)\n"
+            "  (tc) theirs-conflict  - accept their version for all "
+                                      "conflicts (same)\n"
+            "\n"
+            "  (mf) mine-full        - accept my version of entire file "
+                                      "(even non-conflicts)\n"
+            "  (tf) theirs-full      - accept their version of entire "
+                                      "file (same)\n"
+            "\n"
+            "  (p)  postpone         - mark the conflict to be "
+                                      "resolved later\n"
+            "  (m)  merge            - use internal merge tool to "
+                                      "resolve conflict\n"
+            "  (l)  launch           - launch external tool to "
+                                      "resolve conflict\n"
+            "  (s)  show all         - show this list\n\n")));
+        }
+      else if (strcmp(answer, "p") == 0 || strcmp(answer, ":-P") == 0)
+        {
+          /* Do nothing, let file be marked conflicted. */
+          result->choice = svn_wc_conflict_choose_postpone;
+          break;
+        }
+      else if (strcmp(answer, "mc") == 0 || strcmp(answer, "X-)") == 0)
+        {
+          if (desc->is_binary)
+            {
+              SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                                          _("Invalid option; cannot choose "
+                                            "based on conflicts in a "
+                                            "binary file.\n\n")));
+              continue;
+            }
+          result->choice = svn_wc_conflict_choose_mine_conflict;
+          if (performed_edit)
+            result->save_merged = TRUE;
+          break;
+        }
+      else if (strcmp(answer, "tc") == 0 || strcmp(answer, "X-(") == 0)
+        {
+          if (desc->is_binary)
+            {
+              SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                                          _("Invalid option; cannot choose "
+                                            "based on conflicts in a "
+                                            "binary file.\n\n")));
+              continue;
+            }
+          result->choice = svn_wc_conflict_choose_theirs_conflict;
+          if (performed_edit)
+            result->save_merged = TRUE;
+          break;
+        }
+      else if (strcmp(answer, "mf") == 0 || strcmp(answer, ":-)") == 0)
+        {
+          result->choice = svn_wc_conflict_choose_mine_full;
+          if (performed_edit)
+            result->save_merged = TRUE;
+          break;
+        }
+      else if (strcmp(answer, "tf") == 0 || strcmp(answer, ":-(") == 0)
+        {
+          result->choice = svn_wc_conflict_choose_theirs_full;
+          if (performed_edit)
+            result->save_merged = TRUE;
+          break;
+        }
+      else if (strcmp(answer, "dc") == 0)
+        {
+          if (desc->is_binary)
+            {
+              SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                                          _("Invalid option; cannot "
+                                            "display conflicts for a "
+                                            "binary file.\n\n")));
+              continue;
+            }
+          else if (! (desc->my_abspath && desc->base_abspath &&
+                      desc->their_abspath))
+            {
+              SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                                          _("Invalid option; original "
+                                            "files not available.\n\n")));
+              continue;
+            }
+          SVN_ERR(show_conflicts(desc, scratch_pool));
+          knows_something = TRUE;
+        }
+      else if (strcmp(answer, "df") == 0)
+        {
+          if (! diff_allowed)
+            {
+              SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                             _("Invalid option; there's no "
+                                "merged version to diff.\n\n")));
+              continue;
+            }
+
+          SVN_ERR(show_diff(desc, scratch_pool));
+          knows_something = TRUE;
+        }
+      else if (strcmp(answer, "e") == 0 || strcmp(answer, ":-E") == 0)
+        {
+          SVN_ERR(open_editor(&performed_edit, desc, b, scratch_pool));
+          if (performed_edit)
+            knows_something = TRUE;
+        }
+      else if (strcmp(answer, "m") == 0 || strcmp(answer, ":-M") == 0)
+        {
+          if (desc->kind != svn_wc_conflict_kind_text)
+            {
+              SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                                          _("Invalid option; can only "
+                                            "resolve text conflicts with "
+                                            "the internal merge tool."
+                                            "\n\n")));
+              continue;
+            }
+
+          if (desc->base_abspath && desc->their_abspath &&
+              desc->my_abspath && desc->merged_file)
+            {
+              svn_boolean_t remains_in_conflict;
+
+              SVN_ERR(svn_cl__merge_file(desc->base_abspath,
+                                         desc->their_abspath,
+                                         desc->my_abspath,
+                                         desc->merged_file,
+                                         desc->local_abspath,
+                                         b->path_prefix,
+                                         b->editor_cmd,
+                                         b->config,
+                                         &remains_in_conflict,
+                                         scratch_pool));
+              knows_something = !remains_in_conflict;
+            }
+          else
+            SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                                        _("Invalid option.\n\n")));
+        }
+      else if (strcmp(answer, "l") == 0 || strcmp(answer, ":-l") == 0)
+        {
+          if (desc->base_abspath && desc->their_abspath &&
+              desc->my_abspath && desc->merged_file)
+            {
+              SVN_ERR(launch_resolver(&performed_edit, desc, b, scratch_pool));
+              if (performed_edit)
+                knows_something = TRUE;
+            }
+          else
+            SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                                        _("Invalid option.\n\n")));
+        }
+      else if (strcmp(answer, "r") == 0)
+        {
+          /* We only allow the user accept the merged version of
+             the file if they've edited it, or at least looked at
+             the diff. */
+          if (knows_something)
+            {
+              result->choice = svn_wc_conflict_choose_merged;
+              break;
+            }
+          else
+            SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                                        _("Invalid option.\n\n")));
+        }
+    }
+
+  return SVN_NO_ERROR;
+}
+
+/* Ask the user what to do about the property conflict described by DESC.
+ * Return the answer in RESULT. B is the conflict baton for this
+ * conflict resolution session.
+ * SCRATCH_POOL is used for temporary allocations. */
+static svn_error_t *
+handle_prop_conflict(svn_wc_conflict_result_t *result,
+                     const svn_wc_conflict_description2_t *desc,
+                     svn_cl__conflict_baton_t *b,
+                     apr_pool_t *scratch_pool)
+{
+  const char *answer;
+  char *prompt;
+  svn_boolean_t diff_allowed = FALSE;
+  /* Have they done something that might have affected the merged
+     file (so that we need to save a .edited copy)? */
+  svn_boolean_t performed_edit = FALSE;
+  /* Have they done *something* (edit, look at diff, etc) to
+     give them a rational basis for choosing (r)esolved? */
+  svn_boolean_t knows_something = FALSE;
+
+  SVN_ERR_ASSERT(desc->kind == svn_wc_conflict_kind_property);
+
+  SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                              _("Conflict for property '%s' discovered"
+                                " on '%s'.\n"),
+                              desc->property_name,
+                              svn_cl__local_style_skip_ancestor(
+                                b->path_prefix, desc->local_abspath,
+                                scratch_pool)));
+
+  if ((!desc->my_abspath && desc->their_abspath)
+      || (desc->my_abspath && !desc->their_abspath))
+    {
+      /* One agent wants to change the property, one wants to
+         delete it.  This is not something we can diff, so we
+         just tell the user. */
+      svn_stringbuf_t *myval = NULL, *theirval = NULL;
+
+      if (desc->my_abspath)
+        {
+          SVN_ERR(svn_stringbuf_from_file2(&myval, desc->my_abspath,
+                                           scratch_pool));
+          SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                _("They want to delete the property, "
+                  "you want to change the value to '%s'.\n"),
+                  myval->data));
+        }
+      else
+        {
+          SVN_ERR(svn_stringbuf_from_file2(&theirval,
+                                           desc->their_abspath,
+                                           scratch_pool));
+          SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                _("They want to change the property value to '%s', "
+                  "you want to delete the property.\n"),
+                   theirval->data));
+        }
+    }
+
+  /* Diffing can happen between base and merged, to show conflict
+     markers to the user (this is the typical 3-way merge
+     scenario), or if no base is available, we can show a diff
+     between mine and theirs. */
+  if ((desc->merged_file && desc->base_abspath)
+      || (!desc->base_abspath && desc->my_abspath && desc->their_abspath))
+    diff_allowed = TRUE;
+
+  while (TRUE)
+    {
+      svn_pool_clear(scratch_pool);
+
+      prompt = apr_pstrdup(scratch_pool, _("Select: (p) postpone"));
+
+      if (diff_allowed)
+        {
+          prompt = apr_pstrcat(scratch_pool, prompt,
+                               _(", (df) diff-full, (e) edit"),
+                               (char *)NULL);
+
+          if (knows_something)
+            prompt = apr_pstrcat(scratch_pool, prompt, _(", (r) resolved"),
+                                 (char *)NULL);
+        }
+      else
+        {
+          if (knows_something)
+            prompt = apr_pstrcat(scratch_pool, prompt, _(", (r) resolved"),
+                                 (char *)NULL);
+          prompt = apr_pstrcat(scratch_pool, prompt,
+                               _(",\n        "
+                                 "(mf) mine-full, (tf) theirs-full"),
+                               (char *)NULL);
+        }
+
+      prompt = apr_pstrcat(scratch_pool, prompt, ",\n        ", (char *)NULL);
+      prompt = apr_pstrcat(scratch_pool, prompt,
+                           _("(s) show all options: "),
+                           (char *)NULL);
+
+      SVN_ERR(svn_cmdline_prompt_user2(&answer, prompt, b->pb, scratch_pool));
+
+      if (strcmp(answer, "s") == 0)
+        {
+          /* These are used in svn_cl__accept_from_word(). */
+          SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+          _("\n"
+            "  (e)  edit             - change merged file in an editor\n"
+            "  (df) diff-full        - show all changes made to merged "
+                                      "file\n"
+            "  (r)  resolved         - accept merged version of file\n"
+            "\n"
+            "  (mf) mine-full        - accept my version of entire file "
+                                      "(even non-conflicts)\n"
+            "  (tf) theirs-full      - accept their version of entire "
+                                      "file (same)\n"
+            "\n"
+            "  (p)  postpone         - mark the conflict to be "
+                                      "resolved later\n"
+            "  (s)  show all         - show this list\n\n")));
+        }
+      else if (strcmp(answer, "p") == 0 || strcmp(answer, ":-P") == 0)
+        {
+          /* Do nothing, let property be marked conflicted. */
+          result->choice = svn_wc_conflict_choose_postpone;
+          break;
+        }
+      else if (strcmp(answer, "mf") == 0 || strcmp(answer, ":-)") == 0)
+        {
+          result->choice = svn_wc_conflict_choose_mine_full;
+          if (performed_edit)
+            result->save_merged = TRUE;
+          break;
+        }
+      else if (strcmp(answer, "tf") == 0 || strcmp(answer, ":-(") == 0)
+        {
+          result->choice = svn_wc_conflict_choose_theirs_full;
+          if (performed_edit)
+            result->save_merged = TRUE;
+          break;
+        }
+      else if (strcmp(answer, "df") == 0)
+        {
+          if (! diff_allowed)
+            {
+              SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                             _("Invalid option; there's no "
+                                "merged version to diff.\n\n")));
+              continue;
+            }
+
+          SVN_ERR(show_diff(desc, scratch_pool));
+          knows_something = TRUE;
+        }
+      else if (strcmp(answer, "e") == 0 || strcmp(answer, ":-E") == 0)
+        {
+          SVN_ERR(open_editor(&performed_edit, desc, b, scratch_pool));
+          if (performed_edit)
+            knows_something = TRUE;
+        }
+      else if (strcmp(answer, "r") == 0)
+        {
+          /* We only allow the user accept the merged version of
+             the file if they've edited it, or at least looked at
+             the diff. */
+          if (knows_something)
+            {
+              result->choice = svn_wc_conflict_choose_merged;
+              break;
+            }
+          else
+            SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
+                                        _("Invalid option.\n\n")));
+        }
+    }
+
+  return SVN_NO_ERROR;
+}
 
 /* Implement svn_wc_conflict_resolver_func2_t; resolves based on
    --accept option if given, else by prompting. */
@@ -409,333 +847,11 @@ svn_cl__conflict_handler(svn_wc_conflict
   */
   if (((desc->node_kind == svn_node_file)
        && (desc->action == svn_wc_conflict_action_edit)
-       && (desc->reason == svn_wc_conflict_reason_edited))
-      || (desc->kind == svn_wc_conflict_kind_property))
-  {
-      const char *answer;
-      char *prompt;
-      svn_boolean_t diff_allowed = FALSE;
-      /* Have they done something that might have affected the merged
-         file (so that we need to save a .edited copy)? */
-      svn_boolean_t performed_edit = FALSE;
-      /* Have they done *something* (edit, look at diff, etc) to
-         give them a rational basis for choosing (r)esolved? */
-      svn_boolean_t knows_something = FALSE;
-
-      if (desc->kind == svn_wc_conflict_kind_text)
-        SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                    _("Conflict discovered in file '%s'.\n"),
-                                    svn_cl__local_style_skip_ancestor(
-                                      b->path_prefix, desc->local_abspath,
-                                      subpool)));
-      else if (desc->kind == svn_wc_conflict_kind_property)
-        {
-          SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                      _("Conflict for property '%s' discovered"
-                                        " on '%s'.\n"),
-                                      desc->property_name,
-                                      svn_cl__local_style_skip_ancestor(
-                                        b->path_prefix, desc->local_abspath,
-                                        subpool)));
-
-          if ((!desc->my_abspath && desc->their_abspath)
-              || (desc->my_abspath && !desc->their_abspath))
-            {
-              /* One agent wants to change the property, one wants to
-                 delete it.  This is not something we can diff, so we
-                 just tell the user. */
-              svn_stringbuf_t *myval = NULL, *theirval = NULL;
-
-              if (desc->my_abspath)
-                {
-                  SVN_ERR(svn_stringbuf_from_file2(&myval, desc->my_abspath,
-                                                   subpool));
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                        _("They want to delete the property, "
-                          "you want to change the value to '%s'.\n"),
-                          myval->data));
-                }
-              else
-                {
-                  SVN_ERR(svn_stringbuf_from_file2(&theirval,
-                                                   desc->their_abspath,
-                                                   subpool));
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                        _("They want to change the property value to '%s', "
-                          "you want to delete the property.\n"),
-                           theirval->data));
-                }
-            }
-        }
-      else
-        /* We don't recognize any other sort of conflict yet */
-        return SVN_NO_ERROR;
-
-      /* Diffing can happen between base and merged, to show conflict
-         markers to the user (this is the typical 3-way merge
-         scenario), or if no base is available, we can show a diff
-         between mine and theirs. */
-      if ((desc->merged_file && desc->base_abspath)
-          || (!desc->base_abspath && desc->my_abspath && desc->their_abspath))
-        diff_allowed = TRUE;
+       && (desc->reason == svn_wc_conflict_reason_edited)))
+    SVN_ERR(handle_text_conflict(*result, desc, b, subpool));
+  else if (desc->kind == svn_wc_conflict_kind_property)
+    SVN_ERR(handle_prop_conflict(*result, desc, b, subpool));
 
-      while (TRUE)
-        {
-          svn_pool_clear(subpool);
-
-          prompt = apr_pstrdup(subpool, _("Select: (p) postpone"));
-
-          if (diff_allowed)
-            {
-              prompt = apr_pstrcat(subpool, prompt,
-                                   _(", (df) diff-full, (e) edit, (m) merge"),
-                                   (char *)NULL);
-
-              if (knows_something)
-                prompt = apr_pstrcat(subpool, prompt, _(", (r) resolved"),
-                                     (char *)NULL);
-
-              if (! desc->is_binary &&
-                  desc->kind != svn_wc_conflict_kind_property)
-                prompt = apr_pstrcat(subpool, prompt,
-                                     _(",\n        (mc) mine-conflict, "
-                                       "(tc) theirs-conflict"),
-                                     (char *)NULL);
-            }
-          else
-            {
-              if (knows_something)
-                prompt = apr_pstrcat(subpool, prompt, _(", (r) resolved"),
-                                     (char *)NULL);
-              prompt = apr_pstrcat(subpool, prompt,
-                                   _(",\n        "
-                                     "(mf) mine-full, (tf) theirs-full"),
-                                   (char *)NULL);
-            }
-
-          prompt = apr_pstrcat(subpool, prompt, ",\n        ", (char *)NULL);
-          prompt = apr_pstrcat(subpool, prompt,
-                               _("(s) show all options: "),
-                               (char *)NULL);
-
-          SVN_ERR(svn_cmdline_prompt_user2(&answer, prompt, b->pb, subpool));
-
-          if (strcmp(answer, "s") == 0)
-            {
-              /* These are used in svn_cl__accept_from_word(). */
-              SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-              _("\n"
-                "  (e)  edit             - change merged file in an editor\n"
-                "  (df) diff-full        - show all changes made to merged "
-                                          "file\n"
-                "  (r)  resolved         - accept merged version of file\n"
-                "\n"
-                "  (dc) display-conflict - show all conflicts "
-                                          "(ignoring merged version)\n"
-                "  (mc) mine-conflict    - accept my version for all "
-                                          "conflicts (same)\n"
-                "  (tc) theirs-conflict  - accept their version for all "
-                                          "conflicts (same)\n"
-                "\n"
-                "  (mf) mine-full        - accept my version of entire file "
-                                          "(even non-conflicts)\n"
-                "  (tf) theirs-full      - accept their version of entire "
-                                          "file (same)\n"
-                "\n"
-                "  (p)  postpone         - mark the conflict to be "
-                                          "resolved later\n"
-                "  (m)  merge            - use internal merge tool to "
-                                          "resolve conflict\n"
-                "  (l)  launch           - launch external tool to "
-                                          "resolve conflict\n"
-                "  (s)  show all         - show this list\n\n")));
-            }
-          else if (strcmp(answer, "p") == 0 || strcmp(answer, ":-P") == 0)
-            {
-              /* Do nothing, let file be marked conflicted. */
-              (*result)->choice = svn_wc_conflict_choose_postpone;
-              break;
-            }
-          else if (strcmp(answer, "mc") == 0 || strcmp(answer, "X-)") == 0)
-            {
-              if (desc->is_binary)
-                {
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                              _("Invalid option; cannot choose "
-                                                "based on conflicts in a "
-                                                "binary file.\n\n")));
-                  continue;
-                }
-              else if (desc->kind == svn_wc_conflict_kind_property)
-                {
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                              _("Invalid option; cannot choose "
-                                                "based on conflicts for "
-                                                "properties.\n\n")));
-                  continue;
-                }
-
-              (*result)->choice = svn_wc_conflict_choose_mine_conflict;
-              if (performed_edit)
-                (*result)->save_merged = TRUE;
-              break;
-            }
-          else if (strcmp(answer, "tc") == 0 || strcmp(answer, "X-(") == 0)
-            {
-              if (desc->is_binary)
-                {
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                              _("Invalid option; cannot choose "
-                                                "based on conflicts in a "
-                                                "binary file.\n\n")));
-                  continue;
-                }
-              else if (desc->kind == svn_wc_conflict_kind_property)
-                {
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                              _("Invalid option; cannot choose "
-                                                "based on conflicts for "
-                                                "properties.\n\n")));
-                  continue;
-                }
-              (*result)->choice = svn_wc_conflict_choose_theirs_conflict;
-              if (performed_edit)
-                (*result)->save_merged = TRUE;
-              break;
-            }
-          else if (strcmp(answer, "mf") == 0 || strcmp(answer, ":-)") == 0)
-            {
-              (*result)->choice = svn_wc_conflict_choose_mine_full;
-              if (performed_edit)
-                (*result)->save_merged = TRUE;
-              break;
-            }
-          else if (strcmp(answer, "tf") == 0 || strcmp(answer, ":-(") == 0)
-            {
-              (*result)->choice = svn_wc_conflict_choose_theirs_full;
-              if (performed_edit)
-                (*result)->save_merged = TRUE;
-              break;
-            }
-          else if (strcmp(answer, "dc") == 0)
-            {
-              if (desc->is_binary)
-                {
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                              _("Invalid option; cannot "
-                                                "display conflicts for a "
-                                                "binary file.\n\n")));
-                  continue;
-                }
-              else if (desc->kind == svn_wc_conflict_kind_property)
-                {
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                              _("Invalid option; cannot "
-                                                "display conflicts for "
-                                                "properties.\n\n")));
-                  continue;
-                }
-              else if (! (desc->my_abspath && desc->base_abspath &&
-                          desc->their_abspath))
-                {
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                              _("Invalid option; original "
-                                                "files not available.\n\n")));
-                  continue;
-                }
-              SVN_ERR(show_conflicts(desc, subpool));
-              knows_something = TRUE;
-            }
-          else if (strcmp(answer, "df") == 0)
-            {
-              if (! diff_allowed)
-                {
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                 _("Invalid option; there's no "
-                                    "merged version to diff.\n\n")));
-                  continue;
-                }
-
-              SVN_ERR(show_diff(desc, subpool));
-              knows_something = TRUE;
-            }
-          else if (strcmp(answer, "e") == 0 || strcmp(answer, ":-E") == 0)
-            {
-              SVN_ERR(open_editor(&performed_edit, desc, b, subpool));
-              if (performed_edit)
-                knows_something = TRUE;
-            }
-          else if (strcmp(answer, "m") == 0 || strcmp(answer, ":-M") == 0)
-            {
-              if (desc->kind != svn_wc_conflict_kind_text)
-                {
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                              _("Invalid option; can only "
-                                                "resolve text conflicts with "
-                                                "the internal merge tool."
-                                                "\n\n")));
-                  continue;
-                }
-
-              if (desc->base_abspath && desc->their_abspath &&
-                  desc->my_abspath && desc->merged_file)
-                {
-                  svn_boolean_t remains_in_conflict;
-
-                  SVN_ERR(svn_cl__merge_file(desc->base_abspath,
-                                             desc->their_abspath,
-                                             desc->my_abspath,
-                                             desc->merged_file,
-                                             desc->local_abspath,
-                                             b->path_prefix,
-                                             b->editor_cmd,
-                                             b->config,
-                                             &remains_in_conflict,
-                                             subpool));
-                  knows_something = !remains_in_conflict;
-                }
-              else
-                SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                            _("Invalid option.\n\n")));
-            }
-          else if (strcmp(answer, "l") == 0 || strcmp(answer, ":-l") == 0)
-            {
-              if (desc->kind == svn_wc_conflict_kind_property)
-                {
-                  SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                              _("Invalid option; cannot "
-                                                "resolve property conflicts "
-                                                "with an external merge tool."
-                                                "\n\n")));
-                  continue;
-                }
-              if (desc->base_abspath && desc->their_abspath &&
-                  desc->my_abspath && desc->merged_file)
-                {
-                  SVN_ERR(launch_resolver(&performed_edit, desc, b, subpool));
-                  if (performed_edit)
-                    knows_something = TRUE;
-                }
-              else
-                SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                            _("Invalid option.\n\n")));
-            }
-          else if (strcmp(answer, "r") == 0)
-            {
-              /* We only allow the user accept the merged version of
-                 the file if they've edited it, or at least looked at
-                 the diff. */
-              if (knows_something)
-                {
-                  (*result)->choice = svn_wc_conflict_choose_merged;
-                  break;
-                }
-              else
-                SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
-                                            _("Invalid option.\n\n")));
-            }
-        }
-    }
   /*
     Dealing with obstruction of additions can be tricky.  The
     obstructing item could be unversioned, versioned, or even



Mime
View raw message