You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2016/10/14 12:47:53 UTC
svn commit: r1764883 - in /subversion/trunk/subversion: include/svn_client.h
libsvn_client/conflicts.c svn/conflict-callbacks.c
Author: ivan
Date: Fri Oct 14 12:47:52 2016
New Revision: 1764883
URL: http://svn.apache.org/viewvc?rev=1764883&view=rev
Log:
Move conflict resolution options' labels out of the client.
* subversion/include/svn_client.h:
(svn_client_conflict_option_get_label): New function.
* subversion/libsvn_client/conflicts.c:
(svn_client_conflict_option_t): Add label.
(add_resolution_option): Add label argument.
(svn_client_conflict_option_get_label): New function.
(svn_client_conflict_text_get_reslution_options,
svn_client_conflict_prop_get_resolution_options,
configure_option_accept_current_wc_state,
configure_option_move_destination,
configure_option_update_raise_moved_away_children,
configure_option_incoming_add_ignore,
configure_option_incoming_added_file_text_merge,
configure_option_incoming_added_file_replace_and_merge,
configure_option_incoming_added_dir_merge,
configure_option_incoming_added_dir_replace,
configure_option_incoming_added_dir_replace_and_merge,
configure_option_incoming_delete_ignore,
configure_option_incoming_delete_accept,
configure_option_incoming_move_file_merge,
configure_option_incoming_dir_merge,
configure_option_local_move_file_merge,
svn_client_conflict_tree_get_resolution_options): Set
resolution option labels.
* subversion/svn/conflict-callbacks.c:
(resolver_option_t): Remove short_desc and long_desc.
(client_option_t): New struct for client options.
(builtin_resolver_options): Remove short_desc and long_desc.
(extra_resolver_options,
extra_resolver_options_text,
extra_resolver_options_prop,
extra_resolver_options_tree): Convert to client_option_t.
(find_option): Accept options as apr_array_header_t.
(find_option_by_builtin): New function to create provided
options from builtin library options.
(find_option_by_id): Replaced by find_option_by_builtin.
(prompt_string,
help_string,
prompt_user,
build_text_conflict_options,
build_prop_conflict_options,
build_prop_text_conflict_options,
handle_one_prop_conflict.
build_tree_conflict_options,
handle_tree_conflict): Accept options as apr_array_header_t.
Patch by: Patrick Steinhardt <ps{_AT_}pks.im>
Modified:
subversion/trunk/subversion/include/svn_client.h
subversion/trunk/subversion/libsvn_client/conflicts.c
subversion/trunk/subversion/svn/conflict-callbacks.c
Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1764883&r1=1764882&r2=1764883&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Fri Oct 14 12:47:52 2016
@@ -4720,6 +4720,20 @@ svn_client_conflict_option_id_t
svn_client_conflict_option_get_id(svn_client_conflict_option_t *option);
/**
+ * Return a textual human-readable label of @a option, allocated in
+ * @a result_pool. The label is encoded in UTF-8 and usually
+ * contains up to three words.
+ *
+ * Additionally, the label may be localized to the language used
+ * by the current locale.
+ *
+ * @since New in 1.10.
+ */
+const char *
+svn_client_conflict_option_get_label(svn_client_conflict_option_t *option,
+ apr_pool_t *result_pool);
+
+/**
* Return a textual human-readable description of @a option, allocated in
* @a result_pool. The description is encoded in UTF-8 and may contain
* multiple lines separated by @c APR_EOL_STR.
Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1764883&r1=1764882&r2=1764883&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Fri Oct 14 12:47:52 2016
@@ -122,6 +122,7 @@ typedef svn_error_t *(*conflict_option_r
struct svn_client_conflict_option_t
{
svn_client_conflict_option_id_t id;
+ const char *label;
const char *description;
svn_client_conflict_t *conflict;
@@ -7312,6 +7313,7 @@ static svn_client_conflict_option_t *
add_resolution_option(apr_array_header_t *options,
svn_client_conflict_t *conflict,
svn_client_conflict_option_id_t id,
+ const char *label,
const char *description,
conflict_option_resolve_func_t resolve_func)
{
@@ -7320,6 +7322,7 @@ add_resolution_option(apr_array_header_t
option = apr_pcalloc(options->pool, sizeof(*option));
option->pool = options->pool;
option->id = id;
+ option->label = apr_pstrdup(option->pool, label);
option->description = apr_pstrdup(option->pool, description);
option->conflict = conflict;
option->do_resolve_func = resolve_func;
@@ -7345,6 +7348,7 @@ svn_client_conflict_text_get_resolution_
add_resolution_option(*options, conflict,
svn_client_conflict_option_postpone,
+ _("Postpone"),
_("skip this conflict and leave it unresolved"),
resolve_postpone);
@@ -7354,16 +7358,19 @@ svn_client_conflict_text_get_resolution_
/* Resolver options for a binary file conflict. */
add_resolution_option(*options, conflict,
svn_client_conflict_option_base_text,
+ _("Accept base"),
_("discard local and incoming changes for this binary file"),
resolve_text_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_incoming_text,
+ _("Accept incoming"),
_("accept incoming version of binary file"),
resolve_text_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_merged_text,
+ _("Mark as resolved"),
_("accept binary file as it appears in the working copy"),
resolve_text_conflict);
}
@@ -7372,31 +7379,37 @@ svn_client_conflict_text_get_resolution_
/* Resolver options for a text file conflict. */
add_resolution_option(*options, conflict,
svn_client_conflict_option_base_text,
+ _("Accept base"),
_("discard local and incoming changes for this file"),
resolve_text_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_incoming_text,
+ _("Accept incoming"),
_("accept incoming version of entire file"),
resolve_text_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_working_text,
+ _("Reject incoming"),
_("reject all incoming changes for this file"),
resolve_text_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_incoming_text_where_conflicted,
+ _("Accept incoming for conflicts"),
_("accept changes only where they conflict"),
resolve_text_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_working_text_where_conflicted,
+ _("Reject conflicts"),
_("reject changes which conflict and accept the rest"),
resolve_text_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_merged_text,
+ _("Mark as resolved"),
_("accept the file as it appears in the working copy"),
resolve_text_conflict);
}
@@ -7418,36 +7431,43 @@ svn_client_conflict_prop_get_resolution_
add_resolution_option(*options, conflict,
svn_client_conflict_option_postpone,
+ _("Postpone"),
_("skip this conflict and leave it unresolved"),
resolve_postpone);
add_resolution_option(*options, conflict,
svn_client_conflict_option_base_text,
+ _("Accept base"),
_("discard local and incoming changes for this property"),
resolve_prop_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_incoming_text,
+ _("Accept incoming"),
_("accept incoming version of entire property value"),
resolve_prop_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_working_text,
+ _("Mark as resolved"),
_("accept working copy version of entire property value"),
resolve_prop_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_incoming_text_where_conflicted,
- N_("accept changes only where they conflict"),
+ _("Accept incoming for conflicts"),
+ _("accept incoming changes only where they conflict"),
resolve_prop_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_working_text_where_conflicted,
+ _("Reject conflicts"),
_("reject changes which conflict and accept the rest"),
resolve_prop_conflict);
add_resolution_option(*options, conflict,
svn_client_conflict_option_merged_text,
+ _("Accept merged"),
_("accept merged version of property value"),
resolve_prop_conflict);
@@ -7486,6 +7506,7 @@ configure_option_accept_current_wc_state
add_resolution_option(options, conflict,
svn_client_conflict_option_accept_current_wc_state,
+ _("Mark as resolved"),
_("accept current working copy state"),
do_resolve_func);
@@ -7513,6 +7534,7 @@ configure_option_update_move_destination
add_resolution_option(
options, conflict,
svn_client_conflict_option_update_move_destination,
+ _("Update move destination"),
_("apply incoming changes to move destination"),
resolve_update_moved_away_node);
}
@@ -7547,6 +7569,7 @@ configure_option_update_raise_moved_away
add_resolution_option(
options, conflict,
svn_client_conflict_option_update_any_moved_away_children,
+ _("Update any moved-away children"),
_("prepare for updating moved-away children, if any"),
resolve_update_raise_moved_away);
}
@@ -7620,7 +7643,7 @@ configure_option_incoming_add_ignore(svn
operation);
add_resolution_option(
options, conflict, svn_client_conflict_option_incoming_add_ignore,
- description, resolve_incoming_add_ignore);
+ _("Ignore incoming addition"), description, resolve_incoming_add_ignore);
}
return SVN_NO_ERROR;
@@ -7674,7 +7697,8 @@ configure_option_incoming_added_file_tex
add_resolution_option(
options, conflict,
svn_client_conflict_option_incoming_added_file_text_merge,
- description, resolve_merge_incoming_added_file_text_merge);
+ _("Merge the files"), description,
+ resolve_merge_incoming_added_file_text_merge);
}
return SVN_NO_ERROR;
@@ -7730,6 +7754,7 @@ configure_option_incoming_added_file_rep
add_resolution_option(
options, conflict,
svn_client_conflict_option_incoming_added_file_replace_and_merge,
+ _("Replace and merge"),
description, resolve_merge_incoming_added_file_replace_and_merge);
}
@@ -7782,7 +7807,7 @@ configure_option_incoming_added_dir_merg
scratch_pool));
add_resolution_option(options, conflict,
svn_client_conflict_option_incoming_added_dir_merge,
- description,
+ _("Merge the directories"), description,
resolve_merge_incoming_added_dir_merge);
}
@@ -7836,8 +7861,8 @@ configure_option_incoming_added_dir_repl
add_resolution_option(
options, conflict,
svn_client_conflict_option_incoming_added_dir_replace,
- description,
- resolve_merge_incoming_added_dir_replace);
+ _("Delete my directory and replace it with incoming directory"),
+ description, resolve_merge_incoming_added_dir_replace);
}
return SVN_NO_ERROR;
@@ -7893,8 +7918,8 @@ configure_option_incoming_added_dir_repl
add_resolution_option(
options, conflict,
svn_client_conflict_option_incoming_added_dir_replace_and_merge,
- description,
- resolve_merge_incoming_added_dir_replace_and_merge);
+ _("Replace and merge"),
+ description, resolve_merge_incoming_added_dir_replace_and_merge);
}
return SVN_NO_ERROR;
@@ -7966,7 +7991,7 @@ configure_option_incoming_delete_ignore(
add_resolution_option(options, conflict,
svn_client_conflict_option_incoming_delete_ignore,
- description,
+ _("Ignore incoming deletion"), description,
resolve_incoming_delete_ignore);
}
@@ -8023,7 +8048,7 @@ configure_option_incoming_delete_accept(
add_resolution_option(
options, conflict,
svn_client_conflict_option_incoming_delete_accept,
- description,
+ _("Accept incoming deletion"), description,
resolve_incoming_delete_accept);
}
}
@@ -8198,7 +8223,7 @@ configure_option_incoming_move_file_merg
add_resolution_option(
options, conflict,
svn_client_conflict_option_incoming_move_file_text_merge,
- description,
+ _("Move and merge"), description,
resolve_incoming_move_file_text_merge);
}
@@ -8314,7 +8339,7 @@ configure_option_incoming_dir_merge(svn_
scratch_pool));
add_resolution_option(options, conflict,
svn_client_conflict_option_incoming_move_dir_merge,
- description,
+ _("Move and merge"), description,
resolve_incoming_move_dir_merge);
}
@@ -8406,6 +8431,7 @@ configure_option_local_move_file_merge(s
add_resolution_option(
options, conflict,
svn_client_conflict_option_local_move_file_text_merge,
+ _("Apply to move destination"),
description, resolve_local_move_file_merge);
}
else
@@ -8660,6 +8686,7 @@ svn_client_conflict_tree_get_resolution_
/* Add postpone option. */
add_resolution_option(*options, conflict,
svn_client_conflict_option_postpone,
+ _("Postpone"),
_("skip this conflict and leave it unresolved"),
resolve_postpone);
@@ -8751,6 +8778,13 @@ svn_client_conflict_option_get_id(svn_cl
return option->id;
}
+const char *
+svn_client_conflict_option_get_label(svn_client_conflict_option_t *option,
+ apr_pool_t *result_pool)
+{
+ return apr_pstrdup(result_pool, option->label);
+}
+
svn_error_t *
svn_client_conflict_option_describe(const char **description,
svn_client_conflict_option_t *option,
Modified: subversion/trunk/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/conflict-callbacks.c?rev=1764883&r1=1764882&r2=1764883&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/conflict-callbacks.c (original)
+++ subversion/trunk/subversion/svn/conflict-callbacks.c Fri Oct 14 12:47:52 2016
@@ -374,83 +374,74 @@ edit_prop_conflict(const svn_string_t **
typedef struct resolver_option_t
{
const char *code; /* one or two characters */
- const char *short_desc; /* label in prompt (localized) */
- const char *long_desc; /* longer description (localized) */
svn_client_conflict_option_id_t choice;
/* or ..._undefined if not from libsvn_client */
const char *accept_arg; /* --accept option argument (NOT localized) */
} resolver_option_t;
+typedef struct client_option_t
+{
+ const char *code; /* one or two characters */
+ const char *label; /* label in prompt (localized) */
+ const char *long_desc; /* longer description (localized) */
+ svn_client_conflict_option_id_t choice;
+ /* or ..._undefined if not from libsvn_client */
+ const char *accept_arg; /* --accept option argument (NOT localized) */
+} client_option_t;
+
/* Resolver options for conflict options offered by libsvn_client. */
static const resolver_option_t builtin_resolver_options[] =
{
- { "r", NULL, NULL,
- svn_client_conflict_option_merged_text,
- SVN_CL__ACCEPT_WORKING },
- { "mc", NULL, NULL,
- svn_client_conflict_option_working_text_where_conflicted,
- SVN_CL__ACCEPT_MINE_CONFLICT },
- { "tc", NULL, NULL,
- svn_client_conflict_option_incoming_text_where_conflicted,
- SVN_CL__ACCEPT_THEIRS_CONFLICT },
- { "mf", NULL, NULL,
- svn_client_conflict_option_working_text,
- SVN_CL__ACCEPT_MINE_FULL},
- { "tf", NULL, NULL,
- svn_client_conflict_option_incoming_text,
- SVN_CL__ACCEPT_THEIRS_FULL },
- { "p", N_("postpone"), NULL,
- svn_client_conflict_option_postpone,
- SVN_CL__ACCEPT_POSTPONE },
+ { "r", svn_client_conflict_option_merged_text,
+ SVN_CL__ACCEPT_WORKING },
+ { "mc", svn_client_conflict_option_working_text_where_conflicted,
+ SVN_CL__ACCEPT_MINE_CONFLICT },
+ { "tc", svn_client_conflict_option_incoming_text_where_conflicted,
+ SVN_CL__ACCEPT_THEIRS_CONFLICT },
+ { "mf", svn_client_conflict_option_working_text,
+ SVN_CL__ACCEPT_MINE_FULL},
+ { "tf", svn_client_conflict_option_incoming_text,
+ SVN_CL__ACCEPT_THEIRS_FULL },
+ { "p", svn_client_conflict_option_postpone,
+ SVN_CL__ACCEPT_POSTPONE },
/* This option resolves a tree conflict to the current working copy state. */
- { "r", NULL, NULL,
- svn_client_conflict_option_accept_current_wc_state,
- SVN_CL__ACCEPT_WORKING },
+ { "r", svn_client_conflict_option_accept_current_wc_state,
+ SVN_CL__ACCEPT_WORKING },
/* These options use the same code since they only occur in
* distinct conflict scenarios. */
- { "u", N_("update move destination"), NULL,
- svn_client_conflict_option_update_move_destination },
- { "u", N_("update any moved-away children"), NULL,
- svn_client_conflict_option_update_any_moved_away_children },
+ { "u", svn_client_conflict_option_update_move_destination },
+ { "u", svn_client_conflict_option_update_any_moved_away_children },
/* Options for incoming add vs local add. */
- { "i", N_("ignore incoming addition"), NULL,
- svn_client_conflict_option_incoming_add_ignore },
+ { "i", svn_client_conflict_option_incoming_add_ignore },
/* Options for incoming file add vs local file add upon merge. */
- { "m", N_("merge the files"), NULL,
- svn_client_conflict_option_incoming_added_file_text_merge },
- { "M", N_("replace my file with incoming file and merge the files"), NULL,
- svn_client_conflict_option_incoming_added_file_replace_and_merge },
+ { "m", svn_client_conflict_option_incoming_added_file_text_merge },
+ { "M", svn_client_conflict_option_incoming_added_file_replace_and_merge },
/* Options for incoming dir add vs local dir add upon merge. */
- { "m", N_("merge the directories"), NULL,
- svn_client_conflict_option_incoming_added_dir_merge },
- { "R", N_("delete my directory and replace it with incoming directory"), NULL,
- svn_client_conflict_option_incoming_added_dir_replace },
- { "M", N_("replace my directory with incoming directory and merge"), NULL,
- svn_client_conflict_option_incoming_added_dir_replace_and_merge },
+ { "m", svn_client_conflict_option_incoming_added_dir_merge },
+ { "R", svn_client_conflict_option_incoming_added_dir_replace },
+ { "M", svn_client_conflict_option_incoming_added_dir_replace_and_merge },
/* Options for incoming delete vs any. */
- { "i", N_("ignore incoming deletion"), NULL,
- svn_client_conflict_option_incoming_delete_ignore },
- { "a", N_("accept incoming deletion"), NULL,
- svn_client_conflict_option_incoming_delete_accept },
+ { "i", svn_client_conflict_option_incoming_delete_ignore },
+ { "a", svn_client_conflict_option_incoming_delete_accept },
/* Options for incoming move vs local edit. */
- { "m", NULL, NULL, svn_client_conflict_option_incoming_move_file_text_merge },
- { "m", NULL, NULL, svn_client_conflict_option_incoming_move_dir_merge },
+ { "m", svn_client_conflict_option_incoming_move_file_text_merge },
+ { "m", svn_client_conflict_option_incoming_move_dir_merge },
/* Options for local move vs incoming edit. */
- { "m", NULL, NULL, svn_client_conflict_option_local_move_file_text_merge },
+ { "m", svn_client_conflict_option_local_move_file_text_merge },
{ NULL }
};
/* Extra resolver options offered by 'svn' for any conflict. */
-static const resolver_option_t extra_resolver_options[] =
+static const client_option_t extra_resolver_options[] =
{
/* Translators: keep long_desc below 70 characters (wrap with a left
margin of 9 spaces if needed) */
@@ -461,7 +452,7 @@ static const resolver_option_t extra_res
/* Additional resolver options offered by 'svn' for a text conflict. */
-static const resolver_option_t extra_resolver_options_text[] =
+static const client_option_t extra_resolver_options_text[] =
{
/* Translators: keep long_desc below 70 characters (wrap with a left
margin of 9 spaces if needed) */
@@ -488,7 +479,7 @@ static const resolver_option_t extra_res
};
/* Additional resolver options offered by 'svn' for a property conflict. */
-static const resolver_option_t extra_resolver_options_prop[] =
+static const client_option_t extra_resolver_options_prop[] =
{
/* Translators: keep long_desc below 70 characters (wrap with a left
margin of 9 spaces if needed) */
@@ -504,7 +495,7 @@ static const resolver_option_t extra_res
};
/* Additional resolver options offered by 'svn' for a tree conflict. */
-static const resolver_option_t extra_resolver_options_tree[] =
+static const client_option_t extra_resolver_options_tree[] =
{
/* Translators: keep long_desc below 70 characters (wrap with a left
margin of 9 spaces if needed) */
@@ -525,14 +516,16 @@ static const resolver_option_t extra_res
/* Return a pointer to the option description in OPTIONS matching the
* one- or two-character OPTION_CODE. Return NULL if not found. */
-static const resolver_option_t *
-find_option(const resolver_option_t *options,
+static const client_option_t *
+find_option(const apr_array_header_t *options,
const char *option_code)
{
- const resolver_option_t *opt;
+ int i;
- for (opt = options; opt->code; opt++)
+ for (i = 0; i < options->nelts; i++)
{
+ const client_option_t *opt = APR_ARRAY_IDX(options, i, client_option_t *);
+
/* Ignore code "" (blank lines) which is not a valid answer. */
if (opt->code[0] && strcmp(opt->code, option_code) == 0)
return opt;
@@ -541,25 +534,53 @@ find_option(const resolver_option_t *opt
}
/* Return a pointer to the option description in OPTIONS matching the
- * conflict option ID CHOICE. Return NULL if not found. */
-static const resolver_option_t *
-find_option_by_id(const resolver_option_t *options,
- svn_client_conflict_option_id_t choice)
+ * conflict option ID CHOICE. @a out will be set to NULL if the
+ * option was not found. */
+static svn_error_t *
+find_option_by_builtin(client_option_t **out,
+ const resolver_option_t *options,
+ svn_client_conflict_option_t *builtin_option,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
const resolver_option_t *opt;
+ svn_client_conflict_option_id_t id;
+
+ id = svn_client_conflict_option_get_id(builtin_option);
for (opt = options; opt->code; opt++)
{
- if (opt->choice == choice)
- return opt;
+ if (opt->choice == id)
+ {
+ client_option_t *client_opt;
+
+ client_opt = apr_pcalloc(result_pool, sizeof(*client_opt));
+ client_opt->choice = id;
+ client_opt->code = opt->code;
+ client_opt->label = svn_client_conflict_option_get_label(
+ builtin_option,
+ result_pool);
+ SVN_ERR(svn_client_conflict_option_describe(&client_opt->long_desc,
+ builtin_option,
+ result_pool,
+ scratch_pool));
+ client_opt->accept_arg = opt->accept_arg;
+
+ *out = client_opt;
+
+ return SVN_NO_ERROR;
+ }
}
- return NULL;
+
+ *out = NULL;
+
+ return SVN_NO_ERROR;
}
/* Return a prompt string listing the options OPTIONS. If OPTION_CODES is
* non-null, select only the options whose codes are mentioned in it. */
static const char *
-prompt_string(const resolver_option_t *options,
+prompt_string(const apr_array_header_t *options,
const char *const *option_codes,
apr_pool_t *pool)
{
@@ -568,10 +589,11 @@ prompt_string(const resolver_option_t *o
const char *line_sep = apr_psprintf(pool, "\n%*s", left_margin, "");
int this_line_len = left_margin;
svn_boolean_t first = TRUE;
+ int i = 0;
while (1)
{
- const resolver_option_t *opt;
+ const client_option_t *opt;
const char *s;
int slen;
@@ -585,15 +607,16 @@ prompt_string(const resolver_option_t *o
}
else
{
- opt = options++;
- if (! opt->code)
+ if (i >= options->nelts)
break;
+ opt = APR_ARRAY_IDX(options, i, client_option_t *);
+ i++;
}
if (! first)
result = apr_pstrcat(pool, result, ",", SVN_VA_NULL);
s = apr_psprintf(pool, " (%s) %s", opt->code,
- opt->short_desc ? _(opt->short_desc) : opt->long_desc);
+ opt->label ? opt->label : opt->long_desc);
slen = svn_utf_cstring_utf8_width(s);
/* Break the line if adding the next option would make it too long */
if (this_line_len + slen > MAX_PROMPT_WIDTH)
@@ -611,18 +634,22 @@ prompt_string(const resolver_option_t *o
/* Return a help string listing the OPTIONS. */
static svn_error_t *
help_string(const char **result,
- const resolver_option_t *options,
+ const apr_array_header_t *options,
apr_pool_t *pool)
{
- const resolver_option_t *opt;
apr_pool_t *iterpool;
+ int i;
*result = "";
iterpool = svn_pool_create(pool);
- for (opt = options; opt->code; opt++)
+ for (i = 0; i < options->nelts; i++)
{
+ const client_option_t *opt;
svn_pool_clear(iterpool);
+ opt = APR_ARRAY_IDX(options, i,
+ client_option_t *);
+
/* Append a line describing OPT, or a blank line if its code is "". */
if (opt->code[0])
{
@@ -659,8 +686,8 @@ help_string(const char **result,
* *OPT == NULL.
*/
static svn_error_t *
-prompt_user(const resolver_option_t **opt,
- const resolver_option_t *conflict_options,
+prompt_user(const client_option_t **opt,
+ const apr_array_header_t *conflict_options,
const char *const *options_to_show,
const char *conflict_description,
void *prompt_baton,
@@ -696,15 +723,14 @@ prompt_user(const resolver_option_t **op
/* Set *OPTIONS to an array of resolution options for CONFLICT. */
static svn_error_t *
-build_text_conflict_options(resolver_option_t **options,
+build_text_conflict_options(apr_array_header_t **options,
svn_client_conflict_t *conflict,
svn_client_ctx_t *ctx,
svn_boolean_t is_binary,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- resolver_option_t *opt;
- const resolver_option_t *o;
+ const client_option_t *o;
apr_array_header_t *builtin_options;
apr_size_t nopt;
int i;
@@ -717,41 +743,34 @@ build_text_conflict_options(resolver_opt
nopt = builtin_options->nelts + ARRAY_LEN(extra_resolver_options);
if (!is_binary)
nopt += ARRAY_LEN(extra_resolver_options_text);
- *options = apr_pcalloc(result_pool, sizeof(*opt) * (nopt + 1));
+ *options = apr_array_make(result_pool, nopt, sizeof(client_option_t *));
- opt = *options;
iterpool = svn_pool_create(scratch_pool);
for (i = 0; i < builtin_options->nelts; i++)
{
+ client_option_t *opt;
svn_client_conflict_option_t *builtin_option;
- svn_client_conflict_option_id_t id;
- const resolver_option_t *known_option;
svn_pool_clear(iterpool);
builtin_option = APR_ARRAY_IDX(builtin_options, i,
svn_client_conflict_option_t *);
- id = svn_client_conflict_option_get_id(builtin_option);
- known_option = find_option_by_id(builtin_resolver_options, id);
- if (known_option == NULL)
+ SVN_ERR(find_option_by_builtin(&opt,
+ builtin_resolver_options,
+ builtin_option,
+ result_pool,
+ iterpool));
+ if (opt == NULL)
continue; /* ### unknown option -- assign a code dynamically? */
- opt->code = known_option->code;
- opt->short_desc = known_option->short_desc;
- SVN_ERR(svn_client_conflict_option_describe(&opt->long_desc,
- builtin_option,
- result_pool,
- iterpool));
- opt->choice = id;
- opt->accept_arg = known_option->accept_arg;
- opt++;
+ APR_ARRAY_PUSH(*options, client_option_t *) = opt;
}
for (o = extra_resolver_options; o->code; o++)
- *opt++ = *o;
+ APR_ARRAY_PUSH(*options, const client_option_t *) = o;
if (!is_binary)
{
for (o = extra_resolver_options_text; o->code; o++)
- *opt++ = *o;
+ APR_ARRAY_PUSH(*options, const client_option_t *) = o;
}
svn_pool_destroy(iterpool);
@@ -843,7 +862,7 @@ handle_text_conflict(svn_boolean_t *reso
const char *my_abspath;
const char *their_abspath;
const char *merged_abspath = svn_client_conflict_get_local_abspath(conflict);
- resolver_option_t *text_conflict_options;
+ apr_array_header_t *text_conflict_options;
svn_client_conflict_option_id_t option_id;
option_id = svn_client_conflict_option_unspecified;
@@ -890,8 +909,7 @@ handle_text_conflict(svn_boolean_t *reso
{
const char *suggested_options[9]; /* filled statically below */
const char **next_option = suggested_options;
- const resolver_option_t *opt;
-
+ const client_option_t *opt;
svn_pool_clear(iterpool);
@@ -1168,14 +1186,13 @@ handle_text_conflict(svn_boolean_t *reso
/* Set *OPTIONS to an array of resolution options for CONFLICT. */
static svn_error_t *
-build_prop_conflict_options(resolver_option_t **options,
+build_prop_conflict_options(apr_array_header_t **options,
svn_client_conflict_t *conflict,
svn_client_ctx_t *ctx,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- resolver_option_t *opt;
- const resolver_option_t *o;
+ const client_option_t *o;
apr_array_header_t *builtin_options;
apr_size_t nopt;
int i;
@@ -1187,42 +1204,34 @@ build_prop_conflict_options(resolver_opt
scratch_pool));
nopt = builtin_options->nelts + ARRAY_LEN(extra_resolver_options) +
ARRAY_LEN(extra_resolver_options_prop);
- *options = apr_pcalloc(result_pool, sizeof(*opt) * (nopt + 1));
+ *options = apr_array_make(result_pool, nopt, sizeof(client_option_t *));
- opt = *options;
iterpool = svn_pool_create(scratch_pool);
for (i = 0; i < builtin_options->nelts; i++)
{
+ client_option_t *opt;
svn_client_conflict_option_t *builtin_option;
- svn_client_conflict_option_id_t id;
- const resolver_option_t *known_option;
svn_pool_clear(iterpool);
builtin_option = APR_ARRAY_IDX(builtin_options, i,
svn_client_conflict_option_t *);
- id = svn_client_conflict_option_get_id(builtin_option);
- known_option = find_option_by_id(builtin_resolver_options, id);
- if (known_option == NULL)
+ SVN_ERR(find_option_by_builtin(&opt,
+ builtin_resolver_options,
+ builtin_option,
+ result_pool,
+ iterpool));
+ if (opt == NULL)
continue; /* ### unknown option -- assign a code dynamically? */
- opt->code = known_option->code;
- opt->short_desc = known_option->short_desc;
- SVN_ERR(svn_client_conflict_option_describe(&opt->long_desc,
- builtin_option,
- result_pool,
- iterpool));
- opt->choice = id;
- opt->accept_arg = known_option->accept_arg;
-
- opt++;
+ APR_ARRAY_PUSH(*options, client_option_t *) = opt;
}
svn_pool_destroy(iterpool);
for (o = extra_resolver_options; o->code; o++)
- *opt++ = *o;
+ APR_ARRAY_PUSH(*options, const client_option_t *) = o;
for (o = extra_resolver_options_prop; o->code; o++)
- *opt++ = *o;
+ APR_ARRAY_PUSH(*options, const client_option_t *) = o;
return SVN_NO_ERROR;
}
@@ -1251,7 +1260,7 @@ handle_one_prop_conflict(svn_client_conf
const svn_string_t *my_propval;
const svn_string_t *their_propval;
apr_array_header_t *resolution_options;
- resolver_option_t *prop_conflict_options;
+ apr_array_header_t *prop_conflict_options;
SVN_ERR(svn_client_conflict_prop_get_propvals(NULL, &my_propval,
&base_propval, &their_propval,
@@ -1279,7 +1288,7 @@ handle_one_prop_conflict(svn_client_conf
iterpool = svn_pool_create(scratch_pool);
while (TRUE)
{
- const resolver_option_t *opt;
+ const client_option_t *opt;
const char *suggested_options[9]; /* filled statically below */
const char **next_option = suggested_options;
@@ -1426,7 +1435,7 @@ handle_prop_conflicts(svn_boolean_t *res
/* Set *OPTIONS to an array of resolution options for CONFLICT. */
static svn_error_t *
build_tree_conflict_options(
- resolver_option_t **options,
+ apr_array_header_t **options,
apr_array_header_t **possible_moved_to_repos_relpaths,
apr_array_header_t **possible_moved_to_abspaths,
svn_client_conflict_t *conflict,
@@ -1434,8 +1443,7 @@ build_tree_conflict_options(
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- resolver_option_t *opt;
- const resolver_option_t *o;
+ const client_option_t *o;
apr_array_header_t *builtin_options;
apr_size_t nopt;
int i;
@@ -1447,36 +1455,31 @@ build_tree_conflict_options(
scratch_pool));
nopt = builtin_options->nelts + ARRAY_LEN(extra_resolver_options_tree) +
ARRAY_LEN(extra_resolver_options);
- *options = apr_pcalloc(result_pool, sizeof(*opt) * (nopt + 1));
+ *options = apr_array_make(result_pool, nopt, sizeof(client_option_t *));
*possible_moved_to_abspaths = NULL;
*possible_moved_to_repos_relpaths = NULL;
- opt = *options;
iterpool = svn_pool_create(scratch_pool);
for (i = 0; i < builtin_options->nelts; i++)
{
+ client_option_t *opt;
svn_client_conflict_option_t *builtin_option;
svn_client_conflict_option_id_t id;
- const resolver_option_t *known_option;
svn_pool_clear(iterpool);
builtin_option = APR_ARRAY_IDX(builtin_options, i,
svn_client_conflict_option_t *);
- id = svn_client_conflict_option_get_id(builtin_option);
- known_option = find_option_by_id(builtin_resolver_options, id);
- if (known_option == NULL)
+ SVN_ERR(find_option_by_builtin(&opt,
+ builtin_resolver_options,
+ builtin_option,
+ result_pool,
+ iterpool));
+ if (opt == NULL)
continue; /* ### unknown option -- assign a code dynamically? */
- opt->code = known_option->code;
- opt->short_desc = known_option->short_desc;
- SVN_ERR(svn_client_conflict_option_describe(&opt->long_desc,
- builtin_option,
- result_pool,
- iterpool));
- opt->choice = id;
- opt->accept_arg = known_option->accept_arg;
+ APR_ARRAY_PUSH(*options, client_option_t *) = opt;
- opt++;
+ id = svn_client_conflict_option_get_id(builtin_option);
if (id == svn_client_conflict_option_incoming_move_file_text_merge ||
id == svn_client_conflict_option_incoming_move_dir_merge)
@@ -1506,10 +1509,10 @@ build_tree_conflict_options(
(*possible_moved_to_abspaths)->nelts <= 1))
continue;
- *opt++ = *o;
+ APR_ARRAY_PUSH(*options, const client_option_t *) = o;
}
for (o = extra_resolver_options; o->code; o++)
- *opt++ = *o;
+ APR_ARRAY_PUSH(*options, const client_option_t *) = o;
return SVN_NO_ERROR;
}
@@ -1634,7 +1637,7 @@ handle_tree_conflict(svn_boolean_t *reso
apr_pool_t *scratch_pool)
{
apr_pool_t *iterpool;
- resolver_option_t *tree_conflict_options;
+ apr_array_header_t *tree_conflict_options;
svn_client_conflict_option_id_t option_id;
const char *local_abspath;
const char *conflict_description;
@@ -1670,7 +1673,7 @@ handle_tree_conflict(svn_boolean_t *reso
iterpool = svn_pool_create(scratch_pool);
while (1)
{
- const resolver_option_t *opt;
+ const client_option_t *opt;
svn_pool_clear(iterpool);