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

svn commit: r1704591 [2/2] - in /subversion/branches/patch-exec: ./ build/ subversion/bindings/javahl/native/jniwrapper/ subversion/include/ subversion/libsvn_client/ subversion/libsvn_diff/ subversion/libsvn_fs_x/ subversion/libsvn_ra_serf/ subversion...

Modified: subversion/branches/patch-exec/subversion/svn/resolve-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svn/resolve-cmd.c?rev=1704591&r1=1704590&r2=1704591&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svn/resolve-cmd.c (original)
+++ subversion/branches/patch-exec/subversion/svn/resolve-cmd.c Tue Sep 22 12:17:30 2015
@@ -43,11 +43,20 @@
 struct conflict_status_walker_baton
 {
   svn_client_ctx_t *ctx;
-  svn_wc_conflict_choice_t conflict_choice;
+  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
@@ -99,8 +108,13 @@ conflict_status_walker(void *baton,
 
   SVN_ERR(svn_client_conflict_get(&conflict, local_abspath, cswb->ctx,
                                   iterpool, iterpool));
-  SVN_ERR(svn_cl__resolve_conflict(&resolved, conflict, cswb->ctx,
-                                   cswb->conflict_choice,
+  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;
@@ -114,7 +128,16 @@ static svn_error_t *
 walk_conflicts(svn_client_ctx_t *ctx,
                const char *local_abspath,
                svn_depth_t depth,
-               svn_wc_conflict_choice_t conflict_choice,
+               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;
@@ -125,13 +148,24 @@ walk_conflicts(svn_client_ctx_t *ctx,
     depth = svn_depth_infinity;
 
   cswb.ctx = ctx;
-  cswb.conflict_choice = conflict_choice;
+  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,
@@ -265,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,
@@ -342,13 +390,23 @@ svn_cl__resolve(apr_getopt_t *os,
 
           SVN_ERR(svn_client_conflict_get(&conflict, local_abspath, ctx,
                                           iterpool, iterpool));
-          err = svn_cl__resolve_conflict(&resolved, conflict, ctx,
-                                         conflict_choice, 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,
-                               conflict_choice, iterpool);
+                               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)

Modified: subversion/branches/patch-exec/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svn/svn.c?rev=1704591&r1=1704590&r2=1704591&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svn/svn.c (original)
+++ subversion/branches/patch-exec/subversion/svn/svn.c Tue Sep 22 12:17:30 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/patch-exec/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/tests/cmdline/patch_tests.py?rev=1704591&r1=1704590&r2=1704591&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/branches/patch-exec/subversion/tests/cmdline/patch_tests.py Tue Sep 22 12:17:30 2015
@@ -5620,6 +5620,59 @@ 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 48\n',
+    'zc$^E#$ShU>qLPeMg|y6^R0Z|S{E|d<JuZf(=9bpB_PpZ!+|-hc%)E52)STkf{{Wp*\n',
+    'B5)uFa\n',
+    '\n',
+    'literal 25\n',
+    'ec$^E#$ShU>qLPeMg|y6^R0Z|S{E|d<JuU!m{s;*G\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)
+
 def patch_adds_executability_nocontents(sbox):
   """patch adds svn:executable, without contents"""
 
@@ -5864,6 +5917,7 @@ test_list = [ None,
               patch_closest,
               patch_symlink_traversal,
               patch_obstructing_symlink_traversal,
+              patch_binary_file,
               patch_adds_executability_nocontents,
               patch_adds_executability_yescontents,
               patch_deletes_executability,

Modified: subversion/branches/patch-exec/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/tests/cmdline/svntest/main.py?rev=1704591&r1=1704590&r2=1704591&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/branches/patch-exec/subversion/tests/cmdline/svntest/main.py Tue Sep 22 12:17:30 2015
@@ -1585,13 +1585,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/patch-exec/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/tests/libsvn_client/client-test.c?rev=1704591&r1=1704590&r2=1704591&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/branches/patch-exec/subversion/tests/libsvn_client/client-test.c Tue Sep 22 12:17:30 2015
@@ -740,14 +740,14 @@ test_foreign_repos_copy(const svn_test_o
 
   wc_path = svn_test_data_path("test-foreign-repos-copy", pool);
 
-  wc_path = svn_dirent_join(wc_path, "foreign-wc", pool);
-
   /* Remove old test data from the previous run */
   SVN_ERR(svn_io_remove_dir2(wc_path, TRUE, NULL, NULL, pool));
 
   SVN_ERR(svn_io_make_dir_recursively(wc_path, pool));
   svn_test_add_dir_cleanup(wc_path);
 
+  wc_path = svn_dirent_join(wc_path, "foreign-wc", pool);
+
   rev.kind = svn_opt_revision_head;
   peg_rev.kind = svn_opt_revision_unspecified;
   SVN_ERR(svn_client_create_context(&ctx, pool));
@@ -953,7 +953,7 @@ test_remote_only_status(const svn_test_o
 
   /* Check out a sparse root @r1 of the repository */
   wc_path = svn_test_data_path("test-remote-only-status-wc", pool);
-  /*svn_test_add_dir_cleanup(wc_path);*/
+  svn_test_add_dir_cleanup(wc_path);
   SVN_ERR(svn_io_remove_dir2(wc_path, TRUE, NULL, NULL, pool));
 
   rev.kind = svn_opt_revision_number;

Modified: subversion/branches/patch-exec/win-tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/win-tests.py?rev=1704591&r1=1704590&r2=1704591&view=diff
==============================================================================
--- subversion/branches/patch-exec/win-tests.py (original)
+++ subversion/branches/patch-exec/win-tests.py Tue Sep 22 12:17:30 2015
@@ -31,6 +31,7 @@ import os, sys, subprocess
 import filecmp
 import shutil
 import traceback
+import logging
 try:
   # Python >=3.0
   import configparser
@@ -59,7 +60,6 @@ def _usage_exit():
   print("  -u URL, --url=URL      : run ra_dav or ra_svn tests against URL;")
   print("                           will start svnserve for ra_svn tests")
   print("  -v, --verbose          : talk more")
-  print("  -q, --quiet            : talk less")
   print("  -f, --fs-type=type     : filesystem type to use (fsfs is default)")
   print("  -c, --cleanup          : cleanup after running a test")
   print("  -t, --test=TEST        : Run the TEST test (all is default); use")
@@ -108,6 +108,8 @@ def _usage_exit():
   print("  --config-file          : Configuration file for tests")
   print("  --fsfs-sharding        : Specify shard size (for fsfs)")
   print("  --fsfs-packing         : Run 'svnadmin pack' automatically")
+  print("  -q, --quiet            : Deprecated; this is the default.")
+  print("                           Use --set-log-level instead.")
 
   sys.exit(0)
 
@@ -141,7 +143,7 @@ if len(args) > 1:
   print('Warning: non-option arguments after the first one will be ignored')
 
 # Interpret the options and set parameters
-base_url, fs_type, verbose, quiet, cleanup = None, None, None, None, None
+base_url, fs_type, verbose, cleanup = None, None, None, None
 repo_loc = 'local repository.'
 objdir = 'Debug'
 log = 'tests.log'
@@ -187,8 +189,7 @@ for opt, val in opts:
     fs_type = val
   elif opt in ('-v', '--verbose'):
     verbose = 1
-  elif opt in ('-q', '--quiet'):
-    quiet = 1
+    log_level = logging.DEBUG
   elif opt in ('-c', '--cleanup'):
     cleanup = 1
   elif opt in ('-t', '--test'):
@@ -250,7 +251,7 @@ for opt, val in opts:
   elif opt == '--log-to-stdout':
     log_to_stdout = 1
   elif opt == '--log-level':
-    log_level = val
+    log_level = getattr(logging, val, None) or int(val)
   elif opt == '--ssl-cert':
     ssl_cert = val
   elif opt == '--exclusive-wc-locks':
@@ -999,7 +1000,6 @@ if not test_javahl and not test_swig:
   opts.fs_type = fs_type
   opts.http_library = 'serf'
   opts.server_minor_version = server_minor_version
-  opts.verbose = not quiet
   opts.cleanup = cleanup
   opts.enable_sasl = enable_sasl
   opts.parallel = parallel