Hi, here's the second version of the conflict option label patch. Changes:
- reworded some labels
- now using apr_array to pass around options
- renamed and simplified svn_client_resolver_option_label
The functionality has been lightly tested by creating conflict
scenarios.
[[
Move conflict resolution options' labels out of the client
* subversion/include/svn_client.h:
- new function `svn_client_conflict_option_get_label`
* subversion/libsvn_client/conflicts.c:
- svn_client_conflict_option_t: add label
- add_resolution_option: add label argument
- implement function `svn_client_conflict_option_get_label`
- (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,
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: 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
]]
Regards
--
Patrick Steinhardt, Entwickler
elego Software Solutions GmbH, http://www.elego.de
Gebäude 12 (BIG), Gustav-Meyer-Allee 25, 13355 Berlin, Germany
Sitz der Gesellschaft: Berlin, USt-IdNr.: DE 163214194
Handelsregister: Amtsgericht Charlottenburg HRB 77719
Geschäftsführer: Olaf Wagner
diff --git a/subversion/include/svn_client.h b/subversion/include/svn_client.h
index 9bbe62b..8dc121c 100644
--- a/subversion/include/svn_client.h
+++ b/subversion/include/svn_client.h
@@ -4718,6 +4718,19 @@ 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);
+
+/**
* 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.
diff --git a/subversion/libsvn_client/conflicts.c
b/subversion/libsvn_client/conflicts.c
index d06ccb2..2e97cbd 100644
--- a/subversion/libsvn_client/conflicts.c
+++ b/subversion/libsvn_client/conflicts.c
@@ -122,6 +122,7 @@ typedef svn_error_t *(*conflict_option_resolve_func_t)(
struct svn_client_conflict_option_t
{
svn_client_conflict_option_id_t id;
+ const char *label;
const char *description;
svn_client_conflict_t *conflict;
@@ -7063,6 +7064,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)
{
@@ -7071,6 +7073,7 @@ add_resolution_option(apr_array_header_t *options,
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;
@@ -7096,6 +7099,7 @@
svn_client_conflict_text_get_resolution_options(apr_array_header_t **options,
add_resolution_option(*options, conflict,
svn_client_conflict_option_postpone,
+ _("Postpone"),
_("skip this conflict and leave it unresolved"),
resolve_postpone);
@@ -7105,16 +7109,19 @@
svn_client_conflict_text_get_resolution_options(apr_array_header_t **options,
/* 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);
}
@@ -7123,31 +7130,37 @@
svn_client_conflict_text_get_resolution_options(apr_array_header_t **options,
/* 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);
}
@@ -7169,36 +7182,43 @@
svn_client_conflict_prop_get_resolution_options(apr_array_header_t **options,
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);
@@ -7237,6 +7257,7 @@
configure_option_accept_current_wc_state(svn_client_conflict_t *conflict,
add_resolution_option(options, conflict,
svn_client_conflict_option_accept_current_wc_state,
+ _("Mark as resolved"),
_("accept current working copy state"),
do_resolve_func);
@@ -7264,6 +7285,7 @@
configure_option_update_move_destination(svn_client_conflict_t *conflict,
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);
}
@@ -7298,6 +7320,7 @@ configure_option_update_raise_moved_away_children(
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);
}
@@ -7371,7 +7394,7 @@
configure_option_incoming_add_ignore(svn_client_conflict_t *conflict,
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;
@@ -7425,7 +7448,8 @@
configure_option_incoming_added_file_text_merge(svn_client_conflict_t *conflict,
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;
@@ -7481,6 +7505,7 @@ configure_option_incoming_added_file_replace_and_merge(
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);
}
@@ -7533,7 +7558,7 @@
configure_option_incoming_added_dir_merge(svn_client_conflict_t *conflict,
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);
}
@@ -7587,8 +7612,8 @@
configure_option_incoming_added_dir_replace(svn_client_conflict_t *conflict,
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;
@@ -7644,8 +7669,8 @@ configure_option_incoming_added_dir_replace_and_merge(
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;
@@ -7717,7 +7742,7 @@
configure_option_incoming_delete_ignore(svn_client_conflict_t *conflict,
add_resolution_option(options, conflict,
svn_client_conflict_option_incoming_delete_ignore,
- description,
+ _("Ignore incoming deletion"), description,
resolve_incoming_delete_ignore);
}
@@ -7774,7 +7799,7 @@
configure_option_incoming_delete_accept(svn_client_conflict_t *conflict,
add_resolution_option(
options, conflict,
svn_client_conflict_option_incoming_delete_accept,
- description,
+ _("Accept incoming deletion"), description,
resolve_incoming_delete_accept);
}
}
@@ -7949,7 +7974,7 @@
configure_option_incoming_move_file_merge(svn_client_conflict_t *conflict,
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);
}
@@ -8065,7 +8090,7 @@ configure_option_incoming_dir_merge(svn_client_conflict_t
*conflict,
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);
}
@@ -8316,6 +8341,7 @@
svn_client_conflict_tree_get_resolution_options(apr_array_header_t **options,
/* Add postpone option. */
add_resolution_option(*options, conflict,
svn_client_conflict_option_postpone,
+ _("Postpone"),
_("skip this conflict and leave it unresolved"),
resolve_postpone);
@@ -8405,6 +8431,12 @@
svn_client_conflict_option_get_id(svn_client_conflict_option_t *option)
return option->id;
}
+const char *
+svn_client_conflict_option_get_label(svn_client_conflict_option_t *option)
+{
+ return option->label;
+}
+
svn_error_t *
svn_client_conflict_option_describe(const char **description,
svn_client_conflict_option_t *option,
diff --git a/subversion/svn/conflict-callbacks.c
b/subversion/svn/conflict-callbacks.c
index 478a0ff..fd31bcb 100644
--- a/subversion/svn/conflict-callbacks.c
+++ b/subversion/svn/conflict-callbacks.c
@@ -374,80 +374,71 @@ edit_prop_conflict(const svn_string_t **merged_propval,
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 },
{ 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) */
@@ -458,7 +449,7 @@ static const resolver_option_t extra_resolver_options[] =
/* 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) */
@@ -485,7 +476,7 @@ static const resolver_option_t
extra_resolver_options_text[] =
};
/* 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) */
@@ -501,7 +492,7 @@ static const resolver_option_t
extra_resolver_options_prop[] =
};
/* 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) */
@@ -522,14 +513,16 @@ static const resolver_option_t
extra_resolver_options_tree[] =
/* 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;
@@ -538,25 +531,52 @@ find_option(const resolver_option_t *options,
}
/* 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);
+ 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)
{
@@ -565,10 +585,11 @@ prompt_string(const resolver_option_t *options,
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;
@@ -582,15 +603,16 @@ prompt_string(const resolver_option_t *options,
}
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)
@@ -608,18 +630,22 @@ prompt_string(const resolver_option_t *options,
/* 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])
{
@@ -656,8 +682,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,
@@ -693,15 +719,14 @@ prompt_user(const resolver_option_t **opt,
/* 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;
@@ -714,41 +739,34 @@ build_text_conflict_options(resolver_option_t **options,
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);
@@ -840,7 +858,7 @@ handle_text_conflict(svn_boolean_t *resolved,
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;
@@ -887,8 +905,7 @@ handle_text_conflict(svn_boolean_t *resolved,
{
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);
@@ -1165,14 +1182,13 @@ handle_text_conflict(svn_boolean_t *resolved,
/* 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;
@@ -1184,42 +1200,34 @@ build_prop_conflict_options(resolver_option_t **options,
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;
}
@@ -1248,7 +1256,7 @@ handle_one_prop_conflict(svn_client_conflict_option_t
**option,
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,
@@ -1276,7 +1284,7 @@ handle_one_prop_conflict(svn_client_conflict_option_t
**option,
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;
@@ -1423,7 +1431,7 @@ handle_prop_conflicts(svn_boolean_t *resolved,
/* 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,
@@ -1431,8 +1439,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;
@@ -1444,36 +1451,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)
@@ -1503,10 +1505,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;
}
@@ -1631,7 +1633,7 @@ handle_tree_conflict(svn_boolean_t *resolved,
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;
@@ -1667,7 +1669,7 @@ handle_tree_conflict(svn_boolean_t *resolved,
iterpool = svn_pool_create(scratch_pool);
while (1)
{
- const resolver_option_t *opt;
+ const client_option_t *opt;
svn_pool_clear(iterpool);
signature.asc
Description: PGP signature

