Author: luke1410
Date: Fri Oct 14 14:07:58 2016
New Revision: 1764902

URL: http://svn.apache.org/viewvc?rev=1764902&view=rev
Log:
Fix svn resolve --accept=working not working on binary conflicts by retrying
to find a resolution option for the semantically corresponding
svn_client_conflict_option_working_text option.

Additionally, enable the mf option for binary conflicts, so to have the
option displayed in the client.

* subversion/libsvn_client/conflicts.c
  (svn_client_conflict_text_get_resolution_options): return the more
suitable
   svn_client_conflict_option_working_text to resolve binary conflicts.
  (svn_client_conflict_text_resolve_by_id): retry determining resolution
   option with svn_client_conflict_option_working_text.

* subversion/svn/conflict-callbacks.c
  (handle_text_conflict): add "mf" to the list of allowed resolutions for
   binary conflicts.

* subversion/tests/cmdline/resolve_tests.py
  (automatic_binary_conflict_resolution): remove XFail marker

Approved by: stsp

Modified:
    subversion/trunk/subversion/libsvn_client/conflicts.c
    subversion/trunk/subversion/svn/conflict-callbacks.c
    subversion/trunk/subversion/tests/cmdline/resolve_tests.py

Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1764902&r1=1764901&r2=1764902&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Fri Oct 14 14:07:58 
2016
@@ -7359,7 +7359,7 @@ svn_client_conflict_text_get_resolution_
         resolve_text_conflict);
 
       add_resolution_option(*options, conflict,
-        svn_client_conflict_option_merged_text,
+        svn_client_conflict_option_working_text,
         _("Mark as resolved"),
         _("accept binary file as it appears in the working copy"),
         resolve_text_conflict);
@@ -8824,19 +8824,36 @@ svn_client_conflict_text_resolve_by_id(
 {
   apr_array_header_t *resolution_options;
   svn_client_conflict_option_t *option;
+  const char *mime_type;
 
   SVN_ERR(svn_client_conflict_text_get_resolution_options(
             &resolution_options, conflict, ctx,
             scratch_pool, scratch_pool));
   option = svn_client_conflict_option_find_by_id(resolution_options,
                                                  option_id);
+
+  /* Support svn_client_conflict_option_merged_text for binary conflicts by
+   * mapping this onto the semantically equal
+   * svn_client_conflict_option_working_text.
+   */
   if (option == NULL)
-    return svn_error_createf(SVN_ERR_CLIENT_CONFLICT_OPTION_NOT_APPLICABLE,
-                             NULL,
-                             _("Inapplicable conflict resolution option "
-                               "given for conflicted path '%s'"),
-                             svn_dirent_local_style(conflict->local_abspath,
-                                                    scratch_pool));
+  {
+    if (option_id == svn_client_conflict_option_merged_text) {
+      mime_type = svn_client_conflict_text_get_mime_type(conflict);
+      if (mime_type && svn_mime_type_is_binary(mime_type))
+        option = svn_client_conflict_option_find_by_id(resolution_options,
+                   svn_client_conflict_option_working_text);
+    }
+  }
+
+  if (option == NULL)
+      return svn_error_createf(SVN_ERR_CLIENT_CONFLICT_OPTION_NOT_APPLICABLE,
+                               NULL,
+                               _("Inapplicable conflict resolution option "
+                                 "given for conflicted path '%s'"),
+                               svn_dirent_local_style(conflict->local_abspath,
+                                                      scratch_pool));
+
   SVN_ERR(svn_client_conflict_text_resolve(conflict, option, ctx, 
scratch_pool));
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/svn/conflict-callbacks.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/conflict-callbacks.c?rev=1764902&r1=1764901&r2=1764902&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/conflict-callbacks.c (original)
+++ subversion/trunk/subversion/svn/conflict-callbacks.c Fri Oct 14 14:07:58 
2016
@@ -933,10 +933,9 @@ handle_text_conflict(svn_boolean_t *reso
           if (knows_something || is_binary)
             *next_option++ = "r";
 
-          /* The 'mine-full' option selects the ".mine" file so only offer
-           * it if that file exists. It does not exist for binary files,
-           * for example (questionable historical behaviour since 1.0). */
-          if (my_abspath)
+          /* The 'mine-full' option selects the ".mine" file for texts or
+           * the current working directory file for binary files. */
+          if (my_abspath || is_binary)
             *next_option++ = "mf";
 
           *next_option++ = "tf";

Modified: subversion/trunk/subversion/tests/cmdline/resolve_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/resolve_tests.py?rev=1764902&r1=1764901&r2=1764902&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/resolve_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/resolve_tests.py Fri Oct 14 
14:07:58 2016
@@ -602,7 +602,6 @@ def multi_range_merge_with_accept(sbox):
 
 # Test for issue #4647 'auto resolution mine-full fails on binary file'
 @Issue(4647)
-@XFail()
 def automatic_binary_conflict_resolution(sbox):
   "resolve -R --accept [base | mf | tf] binary file"
 


Reply via email to