* subversion/libsvn_wc/merge.c
Merge changes from trunk.
* subversion/libsvn_client/diff.c
(diff_cmd_baton): Ditch the 'cmd' field and merge in the new config
field from trunk.
(diff_file_changed): Merge changes from trunk. Look for a 'diff-cmd'
in the config instead of in the diff_cmd_baton.
(merge_file_changed, merge_file_added): Merge changes from trunk.
adm_access, subpool));
(svn_client_diff): Merge changes from trunk. Drop initialization of
diff_cmd_baton->cmd.
* subversion/clients/cmdline/main.c
(main): Merge changes from trunk. Update the way how we update the
config, since we don't have direct access to it anymore (we need
to get the config from the hash first).
git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/issue-405-internal-diff@844979 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/subversion/clients/cmdline/main.c b/subversion/clients/cmdline/main.c
index c267aa8..2a45197 100644
--- a/subversion/clients/cmdline/main.c
+++ b/subversion/clients/cmdline/main.c
@@ -524,6 +524,7 @@
apr_status_t apr_err;
svn_cl__cmd_baton_t command_baton;
svn_auth_baton_t *ab;
+ svn_config_t *cfg;
/* Initialize the app. */
if (svn_cmdline_init ("svn", stderr) != EXIT_SUCCESS)
@@ -921,20 +922,15 @@
return EXIT_FAILURE;
}
- /* Update the options in the config */
- /* XXX: Only diff_cmd for now, overlay rest later and stop passing
- opt_state altogether? */
- if (opt_state.diff_cmd)
- svn_config_set (cfg, "helpers", "diff-cmd", opt_state.diff_cmd);
-
- err = svn_config_read_servers (&cfg, pool);
- if (err)
- svn_handle_error (err, stderr, 0);
- else
- apr_hash_set (ctx.config, SVN_CONFIG_CATEGORY_SERVERS,
- APR_HASH_KEY_STRING, cfg);
- }
+ cfg = apr_hash_get (ctx.config, SVN_CONFIG_CATEGORY_CONFIG,
+ APR_HASH_KEY_STRING);
+ /* Update the options in the config */
+ /* XXX: Only diff_cmd for now, overlay rest later and stop passing
+ opt_state altogether? */
+ if (opt_state.diff_cmd)
+ svn_config_set (cfg, "helpers", "diff-cmd", opt_state.diff_cmd);
+
ctx.log_msg_func = svn_cl__get_log_message;
ctx.log_msg_baton = svn_cl__make_log_msg_baton (&opt_state, NULL,
ctx.config, pool);
diff --git a/subversion/libsvn_client/diff.c b/subversion/libsvn_client/diff.c
index 6e058ed..60b3e5b 100644
--- a/subversion/libsvn_client/diff.c
+++ b/subversion/libsvn_client/diff.c
@@ -128,10 +128,6 @@
struct diff_cmd_baton {
- /* Full path of external command to run to perform the 'diff',
- NULL for the internal library.
- */
- const char *cmd;
const apr_array_header_t *options;
apr_pool_t *pool;
apr_file_t *outfile;
@@ -154,6 +150,9 @@
*/
svn_revnum_t revnum1;
svn_revnum_t revnum2;
+
+ /* Client config hash (may be NULL). */
+ apr_hash_t *config;
};
@@ -189,7 +188,7 @@
void *diff_baton)
{
struct diff_cmd_baton *diff_cmd_baton = diff_baton;
- const char *diff_cmd = diff_cmd_baton->cmd;
+ const char *diff_cmd = NULL;
const char **args = NULL;
int nargs, exitcode;
apr_file_t *outfile = diff_cmd_baton->outfile;
@@ -257,22 +256,28 @@
label1 = diff_label (path, rev1, subpool);
label2 = diff_label (path, rev2, subpool);
}
-
+
+ /* Find out if we need to run an external diff */
+ if (diff_cmd_baton->config)
+ {
+ svn_config_t *cfg = apr_hash_get (diff_cmd_baton->config,
+ SVN_CONFIG_CATEGORY_CONFIG,
+ APR_HASH_KEY_STRING);
+ svn_config_get (cfg, &diff_cmd, "helpers", "diff-cmd", NULL);
+ }
+
if (diff_cmd)
{
- const char *diff_utf8;
-
- SVN_ERR (svn_path_cstring_to_utf8 (&diff_utf8, diff_cmd, subpool));
-
/* Print out the diff header. */
SVN_ERR (svn_utf_cstring_from_utf8 (&path_native, path, subpool));
SVN_ERR (svn_io_file_printf (outfile, "Index: %s\n%s\n",
path_native, equal_string));
- /* XXX: Find a way to pass diff_cmd to svn_io_run_diff */
SVN_ERR (svn_io_run_diff (".", args, nargs, label1, label2,
tmpfile1, tmpfile2,
- &exitcode, outfile, errfile, subpool));
+ &exitcode, outfile, errfile,
+ diff_cmd_baton->config,
+ subpool));
}
else
{
@@ -449,10 +454,9 @@
SVN_ERR (svn_wc_text_modified_p (&has_local_mods, mine, FALSE,
adm_access, subpool));
SVN_ERR (svn_wc_merge (older, yours, mine, adm_access,
-
left_label, right_label, target_label,
- merge_b->dry_run, &merge_outcome,
- subpool));
+ merge_b->dry_run, &merge_outcome,
+ merge_b->ctx->config, subpool));
/* Philip asks "Why?" Why does the notification depend on whether the
file had modifications before the merge? If the merge didn't change
@@ -529,7 +533,8 @@
"already exists.", mine);
SVN_ERR (svn_wc_merge (older, yours, mine, adm_access,
".older", ".yours", ".working", /* ###? */
- merge_b->dry_run, &merge_outcome, subpool));
+ merge_b->dry_run, &merge_outcome,
+ merge_b->ctx->config, subpool));
break;
}
default:
@@ -1363,8 +1368,7 @@
{
struct diff_cmd_baton diff_cmd_baton;
svn_wc_diff_callbacks_t diff_callbacks;
- svn_config_t *cfg;
-
+
diff_callbacks.file_changed = diff_file_changed;
diff_callbacks.file_added = diff_file_added;
diff_callbacks.file_deleted = no_diff_deleted ? diff_file_deleted_no_diff :
@@ -1373,10 +1377,6 @@
diff_callbacks.dir_deleted = diff_dir_deleted;
diff_callbacks.props_changed = diff_props_changed;
- cfg = apr_hash_get (ctx->config, SVN_CONFIG_CATEGORY_CONFIG,
- APR_HASH_KEY_STRING);
- svn_config_get (cfg, &diff_cmd_baton.cmd, "helpers", "diff-cmd", NULL);
-
diff_cmd_baton.orig_path_1 = path1;
diff_cmd_baton.orig_path_2 = path2;
@@ -1387,6 +1387,8 @@
diff_cmd_baton.revnum1 = SVN_INVALID_REVNUM;
diff_cmd_baton.revnum2 = SVN_INVALID_REVNUM;
+ diff_cmd_baton.config = ctx->config;
+
if ((svn_path_is_url (path1)) != (svn_path_is_url (path2)))
return svn_error_create
(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
diff --git a/subversion/libsvn_wc/merge.c b/subversion/libsvn_wc/merge.c
index 01f887b..d5cd423 100644
--- a/subversion/libsvn_wc/merge.c
+++ b/subversion/libsvn_wc/merge.c
@@ -38,6 +38,7 @@
const char *target_label,
svn_boolean_t dry_run,
enum svn_wc_merge_outcome_t *merge_outcome,
+ apr_hash_t *config,
apr_pool_t *pool)
{
const char *tmp_target, *result_target, *tmp_left, *tmp_right;