You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2015/09/18 03:38:50 UTC
svn commit: r1703735 [6/8] - in /subversion/branches/patch-exec: ./ build/
build/ac-macros/ build/generator/ build/generator/templates/
contrib/hook-scripts/ notes/ subversion/ subversion/bindings/swig/include/
subversion/include/ subversion/include/pr...
Modified: subversion/branches/patch-exec/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svn/conflict-callbacks.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svn/conflict-callbacks.c (original)
+++ subversion/branches/patch-exec/subversion/svn/conflict-callbacks.c Fri Sep 18 01:38:47 2015
@@ -40,6 +40,7 @@
#include "cl-conflicts.h"
#include "private/svn_cmdline_private.h"
+#include "private/svn_wc_private.h"
#include "svn_private_config.h"
@@ -397,15 +398,13 @@ edit_prop_conflict(const svn_string_t **
SVN_ERR(svn_stream_close(merged_prop));
SVN_ERR(svn_io_file_flush(file, scratch_pool));
SVN_ERR(open_editor(&performed_edit, file_path, b, scratch_pool));
- if (performed_edit)
+ if (performed_edit && merged_propval)
{
svn_stringbuf_t *buf;
SVN_ERR(svn_stringbuf_from_file2(&buf, file_path, scratch_pool));
*merged_propval = svn_string_create_from_buf(buf, result_pool);
}
- else
- *merged_propval = NULL;
return SVN_NO_ERROR;
}
@@ -419,7 +418,7 @@ 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_wc_conflict_choice_t choice;
+ svn_client_conflict_option_id_t choice;
/* or ..._undefined if not a simple choice */
} resolver_option_t;
@@ -432,45 +431,45 @@ static const resolver_option_t text_conf
brackets. */
{ "e", N_("edit file"), N_("change merged file in an editor"
" [edit]"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ "df", N_("show diff"), N_("show all changes made to merged file"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ "r", N_("mark resolved"), N_("accept merged version of file [working]"),
- svn_wc_conflict_choose_merged },
- { "", "", "", svn_wc_conflict_choose_unspecified },
+ svn_client_conflict_option_merged_text },
+ { "", "", "", svn_client_conflict_option_unspecified },
{ "dc", N_("display conflict"), N_("show all conflicts "
"(ignoring merged version)"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ "mc", N_("my side of conflict"), N_("accept my version for all conflicts "
"(same) [mine-conflict]"),
- svn_wc_conflict_choose_mine_conflict },
+ svn_client_conflict_option_working_text_where_conflicted },
{ "tc", N_("their side of conflict"), N_("accept their version for all "
"conflicts (same)"
" [theirs-conflict]"),
- svn_wc_conflict_choose_theirs_conflict },
- { "", "", "", svn_wc_conflict_choose_unspecified },
+ svn_client_conflict_option_incoming_text_where_conflicted },
+ { "", "", "", svn_client_conflict_option_unspecified },
{ "mf", N_("my version"), N_("accept my version of entire file (even "
"non-conflicts) [mine-full]"),
- svn_wc_conflict_choose_mine_full },
+ svn_client_conflict_option_working_text },
{ "tf", N_("their version"), N_("accept their version of entire file "
"(same) [theirs-full]"),
- svn_wc_conflict_choose_theirs_full },
- { "", "", "", svn_wc_conflict_choose_unspecified },
+ svn_client_conflict_option_incoming_text },
+ { "", "", "", svn_client_conflict_option_unspecified },
{ "m", N_("merge"), N_("use merge tool to resolve conflict"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ "l", N_("launch tool"), N_("launch external merge tool to resolve "
"conflict [launch]"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ "i", N_("internal merge tool"), N_("use built-in merge tool to "
"resolve conflict"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ "p", N_("postpone"), N_("mark the conflict to be resolved later"
" [postpone]"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "q", N_("quit resolution"), N_("postpone all remaining conflicts"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "s", N_("show all options"), N_("show this list (also 'h', '?')"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ NULL }
};
@@ -482,17 +481,17 @@ static const resolver_option_t binary_co
brackets. */
{ "r", N_("mark resolved"), N_("accept the working copy version of file "
" [working]"),
- svn_wc_conflict_choose_merged },
+ svn_client_conflict_option_merged_text },
{ "tf", N_("their version"), N_("accept the incoming version of file "
" [theirs-full]"),
- svn_wc_conflict_choose_theirs_full },
+ svn_client_conflict_option_incoming_text },
{ "p", N_("postpone"), N_("mark the conflict to be resolved later "
" [postpone]"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "q", N_("quit resolution"), N_("postpone all remaining conflicts"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "s", N_("show all options"), N_("show this list (also 'h', '?')"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ NULL }
};
@@ -501,24 +500,24 @@ static const resolver_option_t prop_conf
{
{ "mf", N_("my version"), N_("accept my version of entire property (even "
"non-conflicts) [mine-full]"),
- svn_wc_conflict_choose_mine_full },
+ svn_client_conflict_option_working_text },
{ "tf", N_("their version"), N_("accept their version of entire property "
"(same) [theirs-full]"),
- svn_wc_conflict_choose_theirs_full },
+ svn_client_conflict_option_incoming_text },
{ "dc", N_("display conflict"), N_("show conflicts in this property"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ "e", N_("edit property"), N_("change merged property value in an editor"
" [edit]"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ "r", N_("mark resolved"), N_("accept edited version of property"),
- svn_wc_conflict_choose_merged },
+ svn_client_conflict_option_merged_text },
{ "p", N_("postpone"), N_("mark the conflict to be resolved later"
" [postpone]"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "q", N_("quit resolution"), N_("postpone all remaining conflicts"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "h", N_("help"), N_("show this help (also '?')"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ NULL }
};
@@ -526,13 +525,13 @@ static const resolver_option_t prop_conf
static const resolver_option_t tree_conflict_options[] =
{
{ "r", N_("mark resolved"), N_("accept current working copy state"),
- svn_wc_conflict_choose_merged },
+ svn_client_conflict_option_merged_text },
{ "p", N_("postpone"), N_("resolve the conflict later [postpone]"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "q", N_("quit resolution"), N_("postpone all remaining conflicts"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "h", N_("help"), N_("show this help (also '?')"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ NULL }
};
@@ -541,13 +540,13 @@ static const resolver_option_t tree_conf
{ "mc", N_("apply update to move destination (recommended)"),
N_("apply incoming update to move destination"
" [mine-conflict]"),
- svn_wc_conflict_choose_mine_conflict },
+ svn_client_conflict_option_working_text_where_conflicted },
{ "p", N_("postpone"), N_("resolve the conflict later [postpone]"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "q", N_("quit resolution"), N_("postpone all remaining conflicts"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "h", N_("help"), N_("show this help (also '?')"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ NULL }
};
@@ -556,13 +555,13 @@ static const resolver_option_t tree_conf
{ "mc", N_("prepare for updating moved-away children, if any (recommended)"),
N_("allow updating moved-away children "
"with 'svn resolve' [mine-conflict]"),
- svn_wc_conflict_choose_mine_conflict },
+ svn_client_conflict_option_working_text_where_conflicted },
{ "p", N_("postpone"), N_("resolve the conflict later [postpone]"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "q", N_("quit resolution"), N_("postpone all remaining conflicts"),
- svn_wc_conflict_choose_postpone },
+ svn_client_conflict_option_postpone },
{ "h", N_("help"), N_("show this help (also '?')"),
- svn_wc_conflict_choose_undefined },
+ svn_client_conflict_option_undefined },
{ NULL }
};
@@ -707,7 +706,8 @@ prompt_user(const resolver_option_t **op
* conflict resolution session.
* SCRATCH_POOL is used for temporary allocations. */
static svn_error_t *
-handle_text_conflict(svn_wc_conflict_result_t *result,
+handle_text_conflict(svn_client_conflict_option_id_t *option_id,
+ svn_boolean_t *save_merged,
const svn_client_conflict_t *conflict,
svn_cl__interactive_conflict_baton_t *b,
apr_pool_t *scratch_pool)
@@ -716,7 +716,7 @@ handle_text_conflict(svn_wc_conflict_res
svn_boolean_t diff_allowed = FALSE;
/* Have they done something that might have affected the merged
file (so that we need to save a .edited copy by setting the
- result->save_merge flag)? */
+ *save_merge flag)? */
svn_boolean_t performed_edit = FALSE;
/* Have they done *something* (edit, look at diff, etc) to
give them a rational basis for choosing (r)esolved? */
@@ -796,7 +796,7 @@ handle_text_conflict(svn_wc_conflict_res
}
else
{
- if (knows_something)
+ if (knows_something || is_binary)
*next_option++ = "r";
/* The 'mine-full' option selects the ".mine" file so only offer
@@ -816,7 +816,7 @@ handle_text_conflict(svn_wc_conflict_res
if (strcmp(opt->code, "q") == 0)
{
- result->choice = opt->choice;
+ *option_id = opt->choice;
b->accept_which = svn_cl__accept_postpone;
b->quit = TRUE;
break;
@@ -996,10 +996,10 @@ handle_text_conflict(svn_wc_conflict_res
if (!remains_in_conflict)
knows_something = TRUE;
}
- else if (opt->choice != svn_wc_conflict_choose_undefined)
+ else if (opt->choice != svn_client_conflict_option_undefined)
{
- if ((opt->choice == svn_wc_conflict_choose_mine_conflict
- || opt->choice == svn_wc_conflict_choose_theirs_conflict)
+ if ((opt->choice == svn_client_conflict_option_working_text_where_conflicted
+ || opt->choice == svn_client_conflict_option_incoming_text_where_conflicted)
&& is_binary)
{
SVN_ERR(svn_cmdline_fprintf(stderr, iterpool,
@@ -1012,8 +1012,8 @@ handle_text_conflict(svn_wc_conflict_res
/* We only allow the user accept the merged version of
the file if they've edited it, or at least looked at
the diff. */
- if (opt->choice == svn_wc_conflict_choose_merged
- && ! knows_something)
+ if (opt->choice == svn_client_conflict_option_merged_text
+ && ! knows_something && diff_allowed)
{
SVN_ERR(svn_cmdline_fprintf(
stderr, iterpool,
@@ -1022,9 +1022,9 @@ handle_text_conflict(svn_wc_conflict_res
continue;
}
- result->choice = opt->choice;
- if (performed_edit)
- result->save_merged = TRUE;
+ *option_id = opt->choice;
+ if (performed_edit && save_merged)
+ *save_merged = TRUE;
break;
}
}
@@ -1038,7 +1038,8 @@ handle_text_conflict(svn_wc_conflict_res
* conflict resolution session.
* SCRATCH_POOL is used for temporary allocations. */
static svn_error_t *
-handle_prop_conflict(svn_wc_conflict_result_t *result,
+handle_prop_conflict(svn_client_conflict_option_id_t *option_id,
+ const svn_string_t **merged_value,
const svn_client_conflict_t *conflict,
svn_cl__interactive_conflict_baton_t *b,
apr_pool_t *result_pool,
@@ -1097,7 +1098,7 @@ handle_prop_conflict(svn_wc_conflict_res
if (strcmp(opt->code, "q") == 0)
{
- result->choice = opt->choice;
+ *option_id = opt->choice;
b->accept_which = svn_cl__accept_postpone;
b->quit = TRUE;
break;
@@ -1126,13 +1127,13 @@ handle_prop_conflict(svn_wc_conflict_res
continue;
}
- result->merged_value = merged_propval;
- result->choice = svn_wc_conflict_choose_merged;
+ *merged_value = merged_propval;
+ *option_id = svn_client_conflict_option_merged_text;
break;
}
- else if (opt->choice != svn_wc_conflict_choose_undefined)
+ else if (opt->choice != svn_client_conflict_option_undefined)
{
- result->choice = opt->choice;
+ *option_id = opt->choice;
break;
}
}
@@ -1146,7 +1147,7 @@ handle_prop_conflict(svn_wc_conflict_res
* conflict resolution session.
* SCRATCH_POOL is used for temporary allocations. */
static svn_error_t *
-handle_tree_conflict(svn_wc_conflict_result_t *result,
+handle_tree_conflict(svn_client_conflict_option_id_t *option_id,
const svn_client_conflict_t *conflict,
svn_cl__interactive_conflict_baton_t *b,
apr_pool_t *scratch_pool)
@@ -1236,14 +1237,14 @@ handle_tree_conflict(svn_wc_conflict_res
if (strcmp(opt->code, "q") == 0)
{
- result->choice = opt->choice;
+ *option_id = opt->choice;
b->accept_which = svn_cl__accept_postpone;
b->quit = TRUE;
break;
}
- else if (opt->choice != svn_wc_conflict_choose_undefined)
+ else if (opt->choice != svn_client_conflict_option_undefined)
{
- result->choice = opt->choice;
+ *option_id = opt->choice;
break;
}
}
@@ -1254,7 +1255,9 @@ handle_tree_conflict(svn_wc_conflict_res
/* The body of svn_cl__conflict_func_interactive(). */
static svn_error_t *
-conflict_func_interactive(svn_wc_conflict_result_t **result,
+conflict_func_interactive(svn_client_conflict_option_id_t *option_id,
+ svn_boolean_t *save_merged,
+ const svn_string_t **merged_propval,
const svn_client_conflict_t *conflict,
void *baton,
apr_pool_t *result_pool,
@@ -1275,8 +1278,7 @@ conflict_func_interactive(svn_wc_conflic
scratch_pool));
/* Start out assuming we're going to postpone the conflict. */
- *result = svn_wc_create_conflict_result(svn_wc_conflict_choose_postpone,
- NULL, result_pool);
+ *option_id = svn_client_conflict_option_postpone;
switch (b->accept_which)
{
@@ -1285,32 +1287,32 @@ conflict_func_interactive(svn_wc_conflic
/* No (or no valid) --accept option, fall through to prompting. */
break;
case svn_cl__accept_postpone:
- (*result)->choice = svn_wc_conflict_choose_postpone;
+ *option_id = svn_client_conflict_option_postpone;
return SVN_NO_ERROR;
case svn_cl__accept_base:
- (*result)->choice = svn_wc_conflict_choose_base;
+ *option_id = svn_client_conflict_option_base_text;
return SVN_NO_ERROR;
case svn_cl__accept_working:
- (*result)->choice = svn_wc_conflict_choose_merged;
+ *option_id = svn_client_conflict_option_merged_text;
return SVN_NO_ERROR;
case svn_cl__accept_mine_conflict:
- (*result)->choice = svn_wc_conflict_choose_mine_conflict;
+ *option_id = svn_client_conflict_option_working_text_where_conflicted;
return SVN_NO_ERROR;
case svn_cl__accept_theirs_conflict:
- (*result)->choice = svn_wc_conflict_choose_theirs_conflict;
+ *option_id = svn_client_conflict_option_incoming_text_where_conflicted;
return SVN_NO_ERROR;
case svn_cl__accept_mine_full:
- (*result)->choice = svn_wc_conflict_choose_mine_full;
+ *option_id = svn_client_conflict_option_working_text;
return SVN_NO_ERROR;
case svn_cl__accept_theirs_full:
- (*result)->choice = svn_wc_conflict_choose_theirs_full;
+ *option_id = svn_client_conflict_option_incoming_text;
return SVN_NO_ERROR;
case svn_cl__accept_edit:
if (merged_abspath)
{
if (b->external_failed)
{
- (*result)->choice = svn_wc_conflict_choose_postpone;
+ *option_id = svn_client_conflict_option_postpone;
return SVN_NO_ERROR;
}
@@ -1331,7 +1333,7 @@ conflict_func_interactive(svn_wc_conflic
}
else if (err)
return svn_error_trace(err);
- (*result)->choice = svn_wc_conflict_choose_merged;
+ *option_id = svn_client_conflict_option_merged_text;
return SVN_NO_ERROR;
}
/* else, fall through to prompting. */
@@ -1344,7 +1346,7 @@ conflict_func_interactive(svn_wc_conflic
if (b->external_failed)
{
- (*result)->choice = svn_wc_conflict_choose_postpone;
+ *option_id = svn_client_conflict_option_postpone;
return SVN_NO_ERROR;
}
@@ -1373,9 +1375,9 @@ conflict_func_interactive(svn_wc_conflic
return svn_error_trace(err);
if (remains_in_conflict)
- (*result)->choice = svn_wc_conflict_choose_postpone;
+ *option_id = svn_client_conflict_option_postpone;
else
- (*result)->choice = svn_wc_conflict_choose_merged;
+ *option_id = svn_client_conflict_option_merged_text;
return SVN_NO_ERROR;
}
/* else, fall through to prompting. */
@@ -1402,22 +1404,69 @@ conflict_func_interactive(svn_wc_conflic
svn_wc_conflict_action_edit)
&& (svn_client_conflict_get_local_change(conflict) ==
svn_wc_conflict_reason_edited)))
- SVN_ERR(handle_text_conflict(*result, conflict, b, scratch_pool));
+ SVN_ERR(handle_text_conflict(option_id, save_merged, conflict, b,
+ scratch_pool));
else if (svn_client_conflict_get_kind(conflict) ==
svn_wc_conflict_kind_property)
- SVN_ERR(handle_prop_conflict(*result, conflict, b, result_pool,
- scratch_pool));
+ SVN_ERR(handle_prop_conflict(option_id, merged_propval, conflict, b,
+ result_pool, scratch_pool));
else if (svn_client_conflict_get_kind(conflict) == svn_wc_conflict_kind_tree)
- SVN_ERR(handle_tree_conflict(*result, conflict, b, scratch_pool));
+ SVN_ERR(handle_tree_conflict(option_id, conflict, b, scratch_pool));
else /* other types of conflicts -- do nothing about them. */
{
- (*result)->choice = svn_wc_conflict_choose_postpone;
+ *option_id = svn_client_conflict_option_postpone;
}
return SVN_NO_ERROR;
}
+/*
+ * Return a legacy conflict choice corresponding to OPTION_ID.
+ * Return svn_wc_conflict_choose_undefined if no corresponding
+ * legacy conflict choice exists.
+ */
+static svn_wc_conflict_choice_t
+conflict_option_id_to_wc_conflict_choice(
+ svn_client_conflict_option_id_t option_id)
+{
+
+ switch (option_id)
+ {
+ case svn_client_conflict_option_undefined:
+ return svn_wc_conflict_choose_undefined;
+
+ case svn_client_conflict_option_postpone:
+ return svn_wc_conflict_choose_postpone;
+
+ case svn_client_conflict_option_base_text:
+ return svn_wc_conflict_choose_base;
+
+ case svn_client_conflict_option_incoming_text:
+ return svn_wc_conflict_choose_theirs_full;
+
+ case svn_client_conflict_option_working_text:
+ return svn_wc_conflict_choose_mine_full;
+
+ case svn_client_conflict_option_incoming_text_where_conflicted:
+ return svn_wc_conflict_choose_theirs_conflict;
+
+ case svn_client_conflict_option_working_text_where_conflicted:
+ return svn_wc_conflict_choose_mine_conflict;
+
+ case svn_client_conflict_option_merged_text:
+ return svn_wc_conflict_choose_merged;
+
+ case svn_client_conflict_option_unspecified:
+ return svn_wc_conflict_choose_unspecified;
+
+ default:
+ break;
+ }
+
+ return svn_wc_conflict_choose_undefined;
+}
+
svn_error_t *
svn_cl__conflict_func_interactive(svn_wc_conflict_result_t **result,
const svn_wc_conflict_description2_t *desc,
@@ -1427,15 +1476,24 @@ svn_cl__conflict_func_interactive(svn_wc
{
svn_cl__interactive_conflict_baton_t *b = baton;
svn_client_conflict_t *conflict;
+ svn_client_conflict_option_id_t option_id;
+ svn_boolean_t save_merged = FALSE;
+ const svn_string_t *merged_propval = NULL;
SVN_ERR(svn_client_conflict_from_wc_description2_t(&conflict, desc,
scratch_pool,
scratch_pool));
- SVN_ERR(conflict_func_interactive(result, conflict, baton,
+ *result = svn_wc_create_conflict_result(svn_client_conflict_option_postpone,
+ NULL, result_pool);
+ SVN_ERR(conflict_func_interactive(&option_id, &save_merged, &merged_propval,
+ conflict, baton,
result_pool, scratch_pool));
+ (*result)->choice = conflict_option_id_to_wc_conflict_choice(option_id);
+ (*result)->save_merged = save_merged;
+ (*result)->merged_value = merged_propval;
/* If we are resolving a conflict, adjust the summary of conflicts. */
- if ((*result)->choice != svn_wc_conflict_choose_postpone)
+ if ((*result)->choice != svn_client_conflict_option_postpone)
{
const char *local_path
= svn_cl__local_style_skip_ancestor(
@@ -1447,3 +1505,73 @@ svn_cl__conflict_func_interactive(svn_wc
}
return SVN_NO_ERROR;
}
+
+svn_error_t *
+svn_cl__resolve_conflict(svn_boolean_t *resolved,
+ svn_client_conflict_t *conflict,
+ svn_client_ctx_t *ctx,
+ svn_wc_conflict_choice_t conflict_choice,
+ apr_pool_t *scratch_pool)
+{
+ svn_cl__interactive_conflict_baton_t *b = ctx->conflict_baton2;
+
+ if (conflict_choice == svn_wc_conflict_choose_unspecified)
+ {
+ svn_client_conflict_option_id_t option_id;
+
+ SVN_ERR(conflict_func_interactive(&option_id, NULL, NULL, conflict, b,
+ scratch_pool, scratch_pool));
+
+ conflict_choice = conflict_option_id_to_wc_conflict_choice(option_id);
+ }
+
+ /* If we are resolving a conflict, adjust the summary of conflicts. */
+ if (conflict_choice != svn_wc_conflict_choose_postpone)
+ {
+ const char *local_relpath
+ = svn_cl__local_style_skip_ancestor(
+ b->path_prefix, svn_client_conflict_get_local_abspath(conflict),
+ scratch_pool);
+ svn_wc_conflict_kind_t conflict_kind;
+ const char *local_abspath;
+ const char *lock_abspath;
+ svn_error_t *err;
+
+ local_abspath = svn_client_conflict_get_local_abspath(conflict);
+
+ /* ### for now, resolve conflict using legacy API */
+ SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath,
+ ctx->wc_ctx,
+ local_abspath,
+ scratch_pool,
+ scratch_pool));
+ conflict_kind = svn_client_conflict_get_kind(conflict);
+
+ err = svn_wc_resolved_conflict5(
+ ctx->wc_ctx, local_abspath, svn_depth_empty, /* ??? */
+ conflict_kind == svn_wc_conflict_kind_text,
+ conflict_kind == svn_wc_conflict_kind_property ? "" : NULL,
+ conflict_kind == svn_wc_conflict_kind_tree,
+ conflict_choice,
+ ctx->cancel_func, ctx->cancel_baton,
+ ctx->notify_func2, ctx->notify_baton2,
+ scratch_pool);
+
+ err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
+ lock_abspath,
+ scratch_pool));
+ svn_io_sleep_for_timestamps(local_abspath, scratch_pool);
+
+ SVN_ERR(err);
+
+ svn_cl__conflict_stats_resolved(b->conflict_stats, local_relpath,
+ svn_client_conflict_get_kind(conflict));
+ *resolved = TRUE;
+ }
+ else
+ {
+ *resolved = FALSE;
+ }
+
+ return SVN_NO_ERROR;
+}
Modified: subversion/branches/patch-exec/subversion/svn/lock-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svn/lock-cmd.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svn/lock-cmd.c (original)
+++ subversion/branches/patch-exec/subversion/svn/lock-cmd.c Fri Sep 18 01:38:47 2015
@@ -80,6 +80,29 @@ get_comment(const char **comment, svn_cl
return SVN_NO_ERROR;
}
+/* Baton for notify_lock_handler */
+struct notify_lock_baton_t
+{
+ void *inner_baton;
+ svn_wc_notify_func2_t inner_notify;
+ svn_boolean_t had_failure;
+};
+
+/* Implements svn_wc_notify_func2_t for svn_cl__lock */
+static void
+notify_lock_handler(void *baton,
+ const svn_wc_notify_t *notify,
+ apr_pool_t *scratch_pool)
+{
+ struct notify_lock_baton_t *nlb = baton;
+
+ if (notify->action == svn_wc_notify_failed_lock)
+ nlb->had_failure = TRUE;
+
+ if (nlb->inner_notify)
+ nlb->inner_notify(nlb->inner_baton, notify, scratch_pool);
+}
+
/* This implements the `svn_opt_subcommand_t' interface. */
svn_error_t *
svn_cl__lock(apr_getopt_t *os,
@@ -90,6 +113,7 @@ svn_cl__lock(apr_getopt_t *os,
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
apr_array_header_t *targets;
const char *comment;
+ struct notify_lock_baton_t nlb;
SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
opt_state->targets,
@@ -106,5 +130,18 @@ svn_cl__lock(apr_getopt_t *os,
SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, pool));
- return svn_client_lock(targets, comment, opt_state->force, ctx, pool);
+ nlb.inner_notify = ctx->notify_func2;
+ nlb.inner_baton = ctx->notify_baton2;
+ nlb.had_failure = FALSE;
+
+ ctx->notify_func2 = notify_lock_handler;
+ ctx->notify_baton2 = &nlb;
+
+ SVN_ERR(svn_client_lock(targets, comment, opt_state->force, ctx, pool));
+
+ if (nlb.had_failure)
+ return svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("One or more locks could not be obtained"));
+
+ return SVN_NO_ERROR;
}
Modified: subversion/branches/patch-exec/subversion/svn/resolve-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svn/resolve-cmd.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svn/resolve-cmd.c (original)
+++ subversion/branches/patch-exec/subversion/svn/resolve-cmd.c Fri Sep 18 01:38:47 2015
@@ -30,6 +30,7 @@
#include "svn_client.h"
#include "svn_error.h"
#include "svn_pools.h"
+#include "svn_hash.h"
#include "cl.h"
#include "svn_private_config.h"
@@ -38,6 +39,225 @@
/*** Code. ***/
+/* Baton for conflict_status_walker */
+struct conflict_status_walker_baton
+{
+ svn_client_ctx_t *ctx;
+ svn_wc_conflict_choice_t conflict_choice;
+ svn_wc_notify_func2_t notify_func;
+ void *notify_baton;
+ svn_boolean_t resolved_one;
+ apr_hash_t *resolve_later;
+};
+
+/* Implements svn_wc_notify_func2_t to collect new conflicts caused by
+ resolving a tree conflict. */
+static void
+tree_conflict_collector(void *baton,
+ const svn_wc_notify_t *notify,
+ apr_pool_t *pool)
+{
+ struct conflict_status_walker_baton *cswb = baton;
+
+ if (cswb->notify_func)
+ cswb->notify_func(cswb->notify_baton, notify, pool);
+
+ if (cswb->resolve_later
+ && (notify->action == svn_wc_notify_tree_conflict
+ || notify->prop_state == svn_wc_notify_state_conflicted
+ || notify->content_state == svn_wc_notify_state_conflicted))
+ {
+ if (!svn_hash_gets(cswb->resolve_later, notify->path))
+ {
+ const char *dup_path;
+
+ dup_path = apr_pstrdup(apr_hash_pool_get(cswb->resolve_later),
+ notify->path);
+
+ svn_hash_sets(cswb->resolve_later, dup_path, dup_path);
+ }
+ }
+}
+
+/* Implements svn_wc_status4_t to walk all conflicts to resolve.
+ */
+static svn_error_t *
+conflict_status_walker(void *baton,
+ const char *local_abspath,
+ const svn_wc_status3_t *status,
+ apr_pool_t *scratch_pool)
+{
+ struct conflict_status_walker_baton *cswb = baton;
+ apr_pool_t *iterpool;
+ svn_boolean_t resolved = FALSE;
+ svn_client_conflict_t *conflict;
+
+ if (!status->conflicted)
+ return SVN_NO_ERROR;
+
+ iterpool = svn_pool_create(scratch_pool);
+
+ SVN_ERR(svn_client_conflict_get(&conflict, local_abspath, cswb->ctx,
+ iterpool, iterpool));
+ SVN_ERR(svn_cl__resolve_conflict(&resolved, conflict, cswb->ctx,
+ cswb->conflict_choice,
+ scratch_pool));
+ if (resolved)
+ cswb->resolved_one = TRUE;
+
+ svn_pool_destroy(iterpool);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+walk_conflicts(svn_client_ctx_t *ctx,
+ const char *local_abspath,
+ svn_depth_t depth,
+ svn_wc_conflict_choice_t conflict_choice,
+ apr_pool_t *scratch_pool)
+{
+ struct conflict_status_walker_baton cswb;
+ apr_pool_t *iterpool = NULL;
+ svn_error_t *err;
+
+ if (depth == svn_depth_unknown)
+ depth = svn_depth_infinity;
+
+ cswb.ctx = ctx;
+ cswb.conflict_choice = conflict_choice;
+
+ cswb.resolved_one = FALSE;
+ cswb.resolve_later = (depth != svn_depth_empty)
+ ? apr_hash_make(scratch_pool)
+ : NULL;
+
+ /* ### call notify.c code */
+ if (ctx->notify_func2)
+ ctx->notify_func2(ctx->notify_baton2,
+ svn_wc_create_notify(
+ local_abspath,
+ svn_wc_notify_conflict_resolver_starting,
+ scratch_pool),
+ scratch_pool);
+
+ cswb.notify_func = ctx->notify_func2;
+ cswb.notify_baton = ctx->notify_baton2;
+ ctx->notify_func2 = tree_conflict_collector;
+ ctx->notify_baton2 = &cswb;
+
+ err = svn_wc_walk_status(ctx->wc_ctx,
+ local_abspath,
+ depth,
+ FALSE /* get_all */,
+ FALSE /* no_ignore */,
+ TRUE /* ignore_text_mods */,
+ NULL /* ignore_patterns */,
+ conflict_status_walker, &cswb,
+ ctx->cancel_func, ctx->cancel_baton,
+ scratch_pool);
+
+ /* If we got new tree conflicts (or delayed conflicts) during the initial
+ walk, we now walk them one by one as closure. */
+ while (!err && cswb.resolve_later && apr_hash_count(cswb.resolve_later))
+ {
+ apr_hash_index_t *hi;
+ svn_wc_status3_t *status = NULL;
+ const char *tc_abspath = NULL;
+
+ if (iterpool)
+ svn_pool_clear(iterpool);
+ else
+ iterpool = svn_pool_create(scratch_pool);
+
+ hi = apr_hash_first(scratch_pool, cswb.resolve_later);
+ cswb.resolve_later = apr_hash_make(scratch_pool);
+ cswb.resolved_one = FALSE;
+
+ for (; hi && !err; hi = apr_hash_next(hi))
+ {
+ const char *relpath;
+ svn_pool_clear(iterpool);
+
+ tc_abspath = apr_hash_this_key(hi);
+
+ if (ctx->cancel_func)
+ SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
+
+ relpath = svn_dirent_skip_ancestor(local_abspath,
+ tc_abspath);
+
+ if (!relpath
+ || (depth >= svn_depth_empty
+ && depth < svn_depth_infinity
+ && strchr(relpath, '/')))
+ {
+ continue;
+ }
+
+ SVN_ERR(svn_wc_status3(&status, ctx->wc_ctx, tc_abspath,
+ iterpool, iterpool));
+
+ if (depth == svn_depth_files
+ && status->kind == svn_node_dir)
+ continue;
+
+ err = svn_error_trace(conflict_status_walker(&cswb, tc_abspath,
+ status, scratch_pool));
+ }
+
+ /* None of the remaining conflicts got resolved, and non did provide
+ an error...
+
+ We can fix that if we disable the 'resolve_later' option...
+ */
+ if (!cswb.resolved_one && !err && tc_abspath
+ && apr_hash_count(cswb.resolve_later))
+ {
+ /* Run the last resolve operation again. We still have status
+ and tc_abspath for that one. */
+
+ cswb.resolve_later = NULL; /* Produce proper error! */
+
+ /* Recreate the error */
+ err = svn_error_trace(conflict_status_walker(&cswb, tc_abspath,
+ status, scratch_pool));
+
+ SVN_ERR_ASSERT(err != NULL);
+
+ err = svn_error_createf(
+ SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, err,
+ _("Unable to resolve pending conflict on '%s'"),
+ svn_dirent_local_style(tc_abspath, scratch_pool));
+ break;
+ }
+ }
+
+ if (iterpool)
+ svn_pool_destroy(iterpool);
+
+ if (err && err->apr_err != SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE)
+ err = svn_error_createf(
+ SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, err,
+ _("Unable to resolve conflicts on '%s'"),
+ svn_dirent_local_style(local_abspath, scratch_pool));
+
+ ctx->notify_func2 = cswb.notify_func;
+ ctx->notify_baton2 = cswb.notify_baton;
+
+ SVN_ERR(err);
+
+ /* ### call notify.c code */
+ if (ctx->notify_func2)
+ ctx->notify_func2(ctx->notify_baton2,
+ svn_wc_create_notify(local_abspath,
+ svn_wc_notify_conflict_resolver_done,
+ scratch_pool),
+ scratch_pool);
+
+ return SVN_NO_ERROR;
+}
+
/* This implements the `svn_opt_subcommand_t' interface. */
svn_error_t *
svn_cl__resolve(apr_getopt_t *os,
@@ -107,12 +327,30 @@ svn_cl__resolve(apr_getopt_t *os,
for (i = 0; i < targets->nelts; i++)
{
const char *target = APR_ARRAY_IDX(targets, i, const char *);
+ const char *local_abspath;
+ svn_client_conflict_t *conflict;
+
svn_pool_clear(iterpool);
+
SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
- err = svn_client_resolve(target,
- opt_state->depth, conflict_choice,
- ctx,
- iterpool);
+
+ SVN_ERR(svn_dirent_get_absolute(&local_abspath, target, iterpool));
+
+ if (opt_state->depth == svn_depth_empty)
+ {
+ svn_boolean_t resolved;
+
+ SVN_ERR(svn_client_conflict_get(&conflict, local_abspath, ctx,
+ iterpool, iterpool));
+ err = svn_cl__resolve_conflict(&resolved, conflict, ctx,
+ conflict_choice, iterpool);
+ }
+ else
+ {
+ err = walk_conflicts(ctx, local_abspath, opt_state->depth,
+ conflict_choice, iterpool);
+ }
+
if (err)
{
svn_handle_warning2(stderr, err, "svn: ");
Modified: subversion/branches/patch-exec/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svn/svn.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svn/svn.c (original)
+++ subversion/branches/patch-exec/subversion/svn/svn.c Fri Sep 18 01:38:47 2015
@@ -415,7 +415,39 @@ const apr_getopt_option_t svn_cl__option
" "
"current revision (recommended when tagging)")},
{"show-item", opt_show_item, 1,
- N_("print only the item identified by ARG")},
+ N_("print only the item identified by ARG:\n"
+ " "
+ " 'kind' node kind of TARGET\n"
+ " "
+ " 'url' URL of TARGET in the repository\n"
+ " "
+ " 'relative-url'\n"
+ " "
+ " repository-relative URL of TARGET\n"
+ " "
+ " 'repos-root-url'\n"
+ " "
+ " root URL of repository\n"
+ " "
+ " 'repos-uuid' UUID of repository\n"
+ " "
+ " 'revision' specified or implied revision\n"
+ " "
+ " 'last-changed-revision'\n"
+ " "
+ " last change of TARGET at or before\n"
+ " "
+ " 'revision'\n"
+ " "
+ " 'last-changed-date'\n"
+ " "
+ " date of 'last-changed-revision'\n"
+ " "
+ " 'last-changed-author'\n"
+ " "
+ " author of 'last-changed-revision'\n"
+ " "
+ " 'wc-root' root of TARGET's working copy")},
/* Long-opt Aliases
*
@@ -726,23 +758,12 @@ const svn_opt_subcommand_desc2_t svn_cl_
"usage: info [TARGET[@REV]...]\n"
"\n"
" Print information about each TARGET (default: '.').\n"
- " TARGET may be either a working-copy path or URL. If specified, REV\n"
- " determines in which revision the target is first looked up.\n"
+ " TARGET may be either a working-copy path or a URL. If specified, REV\n"
+ " determines in which revision the target is first looked up; the default\n"
+ " is HEAD for a URL or BASE for a WC path.\n"
"\n"
" With --show-item, print only the value of one item of information\n"
- " about TARGET. One of the following items can be selected:\n"
- " kind the kind of TARGET\n"
- " url the URL of TARGET in the repository\n"
- " relative-url the repository-relative URL\n"
- " repos-root-url the repository root URL\n"
- " repos-uuid the repository UUID\n"
- " revision the revision of TARGET (defaults to BASE\n"
- " for working copy paths and HEAD for URLs)\n"
- " last-changed-revision the most recent revision in which TARGET\n"
- " was changed\n"
- " last-changed-date the date of the last-changed revision\n"
- " last-changed-author the author of the last-changed revision\n"
- " wc-root the root of TARGET's working copy"),
+ " about TARGET.\n"),
{'r', 'R', opt_depth, opt_targets, opt_incremental, opt_xml,
opt_changelist, opt_include_externals, opt_show_item, opt_no_newline}
},
Modified: subversion/branches/patch-exec/subversion/svn/unlock-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svn/unlock-cmd.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svn/unlock-cmd.c (original)
+++ subversion/branches/patch-exec/subversion/svn/unlock-cmd.c Fri Sep 18 01:38:47 2015
@@ -39,6 +39,29 @@
/*** Code. ***/
+/* Baton for notify_unlock_handler */
+struct notify_unlock_baton_t
+{
+ void *inner_baton;
+ svn_wc_notify_func2_t inner_notify;
+ svn_boolean_t had_failure;
+};
+
+/* Implements svn_wc_notify_func2_t for svn_cl__unlock */
+static void
+notify_unlock_handler(void *baton,
+ const svn_wc_notify_t *notify,
+ apr_pool_t *scratch_pool)
+{
+ struct notify_unlock_baton_t *nub = baton;
+
+ if (notify->action == svn_wc_notify_failed_unlock)
+ nub->had_failure = TRUE;
+
+ if (nub->inner_notify)
+ nub->inner_notify(nub->inner_baton, notify, scratch_pool);
+}
+
/* This implements the `svn_opt_subcommand_t' interface. */
svn_error_t *
@@ -49,6 +72,7 @@ svn_cl__unlock(apr_getopt_t *os,
svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
apr_array_header_t *targets;
+ struct notify_unlock_baton_t nub;
SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
opt_state->targets,
@@ -63,6 +87,18 @@ svn_cl__unlock(apr_getopt_t *os,
SVN_ERR(svn_cl__assert_homogeneous_target_type(targets));
- return svn_error_trace(
- svn_client_unlock(targets, opt_state->force, ctx, scratch_pool));
+ nub.inner_notify = ctx->notify_func2;
+ nub.inner_baton = ctx->notify_baton2;
+ nub.had_failure = FALSE;
+
+ ctx->notify_func2 = notify_unlock_handler;
+ ctx->notify_baton2 = &nub;
+
+ SVN_ERR(svn_client_unlock(targets, opt_state->force, ctx, scratch_pool));
+
+ if (nub.had_failure)
+ return svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("One or more locks could not be released"));
+
+ return SVN_NO_ERROR;
}
Modified: subversion/branches/patch-exec/subversion/svn_private_config.hw
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svn_private_config.hw?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svn_private_config.hw (original)
+++ subversion/branches/patch-exec/subversion/svn_private_config.hw Fri Sep 18 01:38:47 2015
@@ -122,6 +122,14 @@
Supresses compiler warnings about the variable being unused. */
#define SVN_UNUSED(v) ( (void)(v) )
+#if defined(_MSC_VER) && _MSC_VER >= 1600
+#define HAVE_STDINT_H
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER >= 1800
+#define HAVE_STDBOOL_H
+#endif
+
#endif /* SVN_PRIVATE_CONFIG_HW */
/* Inclusion of Berkeley DB header */
Modified: subversion/branches/patch-exec/subversion/svnadmin/svnadmin.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svnadmin/svnadmin.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svnadmin/svnadmin.c (original)
+++ subversion/branches/patch-exec/subversion/svnadmin/svnadmin.c Fri Sep 18 01:38:47 2015
@@ -479,8 +479,12 @@ static const svn_opt_subcommand_desc2_t
{"lstxns", subcommand_lstxns, {0}, N_
("usage: svnadmin lstxns REPOS_PATH\n\n"
- "Print the names of all uncommitted transactions.\n"),
- {0} },
+ "Print the names of uncommitted transactions. With -rN skip the output\n"
+ "of those that have a base revision more recent than rN. Transactions\n"
+ "with base revisions much older than HEAD are likely to have been\n"
+ "abandonded and are candidates to be removed.\n"),
+ {'r'},
+ { {'r', "transaction base revision ARG"} } },
{"pack", subcommand_pack, {0}, N_
("usage: svnadmin pack REPOS_PATH\n\n"
@@ -1109,8 +1113,7 @@ repos_notify_handler(void *baton,
"%" APR_INT64_T_FMT,
notify->shard);
svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool,
- _("Packing revision properties"
- " in shard %s..."),
+ _("Packed revision properties in shard %s\n"),
shardstr));
return;
}
@@ -1121,8 +1124,8 @@ repos_notify_handler(void *baton,
"%" APR_INT64_T_FMT,
notify->shard);
svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool,
- _("Removing non-packed revision properties"
- " in shard %s..."),
+ _("Removed non-packed revision properties"
+ " in shard %s\n"),
shardstr));
return;
}
@@ -1503,7 +1506,7 @@ subcommand_load(apr_getopt_t *os, void *
SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
/* Read the stream from STDIN. Users can redirect a file. */
- SVN_ERR(svn_stream_for_stdin(&stdin_stream, pool));
+ SVN_ERR(svn_stream_for_stdin2(&stdin_stream, TRUE, pool));
/* Progress feedback goes to STDOUT, unless they asked to suppress it. */
if (! opt_state->quiet)
@@ -1547,7 +1550,7 @@ subcommand_load_revprops(apr_getopt_t *o
SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
/* Read the stream from STDIN. Users can redirect a file. */
- SVN_ERR(svn_stream_for_stdin(&stdin_stream, pool));
+ SVN_ERR(svn_stream_for_stdin2(&stdin_stream, TRUE, pool));
/* Progress feedback goes to STDOUT, unless they asked to suppress it. */
if (! opt_state->quiet)
@@ -1576,21 +1579,46 @@ subcommand_lstxns(apr_getopt_t *os, void
svn_repos_t *repos;
svn_fs_t *fs;
apr_array_header_t *txns;
+ apr_pool_t *iterpool;
+ svn_revnum_t youngest, limit;
int i;
/* Expect no more arguments. */
SVN_ERR(parse_args(NULL, os, 0, 0, pool));
+ if (opt_state->end_revision.kind != svn_opt_revision_unspecified)
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Revision range is not allowed"));
SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
fs = svn_repos_fs(repos);
SVN_ERR(svn_fs_list_transactions(&txns, fs, pool));
- /* Loop, printing revisions. */
+ SVN_ERR(svn_fs_youngest_rev(&youngest, fs, pool));
+ SVN_ERR(get_revnum(&limit, &opt_state->start_revision, youngest, repos,
+ pool));
+
+ iterpool = svn_pool_create(pool);
for (i = 0; i < txns->nelts; i++)
{
- SVN_ERR(svn_cmdline_printf(pool, "%s\n",
- APR_ARRAY_IDX(txns, i, const char *)));
+ const char *name = APR_ARRAY_IDX(txns, i, const char *);
+ svn_boolean_t show = TRUE;
+
+ svn_pool_clear(iterpool);
+ if (limit != SVN_INVALID_REVNUM)
+ {
+ svn_fs_txn_t *txn;
+ svn_revnum_t base;
+
+ SVN_ERR(svn_fs_open_txn(&txn, fs, name, iterpool));
+ base = svn_fs_txn_base_revision(txn);
+
+ if (base > limit)
+ show = FALSE;
+ }
+ if (show)
+ SVN_ERR(svn_cmdline_printf(pool, "%s\n", name));
}
+ svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
@@ -2112,6 +2140,7 @@ subcommand_info(apr_getopt_t *os, void *
svn_fs_t *fs;
int fs_format;
const char *uuid;
+ svn_revnum_t head_rev;
/* Expect no more arguments. */
SVN_ERR(parse_args(NULL, os, 0, 0, pool));
@@ -2124,6 +2153,9 @@ subcommand_info(apr_getopt_t *os, void *
SVN_ERR(svn_fs_get_uuid(fs, &uuid, pool));
SVN_ERR(svn_cmdline_printf(pool, _("UUID: %s\n"), uuid));
+
+ SVN_ERR(svn_fs_youngest_rev(&head_rev, fs, pool));
+ SVN_ERR(svn_cmdline_printf(pool, _("Revisions: %ld\n"), head_rev));
{
int repos_format, minor;
svn_version_t *repos_version, *fs_version;
Modified: subversion/branches/patch-exec/subversion/svnbench/null-export-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svnbench/null-export-cmd.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svnbench/null-export-cmd.c (original)
+++ subversion/branches/patch-exec/subversion/svnbench/null-export-cmd.c Fri Sep 18 01:38:47 2015
@@ -165,6 +165,15 @@ close_file(void *file_baton,
return SVN_NO_ERROR;
}
+/* Implement svn_write_fn_t, simply counting the incoming data. */
+static svn_error_t *
+file_write_handler(void *baton, const char *data, apr_size_t *len)
+{
+ edit_baton_t *eb = baton;
+ eb->byte_count += *len;
+
+ return SVN_NO_ERROR;
+}
/*** Public Interfaces ***/
@@ -198,6 +207,7 @@ bench_null_export(svn_revnum_t *result_r
svn_client__pathrev_t *loc;
svn_ra_session_t *ra_session;
svn_node_kind_t kind;
+ edit_baton_t *eb = baton;
/* Get the RA connection. */
SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc,
@@ -211,6 +221,11 @@ bench_null_export(svn_revnum_t *result_r
{
apr_hash_t *props;
+ /* Since we don't use the editor, we must count "manually". */
+ svn_stream_t *stream = svn_stream_create(eb, pool);
+ svn_stream_set_write(stream, file_write_handler);
+ eb->file_count++;
+
/* Since you cannot actually root an editor at a file, we
* manually drive a few functions of our editor. */
@@ -218,8 +233,7 @@ bench_null_export(svn_revnum_t *result_r
* to the repository. */
/* ### note: the stream will not be closed */
SVN_ERR(svn_ra_get_file(ra_session, "", loc->rev,
- svn_stream_empty(pool),
- NULL, &props, pool));
+ stream, NULL, &props, pool));
}
else if (kind == svn_node_dir)
{
@@ -268,6 +282,10 @@ bench_null_export(svn_revnum_t *result_r
NULL, pool));
SVN_ERR(reporter->finish_report(report_baton, pool));
+
+ /* We don't receive the "add directory" callback for the starting
+ * node. */
+ eb->dir_count++;
}
else if (kind == svn_node_none)
{
Modified: subversion/branches/patch-exec/subversion/svnbench/svnbench.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svnbench/svnbench.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svnbench/svnbench.c (original)
+++ subversion/branches/patch-exec/subversion/svnbench/svnbench.c Fri Sep 18 01:38:47 2015
@@ -371,6 +371,7 @@ sub_main(int *exit_code, int argc, const
svn_config_t *cfg_config;
svn_boolean_t descend = TRUE;
svn_boolean_t use_notifier = TRUE;
+ apr_time_t start_time, time_taken;
received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
@@ -939,7 +940,10 @@ sub_main(int *exit_code, int argc, const
ctx->conflict_baton2 = NULL;
/* And now we finally run the subcommand. */
+ start_time = apr_time_now();
err = (*subcommand->cmd_func)(os, &command_baton, pool);
+ time_taken = apr_time_now() - start_time;
+
if (err)
{
/* For argument-related problems, suggest using the 'help'
@@ -968,6 +972,14 @@ sub_main(int *exit_code, int argc, const
return err;
}
+ else if ((subcommand->cmd_func != svn_cl__help) && !opt_state.quiet)
+ {
+ /* This formatting lines up nicely with the output of our sub-commands
+ * and gives musec resolution while not overflowing for 30 years. */
+ SVN_ERR(svn_cmdline_printf(pool,
+ _("%15.6f seconds taken\n"),
+ time_taken / 1.0e6));
+ }
return SVN_NO_ERROR;
}
Modified: subversion/branches/patch-exec/subversion/svndumpfilter/svndumpfilter.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svndumpfilter/svndumpfilter.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svndumpfilter/svndumpfilter.c (original)
+++ subversion/branches/patch-exec/subversion/svndumpfilter/svndumpfilter.c Fri Sep 18 01:38:47 2015
@@ -48,42 +48,8 @@
#include "private/svn_cmdline_private.h"
#include "private/svn_sorts_private.h"
-#ifdef _WIN32
-typedef apr_status_t (__stdcall *open_fn_t)(apr_file_t **, apr_pool_t *);
-#else
-typedef apr_status_t (*open_fn_t)(apr_file_t **, apr_pool_t *);
-#endif
-
/*** Code. ***/
-/* Helper to open stdio streams */
-
-/* NOTE: we used to call svn_stream_from_stdio(), which wraps a stream
- around a standard stdio.h FILE pointer. The problem is that these
- pointers operate through C Run Time (CRT) on Win32, which does all
- sorts of translation on them: LF's become CRLF's, and ctrl-Z's
- embedded in Word documents are interpreted as premature EOF's.
-
- So instead, we use apr_file_open_std*, which bypass the CRT and
- directly wrap the OS's file-handles, which don't know or care about
- translation. Thus dump/load works correctly on Win32.
-*/
-static svn_error_t *
-create_stdio_stream(svn_stream_t **stream,
- open_fn_t open_fn,
- apr_pool_t *pool)
-{
- apr_file_t *stdio_file;
- apr_status_t apr_err = open_fn(&stdio_file, pool);
-
- if (apr_err)
- return svn_error_wrap_apr(apr_err, _("Can't open stdio file"));
-
- *stream = svn_stream_from_aprfile2(stdio_file, TRUE, pool);
- return SVN_NO_ERROR;
-}
-
-
/* Writes a property in dumpfile format to given stringbuf. */
static void
write_prop_to_stringbuf(svn_stringbuf_t *strbuf,
@@ -1065,12 +1031,10 @@ parse_baton_initialize(struct parse_bato
struct parse_baton_t *baton = apr_palloc(pool, sizeof(*baton));
/* Read the stream from STDIN. Users can redirect a file. */
- SVN_ERR(create_stdio_stream(&(baton->in_stream),
- apr_file_open_stdin, pool));
+ SVN_ERR(svn_stream_for_stdin2(&baton->in_stream, TRUE, pool));
/* Have the parser dump results to STDOUT. Users can redirect a file. */
- SVN_ERR(create_stdio_stream(&(baton->out_stream),
- apr_file_open_stdout, pool));
+ SVN_ERR(svn_stream_for_stdout(&baton->out_stream, pool));
baton->do_exclude = do_exclude;
Modified: subversion/branches/patch-exec/subversion/svnfsfs/load-index-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svnfsfs/load-index-cmd.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svnfsfs/load-index-cmd.c (original)
+++ subversion/branches/patch-exec/subversion/svnfsfs/load-index-cmd.c Fri Sep 18 01:38:47 2015
@@ -54,13 +54,15 @@ str_to_item_type(unsigned *type,
_("Unknown item type '%s'"), str);
}
-/* Parse the hex string given as const char * at IDX in TOKENS and return
- * its value in *VALUE_P. Check for index overflows and non-hex chars.
+/* Parse the string given as const char * at IDX in TOKENS and return its
+ * value in *VALUE_P. Assume that the string an integer with base RADIX.
+ * Check for index overflows and non-hex chars.
*/
static svn_error_t *
token_to_i64(apr_int64_t *value_p,
apr_array_header_t *tokens,
- int idx)
+ int idx,
+ int radix)
{
const char *hex;
char *end;
@@ -75,7 +77,7 @@ token_to_i64(apr_int64_t *value_p,
/* hex -> int conversion */
hex = APR_ARRAY_IDX(tokens, idx, const char *);
- value = apr_strtoi64(hex, &end, 16);
+ value = apr_strtoi64(hex, &end, radix);
/* Has the whole token be parsed without error? */
if (errno || *end != '\0')
@@ -102,11 +104,13 @@ parse_index_line(svn_fs_fs__p2l_entry_t
apr_int64_t value;
/* Parse the hex columns. */
- SVN_ERR(token_to_i64(&value, tokens, 0));
+ SVN_ERR(token_to_i64(&value, tokens, 0, 16));
result->offset = (apr_off_t)value;
- SVN_ERR(token_to_i64(&value, tokens, 1));
+ SVN_ERR(token_to_i64(&value, tokens, 1, 16));
result->size = (apr_off_t)value;
- SVN_ERR(token_to_i64(&value, tokens, 4));
+
+ /* Parse the rightmost colum that we care of. */
+ SVN_ERR(token_to_i64(&value, tokens, 4, 10));
result->item.number = (apr_uint64_t)value;
/* We now know that there were at least 5 columns.
@@ -182,7 +186,7 @@ subcommand__load_index(apr_getopt_t *os,
svnfsfs__opt_state *opt_state = baton;
svn_stream_t *input;
- SVN_ERR(svn_stream_for_stdin(&input, pool));
+ SVN_ERR(svn_stream_for_stdin2(&input, TRUE, pool));
SVN_ERR(load_index(opt_state->repository_path, input, pool));
return SVN_NO_ERROR;
Modified: subversion/branches/patch-exec/subversion/svnfsfs/stats-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svnfsfs/stats-cmd.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svnfsfs/stats-cmd.c (original)
+++ subversion/branches/patch-exec/subversion/svnfsfs/stats-cmd.c Fri Sep 18 01:38:47 2015
@@ -20,6 +20,8 @@
* ====================================================================
*/
+#include <assert.h>
+
#include "svn_fs.h"
#include "svn_pools.h"
#include "svn_sorts.h"
@@ -47,10 +49,10 @@ print_two_power(int i,
*/
const char *si_prefixes = " kMGTPEZY";
- int number = (1 << (i % 10));
- int thousands = i / 10;
+ int number = (i >= 0) ? (1 << (i % 10)) : 0;
+ int thousands = (i >= 0) ? (i / 10) : 0;
- char si_prefix = ((thousands >= 0) && (thousands < strlen(si_prefixes)))
+ char si_prefix = (thousands < strlen(si_prefixes))
? si_prefixes[thousands]
: '?';
@@ -235,6 +237,10 @@ print_extensions_by_changes(svn_fs_fs__s
{
svn_fs_fs__extension_info_t *info
= APR_ARRAY_IDX(data, i, svn_fs_fs__extension_info_t *);
+
+ /* If there are elements, then their count cannot be 0. */
+ assert(stats->file_histogram.total.count);
+
sum += info->node_histogram.total.count;
printf(_("%11s %20s (%2d%%) representations\n"),
info->extension,
@@ -243,11 +249,28 @@ print_extensions_by_changes(svn_fs_fs__s
stats->file_histogram.total.count));
}
- printf(_("%11s %20s (%2d%%) representations\n"),
- "(others)",
- svn__ui64toa_sep(stats->file_histogram.total.count - sum, ',', pool),
- (int)((stats->file_histogram.total.count - sum) * 100 /
- stats->file_histogram.total.count));
+ if (stats->file_histogram.total.count)
+ {
+ printf(_("%11s %20s (%2d%%) representations\n"),
+ "(others)",
+ svn__ui64toa_sep(stats->file_histogram.total.count - sum, ',',
+ pool),
+ (int)((stats->file_histogram.total.count - sum) * 100 /
+ stats->file_histogram.total.count));
+ }
+}
+
+/* Calculate a percentage, handling edge cases. */
+static int
+get_percentage(apr_uint64_t part,
+ apr_uint64_t total)
+{
+ /* This include total == 0. */
+ if (part >= total)
+ return 100;
+
+ /* Standard case. */
+ return (int)(part * 100.0 / total);
}
/* Print the (up to) 16 extensions in STATS with the largest total size of
@@ -269,15 +292,20 @@ print_extensions_by_nodes(svn_fs_fs__sta
printf(_("%11s %20s (%2d%%) bytes\n"),
info->extension,
svn__ui64toa_sep(info->node_histogram.total.sum, ',', pool),
- (int)(info->node_histogram.total.sum * 100 /
- stats->file_histogram.total.sum));
+ get_percentage(info->node_histogram.total.sum,
+ stats->file_histogram.total.sum));
}
- printf(_("%11s %20s (%2d%%) bytes\n"),
- "(others)",
- svn__ui64toa_sep(stats->file_histogram.total.sum - sum, ',', pool),
- (int)((stats->file_histogram.total.sum - sum) * 100 /
- stats->file_histogram.total.sum));
+ if (stats->file_histogram.total.sum > sum)
+ {
+ /* Total sum can't be zero here. */
+ printf(_("%11s %20s (%2d%%) bytes\n"),
+ "(others)",
+ svn__ui64toa_sep(stats->file_histogram.total.sum - sum, ',',
+ pool),
+ get_percentage(stats->file_histogram.total.sum - sum,
+ stats->file_histogram.total.sum));
+ }
}
/* Print the (up to) 16 extensions in STATS with the largest total size of
@@ -299,16 +327,20 @@ print_extensions_by_reps(svn_fs_fs__stat
printf(_("%11s %20s (%2d%%) bytes\n"),
info->extension,
svn__ui64toa_sep(info->rep_histogram.total.sum, ',', pool),
- (int)(info->rep_histogram.total.sum * 100 /
- stats->rep_size_histogram.total.sum));
+ get_percentage(info->rep_histogram.total.sum,
+ stats->rep_size_histogram.total.sum));
}
- printf(_("%11s %20s (%2d%%) bytes\n"),
- "(others)",
- svn__ui64toa_sep(stats->rep_size_histogram.total.sum - sum, ',',
- pool),
- (int)((stats->rep_size_histogram.total.sum - sum) * 100 /
- stats->rep_size_histogram.total.sum));
+ if (stats->rep_size_histogram.total.sum > sum)
+ {
+ /* Total sum can't be zero here. */
+ printf(_("%11s %20s (%2d%%) bytes\n"),
+ "(others)",
+ svn__ui64toa_sep(stats->rep_size_histogram.total.sum - sum, ',',
+ pool),
+ get_percentage(stats->rep_size_histogram.total.sum - sum,
+ stats->rep_size_histogram.total.sum));
+ }
}
/* Print per-extension histograms for the most frequent extensions in STATS.
@@ -343,7 +375,7 @@ print_stats(svn_fs_fs__stats_t *stats,
apr_pool_t *pool)
{
/* print results */
- printf("\nGlobal statistics:\n");
+ printf("\n\nGlobal statistics:\n");
printf(_("%20s bytes in %12s revisions\n"
"%20s bytes in %12s changes\n"
"%20s bytes in %12s node revision records\n"
Modified: subversion/branches/patch-exec/subversion/svnmucc/svnmucc.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svnmucc/svnmucc.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svnmucc/svnmucc.c (original)
+++ subversion/branches/patch-exec/subversion/svnmucc/svnmucc.c Fri Sep 18 01:38:47 2015
@@ -193,7 +193,7 @@ execute(const apr_array_header_t *action
SVN_ERR(svn_stream_open_readonly(&src, action->path[1],
pool, iterpool));
else
- SVN_ERR(svn_stream_for_stdin(&src, pool));
+ SVN_ERR(svn_stream_for_stdin2(&src, TRUE, pool));
if (kind == svn_node_file)
Modified: subversion/branches/patch-exec/subversion/svnrdump/svnrdump.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svnrdump/svnrdump.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svnrdump/svnrdump.c (original)
+++ subversion/branches/patch-exec/subversion/svnrdump/svnrdump.c Fri Sep 18 01:38:47 2015
@@ -546,7 +546,6 @@ replay_revisions(svn_ra_session_t *sessi
#endif
}
- SVN_ERR(svn_stream_close(stdout_stream));
return SVN_NO_ERROR;
}
@@ -564,18 +563,14 @@ load_revisions(svn_ra_session_t *session
apr_hash_t *skip_revprops,
apr_pool_t *pool)
{
- apr_file_t *stdin_file;
svn_stream_t *stdin_stream;
- apr_file_open_stdin(&stdin_file, pool);
- stdin_stream = svn_stream_from_aprfile2(stdin_file, FALSE, pool);
+ SVN_ERR(svn_stream_for_stdin2(&stdin_stream, TRUE, pool));
SVN_ERR(svn_rdump__load_dumpstream(stdin_stream, session, aux_session,
quiet, skip_revprops,
check_cancel, NULL, pool));
- SVN_ERR(svn_stream_close(stdin_stream));
-
return SVN_NO_ERROR;
}
Modified: subversion/branches/patch-exec/subversion/svnserve/cyrus_auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/svnserve/cyrus_auth.c?rev=1703735&r1=1703734&r2=1703735&view=diff
==============================================================================
--- subversion/branches/patch-exec/subversion/svnserve/cyrus_auth.c (original)
+++ subversion/branches/patch-exec/subversion/svnserve/cyrus_auth.c Fri Sep 18 01:38:47 2015
@@ -199,7 +199,7 @@ static svn_error_t *try_auth(svn_ra_svn_
while (result == SASL_CONTINUE)
{
- svn_ra_svn_item_t *item;
+ svn_ra_svn__item_t *item;
arg = svn_string_ncreate(out, outlen, pool);
/* Encode what we send to the client. */
@@ -213,7 +213,7 @@ static svn_error_t *try_auth(svn_ra_svn_
if (item->kind != SVN_RA_SVN_STRING)
return SVN_NO_ERROR;
- in = item->u.string;
+ in = &item->u.string;
if (use_base64)
in = svn_base64_decode_string(in, pool);