[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: svn commit: r26920 - in trunk/subversion: include libsvn_client libsvn_subr libsvn_wc svn tests/cmdline tests/cmdline/svntest

From: Paul Burba <pburba_at_collab.net>
Date: 2007-10-04 02:59:14 CEST

> -----Original Message-----
> From: epg@tigris.org [mailto:epg@tigris.org]
> Sent: Wednesday, October 03, 2007 7:44 PM
> To: svn@subversion.tigris.org
> Subject: svn commit: r26920 - in trunk/subversion: include
> libsvn_client libsvn_subr libsvn_wc svn tests/cmdline
> tests/cmdline/svntest
>
> Author: epg
> Date: Wed Oct 3 16:44:00 2007
> New Revision: 26920
>
> Log:
> Resolve issue 2946: --accept does not match conflict handling prompt.
>
> * subversion/include/svn_client.h
> (svn_client_resolved2): Replace svn_accept_t argument with
> svn_wc_conflict_result_t.
>
> * subversion/include/svn_types.h
> (svn_accept_t, svn_accept_from_word): Remove.
>
> * subversion/include/svn_wc.h
> (svn_wc_conflict_description_t): Rename repos_file to their_file and
> user_file to my_file.
> (svn_wc_conflict_result_t): Rename
> svn_wc_conflict_result_choose_repos to
> svn_wc_conflict_result_choose_theirs and
> svn_wc_conflict_result_choose_user to
> svn_wc_conflict_result_choose_mine.
> (svn_wc_resolved_conflict3): Replace svn_accept_t argument with
> svn_wc_conflict_result_t.
>
> * subversion/libsvn_client/resolved.c
> (svn_client_resolved, svn_client_resolved2): Adapt.
>
> * subversion/libsvn_subr/kitchensink.c
> (svn_accept_from_word): Remove.
>
> * subversion/libsvn_wc/adm_crawler.c
> (restore_file): Adapt to svn_wc_resolved_conflict3 changes.
>
> * subversion/libsvn_wc/adm_ops.c
> (resolve_conflict_on_entry, struct resolve_callback_baton): Replace
> svn_accept_t argument with svn_wc_conflict_result_t.
> (resolve_found_entry_callback, svn_wc_resolved_conflict2,
> svn_wc_resolved_conflict3): Adapt.
>
> * subversion/libsvn_wc/merge.c
> (svn_wc__merge_internal): Adapt to
> svn_wc_conflict_description_t changes.
>
> * subversion/tests/cmdline/basic_tests.py
> (automatic_conflict_resolution): Adapt.
>
> * subversion/tests/cmdline/svneditor.py
> (main): Work as the merge tool as well.
>
> * subversion/tests/cmdline/svntest/main.py
> (use_editor): Also set SVN_MERGE to svneditor_script.
>
> * subversion/tests/cmdline/update_tests.py
> (update_accept_conflicts): Add test for update --accept options.
>
> * subversion/svn/cl.h
> (svn_cl__accept_t): New enumerated type, based on old
> svn_accept_t but
> with values matching the interactive callback prompt.
> (svn_cl__opt_state_t): Change accept_which to svn_cl__accept_t.
> (svn_cl__conflict_baton_t): Add type for
> svn_cl__conflict_handler baton.
> (svn_cl__conflict_baton_new, svn_cl__accept_from_word): Declare.
> (svn_cl__conflict_handler): Rename from
> svn_cl__interactive_conflict_handler.
> (svn_cl__merge_file_externally): Rename repos_path and user_path to
> their_path and my_path.
>
> * subversion/svn/conflict-callbacks.c
> (svn_cl__conflict_baton_new): Add svn_cl__conflict_baton_t
> constructor.
> (svn_cl__accept_from_word): Adapted from old svn_accept_from_word.
> (print_conflict_description): Adapt to
> svn_wc_resolved_conflict3 changes.
> (svn_cl__conflict_handler): Rename from
> svn_cl__interactive_conflict_handler.
> Resolve conflicts based on --accept option if given, else
> by prompting.
> Use function-scoped svn_error_t *err rather than
> declaring one in many
> different places.
>
> * subversion/svn/main.c
> (svn_cl__option): Adapt help text for --accept option.
> (svn_cl__cmd_table): Use specific --accept help text for
> resolved, which
> does not accept all --accept actions. Add --accept for
> checkout, merge,
> and update.
> (main): Initialize opt_state.accept_which to
> svn_cl__accept_invalid.. Setup
> ctx->conflict_func based on the intersection of the
> interactive-conflicts
> config option, --accept option, and --non-interactive option.
>
> * subversion/svn/resolved-cmd.c
> (svn_cl__resolved): Turn some --accept actions into the appropriate
> svn_wc_conflict_result_t value to pass to
> svn_client_resolved2; return
> an error for the rest.
>
> * subversion/svn/util.c
> (svn_cl__merge_file_externally): Rename repos_path and user_path to
> their_path and my_path.
>
>
> Modified:
> trunk/subversion/include/svn_client.h
> trunk/subversion/include/svn_types.h
> trunk/subversion/include/svn_wc.h
> trunk/subversion/libsvn_client/resolved.c
> trunk/subversion/libsvn_subr/kitchensink.c
> trunk/subversion/libsvn_wc/adm_crawler.c
> trunk/subversion/libsvn_wc/adm_ops.c
> trunk/subversion/libsvn_wc/merge.c
> trunk/subversion/svn/cl.h
> trunk/subversion/svn/conflict-callbacks.c
> trunk/subversion/svn/main.c
> trunk/subversion/svn/resolved-cmd.c
> trunk/subversion/svn/util.c
> trunk/subversion/tests/cmdline/basic_tests.py
> trunk/subversion/tests/cmdline/svneditor.py
> trunk/subversion/tests/cmdline/svntest/main.py
> trunk/subversion/tests/cmdline/update_tests.py

<snip>

> Modified: trunk/subversion/svn/conflict-callbacks.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/svn/conflict
> -callbacks.c?pathrev=26920&r1=26919&r2=26920
> ==============================================================
> ================
> --- trunk/subversion/svn/conflict-callbacks.c (original)
> +++ trunk/subversion/svn/conflict-callbacks.c Wed Oct 3 16:44:00 2007
> @@ -38,6 +38,42 @@
> >
>
>
> +svn_cl__conflict_baton_t *
> +svn_cl__conflict_baton_make(svn_cl__accept_t accept_which,
> + apr_hash_t *config,
> + const char *editor_cmd,
> + svn_cmdline_prompt_baton_t *pb,
> + apr_pool_t *pool)
> +{
> + svn_cl__conflict_baton_t *b = apr_palloc(pool, sizeof(*b));
> + b->accept_which = accept_which;
> + b->config = config;
> + b->editor_cmd = editor_cmd;
> + b->external_failed = FALSE;
> + b->pb = pb;
> + return b;
> +}
> +
> +svn_cl__accept_t
> +svn_cl__accept_from_word(const char *word)
> +{
> + if (strcmp(word, SVN_CL__ACCEPT_POSTPONE) == 0)
> + return svn_cl__accept_postpone;
> + if (strcmp(word, SVN_CL__ACCEPT_BASE) == 0)
> + return svn_cl__accept_base;
> + if (strcmp(word, SVN_CL__ACCEPT_MINE) == 0)
> + return svn_cl__accept_mine;
> + if (strcmp(word, SVN_CL__ACCEPT_THEIRS) == 0)
> + return svn_cl__accept_theirs;
> + if (strcmp(word, SVN_CL__ACCEPT_EDIT) == 0)
> + return svn_cl__accept_edit;
> + if (strcmp(word, SVN_CL__ACCEPT_LAUNCH) == 0)
> + return svn_cl__accept_launch;
> + /* word is an invalid action. */
> + return svn_cl__accept_invalid;
> +}
> +
> +
> /* Utility to print a full description of the conflict. */
> static svn_error_t *
> print_conflict_description(const svn_wc_conflict_description_t *desc,
> @@ -102,14 +138,14 @@
> }
>
> if (desc->base_file)
> - SVN_ERR(svn_cmdline_printf(pool, _(" Ancestor file: %s\n"),
> + SVN_ERR(svn_cmdline_printf(pool, _(" Base file: %s\n"),
> desc->base_file));
> - if (desc->repos_file)
> - SVN_ERR(svn_cmdline_printf(pool, _(" Repository's file: %s\n"),
> - desc->repos_file));
> - if (desc->user_file)
> - SVN_ERR(svn_cmdline_printf(pool, _(" User's file: %s\n"),
> - desc->user_file));
> + if (desc->their_file)
> + SVN_ERR(svn_cmdline_printf(pool, _(" Their file: %s\n"),
> + desc->their_file));
> + if (desc->my_file)
> + SVN_ERR(svn_cmdline_printf(pool, _(" My file: %s\n"),
> + desc->my_file));
> if (desc->merged_file)
> SVN_ERR(svn_cmdline_printf(pool, _(" File with conflict
> markers: %s\n"),
> desc->merged_file));
> @@ -135,15 +171,115 @@
> }
>
>
> -/* A conflict callback which does real user prompting. */
> +/* Implement svn_wc_conflict_resolver_func_t; resolves based on
> + --accept option if given, else by prompting. */
> svn_error_t *
> -svn_cl__interactive_conflict_handler(svn_wc_conflict_result_t
> *result,
> - const
> svn_wc_conflict_description_t *desc,
> - void *baton,
> - apr_pool_t *pool)
> +svn_cl__conflict_handler(svn_wc_conflict_result_t *result,
> + const svn_wc_conflict_description_t *desc,
> + void *baton,
> + apr_pool_t *pool)
> {
> - apr_pool_t *subpool = svn_pool_create(pool);
> - svn_cmdline_prompt_baton_t *pb = baton;
> + svn_cl__conflict_baton_t *b = baton;
> + svn_error_t *err;
> + apr_pool_t *subpool;
> +
> + switch (b->accept_which)
> + {
> + case svn_cl__accept_invalid:
> + /* No --accept option, fall through to prompting. */
> + break;
> + case svn_cl__accept_postpone:
> + *result = svn_wc_conflict_result_conflicted;
> + return SVN_NO_ERROR;
> + case svn_cl__accept_base:
> + *result = svn_wc_conflict_result_choose_base;
> + return SVN_NO_ERROR;
> + case svn_cl__accept_mine:
> + *result = svn_wc_conflict_result_choose_mine;
> + return SVN_NO_ERROR;
> + case svn_cl__accept_theirs:
> + *result = svn_wc_conflict_result_choose_theirs;
> + return SVN_NO_ERROR;
> + case svn_cl__accept_edit:
> + if (desc->merged_file)
> + {
> + if (b->external_failed)
> + {
> + *result = svn_wc_conflict_result_conflicted;
> + return SVN_NO_ERROR;
> + }
> +
> + err = svn_cl__edit_file_externally(desc->merged_file,
> + b->editor_cmd,
> b->config, pool);
> + if (err && (err->apr_err == SVN_ERR_CL_NO_EXTERNAL_EDITOR))
> + {
> + SVN_ERR(svn_cmdline_fprintf(stderr, pool, "%s\n",
> + err->message ?
> err->message :
> + _("No editor found,"
> + " leaving all
> conflicts.")));
> + svn_error_clear(err);
> + b->external_failed = TRUE;
> + }
> + else if (err && (err->apr_err == SVN_ERR_EXTERNAL_PROGRAM))
> + {
> + SVN_ERR(svn_cmdline_fprintf(stderr, pool, "%s\n",
> + err->message ?
> err->message :
> + _("Error running editor,"
> + " leaving all
> conflicts.")));
> + svn_error_clear(err);
> + b->external_failed = TRUE;
> + }
> + else if (err)
> + return err;
> + *result = svn_wc_conflict_result_choose_merged;
> + return SVN_NO_ERROR;
> + }
> + /* else, fall through to prompting. */
> + break;
> + case svn_cl__accept_launch:
> + if (desc->base_file && desc->their_file
> + && desc->my_file && desc->merged_file)
> + {
> + if (b->external_failed)
> + {
> + *result = svn_wc_conflict_result_conflicted;
> + return SVN_NO_ERROR;
> + }
> +
> + err = svn_cl__merge_file_externally(desc->base_file,
> + desc->their_file,
> + desc->my_file,
> + desc->merged_file,
> + b->config,
> + pool);
> + if (err && err->apr_err ==
> SVN_ERR_CL_NO_EXTERNAL_MERGE_TOOL)
> + {
> + SVN_ERR(svn_cmdline_fprintf(stderr, subpool, "%s\n",
> + err->message ?
> err->message :
> + _("No merge tool
> found.\n")));

subpool is not initialized.

> + svn_error_clear(err);
> + b->external_failed = TRUE;
> + }
> + else if (err && err->apr_err == SVN_ERR_EXTERNAL_PROGRAM)
> + {
> + SVN_ERR(svn_cmdline_fprintf(stderr, subpool, "%s\n",

Ditto.

> + err->message ?
> err->message :
> + _("Error running
> merge tool.")));
> + svn_error_clear(err);
> + b->external_failed = TRUE;
> + }
> + else if (err)
> + return err;
> + *result = svn_wc_conflict_result_choose_merged;
> + return SVN_NO_ERROR;
> + }
> + /* else, fall through to prompting. */
> + break;
> + }
> +
> + /* We're in interactive mode and either the user gave no --accept
> + option or the option did not apply; let's prompt. */
> + subpool = svn_pool_create(pool);
>
> /* Handle conflicting file contents, which is the most

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 4 03:03:24 2007

This is an archived mail posted to the Subversion Dev mailing list.