You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/09/21 17:27:08 UTC

svn commit: r1704320 [3/4] - in /subversion/branches/move-tracking-2: ./ build/ build/generator/ build/generator/templates/ subversion/ subversion/bindings/javahl/native/jniwrapper/ subversion/include/ subversion/include/private/ subversion/libsvn_clie...

Modified: subversion/branches/move-tracking-2/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svn/conflict-callbacks.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svn/conflict-callbacks.c (original)
+++ subversion/branches/move-tracking-2/subversion/svn/conflict-callbacks.c Mon Sep 21 15:26:27 2015
@@ -40,6 +40,7 @@
 #include "cl-conflicts.h"
 
 #include "private/svn_cmdline_private.h"
+#include "private/svn_wc_private.h"
 
 #include "svn_private_config.h"
 
@@ -333,15 +334,16 @@ show_prop_conflict(const svn_string_t *b
 static svn_error_t *
 open_editor(svn_boolean_t *performed_edit,
             const char *merged_abspath,
-            svn_cl__interactive_conflict_baton_t *b,
+            const char *editor_cmd,
+            apr_hash_t *config,
             apr_pool_t *pool)
 {
   svn_error_t *err;
 
   if (merged_abspath)
     {
-      err = svn_cmdline__edit_file_externally(merged_abspath, b->editor_cmd,
-                                              b->config, pool);
+      err = svn_cmdline__edit_file_externally(merged_abspath, editor_cmd,
+                                              config, pool);
       if (err && (err->apr_err == SVN_ERR_CL_NO_EXTERNAL_EDITOR ||
                   err->apr_err == SVN_ERR_EXTERNAL_PROGRAM))
         {
@@ -375,7 +377,9 @@ edit_prop_conflict(const svn_string_t **
                    const svn_string_t *base_propval,
                    const svn_string_t *my_propval,
                    const svn_string_t *their_propval,
-                   svn_cl__interactive_conflict_baton_t *b,
+                   const char *editor_cmd,
+                   apr_hash_t *config,
+                   svn_cmdline_prompt_baton_t *pb,
                    apr_pool_t *result_pool,
                    apr_pool_t *scratch_pool)
 {
@@ -391,21 +395,20 @@ edit_prop_conflict(const svn_string_t **
                                          scratch_pool);
   SVN_ERR(merge_prop_conflict(merged_prop, base_propval, my_propval,
                               their_propval, NULL,
-                              b->pb->cancel_func,
-                              b->pb->cancel_baton,
+                              pb->cancel_func,
+                              pb->cancel_baton,
                               scratch_pool));
   SVN_ERR(svn_stream_close(merged_prop));
   SVN_ERR(svn_io_file_flush(file, scratch_pool));
-  SVN_ERR(open_editor(&performed_edit, file_path, b, scratch_pool));
-  if (performed_edit)
+  SVN_ERR(open_editor(&performed_edit, file_path, editor_cmd,
+                      config, scratch_pool));
+  if (performed_edit && merged_propval)
     {
       svn_stringbuf_t *buf;
 
       SVN_ERR(svn_stringbuf_from_file2(&buf, file_path, scratch_pool));
       *merged_propval = svn_string_create_from_buf(buf, result_pool); 
     }
-  else
-    *merged_propval = NULL;
 
   return SVN_NO_ERROR;
 }
@@ -419,7 +422,7 @@ typedef struct resolver_option_t
   const char *code;        /* one or two characters */
   const char *short_desc;  /* label in prompt (localized) */
   const char *long_desc;   /* longer description (localized) */
-  svn_wc_conflict_choice_t choice;
+  svn_client_conflict_option_id_t choice;
                            /* or ..._undefined if not a simple choice */
 } resolver_option_t;
 
@@ -432,45 +435,45 @@ static const resolver_option_t text_conf
      brackets. */
   { "e",  N_("edit file"),        N_("change merged file in an editor"
                                      "  [edit]"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "df", N_("show diff"),        N_("show all changes made to merged file"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "r",  N_("mark resolved"),   N_("accept merged version of file  [working]"),
-                                  svn_wc_conflict_choose_merged },
-  { "",   "",                     "", svn_wc_conflict_choose_unspecified },
+                                  svn_client_conflict_option_merged_text },
+  { "",   "",                     "", svn_client_conflict_option_unspecified },
   { "dc", N_("display conflict"), N_("show all conflicts "
                                      "(ignoring merged version)"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "mc", N_("my side of conflict"), N_("accept my version for all conflicts "
                                         "(same)  [mine-conflict]"),
-                                  svn_wc_conflict_choose_mine_conflict },
+                                  svn_client_conflict_option_working_text_where_conflicted },
   { "tc", N_("their side of conflict"), N_("accept their version for all "
                                            "conflicts (same)"
                                            "  [theirs-conflict]"),
-                                  svn_wc_conflict_choose_theirs_conflict },
-  { "",   "",                     "", svn_wc_conflict_choose_unspecified },
+                                  svn_client_conflict_option_incoming_text_where_conflicted },
+  { "",   "",                     "", svn_client_conflict_option_unspecified },
   { "mf", N_("my version"),       N_("accept my version of entire file (even "
                                      "non-conflicts)  [mine-full]"),
-                                  svn_wc_conflict_choose_mine_full },
+                                  svn_client_conflict_option_working_text },
   { "tf", N_("their version"),    N_("accept their version of entire file "
                                      "(same)  [theirs-full]"),
-                                  svn_wc_conflict_choose_theirs_full },
-  { "",   "",                     "", svn_wc_conflict_choose_unspecified },
+                                  svn_client_conflict_option_incoming_text },
+  { "",   "",                     "", svn_client_conflict_option_unspecified },
   { "m",  N_("merge"),            N_("use merge tool to resolve conflict"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "l",  N_("launch tool"),      N_("launch external merge tool to resolve "
                                      "conflict  [launch]"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "i",  N_("internal merge tool"), N_("use built-in merge tool to "
                                      "resolve conflict"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "p",  N_("postpone"),         N_("mark the conflict to be resolved later"
                                      "  [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "s",  N_("show all options"), N_("show this list (also 'h', '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -482,17 +485,17 @@ static const resolver_option_t binary_co
      brackets. */
   { "r",  N_("mark resolved"),   N_("accept the working copy version of file "
                                     " [working]"),
-                                  svn_wc_conflict_choose_merged },
+                                  svn_client_conflict_option_merged_text },
   { "tf", N_("their version"),    N_("accept the incoming version of file "
                                      " [theirs-full]"),
-                                  svn_wc_conflict_choose_theirs_full },
+                                  svn_client_conflict_option_incoming_text },
   { "p",  N_("postpone"),         N_("mark the conflict to be resolved later "
                                      " [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "s",  N_("show all options"), N_("show this list (also 'h', '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -501,24 +504,24 @@ static const resolver_option_t prop_conf
 {
   { "mf", N_("my version"),       N_("accept my version of entire property (even "
                                      "non-conflicts)  [mine-full]"),
-                                  svn_wc_conflict_choose_mine_full },
+                                  svn_client_conflict_option_working_text },
   { "tf", N_("their version"),    N_("accept their version of entire property "
                                      "(same)  [theirs-full]"),
-                                  svn_wc_conflict_choose_theirs_full },
+                                  svn_client_conflict_option_incoming_text },
   { "dc", N_("display conflict"), N_("show conflicts in this property"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "e",  N_("edit property"),    N_("change merged property value in an editor"
                                      "  [edit]"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "r",  N_("mark resolved"),    N_("accept edited version of property"),
-                                  svn_wc_conflict_choose_merged },
+                                  svn_client_conflict_option_merged_text },
   { "p",  N_("postpone"),         N_("mark the conflict to be resolved later"
                                      "  [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "h",  N_("help"),             N_("show this help (also '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -526,13 +529,13 @@ static const resolver_option_t prop_conf
 static const resolver_option_t tree_conflict_options[] =
 {
   { "r",  N_("mark resolved"),    N_("accept current working copy state"),
-                                  svn_wc_conflict_choose_merged },
+                                  svn_client_conflict_option_merged_text },
   { "p",  N_("postpone"),         N_("resolve the conflict later  [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "h",  N_("help"),             N_("show this help (also '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -541,13 +544,13 @@ static const resolver_option_t tree_conf
   { "mc", N_("apply update to move destination (recommended)"),
                                   N_("apply incoming update to move destination"
                                      "  [mine-conflict]"),
-                                  svn_wc_conflict_choose_mine_conflict },
+                                  svn_client_conflict_option_working_text_where_conflicted },
   { "p",  N_("postpone"),         N_("resolve the conflict later  [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "h",  N_("help"),             N_("show this help (also '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -556,13 +559,13 @@ static const resolver_option_t tree_conf
   { "mc", N_("prepare for updating moved-away children, if any (recommended)"),
                                   N_("allow updating moved-away children "
                                      "with 'svn resolve' [mine-conflict]"),
-                                  svn_wc_conflict_choose_mine_conflict },
+                                  svn_client_conflict_option_working_text_where_conflicted },
   { "p",  N_("postpone"),         N_("resolve the conflict later  [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "h",  N_("help"),             N_("show this help (also '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -707,16 +710,22 @@ prompt_user(const resolver_option_t **op
  * conflict resolution session.
  * SCRATCH_POOL is used for temporary allocations. */
 static svn_error_t *
-handle_text_conflict(svn_wc_conflict_result_t *result,
+handle_text_conflict(svn_client_conflict_option_id_t *option_id,
+                     svn_boolean_t *save_merged,
+                     svn_cl__accept_t *accept_which,
+                     svn_boolean_t *quit,
                      const svn_client_conflict_t *conflict,
-                     svn_cl__interactive_conflict_baton_t *b,
+                     const char *path_prefix,
+                     svn_cmdline_prompt_baton_t *pb,
+                     const char *editor_cmd,
+                     apr_hash_t *config,
                      apr_pool_t *scratch_pool)
 {
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
   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 by setting the
-     result->save_merge flag)? */
+     *save_merge flag)? */
   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? */
@@ -736,7 +745,7 @@ handle_text_conflict(svn_wc_conflict_res
                                                 conflict, scratch_pool,
                                                 scratch_pool));
 
-  local_relpath = svn_cl__local_style_skip_ancestor(b->path_prefix,
+  local_relpath = svn_cl__local_style_skip_ancestor(path_prefix,
                                                     local_abspath,
                                                     scratch_pool);
 
@@ -796,7 +805,7 @@ handle_text_conflict(svn_wc_conflict_res
         }
       else
         {
-          if (knows_something)
+          if (knows_something || is_binary)
             *next_option++ = "r";
 
           /* The 'mine-full' option selects the ".mine" file so only offer
@@ -810,15 +819,15 @@ handle_text_conflict(svn_wc_conflict_res
       *next_option++ = "s";
       *next_option++ = NULL;
 
-      SVN_ERR(prompt_user(&opt, conflict_options, options, b->pb, iterpool));
+      SVN_ERR(prompt_user(&opt, conflict_options, options, pb, iterpool));
       if (! opt)
         continue;
 
       if (strcmp(opt->code, "q") == 0)
         {
-          result->choice = opt->choice;
-          b->accept_which = svn_cl__accept_postpone;
-          b->quit = TRUE;
+          *option_id = opt->choice;
+          *accept_which = svn_cl__accept_postpone;
+          *quit = TRUE;
           break;
         }
       else if (strcmp(opt->code, "s") == 0)
@@ -845,8 +854,8 @@ handle_text_conflict(svn_wc_conflict_res
               continue;
             }
           SVN_ERR(show_conflicts(conflict,
-                                 b->pb->cancel_func,
-                                 b->pb->cancel_baton,
+                                 pb->cancel_func,
+                                 pb->cancel_baton,
                                  iterpool));
           knows_something = TRUE;
         }
@@ -861,14 +870,15 @@ handle_text_conflict(svn_wc_conflict_res
               continue;
             }
 
-          SVN_ERR(show_diff(conflict, merged_abspath, b->path_prefix,
-                            b->pb->cancel_func, b->pb->cancel_baton,
+          SVN_ERR(show_diff(conflict, merged_abspath, path_prefix,
+                            pb->cancel_func, pb->cancel_baton,
                             iterpool));
           knows_something = TRUE;
         }
       else if (strcmp(opt->code, "e") == 0 || strcmp(opt->code, ":-E") == 0)
         {
-          SVN_ERR(open_editor(&performed_edit, merged_abspath, b, iterpool));
+          SVN_ERR(open_editor(&performed_edit, merged_abspath, editor_cmd,
+                              config, iterpool));
           if (performed_edit)
             knows_something = TRUE;
         }
@@ -890,7 +900,7 @@ handle_text_conflict(svn_wc_conflict_res
                                               their_abspath,
                                               my_abspath,
                                               merged_abspath,
-                                              local_abspath, b->config,
+                                              local_abspath, config,
                                               NULL, iterpool);
           if (err)
             {
@@ -906,11 +916,11 @@ handle_text_conflict(svn_wc_conflict_res
                                              my_abspath,
                                              merged_abspath,
                                              local_abspath,
-                                             b->path_prefix,
-                                             b->editor_cmd,
-                                             b->config,
-                                             b->pb->cancel_func,
-                                             b->pb->cancel_baton,
+                                             path_prefix,
+                                             editor_cmd,
+                                             config,
+                                             pb->cancel_func,
+                                             pb->cancel_baton,
                                              iterpool));
                   knows_something = !remains_in_conflict;
                 }
@@ -955,7 +965,7 @@ handle_text_conflict(svn_wc_conflict_res
                                                   my_abspath,
                                                   merged_abspath,
                                                   local_abspath,
-                                                  b->config, NULL, iterpool);
+                                                  config, NULL, iterpool);
               if (err && (err->apr_err == SVN_ERR_CL_NO_EXTERNAL_MERGE_TOOL ||
                           err->apr_err == SVN_ERR_EXTERNAL_PROGRAM))
                 {
@@ -986,20 +996,20 @@ handle_text_conflict(svn_wc_conflict_res
                                      my_abspath,
                                      merged_abspath,
                                      local_abspath,
-                                     b->path_prefix,
-                                     b->editor_cmd,
-                                     b->config,
-                                     b->pb->cancel_func,
-                                     b->pb->cancel_baton,
+                                     path_prefix,
+                                     editor_cmd,
+                                     config,
+                                     pb->cancel_func,
+                                     pb->cancel_baton,
                                      iterpool));
 
           if (!remains_in_conflict)
             knows_something = TRUE;
         }
-      else if (opt->choice != svn_wc_conflict_choose_undefined)
+      else if (opt->choice != svn_client_conflict_option_undefined)
         {
-          if ((opt->choice == svn_wc_conflict_choose_mine_conflict
-               || opt->choice == svn_wc_conflict_choose_theirs_conflict)
+          if ((opt->choice == svn_client_conflict_option_working_text_where_conflicted
+               || opt->choice == svn_client_conflict_option_incoming_text_where_conflicted)
               && is_binary)
             {
               SVN_ERR(svn_cmdline_fprintf(stderr, iterpool,
@@ -1012,8 +1022,8 @@ handle_text_conflict(svn_wc_conflict_res
           /* 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 (opt->choice == svn_wc_conflict_choose_merged
-              && ! knows_something)
+          if (opt->choice == svn_client_conflict_option_merged_text
+              && ! knows_something && diff_allowed)
             {
               SVN_ERR(svn_cmdline_fprintf(
                         stderr, iterpool,
@@ -1022,9 +1032,9 @@ handle_text_conflict(svn_wc_conflict_res
               continue;
             }
 
-          result->choice = opt->choice;
-          if (performed_edit)
-            result->save_merged = TRUE;
+          *option_id = opt->choice;
+          if (performed_edit && save_merged)
+            *save_merged = TRUE;
           break;
         }
     }
@@ -1038,9 +1048,15 @@ handle_text_conflict(svn_wc_conflict_res
  * conflict resolution session.
  * SCRATCH_POOL is used for temporary allocations. */
 static svn_error_t *
-handle_prop_conflict(svn_wc_conflict_result_t *result,
+handle_prop_conflict(svn_client_conflict_option_id_t *option_id,
+                     const svn_string_t **merged_value,
+                     svn_cl__accept_t *accept_which,
+                     svn_boolean_t *quit,
+                     const char *path_prefix,
+                     svn_cmdline_prompt_baton_t *pb,
+                     const char *editor_cmd,
+                     apr_hash_t *config,
                      const svn_client_conflict_t *conflict,
-                     svn_cl__interactive_conflict_baton_t *b,
                      apr_pool_t *result_pool,
                      apr_pool_t *scratch_pool)
 {
@@ -1061,7 +1077,7 @@ handle_prop_conflict(svn_wc_conflict_res
                                 " on '%s'.\n"),
                               svn_client_conflict_prop_get_propname(conflict),
                               svn_cl__local_style_skip_ancestor(
-                                b->path_prefix,
+                                path_prefix,
                                 svn_client_conflict_get_local_abspath(conflict),
                                 scratch_pool)));
 
@@ -1090,30 +1106,31 @@ handle_prop_conflict(svn_wc_conflict_res
 
       svn_pool_clear(iterpool);
 
-      SVN_ERR(prompt_user(&opt, prop_conflict_options, options, b->pb,
+      SVN_ERR(prompt_user(&opt, prop_conflict_options, options, pb,
                           iterpool));
       if (! opt)
         continue;
 
       if (strcmp(opt->code, "q") == 0)
         {
-          result->choice = opt->choice;
-          b->accept_which = svn_cl__accept_postpone;
-          b->quit = TRUE;
+          *option_id = opt->choice;
+          *accept_which = svn_cl__accept_postpone;
+          *quit = TRUE;
           break;
         }
       else if (strcmp(opt->code, "dc") == 0)
         {
           SVN_ERR(show_prop_conflict(base_propval, my_propval, their_propval,
                                      merged_propval,
-                                     b->pb->cancel_func, b->pb->cancel_baton,
+                                     pb->cancel_func, pb->cancel_baton,
                                      scratch_pool));
         }
       else if (strcmp(opt->code, "e") == 0)
         {
           SVN_ERR(edit_prop_conflict(&merged_propval,
                                      base_propval, my_propval, their_propval,
-                                     b, result_pool, scratch_pool));
+                                     editor_cmd, config, pb,
+                                     result_pool, scratch_pool));
           resolved_allowed = (merged_propval != NULL);
         }
       else if (strcmp(opt->code, "r") == 0)
@@ -1126,13 +1143,13 @@ handle_prop_conflict(svn_wc_conflict_res
               continue;
             }
 
-          result->merged_value = merged_propval;
-          result->choice = svn_wc_conflict_choose_merged;
+          *merged_value = merged_propval;
+          *option_id = svn_client_conflict_option_merged_text;
           break;
         }
-      else if (opt->choice != svn_wc_conflict_choose_undefined)
+      else if (opt->choice != svn_client_conflict_option_undefined)
         {
-          result->choice = opt->choice;
+          *option_id = opt->choice;
           break;
         }
     }
@@ -1146,9 +1163,12 @@ handle_prop_conflict(svn_wc_conflict_res
  * conflict resolution session.
  * SCRATCH_POOL is used for temporary allocations. */
 static svn_error_t *
-handle_tree_conflict(svn_wc_conflict_result_t *result,
+handle_tree_conflict(svn_client_conflict_option_id_t *option_id,
+                     svn_cl__accept_t *accept_which,
+                     svn_boolean_t *quit,
                      const svn_client_conflict_t *conflict,
-                     svn_cl__interactive_conflict_baton_t *b,
+                     const char *path_prefix,
+                     svn_cmdline_prompt_baton_t *pb,
                      apr_pool_t *scratch_pool)
 {
   const char *readable_desc;
@@ -1165,7 +1185,7 @@ handle_tree_conflict(svn_wc_conflict_res
   SVN_ERR(svn_cmdline_fprintf(
                stderr, scratch_pool,
                _("Tree conflict on '%s'\n   > %s\n"),
-               svn_cl__local_style_skip_ancestor(b->path_prefix,
+               svn_cl__local_style_skip_ancestor(path_prefix,
                  svn_client_conflict_get_local_abspath(conflict), scratch_pool),
                readable_desc));
 
@@ -1230,20 +1250,20 @@ handle_tree_conflict(svn_wc_conflict_res
             }
         }
 
-      SVN_ERR(prompt_user(&opt, tc_opts, NULL, b->pb, iterpool));
+      SVN_ERR(prompt_user(&opt, tc_opts, NULL, pb, iterpool));
       if (! opt)
         continue;
 
       if (strcmp(opt->code, "q") == 0)
         {
-          result->choice = opt->choice;
-          b->accept_which = svn_cl__accept_postpone;
-          b->quit = TRUE;
+          *option_id = opt->choice;
+          *accept_which = svn_cl__accept_postpone;
+          *quit = TRUE;
           break;
         }
-      else if (opt->choice != svn_wc_conflict_choose_undefined)
+      else if (opt->choice != svn_client_conflict_option_undefined)
         {
-          result->choice = opt->choice;
+          *option_id = opt->choice;
           break;
         }
     }
@@ -1254,13 +1274,22 @@ handle_tree_conflict(svn_wc_conflict_res
 
 /* The body of svn_cl__conflict_func_interactive(). */
 static svn_error_t *
-conflict_func_interactive(svn_wc_conflict_result_t **result,
+conflict_func_interactive(svn_client_conflict_option_id_t *option_id,
+                          svn_boolean_t *save_merged,
+                          const svn_string_t **merged_propval,
+                          svn_cl__accept_t *accept_which, 
+                          svn_boolean_t *quit,
+                          svn_boolean_t *external_failed,
+                          svn_boolean_t *printed_summary,
                           const svn_client_conflict_t *conflict,
-                          void *baton,
+                          const char *editor_cmd,
+                          apr_hash_t *config,
+                          const char *path_prefix,
+                          svn_cmdline_prompt_baton_t *pb,
+                          svn_cl__conflict_stats_t *conflict_stats,
                           apr_pool_t *result_pool,
                           apr_pool_t *scratch_pool)
 {
-  svn_cl__interactive_conflict_baton_t *b = baton;
   svn_error_t *err;
   const char *base_abspath = NULL;
   const char *my_abspath = NULL;
@@ -1275,47 +1304,46 @@ conflict_func_interactive(svn_wc_conflic
                                                   scratch_pool));
 
   /* Start out assuming we're going to postpone the conflict. */
-  *result = svn_wc_create_conflict_result(svn_wc_conflict_choose_postpone,
-                                          NULL, result_pool);
+  *option_id = svn_client_conflict_option_postpone;
 
-  switch (b->accept_which)
+  switch (*accept_which)
     {
     case svn_cl__accept_invalid:
     case svn_cl__accept_unspecified:
       /* No (or no valid) --accept option, fall through to prompting. */
       break;
     case svn_cl__accept_postpone:
-      (*result)->choice = svn_wc_conflict_choose_postpone;
+      *option_id = svn_client_conflict_option_postpone;
       return SVN_NO_ERROR;
     case svn_cl__accept_base:
-      (*result)->choice = svn_wc_conflict_choose_base;
+      *option_id = svn_client_conflict_option_base_text;
       return SVN_NO_ERROR;
     case svn_cl__accept_working:
-      (*result)->choice = svn_wc_conflict_choose_merged;
+      *option_id = svn_client_conflict_option_merged_text;
       return SVN_NO_ERROR;
     case svn_cl__accept_mine_conflict:
-      (*result)->choice = svn_wc_conflict_choose_mine_conflict;
+      *option_id = svn_client_conflict_option_working_text_where_conflicted;
       return SVN_NO_ERROR;
     case svn_cl__accept_theirs_conflict:
-      (*result)->choice = svn_wc_conflict_choose_theirs_conflict;
+      *option_id = svn_client_conflict_option_incoming_text_where_conflicted;
       return SVN_NO_ERROR;
     case svn_cl__accept_mine_full:
-      (*result)->choice = svn_wc_conflict_choose_mine_full;
+      *option_id = svn_client_conflict_option_working_text;
       return SVN_NO_ERROR;
     case svn_cl__accept_theirs_full:
-      (*result)->choice = svn_wc_conflict_choose_theirs_full;
+      *option_id = svn_client_conflict_option_incoming_text;
       return SVN_NO_ERROR;
     case svn_cl__accept_edit:
       if (merged_abspath)
         {
-          if (b->external_failed)
+          if (*external_failed)
             {
-              (*result)->choice = svn_wc_conflict_choose_postpone;
+              *option_id = svn_client_conflict_option_postpone;
               return SVN_NO_ERROR;
             }
 
           err = svn_cmdline__edit_file_externally(merged_abspath,
-                                                  b->editor_cmd, b->config,
+                                                  editor_cmd, config,
                                                   scratch_pool);
           if (err && (err->apr_err == SVN_ERR_CL_NO_EXTERNAL_EDITOR ||
                       err->apr_err == SVN_ERR_EXTERNAL_PROGRAM))
@@ -1327,11 +1355,11 @@ conflict_func_interactive(svn_wc_conflic
               SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool, "%s\n",
                                           message));
               svn_error_clear(err);
-              b->external_failed = TRUE;
+              *external_failed = TRUE;
             }
           else if (err)
             return svn_error_trace(err);
-          (*result)->choice = svn_wc_conflict_choose_merged;
+          *option_id = svn_client_conflict_option_merged_text;
           return SVN_NO_ERROR;
         }
       /* else, fall through to prompting. */
@@ -1342,9 +1370,9 @@ conflict_func_interactive(svn_wc_conflic
           svn_boolean_t remains_in_conflict;
           const char *local_abspath;
 
-          if (b->external_failed)
+          if (*external_failed)
             {
-              (*result)->choice = svn_wc_conflict_choose_postpone;
+              *option_id = svn_client_conflict_option_postpone;
               return SVN_NO_ERROR;
             }
 
@@ -1354,7 +1382,7 @@ conflict_func_interactive(svn_wc_conflic
                                               my_abspath,
                                               merged_abspath,
                                               local_abspath,
-                                              b->config,
+                                              config,
                                               &remains_in_conflict,
                                               scratch_pool);
           if (err && (err->apr_err == SVN_ERR_CL_NO_EXTERNAL_MERGE_TOOL ||
@@ -1366,16 +1394,16 @@ conflict_func_interactive(svn_wc_conflic
               message = svn_err_best_message(err, buf, sizeof(buf));
               SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool, "%s\n",
                                           message));
-              b->external_failed = TRUE;
+              *external_failed = TRUE;
               return svn_error_trace(err);
             }
           else if (err)
             return svn_error_trace(err);
 
           if (remains_in_conflict)
-            (*result)->choice = svn_wc_conflict_choose_postpone;
+            *option_id = svn_client_conflict_option_postpone;
           else
-            (*result)->choice = svn_wc_conflict_choose_merged;
+            *option_id = svn_client_conflict_option_merged_text;
           return SVN_NO_ERROR;
         }
       /* else, fall through to prompting. */
@@ -1383,10 +1411,10 @@ conflict_func_interactive(svn_wc_conflic
     }
 
   /* Print a summary of conflicts before starting interactive resolution */
-  if (! b->printed_summary)
+  if (! *printed_summary)
     {
-      SVN_ERR(svn_cl__print_conflict_stats(b->conflict_stats, scratch_pool));
-      b->printed_summary = TRUE;
+      SVN_ERR(svn_cl__print_conflict_stats(conflict_stats, scratch_pool));
+      *printed_summary = TRUE;
     }
 
   /* We're in interactive mode and either the user gave no --accept
@@ -1402,22 +1430,74 @@ conflict_func_interactive(svn_wc_conflic
            svn_wc_conflict_action_edit)
        && (svn_client_conflict_get_local_change(conflict) ==
            svn_wc_conflict_reason_edited)))
-    SVN_ERR(handle_text_conflict(*result, conflict, b, scratch_pool));
+    SVN_ERR(handle_text_conflict(option_id, save_merged, accept_which,
+                                 quit, conflict, path_prefix, pb,
+                                 editor_cmd, config, scratch_pool));
   else if (svn_client_conflict_get_kind(conflict) ==
            svn_wc_conflict_kind_property)
-    SVN_ERR(handle_prop_conflict(*result, conflict, b, result_pool,
-                                 scratch_pool));
+    SVN_ERR(handle_prop_conflict(option_id, merged_propval, accept_which,
+                                 quit, path_prefix, pb,
+                                 editor_cmd, config, conflict,
+                                 result_pool, scratch_pool));
   else if (svn_client_conflict_get_kind(conflict) == svn_wc_conflict_kind_tree)
-    SVN_ERR(handle_tree_conflict(*result, conflict, b, scratch_pool));
+    SVN_ERR(handle_tree_conflict(option_id, accept_which, quit,
+                                 conflict, path_prefix, pb,
+                                 scratch_pool));
 
   else /* other types of conflicts -- do nothing about them. */
     {
-      (*result)->choice = svn_wc_conflict_choose_postpone;
+      *option_id = svn_client_conflict_option_postpone;
     }
 
   return SVN_NO_ERROR;
 }
 
+/*
+ * Return a legacy conflict choice corresponding to OPTION_ID.
+ * Return svn_wc_conflict_choose_undefined if no corresponding
+ * legacy conflict choice exists.
+ */
+static svn_wc_conflict_choice_t
+conflict_option_id_to_wc_conflict_choice(
+  svn_client_conflict_option_id_t option_id)
+{
+
+  switch (option_id)
+    {
+      case svn_client_conflict_option_undefined:
+        return svn_wc_conflict_choose_undefined;
+
+      case svn_client_conflict_option_postpone:
+        return svn_wc_conflict_choose_postpone;
+
+      case svn_client_conflict_option_base_text:
+        return svn_wc_conflict_choose_base;
+
+      case svn_client_conflict_option_incoming_text:
+        return svn_wc_conflict_choose_theirs_full;
+
+      case svn_client_conflict_option_working_text:
+        return svn_wc_conflict_choose_mine_full;
+
+      case svn_client_conflict_option_incoming_text_where_conflicted:
+        return svn_wc_conflict_choose_theirs_conflict;
+
+      case svn_client_conflict_option_working_text_where_conflicted:
+        return svn_wc_conflict_choose_mine_conflict;
+
+      case svn_client_conflict_option_merged_text:
+        return svn_wc_conflict_choose_merged;
+
+      case svn_client_conflict_option_unspecified:
+        return svn_wc_conflict_choose_unspecified;
+
+      default:
+        break;
+    }
+
+  return svn_wc_conflict_choose_undefined;
+}
+
 svn_error_t *
 svn_cl__conflict_func_interactive(svn_wc_conflict_result_t **result,
                                   const svn_wc_conflict_description2_t *desc,
@@ -1427,15 +1507,27 @@ svn_cl__conflict_func_interactive(svn_wc
 {
   svn_cl__interactive_conflict_baton_t *b = baton;
   svn_client_conflict_t *conflict;
+  svn_client_conflict_option_id_t option_id;
+  svn_boolean_t save_merged = FALSE;
+  const svn_string_t *merged_propval = NULL;
 
   SVN_ERR(svn_client_conflict_from_wc_description2_t(&conflict, desc,
                                                      scratch_pool,
                                                      scratch_pool));
-  SVN_ERR(conflict_func_interactive(result, conflict, baton,
+  *result = svn_wc_create_conflict_result(svn_client_conflict_option_postpone,
+                                          NULL, result_pool);
+  SVN_ERR(conflict_func_interactive(&option_id, &save_merged, &merged_propval,
+                                    &b->accept_which, &b->quit,
+                                    &b->external_failed, &b->printed_summary,
+                                    conflict, b->editor_cmd, b->config,
+                                    b->path_prefix, b->pb, b->conflict_stats,
                                     result_pool, scratch_pool));
+  (*result)->choice = conflict_option_id_to_wc_conflict_choice(option_id);
+  (*result)->save_merged = save_merged;
+  (*result)->merged_value = merged_propval;
 
   /* If we are resolving a conflict, adjust the summary of conflicts. */
-  if ((*result)->choice != svn_wc_conflict_choose_postpone)
+  if (option_id != svn_client_conflict_option_postpone)
     {
       const char *local_path
         = svn_cl__local_style_skip_ancestor(
@@ -1447,3 +1539,80 @@ svn_cl__conflict_func_interactive(svn_wc
     }
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_cl__resolve_conflict(svn_boolean_t *resolved,
+                         svn_cl__accept_t *accept_which,
+                         svn_boolean_t *quit,
+                         svn_boolean_t *external_failed,
+                         svn_boolean_t *printed_summary,
+                         svn_client_conflict_t *conflict,
+                         const char *editor_cmd,
+                         apr_hash_t *config,
+                         const char *path_prefix,
+                         svn_cmdline_prompt_baton_t *pb,
+                         svn_cl__conflict_stats_t *conflict_stats,
+                         svn_client_conflict_option_id_t option_id,
+                         svn_client_ctx_t *ctx,
+                         apr_pool_t *scratch_pool)
+{
+  if (option_id == svn_client_conflict_option_unspecified)
+    SVN_ERR(conflict_func_interactive(&option_id, NULL, NULL,
+                                      accept_which, quit,
+                                      external_failed, printed_summary,
+                                      conflict, editor_cmd, config,
+                                      path_prefix, pb, conflict_stats,
+                                      scratch_pool, scratch_pool));
+
+  SVN_ERR_ASSERT(option_id != svn_client_conflict_option_unspecified);
+
+  /* If we are resolving a conflict, adjust the summary of conflicts. */
+  if (option_id != svn_client_conflict_option_postpone)
+    {
+      const char *local_relpath
+        = svn_cl__local_style_skip_ancestor(
+            path_prefix, svn_client_conflict_get_local_abspath(conflict),
+            scratch_pool);
+      svn_wc_conflict_kind_t conflict_kind;
+      const char *local_abspath;
+      const char *lock_abspath;
+      svn_error_t *err;
+
+      local_abspath = svn_client_conflict_get_local_abspath(conflict);
+
+      /* ### for now, resolve conflict using legacy API */
+      SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath,
+                                                     ctx->wc_ctx,
+                                                     local_abspath,
+                                                     scratch_pool,
+                                                     scratch_pool));
+      conflict_kind = svn_client_conflict_get_kind(conflict);
+
+      err = svn_wc_resolved_conflict5(
+              ctx->wc_ctx, local_abspath, svn_depth_empty, /* ??? */
+              conflict_kind == svn_wc_conflict_kind_text,
+              conflict_kind == svn_wc_conflict_kind_property ? "" : NULL,
+              conflict_kind == svn_wc_conflict_kind_tree,
+              conflict_option_id_to_wc_conflict_choice(option_id),
+              ctx->cancel_func, ctx->cancel_baton,
+              ctx->notify_func2, ctx->notify_baton2,
+              scratch_pool);
+
+      err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
+                                                                     lock_abspath,
+                                                                     scratch_pool));
+      svn_io_sleep_for_timestamps(local_abspath, scratch_pool);
+
+      SVN_ERR(err);
+    
+      svn_cl__conflict_stats_resolved(conflict_stats, local_relpath,
+                                      svn_client_conflict_get_kind(conflict));
+      *resolved = TRUE;
+    }
+  else
+    {
+      *resolved = FALSE;
+    }
+
+  return SVN_NO_ERROR;
+}

Modified: subversion/branches/move-tracking-2/subversion/svn/resolve-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svn/resolve-cmd.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svn/resolve-cmd.c (original)
+++ subversion/branches/move-tracking-2/subversion/svn/resolve-cmd.c Mon Sep 21 15:26:27 2015
@@ -30,6 +30,7 @@
 #include "svn_client.h"
 #include "svn_error.h"
 #include "svn_pools.h"
+#include "svn_hash.h"
 #include "cl.h"
 
 #include "svn_private_config.h"
@@ -38,6 +39,259 @@
 
 /*** Code. ***/
 
+/* Baton for conflict_status_walker */
+struct conflict_status_walker_baton
+{
+  svn_client_ctx_t *ctx;
+  svn_client_conflict_option_id_t option_id;
+  svn_wc_notify_func2_t notify_func;
+  void *notify_baton;
+  svn_boolean_t resolved_one;
+  apr_hash_t *resolve_later;
+  svn_cl__accept_t *accept_which;
+  svn_boolean_t *quit;
+  svn_boolean_t *external_failed;
+  svn_boolean_t *printed_summary;
+  const char *editor_cmd;
+  apr_hash_t *config;
+  const char *path_prefix;
+  svn_cmdline_prompt_baton_t *pb;
+  svn_cl__conflict_stats_t *conflict_stats;
+};
+
+/* Implements svn_wc_notify_func2_t to collect new conflicts caused by
+   resolving a tree conflict. */
+static void
+tree_conflict_collector(void *baton,
+                        const svn_wc_notify_t *notify,
+                        apr_pool_t *pool)
+{
+  struct conflict_status_walker_baton *cswb = baton;
+
+  if (cswb->notify_func)
+    cswb->notify_func(cswb->notify_baton, notify, pool);
+
+  if (cswb->resolve_later
+      && (notify->action == svn_wc_notify_tree_conflict
+          || notify->prop_state == svn_wc_notify_state_conflicted
+          || notify->content_state == svn_wc_notify_state_conflicted))
+    {
+      if (!svn_hash_gets(cswb->resolve_later, notify->path))
+        {
+          const char *dup_path;
+
+          dup_path = apr_pstrdup(apr_hash_pool_get(cswb->resolve_later),
+                                 notify->path);
+
+          svn_hash_sets(cswb->resolve_later, dup_path, dup_path);
+        }
+    }
+}
+
+/* Implements svn_wc_status4_t to walk all conflicts to resolve.
+ */
+static svn_error_t *
+conflict_status_walker(void *baton,
+                       const char *local_abspath,
+                       const svn_wc_status3_t *status,
+                       apr_pool_t *scratch_pool)
+{
+  struct conflict_status_walker_baton *cswb = baton;
+  apr_pool_t *iterpool;
+  svn_boolean_t resolved = FALSE;
+  svn_client_conflict_t *conflict;
+
+  if (!status->conflicted)
+    return SVN_NO_ERROR;
+
+  iterpool = svn_pool_create(scratch_pool);
+
+  SVN_ERR(svn_client_conflict_get(&conflict, local_abspath, cswb->ctx,
+                                  iterpool, iterpool));
+  SVN_ERR(svn_cl__resolve_conflict(&resolved, cswb->accept_which,
+                                   cswb->quit, cswb->external_failed,
+                                   cswb->printed_summary,
+                                   conflict, cswb->editor_cmd,
+                                   cswb->config, cswb->path_prefix,
+                                   cswb->pb, cswb->conflict_stats,
+                                   cswb->option_id, cswb->ctx,
+                                   scratch_pool));
+  if (resolved)
+    cswb->resolved_one = TRUE;
+
+  svn_pool_destroy(iterpool);
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+walk_conflicts(svn_client_ctx_t *ctx,
+               const char *local_abspath,
+               svn_depth_t depth,
+               svn_client_conflict_option_id_t option_id,
+               svn_cl__accept_t *accept_which,
+               svn_boolean_t *quit,
+               svn_boolean_t *external_failed,
+               svn_boolean_t *printed_summary,
+               const char *editor_cmd,
+               apr_hash_t *config,
+               const char *path_prefix,
+               svn_cmdline_prompt_baton_t *pb,
+               svn_cl__conflict_stats_t *conflict_stats,
+               apr_pool_t *scratch_pool)
+{
+  struct conflict_status_walker_baton cswb;
+  apr_pool_t *iterpool = NULL;
+  svn_error_t *err;
+
+  if (depth == svn_depth_unknown)
+    depth = svn_depth_infinity;
+
+  cswb.ctx = ctx;
+  cswb.option_id = option_id;
+
+  cswb.resolved_one = FALSE;
+  cswb.resolve_later = (depth != svn_depth_empty)
+                          ? apr_hash_make(scratch_pool)
+                          : NULL;
+
+  cswb.accept_which = accept_which;
+  cswb.quit = quit;
+  cswb.external_failed = external_failed;
+  cswb.printed_summary = printed_summary;
+  cswb.editor_cmd = editor_cmd;
+  cswb.config = config;
+  cswb.path_prefix = path_prefix;
+  cswb.pb = pb;
+  cswb.conflict_stats = conflict_stats;
+
+
+  /* ### call notify.c code */
+  if (ctx->notify_func2)
+    ctx->notify_func2(ctx->notify_baton2,
+                      svn_wc_create_notify(
+                        local_abspath,
+                        svn_wc_notify_conflict_resolver_starting,
+                        scratch_pool),
+                      scratch_pool);
+
+  cswb.notify_func = ctx->notify_func2;
+  cswb.notify_baton = ctx->notify_baton2;
+  ctx->notify_func2 = tree_conflict_collector;
+  ctx->notify_baton2 = &cswb;
+
+  err = svn_wc_walk_status(ctx->wc_ctx,
+                           local_abspath,
+                           depth,
+                           FALSE /* get_all */,
+                           FALSE /* no_ignore */,
+                           TRUE /* ignore_text_mods */,
+                           NULL /* ignore_patterns */,
+                           conflict_status_walker, &cswb,
+                           ctx->cancel_func, ctx->cancel_baton,
+                           scratch_pool);
+
+  /* If we got new tree conflicts (or delayed conflicts) during the initial
+     walk, we now walk them one by one as closure. */
+  while (!err && cswb.resolve_later && apr_hash_count(cswb.resolve_later))
+    {
+      apr_hash_index_t *hi;
+      svn_wc_status3_t *status = NULL;
+      const char *tc_abspath = NULL;
+
+      if (iterpool)
+        svn_pool_clear(iterpool);
+      else
+        iterpool = svn_pool_create(scratch_pool);
+
+      hi = apr_hash_first(scratch_pool, cswb.resolve_later);
+      cswb.resolve_later = apr_hash_make(scratch_pool);
+      cswb.resolved_one = FALSE;
+
+      for (; hi && !err; hi = apr_hash_next(hi))
+        {
+          const char *relpath;
+          svn_pool_clear(iterpool);
+
+          tc_abspath = apr_hash_this_key(hi);
+
+          if (ctx->cancel_func)
+            SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
+
+          relpath = svn_dirent_skip_ancestor(local_abspath,
+                                             tc_abspath);
+
+          if (!relpath
+              || (depth >= svn_depth_empty
+                  && depth < svn_depth_infinity
+                  && strchr(relpath, '/')))
+            {
+              continue;
+            }
+
+          SVN_ERR(svn_wc_status3(&status, ctx->wc_ctx, tc_abspath,
+                                 iterpool, iterpool));
+
+          if (depth == svn_depth_files
+              && status->kind == svn_node_dir)
+            continue;
+
+          err = svn_error_trace(conflict_status_walker(&cswb, tc_abspath,
+                                                       status, scratch_pool));
+        }
+
+      /* None of the remaining conflicts got resolved, and non did provide
+         an error...
+
+         We can fix that if we disable the 'resolve_later' option...
+       */
+      if (!cswb.resolved_one && !err && tc_abspath
+          && apr_hash_count(cswb.resolve_later))
+        {
+          /* Run the last resolve operation again. We still have status
+             and tc_abspath for that one. */
+
+          cswb.resolve_later = NULL; /* Produce proper error! */
+
+          /* Recreate the error */
+          err = svn_error_trace(conflict_status_walker(&cswb, tc_abspath,
+                                                       status, scratch_pool));
+
+          SVN_ERR_ASSERT(err != NULL);
+
+          err = svn_error_createf(
+                    SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, err,
+                    _("Unable to resolve pending conflict on '%s'"),
+                    svn_dirent_local_style(tc_abspath, scratch_pool));
+          break;
+        }
+    }
+
+  if (iterpool)
+    svn_pool_destroy(iterpool);
+
+  if (err && err->apr_err != SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE)
+    err = svn_error_createf(
+                SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, err,
+                _("Unable to resolve conflicts on '%s'"),
+                svn_dirent_local_style(local_abspath, scratch_pool));
+
+  ctx->notify_func2 = cswb.notify_func;
+  ctx->notify_baton2 = cswb.notify_baton;
+
+  SVN_ERR(err);
+
+  /* ### call notify.c code */
+  if (ctx->notify_func2)
+    ctx->notify_func2(ctx->notify_baton2,
+                      svn_wc_create_notify(local_abspath,
+                                          svn_wc_notify_conflict_resolver_done,
+                                          scratch_pool),
+                      scratch_pool);
+
+  return SVN_NO_ERROR;
+}
+
 /* This implements the `svn_opt_subcommand_t' interface. */
 svn_error_t *
 svn_cl__resolve(apr_getopt_t *os,
@@ -45,39 +299,53 @@ svn_cl__resolve(apr_getopt_t *os,
                 apr_pool_t *scratch_pool)
 {
   svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
+  svn_cl__conflict_stats_t *conflict_stats =
+    ((svn_cl__cmd_baton_t *) baton)->conflict_stats;
   svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
-  svn_wc_conflict_choice_t conflict_choice;
+  svn_client_conflict_option_id_t option_id;
   svn_error_t *err;
   apr_array_header_t *targets;
+  const char *path_prefix;
   int i;
   apr_pool_t *iterpool;
   svn_boolean_t had_error = FALSE;
+  svn_boolean_t quit = FALSE;
+  svn_boolean_t external_failed = FALSE;
+  svn_boolean_t printed_summary = FALSE;
+  svn_cmdline_prompt_baton_t *pb = apr_palloc(scratch_pool, sizeof(*pb));
+
+  pb->cancel_func = ctx->cancel_func;
+  pb->cancel_baton = ctx->cancel_baton;
+
+  option_id = svn_client_conflict_option_unspecified;
+
+  SVN_ERR(svn_dirent_get_absolute(&path_prefix, "", scratch_pool));
 
   switch (opt_state->accept_which)
     {
     case svn_cl__accept_working:
-      conflict_choice = svn_wc_conflict_choose_merged;
+      option_id = svn_wc_conflict_choose_merged;
       break;
     case svn_cl__accept_base:
-      conflict_choice = svn_wc_conflict_choose_base;
+      option_id = svn_wc_conflict_choose_base;
       break;
     case svn_cl__accept_theirs_conflict:
-      conflict_choice = svn_wc_conflict_choose_theirs_conflict;
+      option_id = svn_wc_conflict_choose_theirs_conflict;
       break;
     case svn_cl__accept_mine_conflict:
-      conflict_choice = svn_wc_conflict_choose_mine_conflict;
+      option_id = svn_wc_conflict_choose_mine_conflict;
       break;
     case svn_cl__accept_theirs_full:
-      conflict_choice = svn_wc_conflict_choose_theirs_full;
+      option_id = svn_wc_conflict_choose_theirs_full;
       break;
     case svn_cl__accept_mine_full:
-      conflict_choice = svn_wc_conflict_choose_mine_full;
+      option_id = svn_wc_conflict_choose_mine_full;
       break;
     case svn_cl__accept_unspecified:
       if (opt_state->non_interactive)
         return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
                                 _("missing --accept option"));
-      conflict_choice = svn_wc_conflict_choose_unspecified;
+      option_id = svn_wc_conflict_choose_unspecified;
       break;
     default:
       return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
@@ -107,12 +375,40 @@ svn_cl__resolve(apr_getopt_t *os,
   for (i = 0; i < targets->nelts; i++)
     {
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
+      const char *local_abspath;
+      svn_client_conflict_t *conflict;
+
       svn_pool_clear(iterpool);
+ 
       SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
-      err = svn_client_resolve(target,
-                               opt_state->depth, conflict_choice,
-                               ctx,
-                               iterpool);
+
+      SVN_ERR(svn_dirent_get_absolute(&local_abspath, target, iterpool));
+
+      if (opt_state->depth == svn_depth_empty)
+        {
+          svn_boolean_t resolved;
+
+          SVN_ERR(svn_client_conflict_get(&conflict, local_abspath, ctx,
+                                          iterpool, iterpool));
+          err = svn_cl__resolve_conflict(&resolved,
+                                         &opt_state->accept_which,
+                                         &quit, &external_failed,
+                                         &printed_summary,
+                                         conflict, opt_state->editor_cmd,
+                                         ctx->config, path_prefix,
+                                         pb, conflict_stats,
+                                         option_id, ctx,
+                                         iterpool);
+        }
+      else
+        {
+          err = walk_conflicts(ctx, local_abspath, opt_state->depth,
+                               option_id, &opt_state->accept_which,
+                               &quit, &external_failed, &printed_summary,
+                               opt_state->editor_cmd, ctx->config,
+                               path_prefix, pb, conflict_stats, iterpool);
+        }
+
       if (err)
         {
           svn_handle_warning2(stderr, err, "svn: ");

Modified: subversion/branches/move-tracking-2/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svn/svn.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svn/svn.c (original)
+++ subversion/branches/move-tracking-2/subversion/svn/svn.c Mon Sep 21 15:26:27 2015
@@ -2793,6 +2793,7 @@ sub_main(int *exit_code, int argc, const
 
   /* Create a client context object. */
   command_baton.opt_state = &opt_state;
+  command_baton.conflict_stats = conflict_stats;
   SVN_ERR(svn_client_create_context2(&ctx, cfg_hash, pool));
   command_baton.ctx = ctx;
 

Modified: subversion/branches/move-tracking-2/subversion/svn_private_config.hw
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svn_private_config.hw?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svn_private_config.hw (original)
+++ subversion/branches/move-tracking-2/subversion/svn_private_config.hw Mon Sep 21 15:26:27 2015
@@ -122,6 +122,14 @@
    Supresses compiler warnings about the variable being unused.  */
 #define SVN_UNUSED(v) ( (void)(v) )
 
+#if defined(_MSC_VER) && _MSC_VER >= 1600
+#define HAVE_STDINT_H
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER >= 1800
+#define HAVE_STDBOOL_H
+#endif
+
 #endif /* SVN_PRIVATE_CONFIG_HW */
 
 /* Inclusion of Berkeley DB header */

Modified: subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c Mon Sep 21 15:26:27 2015
@@ -479,8 +479,12 @@ static const svn_opt_subcommand_desc2_t
 
   {"lstxns", subcommand_lstxns, {0}, N_
    ("usage: svnadmin lstxns REPOS_PATH\n\n"
-    "Print the names of all uncommitted transactions.\n"),
-   {0} },
+    "Print the names of uncommitted transactions. With -rN skip the output\n"
+    "of those that have a base revision more recent than rN.  Transactions\n"
+    "with base revisions much older than HEAD are likely to have been\n"
+    "abandonded and are candidates to be removed.\n"),
+   {'r'},
+   { {'r', "transaction base revision ARG"} } },
 
   {"pack", subcommand_pack, {0}, N_
    ("usage: svnadmin pack REPOS_PATH\n\n"
@@ -1109,8 +1113,7 @@ repos_notify_handler(void *baton,
                                             "%" APR_INT64_T_FMT,
                                             notify->shard);
         svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool,
-                              _("Packing revision properties"
-                                " in shard %s..."),
+                              _("Packed revision properties in shard %s\n"),
                               shardstr));
         return;
       }
@@ -1121,8 +1124,8 @@ repos_notify_handler(void *baton,
                                             "%" APR_INT64_T_FMT,
                                             notify->shard);
         svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool,
-                              _("Removing non-packed revision properties"
-                                " in shard %s..."),
+                              _("Removed non-packed revision properties"
+                                " in shard %s\n"),
                               shardstr));
         return;
       }
@@ -1503,7 +1506,7 @@ subcommand_load(apr_getopt_t *os, void *
   SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
 
   /* Read the stream from STDIN.  Users can redirect a file. */
-  SVN_ERR(svn_stream_for_stdin(&stdin_stream, pool));
+  SVN_ERR(svn_stream_for_stdin2(&stdin_stream, TRUE, pool));
 
   /* Progress feedback goes to STDOUT, unless they asked to suppress it. */
   if (! opt_state->quiet)
@@ -1547,8 +1550,7 @@ subcommand_load_revprops(apr_getopt_t *o
   SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
 
   /* Read the stream from STDIN.  Users can redirect a file. */
-  SVN_ERR(svn_stream_for_stdin(&stdin_stream, pool));
-  stdin_stream = svn_stream_wrap_buffered_read(stdin_stream, pool);
+  SVN_ERR(svn_stream_for_stdin2(&stdin_stream, TRUE, pool));
 
   /* Progress feedback goes to STDOUT, unless they asked to suppress it. */
   if (! opt_state->quiet)
@@ -1577,21 +1579,46 @@ subcommand_lstxns(apr_getopt_t *os, void
   svn_repos_t *repos;
   svn_fs_t *fs;
   apr_array_header_t *txns;
+  apr_pool_t *iterpool;
+  svn_revnum_t youngest, limit;
   int i;
 
   /* Expect no more arguments. */
   SVN_ERR(parse_args(NULL, os, 0, 0, pool));
+  if (opt_state->end_revision.kind != svn_opt_revision_unspecified)
+    return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                             _("Revision range is not allowed"));
 
   SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
   fs = svn_repos_fs(repos);
   SVN_ERR(svn_fs_list_transactions(&txns, fs, pool));
 
-  /* Loop, printing revisions. */
+  SVN_ERR(svn_fs_youngest_rev(&youngest, fs, pool));
+  SVN_ERR(get_revnum(&limit, &opt_state->start_revision, youngest, repos,
+                     pool));
+  
+  iterpool = svn_pool_create(pool);
   for (i = 0; i < txns->nelts; i++)
     {
-      SVN_ERR(svn_cmdline_printf(pool, "%s\n",
-                                 APR_ARRAY_IDX(txns, i, const char *)));
+      const char *name = APR_ARRAY_IDX(txns, i, const char *);
+      svn_boolean_t show = TRUE;
+
+      svn_pool_clear(iterpool);
+      if (limit != SVN_INVALID_REVNUM)
+        {
+          svn_fs_txn_t *txn;
+          svn_revnum_t base;
+
+          SVN_ERR(svn_fs_open_txn(&txn, fs, name, iterpool));
+          base = svn_fs_txn_base_revision(txn);
+
+          if (base > limit)
+            show = FALSE;
+        }
+      if (show)
+        SVN_ERR(svn_cmdline_printf(pool, "%s\n", name));
     }
+  svn_pool_destroy(iterpool);
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/move-tracking-2/subversion/svnbench/null-export-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnbench/null-export-cmd.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnbench/null-export-cmd.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnbench/null-export-cmd.c Mon Sep 21 15:26:27 2015
@@ -165,6 +165,15 @@ close_file(void *file_baton,
   return SVN_NO_ERROR;
 }
 
+/* Implement svn_write_fn_t, simply counting the incoming data. */
+static svn_error_t *
+file_write_handler(void *baton, const char *data, apr_size_t *len)
+{
+  edit_baton_t *eb = baton;
+  eb->byte_count += *len;
+
+  return SVN_NO_ERROR;
+}
 
 /*** Public Interfaces ***/
 
@@ -198,6 +207,7 @@ bench_null_export(svn_revnum_t *result_r
       svn_client__pathrev_t *loc;
       svn_ra_session_t *ra_session;
       svn_node_kind_t kind;
+      edit_baton_t *eb = baton;
 
       /* Get the RA connection. */
       SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc,
@@ -211,6 +221,11 @@ bench_null_export(svn_revnum_t *result_r
         {
           apr_hash_t *props;
 
+          /* Since we don't use the editor, we must count "manually". */
+          svn_stream_t *stream = svn_stream_create(eb, pool);
+          svn_stream_set_write(stream, file_write_handler);
+          eb->file_count++;
+
           /* Since you cannot actually root an editor at a file, we
            * manually drive a few functions of our editor. */
 
@@ -218,8 +233,7 @@ bench_null_export(svn_revnum_t *result_r
            * to the repository. */
           /* ### note: the stream will not be closed */
           SVN_ERR(svn_ra_get_file(ra_session, "", loc->rev,
-                                  svn_stream_empty(pool),
-                                  NULL, &props, pool));
+                                  stream, NULL, &props, pool));
         }
       else if (kind == svn_node_dir)
         {
@@ -268,6 +282,10 @@ bench_null_export(svn_revnum_t *result_r
                                      NULL, pool));
 
           SVN_ERR(reporter->finish_report(report_baton, pool));
+
+          /* We don't receive the "add directory" callback for the starting
+           * node. */
+          eb->dir_count++;
         }
       else if (kind == svn_node_none)
         {

Modified: subversion/branches/move-tracking-2/subversion/svnbench/svnbench.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnbench/svnbench.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnbench/svnbench.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnbench/svnbench.c Mon Sep 21 15:26:27 2015
@@ -371,6 +371,7 @@ sub_main(int *exit_code, int argc, const
   svn_config_t *cfg_config;
   svn_boolean_t descend = TRUE;
   svn_boolean_t use_notifier = TRUE;
+  apr_time_t start_time, time_taken;
 
   received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
 
@@ -939,7 +940,10 @@ sub_main(int *exit_code, int argc, const
   ctx->conflict_baton2 = NULL;
 
   /* And now we finally run the subcommand. */
+  start_time = apr_time_now();
   err = (*subcommand->cmd_func)(os, &command_baton, pool);
+  time_taken = apr_time_now() - start_time;
+
   if (err)
     {
       /* For argument-related problems, suggest using the 'help'
@@ -968,6 +972,14 @@ sub_main(int *exit_code, int argc, const
 
       return err;
     }
+  else if ((subcommand->cmd_func != svn_cl__help) && !opt_state.quiet)
+    {
+      /* This formatting lines up nicely with the output of our sub-commands
+       * and gives musec resolution while not overflowing for 30 years. */
+      SVN_ERR(svn_cmdline_printf(pool,
+                                _("%15.6f seconds taken\n"),
+                                time_taken / 1.0e6));
+    }
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/move-tracking-2/subversion/svndumpfilter/svndumpfilter.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svndumpfilter/svndumpfilter.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svndumpfilter/svndumpfilter.c (original)
+++ subversion/branches/move-tracking-2/subversion/svndumpfilter/svndumpfilter.c Mon Sep 21 15:26:27 2015
@@ -48,42 +48,8 @@
 #include "private/svn_cmdline_private.h"
 #include "private/svn_sorts_private.h"
 
-#ifdef _WIN32
-typedef apr_status_t (__stdcall *open_fn_t)(apr_file_t **, apr_pool_t *);
-#else
-typedef apr_status_t (*open_fn_t)(apr_file_t **, apr_pool_t *);
-#endif
-
 /*** Code. ***/
 
-/* Helper to open stdio streams */
-
-/* NOTE: we used to call svn_stream_from_stdio(), which wraps a stream
-   around a standard stdio.h FILE pointer.  The problem is that these
-   pointers operate through C Run Time (CRT) on Win32, which does all
-   sorts of translation on them: LF's become CRLF's, and ctrl-Z's
-   embedded in Word documents are interpreted as premature EOF's.
-
-   So instead, we use apr_file_open_std*, which bypass the CRT and
-   directly wrap the OS's file-handles, which don't know or care about
-   translation.  Thus dump/load works correctly on Win32.
-*/
-static svn_error_t *
-create_stdio_stream(svn_stream_t **stream,
-                    open_fn_t open_fn,
-                    apr_pool_t *pool)
-{
-  apr_file_t *stdio_file;
-  apr_status_t apr_err = open_fn(&stdio_file, pool);
-
-  if (apr_err)
-    return svn_error_wrap_apr(apr_err, _("Can't open stdio file"));
-
-  *stream = svn_stream_from_aprfile2(stdio_file, TRUE, pool);
-  return SVN_NO_ERROR;
-}
-
-
 /* Writes a property in dumpfile format to given stringbuf. */
 static void
 write_prop_to_stringbuf(svn_stringbuf_t *strbuf,
@@ -1065,12 +1031,10 @@ parse_baton_initialize(struct parse_bato
   struct parse_baton_t *baton = apr_palloc(pool, sizeof(*baton));
 
   /* Read the stream from STDIN.  Users can redirect a file. */
-  SVN_ERR(create_stdio_stream(&(baton->in_stream),
-                              apr_file_open_stdin, pool));
+  SVN_ERR(svn_stream_for_stdin2(&baton->in_stream, TRUE, pool));
 
   /* Have the parser dump results to STDOUT. Users can redirect a file. */
-  SVN_ERR(create_stdio_stream(&(baton->out_stream),
-                              apr_file_open_stdout, pool));
+  SVN_ERR(svn_stream_for_stdout(&baton->out_stream, pool));
 
   baton->do_exclude = do_exclude;
 

Modified: subversion/branches/move-tracking-2/subversion/svnfsfs/load-index-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnfsfs/load-index-cmd.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnfsfs/load-index-cmd.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnfsfs/load-index-cmd.c Mon Sep 21 15:26:27 2015
@@ -186,8 +186,7 @@ subcommand__load_index(apr_getopt_t *os,
   svnfsfs__opt_state *opt_state = baton;
   svn_stream_t *input;
 
-  SVN_ERR(svn_stream_for_stdin(&input, pool));
-  input = svn_stream_wrap_buffered_read(input, pool);
+  SVN_ERR(svn_stream_for_stdin2(&input, TRUE, pool));
   SVN_ERR(load_index(opt_state->repository_path, input, pool));
 
   return SVN_NO_ERROR;

Modified: subversion/branches/move-tracking-2/subversion/svnmucc/svnmucc.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmucc/svnmucc.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmucc/svnmucc.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmucc/svnmucc.c Mon Sep 21 15:26:27 2015
@@ -193,7 +193,7 @@ execute(const apr_array_header_t *action
               SVN_ERR(svn_stream_open_readonly(&src, action->path[1],
                                                pool, iterpool));
             else
-              SVN_ERR(svn_stream_for_stdin(&src, pool));
+              SVN_ERR(svn_stream_for_stdin2(&src, TRUE, pool));
 
 
             if (kind == svn_node_file)

Modified: subversion/branches/move-tracking-2/subversion/svnrdump/svnrdump.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnrdump/svnrdump.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnrdump/svnrdump.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnrdump/svnrdump.c Mon Sep 21 15:26:27 2015
@@ -546,7 +546,6 @@ replay_revisions(svn_ra_session_t *sessi
 #endif
     }
 
-  SVN_ERR(svn_stream_close(stdout_stream));
   return SVN_NO_ERROR;
 }
 
@@ -564,18 +563,14 @@ load_revisions(svn_ra_session_t *session
                apr_hash_t *skip_revprops,
                apr_pool_t *pool)
 {
-  apr_file_t *stdin_file;
   svn_stream_t *stdin_stream;
 
-  apr_file_open_stdin(&stdin_file, pool);
-  stdin_stream = svn_stream_from_aprfile2(stdin_file, FALSE, pool);
+  SVN_ERR(svn_stream_for_stdin2(&stdin_stream, TRUE, pool));
 
   SVN_ERR(svn_rdump__load_dumpstream(stdin_stream, session, aux_session,
                                      quiet, skip_revprops,
                                      check_cancel, NULL, pool));
 
-  SVN_ERR(svn_stream_close(stdin_stream));
-
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/move-tracking-2/subversion/svnserve/svnserve.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnserve/svnserve.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnserve/svnserve.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnserve/svnserve.c Mon Sep 21 15:26:27 2015
@@ -1030,7 +1030,9 @@ sub_main(int *exit_code, int argc, const
       apr_pool_cleanup_register(pool, pool, apr_pool_cleanup_null,
                                 redirect_stdout);
 
-      SVN_ERR(svn_stream_for_stdin(&stdin_stream, pool));
+      /* We are an interactive server, i.e. can't use APR buffering on
+       * stdin. */
+      SVN_ERR(svn_stream_for_stdin2(&stdin_stream, FALSE, pool));
       SVN_ERR(svn_stream_for_stdout(&stdout_stream, pool));
 
       /* Use a subpool for the connection to ensure that if SASL is used

Modified: subversion/branches/move-tracking-2/subversion/tests/cmdline/merge_automatic_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/cmdline/merge_automatic_tests.py?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/cmdline/merge_automatic_tests.py (original)
+++ subversion/branches/move-tracking-2/subversion/tests/cmdline/merge_automatic_tests.py Mon Sep 21 15:26:27 2015
@@ -1352,6 +1352,53 @@ def merge_to_copy_and_add(sbox):
                                      'merge', '--reintegrate', '^/A',
                                      sbox.ospath('A3'))
 
+def merge_delete_crlf_file(sbox):
+  "merge the deletion of a strict CRLF file"
+
+  sbox.build()
+
+  sbox.simple_copy('A', 'AA')
+
+  # Let commit fix the eols
+  sbox.simple_add_text('with\rCRLF\rhere!', 'A/crlf')
+  sbox.simple_add_text('with\rnative\r\eol', 'A/native')
+  sbox.simple_add_text('with\rCR\r\eol', 'A/cr')
+  sbox.simple_add_text('with\rLF\r\eol', 'A/lf')
+
+  # And apply the magic property
+  sbox.simple_propset('svn:eol-style', 'CRLF',   'A/crlf')
+  sbox.simple_propset('svn:eol-style', 'native', 'A/native')
+  sbox.simple_propset('svn:eol-style', 'CR',     'A/cr')
+  sbox.simple_propset('svn:eol-style', 'LF',     'A/lf')
+
+  sbox.simple_commit('A') # r2
+
+  # Merge the addition of the files
+  svntest.actions.run_and_verify_svn(None, [],
+                                     'merge', '^/A', sbox.ospath('AA'))
+  sbox.simple_commit('AA') # r3
+
+  sbox.simple_rm('A/D', 'A/mu', 'A/crlf', 'A/native', 'A/cr', 'A/lf')
+  sbox.simple_commit('A') # r4
+
+  sbox.simple_update('') # Make single revision r4
+
+  # And now merge the deletes
+  expected_output = svntest.verify.UnorderedOutput([
+    '--- Merging r3 through r4 into \'%s\':\n' % sbox.ospath('AA'),
+    'D    %s\n' % sbox.ospath('AA/cr'),
+    'D    %s\n' % sbox.ospath('AA/crlf'),
+    'D    %s\n' % sbox.ospath('AA/lf'),
+    'D    %s\n' % sbox.ospath('AA/native'),
+    'D    %s\n' % sbox.ospath('AA/mu'),
+    'D    %s\n' % sbox.ospath('AA/D'),
+    '--- Recording mergeinfo for merge of r3 through r4 into \'%s\':\n'
+                % sbox.ospath('AA'),
+    ' U   %s\n' % sbox.ospath('AA')
+  ])
+  svntest.actions.run_and_verify_svn(expected_output, [],
+                                     'merge', '^/A', sbox.ospath('AA'))
+
 ########################################################################
 # Run the tests
 
@@ -1382,6 +1429,7 @@ test_list = [ None,
               effective_sync_results_in_reintegrate,
               reintegrate_subtree_not_updated,
               merge_to_copy_and_add,
+              merge_delete_crlf_file
              ]
 
 if __name__ == '__main__':

Modified: subversion/branches/move-tracking-2/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/cmdline/patch_tests.py?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/branches/move-tracking-2/subversion/tests/cmdline/patch_tests.py Mon Sep 21 15:26:27 2015
@@ -5620,6 +5620,60 @@ def patch_obstructing_symlink_traversal(
                                        expected_output, expected_disk,
                                        expected_status, expected_skip)
 
+@XFail()
+def patch_binary_file(sbox):
+  "patch a binary file"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  # Make the file binary by putting some non ascii chars inside or propset
+  # will return a warning
+  sbox.simple_append('iota', '\0\202\203\204\205\206\207nsomething\nelse\xFF')
+  sbox.simple_propset('svn:mime-type', 'application/binary', 'iota')
+
+  expected_output = [
+    'Index: svn-test-work/working_copies/patch_tests-57/iota\n',
+    '===================================================================\n',
+    'diff --git a/iota b/iota\n',
+    'GIT binary patch\n',
+    'literal 25\n',
+    'ec$^E#$ShU>qLPeMg|y6^R0Z|S{E|d<JuU!m{s;*G\n',
+    '\n',
+    'literal 48\n',
+    'zc$^E#$ShU>qLPeMg|y6^R0Z|S{E|d<JuZf(=9bpB_PpZ!+|-hc%)E52)STkf{{Wp*\n',
+    'B5)uFa\n',
+    '\n',
+    'Property changes on: iota\n',
+    '___________________________________________________________________\n',
+    'Added: svn:mime-type\n',
+    '## -0,0 +1 ##\n',
+    '+application/binary\n',
+    '\ No newline at end of property\n',
+  ]
+
+  _, diff_output, _ = svntest.actions.run_and_verify_svn(expected_output, [],
+                                                         'diff', '--git',
+                                                         wc_dir)
+
+  sbox.simple_revert('iota')
+
+  tmp = sbox.get_tempname()
+  svntest.main.file_write(tmp, ''.join(diff_output))
+
+  expected_output = wc.State(wc_dir, {
+    'iota'              : Item(status='UU'),
+  })
+  expected_disk = None
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('iota', status='MM')
+  expected_skip = wc.State('', { })
+
+  svntest.actions.run_and_verify_patch(wc_dir, tmp,
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+
 ########################################################################
 #Run the tests
 
@@ -5681,6 +5735,7 @@ test_list = [ None,
               patch_closest,
               patch_symlink_traversal,
               patch_obstructing_symlink_traversal,
+              patch_binary_file,
             ]
 
 if __name__ == '__main__':

Modified: subversion/branches/move-tracking-2/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/cmdline/svntest/actions.py?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/branches/move-tracking-2/subversion/tests/cmdline/svntest/actions.py Mon Sep 21 15:26:27 2015
@@ -1689,7 +1689,7 @@ def run_and_verify_diff_summarize_xml(er
   for path in paths:
     modified_path = path.childNodes[0].data
 
-    if (expected_prefix is not None
+    if (expected_prefix
         and modified_path.find(expected_prefix) == 0):
       modified_path = modified_path.replace(expected_prefix, '')[1:].strip()
 

Modified: subversion/branches/move-tracking-2/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/cmdline/svntest/main.py?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/branches/move-tracking-2/subversion/tests/cmdline/svntest/main.py Mon Sep 21 15:26:27 2015
@@ -1592,13 +1592,12 @@ class TestSpawningThread(threading.Threa
     args = []
     args.append(str(index))
     args.append('-c')
+    args.append('--set-log-level=%s' % logger.getEffectiveLevel())
     # add some startup arguments from this process
     if options.fs_type:
       args.append('--fs-type=' + options.fs_type)
     if options.test_area_url:
       args.append('--url=' + options.test_area_url)
-    if logger.getEffectiveLevel() <= logging.DEBUG:
-      args.append('-v')
     if options.cleanup:
       args.append('--cleanup')
     if options.enable_sasl:

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c Mon Sep 21 15:26:27 2015
@@ -1343,8 +1343,9 @@ plain_0_length(const svn_test_opts_t *op
       memcpy(rev_contents->data + offset, noderev_str->data, noderev_str->len);
     }
 
-  SVN_ERR(svn_io_write_atomic(rev_path, rev_contents->data,
-                              rev_contents->len, NULL, pool));
+  SVN_ERR(svn_io_write_atomic2(rev_path, rev_contents->data,
+                               rev_contents->len, NULL, FALSE,
+                               pool));
 
   if (svn_fs_fs__use_log_addressing(fs))
     {

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_x/fs-x-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_x/fs-x-pack-test.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_x/fs-x-pack-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_x/fs-x-pack-test.c Mon Sep 21 15:26:27 2015
@@ -61,8 +61,8 @@ write_format(const char *path,
                           "layout sharded %d\n",
                           format, max_files_per_dir);
 
-  SVN_ERR(svn_io_write_atomic(path, contents, strlen(contents),
-                              NULL /* copy perms */, pool));
+  SVN_ERR(svn_io_write_atomic2(path, contents, strlen(contents),
+                               NULL /* copy perms */, FALSE, pool));
 
   /* And set the perms to make it read only */
   return svn_io_set_file_read_only(path, FALSE, pool);

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_repos/repos-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_repos/repos-test.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_repos/repos-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_repos/repos-test.c Mon Sep 21 15:26:27 2015
@@ -3375,26 +3375,26 @@ test_config_pool(const svn_test_opts_t *
   svn_stringbuf_appendcstr(cfg_buffer2, "\n[more]\nU=\"X\"\n");
 
   /* write them to 2x2 files */
-  SVN_ERR(svn_io_write_atomic(svn_dirent_join(wrk_dir,
-                                              "config-pool-test1.cfg",
-                                              pool),
-                              cfg_buffer1->data, cfg_buffer1->len, NULL,
-                              pool));
-  SVN_ERR(svn_io_write_atomic(svn_dirent_join(wrk_dir,
-                                              "config-pool-test2.cfg",
-                                              pool),
-                              cfg_buffer1->data, cfg_buffer1->len, NULL,
-                              pool));
-  SVN_ERR(svn_io_write_atomic(svn_dirent_join(wrk_dir,
-                                              "config-pool-test3.cfg",
-                                              pool),
-                              cfg_buffer2->data, cfg_buffer2->len, NULL,
-                              pool));
-  SVN_ERR(svn_io_write_atomic(svn_dirent_join(wrk_dir,
-                                              "config-pool-test4.cfg",
-                                              pool),
-                              cfg_buffer2->data, cfg_buffer2->len, NULL,
-                              pool));
+  SVN_ERR(svn_io_write_atomic2(svn_dirent_join(wrk_dir,
+                                               "config-pool-test1.cfg",
+                                               pool),
+                               cfg_buffer1->data, cfg_buffer1->len, NULL,
+                               FALSE, pool));
+  SVN_ERR(svn_io_write_atomic2(svn_dirent_join(wrk_dir,
+                                               "config-pool-test2.cfg",
+                                               pool),
+                               cfg_buffer1->data, cfg_buffer1->len, NULL,
+                               FALSE, pool));
+  SVN_ERR(svn_io_write_atomic2(svn_dirent_join(wrk_dir,
+                                               "config-pool-test3.cfg",
+                                               pool),
+                               cfg_buffer2->data, cfg_buffer2->len, NULL,
+                               FALSE, pool));
+  SVN_ERR(svn_io_write_atomic2(svn_dirent_join(wrk_dir,
+                                               "config-pool-test4.cfg",
+                                               pool),
+                               cfg_buffer2->data, cfg_buffer2->len, NULL,
+                               FALSE, pool));
 
   /* requesting a config over and over again should return the same
      (even though it is not being referenced) */

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/checksum-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/checksum-test.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/checksum-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/checksum-test.c Mon Sep 21 15:26:27 2015
@@ -274,6 +274,28 @@ test_serialization(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_checksum_parse_all_zero(apr_pool_t *pool)
+{
+  svn_checksum_kind_t kind;
+  for (kind = svn_checksum_md5; kind <= svn_checksum_fnv1a_32x4; ++kind)
+    {
+      svn_checksum_t *checksum;
+      const char *hex;
+
+      checksum = svn_checksum_create(kind, pool);
+
+      hex = svn_checksum_to_cstring_display(checksum, pool);
+      SVN_ERR(svn_checksum_parse_hex(&checksum, kind, hex, pool));
+
+      /* All zeroes checksum is NULL by definition. See
+         svn_checksum_parse_hex().*/
+      SVN_TEST_ASSERT(checksum == NULL);
+    }
+
+  return SVN_NO_ERROR;
+}
+
 /* An array of all test functions */
 
 static int max_threads = 1;
@@ -293,6 +315,8 @@ static struct svn_test_descriptor_t test
                    "zero checksum cross-type matching"),
     SVN_TEST_PASS2(test_serialization,
                    "checksum (de-)serialization"),
+    SVN_TEST_PASS2(test_checksum_parse_all_zero,
+                   "checksum parse all zero"),
     SVN_TEST_NULL
   };