This patch is a followup of the following thread. All tests pass with
this patch.
http://svn.haxx.se/dev/archive-2011-01/0210.shtml
Log
[[[
Make svn 'add' command to return 1 when one or more targets fail. Also
print error message at the end.
* subversion/svn/add-cmd.c
(svn_cl__add): If one or more target fails to get processed then print
error message at end of command execution. Also return 1 to shell.
Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
]]]
Index: subversion/svn/add-cmd.c
===================================================================
--- subversion/svn/add-cmd.c (revision 1060693)
+++ subversion/svn/add-cmd.c (working copy)
@@ -51,6 +51,7 @@
apr_array_header_t *targets;
int i;
apr_pool_t *iterpool;
+ svn_boolean_t saw_a_problem = FALSE;
SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
opt_state->targets,
@@ -79,6 +80,7 @@
for (i = 0; i < targets->nelts; i++)
{
const char *target = APR_ARRAY_IDX(targets, i, const char *);
+ svn_boolean_t success;
svn_pool_clear(iterpool);
SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
@@ -87,12 +89,19 @@
opt_state->depth,
opt_state->force, opt_state->no_ignore,
opt_state->parents, ctx, iterpool),
- NULL, opt_state->quiet,
+ &success, opt_state->quiet,
SVN_ERR_ENTRY_EXISTS,
SVN_ERR_WC_PATH_NOT_FOUND,
SVN_NO_ERROR));
+
+ if (! success)
+ saw_a_problem = TRUE;
}
svn_pool_destroy(iterpool);
- return SVN_NO_ERROR;
+
+ if (saw_a_problem)
+ return svn_error_create(SVN_ERR_BASE, NULL, NULL);
+ else
+ return SVN_NO_ERROR;
}
Received on 2011-01-20 12:21:47 CET