Author: rhuijben
Date: Thu Jul 5 12:30:25 2012
New Revision: 1357580
URL: http://svn.apache.org/viewvc?rev=1357580&view=rev
Log:
Following up on the recent interactive conflict handling changes in svn, stop
abusing svn_client_ctx_t's resolver as a temporary variable by storing some
state in the option state.
This allows reverting some changes in libsvn_client that changed the library
behavior. And this then should fix the javahl tests.
* subversion/libsvn_client/merge.c
(merge_dir_props_changed): Restore old behavior. Provide left and right
locations for recording the conflict.
(merge_file_changed): Restore old behavior.
* subversion/svn/cl.h
(svn_cl__opt_state_t): Store interactive resolver in this.
(svn_cl__resolve_conflicts): Add opt_state argument.
* subversion/svn/conflict-callbacks.c
(svn_cl__resolve_conflicts): Just enable the interactive handling from
this specific point and restore old values.
* subversion/svn/main.c
(main): Set conflict handler in opt_state instead of ctx.
* subversion/svn/merge-cmd.c
(svn_cl__merge): Remove ctx changes. Call interactive resolver on opt_state.
* subversion/svn/resolve-cmd.c
(svn_cl__resolve): Verify the right variable. Set and restore interactive
handler.
* subversion/svn/switch-cmd.c
(svn_cl__switch): Remove ctx changes. Call interactive resolver on opt_state.
* subversion/svn/update-cmd.c
(svn_cl__update): Remove ctx changes. Call interactive resolver on opt_state.
Modified:
subversion/trunk/subversion/libsvn_client/merge.c
subversion/trunk/subversion/svn/cl.h
subversion/trunk/subversion/svn/conflict-callbacks.c
subversion/trunk/subversion/svn/main.c
subversion/trunk/subversion/svn/merge-cmd.c
subversion/trunk/subversion/svn/resolve-cmd.c
subversion/trunk/subversion/svn/switch-cmd.c
subversion/trunk/subversion/svn/update-cmd.c
Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1357580&r1=1357579&r2=1357580&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Thu Jul 5 12:30:25 2012
@@ -1376,10 +1376,17 @@ merge_dir_props_changed(svn_wc_notify_st
definition, 'svn merge' shouldn't touch any pristine data */
if (props->nelts)
{
+ svn_wc_conflict_version_t *left;
+ svn_wc_conflict_version_t *right;
svn_client_ctx_t *ctx = merge_b->ctx;
+ SVN_ERR(make_conflict_versions(&left, &right, local_abspath,
+ svn_node_dir, &merge_b->merge_source,
+ merge_b->target, merge_b->pool));
+
SVN_ERR(svn_wc_merge_props3(state, ctx->wc_ctx, local_abspath,
- NULL, NULL, original_props, props,
+ left, right,
+ original_props, props,
merge_b->dry_run,
ctx->conflict_func2, ctx->conflict_baton2,
ctx->cancel_func, ctx->cancel_baton,
@@ -1729,8 +1736,8 @@ merge_file_changed(svn_wc_notify_state_t
local_abspath, FALSE, scratch_pool));
/* Postpone all conflicts. */
- conflict_baton.wrapped_func = NULL;
- conflict_baton.wrapped_baton = NULL;
+ conflict_baton.wrapped_func = ctx->conflict_func2;
+ conflict_baton.wrapped_baton = ctx->conflict_baton2;
conflict_baton.conflicted_paths = &merge_b->conflicted_paths;
conflict_baton.pool = merge_b->pool;
Modified: subversion/trunk/subversion/svn/cl.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1357580&r1=1357579&r2=1357580&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Thu Jul 5 12:30:25 2012
@@ -239,6 +239,9 @@ typedef struct svn_cl__opt_state_t
svn_boolean_t include_externals; /* Recurses (in)to file & dir externals */
const char *search_pattern; /* pattern argument for --search */
svn_boolean_t case_insensitive_search; /* perform case-insensitive search */
+
+ svn_wc_conflict_resolver_func2_t conflict_func;
+ void *conflict_baton;
} svn_cl__opt_state_t;
@@ -863,6 +866,7 @@ svn_cl__check_related_source_and_target(
svn_error_t *
svn_cl__resolve_conflicts(apr_array_header_t *targets,
svn_depth_t depth,
+ const svn_cl__opt_state_t *opt_state,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool);
Modified: subversion/trunk/subversion/svn/conflict-callbacks.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/conflict-callbacks.c?rev=1357580&r1=1357579&r2=1357580&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/conflict-callbacks.c (original)
+++ subversion/trunk/subversion/svn/conflict-callbacks.c Thu Jul 5 12:30:25
2012
@@ -818,6 +818,7 @@ svn_cl__conflict_handler(svn_wc_conflict
svn_error_t *
svn_cl__resolve_conflicts(apr_array_header_t *targets,
svn_depth_t depth,
+ const svn_cl__opt_state_t *opt_state,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
{
@@ -830,13 +831,30 @@ svn_cl__resolve_conflicts(apr_array_head
const char *target = APR_ARRAY_IDX(targets, i, const char *);
svn_error_t *err = SVN_NO_ERROR;
const char *local_abspath;
+ svn_wc_conflict_resolver_func2_t conflict_func2;
+ void *conflict_baton2;
svn_pool_clear(iterpool);
SVN_ERR(svn_dirent_get_absolute(&local_abspath, target, iterpool));
+
+
+ /* Store old state */
+ conflict_func2 = ctx->conflict_func2;
+ conflict_baton2 = ctx->conflict_baton2;
+
+ /* Store interactive resolver */
+ ctx->conflict_func2 = opt_state->conflict_func;
+ ctx->conflict_baton2 = opt_state->conflict_baton;
+
err = svn_client_resolve(local_abspath, depth,
svn_wc_conflict_choose_unspecified,
ctx, iterpool);
+
+ /* Restore state */
+ ctx->conflict_func2 = conflict_func2;
+ ctx->conflict_baton2 = conflict_baton2;
+
if (err)
{
if ((err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
Modified: subversion/trunk/subversion/svn/main.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/main.c?rev=1357580&r1=1357579&r2=1357580&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/main.c (original)
+++ subversion/trunk/subversion/svn/main.c Thu Jul 5 12:30:25 2012
@@ -2712,6 +2712,13 @@ main(int argc, const char *argv[])
we can change this. */
svn_handle_error2(err, stderr, TRUE, "svn: ");
+ /* The new svn behavior is to postpone everything until after the operation
+ completed */
+ ctx->conflict_func = NULL;
+ ctx->conflict_baton = NULL;
+ ctx->conflict_func2 = NULL;
+ ctx->conflict_baton2 = NULL;
+
if ((opt_state.accept_which == svn_cl__accept_unspecified
&& (!interactive_conflicts || opt_state.non_interactive))
|| opt_state.accept_which == svn_cl__accept_postpone)
@@ -2719,10 +2726,8 @@ main(int argc, const char *argv[])
/* If no --accept option at all and we're non-interactive, we're
leaving the conflicts behind, so don't need the callback. Same if
the user said to postpone. */
- ctx->conflict_func = NULL;
- ctx->conflict_baton = NULL;
- ctx->conflict_func2 = NULL;
- ctx->conflict_baton2 = NULL;
+ opt_state.conflict_func = NULL;
+ opt_state.conflict_baton = NULL;
}
else
{
@@ -2748,16 +2753,14 @@ main(int argc, const char *argv[])
pool, "svn: ");
}
- ctx->conflict_func = NULL;
- ctx->conflict_baton = NULL;
- ctx->conflict_func2 = svn_cl__conflict_handler;
+ opt_state.conflict_func = svn_cl__conflict_handler;
SVN_INT_ERR(svn_cl__conflict_baton_make(&conflict_baton2,
opt_state.accept_which,
ctx->config,
opt_state.editor_cmd,
pb,
pool));
- ctx->conflict_baton2 = conflict_baton2;
+ opt_state.conflict_baton = conflict_baton2;
}
/* And now we finally run the subcommand. */
Modified: subversion/trunk/subversion/svn/merge-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/merge-cmd.c?rev=1357580&r1=1357579&r2=1357580&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/merge-cmd.c (original)
+++ subversion/trunk/subversion/svn/merge-cmd.c Thu Jul 5 12:30:25 2012
@@ -158,8 +158,6 @@ svn_cl__merge(apr_getopt_t *os,
peg_revision2;
apr_array_header_t *options, *ranges_to_merge = opt_state->revision_ranges;
svn_opt_revision_t unspecified = { svn_opt_revision_unspecified, { 0 } };
- svn_wc_conflict_resolver_func2_t conflict_func2 = ctx->conflict_func2;
- void *conflict_baton2 = ctx->conflict_baton2;
/* Merge doesn't support specifying a revision or revision range
when using --reintegrate. */
@@ -395,8 +393,6 @@ svn_cl__merge(apr_getopt_t *os,
/* Postpone conflict resolution during the merge operation.
* If any conflicts occur we'll run the conflict resolver later. */
- ctx->conflict_func2 = NULL;
- ctx->conflict_baton2 = NULL;
#ifdef SVN_WITH_SYMMETRIC_MERGE
if (opt_state->symmetric_merge)
@@ -501,14 +497,13 @@ svn_cl__merge(apr_getopt_t *os,
if (! opt_state->quiet)
err = svn_cl__print_conflict_stats(ctx->notify_baton2, pool);
- if (!err &&
- conflict_func2 && svn_cl__notifier_check_conflicts(ctx->notify_baton2))
+ if (!err
+ && opt_state->conflict_func
+ && svn_cl__notifier_check_conflicts(ctx->notify_baton2))
{
- ctx->conflict_func2 = conflict_func2;
- ctx->conflict_baton2 = conflict_baton2;
err = svn_cl__resolve_conflicts(
svn_cl__notifier_get_conflicted_paths(ctx->notify_baton2, pool),
- opt_state->depth, ctx, pool);
+ opt_state->depth, opt_state, ctx, pool);
}
if (merge_err)
Modified: subversion/trunk/subversion/svn/resolve-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/resolve-cmd.c?rev=1357580&r1=1357579&r2=1357580&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/resolve-cmd.c (original)
+++ subversion/trunk/subversion/svn/resolve-cmd.c Thu Jul 5 12:30:25 2012
@@ -55,6 +55,8 @@ svn_cl__resolve(apr_getopt_t *os,
int i;
apr_pool_t *iterpool;
svn_boolean_t had_error = FALSE;
+ svn_wc_conflict_resolver_func2_t conflict_func2;
+ void *conflict_baton2;
switch (opt_state->accept_which)
{
@@ -77,7 +79,7 @@ svn_cl__resolve(apr_getopt_t *os,
conflict_choice = svn_wc_conflict_choose_mine_full;
break;
case svn_cl__accept_unspecified:
- if (ctx->conflict_func2 == NULL)
+ if (opt_state->conflict_func == NULL)
return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
_("missing --accept option"));
conflict_choice = svn_wc_conflict_choose_unspecified;
@@ -106,6 +108,14 @@ svn_cl__resolve(apr_getopt_t *os,
SVN_ERR(svn_cl__check_targets_are_local_paths(targets));
+ /* Store old state */
+ conflict_func2 = ctx->conflict_func2;
+ conflict_baton2 = ctx->conflict_baton2;
+
+ /* Store interactive resolver */
+ ctx->conflict_func2 = opt_state->conflict_func;
+ ctx->conflict_baton2 = opt_state->conflict_baton;
+
iterpool = svn_pool_create(scratch_pool);
for (i = 0; i < targets->nelts; i++)
{
@@ -125,6 +135,10 @@ svn_cl__resolve(apr_getopt_t *os,
}
svn_pool_destroy(iterpool);
+ /* Restore state */
+ ctx->conflict_func2 = conflict_func2;
+ ctx->conflict_baton2 = conflict_baton2;
+
if (had_error)
return svn_error_create(SVN_ERR_CL_ERROR_PROCESSING_EXTERNALS, NULL,
_("Failure occurred resolving one or more "
Modified: subversion/trunk/subversion/svn/switch-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/switch-cmd.c?rev=1357580&r1=1357579&r2=1357580&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/switch-cmd.c (original)
+++ subversion/trunk/subversion/svn/switch-cmd.c Thu Jul 5 12:30:25 2012
@@ -103,8 +103,6 @@ svn_cl__switch(apr_getopt_t *os,
svn_depth_t depth;
svn_boolean_t depth_is_sticky;
struct svn_cl__check_externals_failed_notify_baton nwb;
- svn_wc_conflict_resolver_func2_t conflict_func2 = ctx->conflict_func2;
- void *conflict_baton2 = ctx->conflict_baton2;
/* This command should discover (or derive) exactly two cmdline
arguments: a local path to update ("target"), and a new url to
@@ -161,8 +159,6 @@ svn_cl__switch(apr_getopt_t *os,
/* Postpone conflict resolution during the switch operation.
* If any conflicts occur we'll run the conflict resolver later. */
- ctx->conflict_func2 = NULL;
- ctx->conflict_baton2 = NULL;
/* Do the 'switch' update. */
err = svn_client_switch3(NULL, target, switch_url, &peg_revision,
@@ -196,14 +192,13 @@ svn_cl__switch(apr_getopt_t *os,
return svn_error_compose_create(externals_err, err);
}
- if (conflict_func2 && svn_cl__notifier_check_conflicts(nwb.wrapped_baton))
+ if (opt_state->conflict_func
+ && svn_cl__notifier_check_conflicts(nwb.wrapped_baton))
{
- ctx->conflict_func2 = conflict_func2;
- ctx->conflict_baton2 = conflict_baton2;
err = svn_cl__resolve_conflicts(
svn_cl__notifier_get_conflicted_paths(nwb.wrapped_baton,
scratch_pool),
- depth, ctx, scratch_pool);
+ depth, opt_state, ctx, scratch_pool);
if (err)
return svn_error_compose_create(externals_err, err);
}
Modified: subversion/trunk/subversion/svn/update-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/update-cmd.c?rev=1357580&r1=1357579&r2=1357580&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/update-cmd.c (original)
+++ subversion/trunk/subversion/svn/update-cmd.c Thu Jul 5 12:30:25 2012
@@ -160,8 +160,6 @@ svn_cl__update(apr_getopt_t *os,
/* Postpone conflict resolution during the update operation.
* If any conflicts occur we'll run the conflict resolver later. */
- ctx->conflict_func2 = NULL;
- ctx->conflict_baton2 = NULL;
SVN_ERR(svn_client_update4(&result_revs, targets,
&(opt_state->start_revision),
@@ -191,14 +189,15 @@ svn_cl__update(apr_getopt_t *os,
return svn_error_compose_create(externals_err, err);
}
- if (conflict_func2 && svn_cl__notifier_check_conflicts(nwb.wrapped_baton))
+ if (opt_state->conflict_func
+ && svn_cl__notifier_check_conflicts(nwb.wrapped_baton))
{
ctx->conflict_func2 = conflict_func2;
ctx->conflict_baton2 = conflict_baton2;
err = svn_cl__resolve_conflicts(
svn_cl__notifier_get_conflicted_paths(nwb.wrapped_baton,
scratch_pool),
- depth, ctx, scratch_pool);
+ depth, opt_state, ctx, scratch_pool);
if (err)
return svn_error_compose_create(externals_err, err);
}