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

Re: svn commit: r30875 - in trunk/subversion: include libsvn_wc svn

From: David Glasser <glasser_at_davidglasser.net>
Date: Wed, 30 Apr 2008 18:22:37 -0700

I did edit the log message. This commit could use some review,
specifically the choice to copy-with-translation.

--dave

On Wed, Apr 30, 2008 at 5:30 PM, <glasser_at_tigris.org> wrote:
> Author: glasser
> Date: Wed Apr 30 17:30:11 2008
> New Revision: 30875
>
> Log:
> Support mine-conflict/theirs-conflict, but not in _resolved. Real log message TBA.
>
> Modified:
> trunk/subversion/include/svn_client.h
> trunk/subversion/include/svn_wc.h
> trunk/subversion/libsvn_wc/adm_ops.c
> trunk/subversion/libsvn_wc/merge.c
> trunk/subversion/svn/conflict-callbacks.c
> trunk/subversion/svn/main.c
>
> Modified: trunk/subversion/include/svn_client.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_client.h?pathrev=30875&r1=30874&r2=30875
> ==============================================================================
> --- trunk/subversion/include/svn_client.h Wed Apr 30 16:18:26 2008 (r30874)
> +++ trunk/subversion/include/svn_client.h Wed Apr 30 17:30:11 2008 (r30875)
> @@ -2901,12 +2901,9 @@ svn_client_resolved(const char *path,
> * @c svn_wc_conflict_choose_merged, don't change the contents at all,
> * just remove the conflict status, which is the pre-1.5 behavior.
> *
> - * (@c svn_wc_conflict_choose_theirs_conflict and
> - * @c svn_wc_conflict_choose_mine_conflict are not yet implemented;
> - * the effect of passing one of those values as @a conflict_choice is
> - * currently undefined, which may or may not be an underhanded way of
> - * allowing real behaviors to be added for them later without revving
> - * this interface.)
> + * @c svn_wc_conflict_choose_theirs_conflict and @c
> + * svn_wc_conflict_choose_mine_conflict are not legal for binary
> + * files.
> *
> * If @a path is not in a state of conflict to begin with, do nothing.
> * If @a path's conflict state is removed and @a ctx->notify_func2 is non-NULL,
>
> Modified: trunk/subversion/include/svn_wc.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_wc.h?pathrev=30875&r1=30874&r2=30875
> ==============================================================================
> --- trunk/subversion/include/svn_wc.h Wed Apr 30 16:18:26 2008 (r30874)
> +++ trunk/subversion/include/svn_wc.h Wed Apr 30 17:30:11 2008 (r30875)
> @@ -1229,6 +1229,10 @@ svn_wc_create_conflict_result(svn_wc_con
> * finished, the callback signals its resolution by returning a
> * structure in @a *result. (See @c svn_wc_conflict_result_t.)
> *
> + * The values @c svn_wc_conflict_choose_mine_conflict and @c
> + * svn_wc_conflict_choose_theirs_conflict are not legal for conflicts
> + * in binary files.
> + *
> * Implementations of this callback are free to present the conflict
> * using any user interface. This may include simple contextual
> * conflicts in a file's text or properties, or more complex
> @@ -2944,12 +2948,9 @@ svn_wc_remove_from_revision_control(svn_
> * @c svn_wc_conflict_choose_merged, don't change the contents at all,
> * just remove the conflict status, which is the pre-1.5 behavior.
> *
> - * (@c svn_wc_conflict_choose_theirs_conflict and
> - * @c svn_wc_conflict_choose_mine_conflict are not yet implemented;
> - * the effect of passing one of those values as @a conflict_choice is
> - * currently undefined, which may or may not be an underhanded way of
> - * allowing real behaviors to be added for them later without revving
> - * this interface.)
> + * @c svn_wc_conflict_choose_theirs_conflict and @c
> + * svn_wc_conflict_choose_mine_conflict are not legal for binary
> + * files.
> *
> * @a adm_access is an access baton, with a write lock, for @a path.
> *
>
> Modified: trunk/subversion/libsvn_wc/adm_ops.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/adm_ops.c?pathrev=30875&r1=30874&r2=30875
> ==============================================================================
> --- trunk/subversion/libsvn_wc/adm_ops.c Wed Apr 30 16:18:26 2008 (r30874)
> +++ trunk/subversion/libsvn_wc/adm_ops.c Wed Apr 30 17:30:11 2008 (r30875)
> @@ -2657,6 +2657,7 @@ resolve_conflict_on_entry(const char *pa
> case svn_wc_conflict_choose_merged:
> auto_resolve_src = NULL;
> break;
> + /** ### TODO(glasser): support mc/tc!! */
> default:
> return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
> _("Invalid 'conflict_result' argument"));
>
> Modified: trunk/subversion/libsvn_wc/merge.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/merge.c?pathrev=30875&r1=30874&r2=30875
> ==============================================================================
> --- trunk/subversion/libsvn_wc/merge.c Wed Apr 30 16:18:26 2008 (r30874)
> +++ trunk/subversion/libsvn_wc/merge.c Wed Apr 30 17:30:11 2008 (r30875)
> @@ -283,6 +283,7 @@ svn_wc__merge_internal(svn_stringbuf_t *
> const svn_wc_entry_t *entry;
> svn_boolean_t contains_conflicts;
> const svn_prop_t *mimeprop;
> + svn_diff_file_options_t *options;
>
> /* Sanity check: the merge target must be under revision control (unless
> this is an add-with-history). */
> @@ -318,6 +319,12 @@ svn_wc__merge_internal(svn_stringbuf_t *
> adm_path, svn_io_file_del_none,
> pool));
>
> + options = svn_diff_file_options_create(pool);
> +
> + if (merge_options)
> + SVN_ERR(svn_diff_file_options_parse(options, merge_options, pool));
> +
> +
> /* Run an external merge if requested. */
> if (diff3_cmd)
> {
> @@ -338,13 +345,8 @@ svn_wc__merge_internal(svn_stringbuf_t *
> const char *left_marker;
> const char *right_marker;
> svn_stream_t *ostream;
> - svn_diff_file_options_t *options;
>
> ostream = svn_stream_from_aprfile(result_f, pool);
> - options = svn_diff_file_options_create(pool);
> -
> - if (merge_options)
> - SVN_ERR(svn_diff_file_options_parse(options, merge_options, pool));
>
> SVN_ERR(svn_diff_file_diff3_2(&diff,
> left, tmp_target, right,
> @@ -452,6 +454,48 @@ svn_wc__merge_internal(svn_stringbuf_t *
> contains_conflicts = FALSE;
> goto merge_complete;
> }
> + case svn_wc_conflict_choose_theirs_conflict:
> + case svn_wc_conflict_choose_mine_conflict:
> + {
> + apr_file_t *chosen_f;
> + const char *chosen_path;
> + svn_stream_t *chosen_stream;
> + svn_diff_t *diff;
> + svn_diff_conflict_display_style_t style =
> + result->choice == svn_wc_conflict_choose_theirs_conflict
> + ? svn_diff_conflict_display_latest
> + : svn_diff_conflict_display_modified;
> +
> + SVN_ERR(svn_wc_create_tmp_file2(&chosen_f,
> + &chosen_path,
> + adm_path,
> + svn_io_file_del_none,
> + pool));
> + chosen_stream = svn_stream_from_aprfile2(chosen_f, FALSE,
> + pool);
> + SVN_ERR(svn_diff_file_diff3_2(&diff,
> + left, tmp_target, right,
> + options, pool));
> + SVN_ERR(svn_diff_file_output_merge2(chosen_stream, diff,
> + left,
> + tmp_target,
> + right,
> + /* markers ignored */
> + NULL, NULL,
> + NULL, NULL,
> + style,
> + pool));
> + SVN_ERR(svn_stream_close(chosen_stream));
> + SVN_ERR(svn_wc__loggy_copy
> + (log_accum, NULL, adm_access,
> + /* ### XXX: translation needed here? */
> + svn_wc__copy_translate,
> + chosen_path, merge_target,
> + FALSE, pool));
> + *merge_outcome = svn_wc_merge_merged;
> + contains_conflicts = FALSE;
> + goto merge_complete;
> + }
>
> /* For the case of 3-way file merging, we don't
> really distinguish between these return values;
>
> Modified: trunk/subversion/svn/conflict-callbacks.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/svn/conflict-callbacks.c?pathrev=30875&r1=30874&r2=30875
> ==============================================================================
> --- trunk/subversion/svn/conflict-callbacks.c Wed Apr 30 16:18:26 2008 (r30874)
> +++ trunk/subversion/svn/conflict-callbacks.c Wed Apr 30 17:30:11 2008 (r30875)
> @@ -63,12 +63,10 @@ svn_cl__accept_from_word(const char *wor
> return svn_cl__accept_base;
> if (strcmp(word, SVN_CL__ACCEPT_WORKING) == 0)
> return svn_cl__accept_working;
> -#if 0 /* not yet implemented */
> if (strcmp(word, SVN_CL__ACCEPT_MINE_CONFLICT) == 0)
> return svn_cl__accept_mine_conflict;
> if (strcmp(word, SVN_CL__ACCEPT_THEIRS_CONFLICT) == 0)
> return svn_cl__accept_theirs_conflict;
> -#endif /* 0 */
> if (strcmp(word, SVN_CL__ACCEPT_MINE_FULL) == 0)
> return svn_cl__accept_mine_full;
> if (strcmp(word, SVN_CL__ACCEPT_THEIRS_FULL) == 0)
> @@ -396,9 +394,16 @@ svn_cl__conflict_handler(svn_wc_conflict
>
> prompt = apr_pstrdup(subpool, _("Select: (p) postpone"));
> if (diff_allowed)
> - prompt = apr_pstrcat(subpool, prompt,
> - _(", (df) diff-full, (e) edit"),
> - NULL);
> + {
> + prompt = apr_pstrcat(subpool, prompt,
> + _(", (df) diff-full, (e) edit"),
> + NULL);
> + if (! desc->is_binary)
> + prompt = apr_pstrcat(subpool, prompt,
> + _(", (mc) mine-conflict, "
> + "(tc) theirs-conflict"),
> + NULL);
> + }
> else
> prompt = apr_pstrcat(subpool, prompt,
> _(", (mf) mine-full, (tf) theirs-full"),
> @@ -418,13 +423,17 @@ svn_cl__conflict_handler(svn_wc_conflict
> SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
> _(" (p) postpone - mark the conflict to be "
> "resolved later\n"
> - " (df) diff-full - show all changes made to merged file\n"
> - " (e) edit - change merged file in an editor\n"
> - " (r) resolved - accept merged version of file\n"
> - " (mf) mine-full - accept my version of entire file "
> + " (df) diff-full - show all changes made to merged file\n"
> + " (e) edit - change merged file in an editor\n"
> + " (r) resolved - accept merged version of file\n"
> + " (mf) mine-full - accept my version of entire file "
> "(ignore their changes)\n"
> - " (tf) theirs-full - accept their version of entire file "
> + " (tf) theirs-full - accept their version of entire file "
> "(lose my changes)\n"
> + " (mc) mine-conflict - accept my version for conflicts"
> + "(ignore edited file)\n"
> + " (tc) theirs-conflict - accept their version for conflicts "
> + "(ignore edited file)\n"
> " (l) launch - launch external tool to "
> "resolve conflict\n"
> " (s) show all - show this list\n\n")));
> @@ -437,21 +446,29 @@ svn_cl__conflict_handler(svn_wc_conflict
> }
> else if (strcmp(answer, "mc") == 0)
> {
> - SVN_ERR(svn_cmdline_fprintf
> - (stderr, subpool,
> - _("Sorry, '(mc) mine for conflicts' "
> - "is not yet implemented; see\n"
> - "http://subversion.tigris.org/issues/show_bug.cgi?id=3049\n\n")));
> - continue;
> + if (desc->is_binary)
> + {
> + SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
> + _("Invalid option; cannot choose "
> + "based on conflicts in a "
> + "binary file.\n\n")));
> + continue;
> + }
> + (*result)->choice = svn_wc_conflict_choose_mine_conflict;
> + break;
> }
> else if (strcmp(answer, "tc") == 0)
> {
> - SVN_ERR(svn_cmdline_fprintf
> - (stderr, subpool,
> - _("Sorry, '(tc) theirs for conflicts' "
> - "is not yet implemented; see\n"
> - "http://subversion.tigris.org/issues/show_bug.cgi?id=3049\n\n")));
> - continue;
> + if (desc->is_binary)
> + {
> + SVN_ERR(svn_cmdline_fprintf(stderr, subpool,
> + _("Invalid option; cannot choose "
> + "based on conflicts in a "
> + "binary file.\n\n")));
> + continue;
> + }
> + (*result)->choice = svn_wc_conflict_choose_theirs_conflict;
> + break;
> }
> else if (strcmp(answer, "mf") == 0)
> {
>
> Modified: trunk/subversion/svn/main.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/svn/main.c?pathrev=30875&r1=30874&r2=30875
> ==============================================================================
> --- trunk/subversion/svn/main.c Wed Apr 30 16:18:26 2008 (r30874)
> +++ trunk/subversion/svn/main.c Wed Apr 30 17:30:11 2008 (r30875)
> @@ -261,10 +261,9 @@ const apr_getopt_option_t svn_cl__option
> " "
> "('" SVN_CL__ACCEPT_POSTPONE "',"
> " '" SVN_CL__ACCEPT_BASE "',"
> - /* These two are not implemented yet, so don't
> - waste the user's time with them. */
> - /* " '" SVN_CL__ACCEPT_MINE_CONFLICT "'," */
> - /* " '" SVN_CL__ACCEPT_THEIRS_CONFLICT "'," */
> + " '" SVN_CL__ACCEPT_MINE_CONFLICT "',"
> + "\n "
> + " '" SVN_CL__ACCEPT_THEIRS_CONFLICT "',"
> " '" SVN_CL__ACCEPT_MINE_FULL "',"
> " '" SVN_CL__ACCEPT_THEIRS_FULL "',"
> "\n "
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: svn-help_at_subversion.tigris.org
>
>

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-05-01 03:22:53 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.