Index: subversion/include/svn_client.h =================================================================== --- subversion/include/svn_client.h (revision 7591) +++ subversion/include/svn_client.h (working copy) @@ -918,6 +918,23 @@ apr_pool_t *pool); +/** Restore the pristine version of each working copy named in @a paths, + * effectively undoing any local mods. This is equivalent to calling + * svn_client_revert once for each path, except that (1) it may be faster + * because it avoids redundant sleeping and (2) nonexistent paths + * will not cause an error to be returned -- instead a warning + * will be issued via @a svn_handle_warning if @a + * warn_on_nonexistence is true, or the problem will be completely + * ignored if not. + */ +svn_error_t * +svn_client_revert_list (apr_array_header_t *paths, + svn_boolean_t recursive, + svn_client_ctx_t *ctx, + svn_boolean_t warn_on_nonexistence, + apr_pool_t *pool); + + /** Remove the 'conflicted' state on a working copy @a path. This will * not semantically resolve conflicts; it just allows @a path to be * committed in the future. The implementation details are opaque. Index: subversion/libsvn_client/revert.c =================================================================== --- subversion/libsvn_client/revert.c (revision 7591) +++ subversion/libsvn_client/revert.c (working copy) @@ -36,11 +36,11 @@ /*** Code. ***/ -svn_error_t * -svn_client_revert (const char *path, - svn_boolean_t recursive, - svn_client_ctx_t *ctx, - apr_pool_t *pool) +static svn_error_t * +revert_1 (const char *path, + svn_boolean_t recursive, + svn_client_ctx_t *ctx, + apr_pool_t *pool) { svn_wc_adm_access_t *adm_access; svn_boolean_t wc_root; @@ -107,9 +107,64 @@ out: SVN_ERR (svn_wc_adm_close (adm_access)); + return err; +} +svn_error_t * +svn_client_revert (const char *path, + svn_boolean_t recursive, + svn_client_ctx_t *ctx, + apr_pool_t *pool) +{ + svn_error_t * err = revert_1 (path, recursive, ctx, pool); + /* Sleep to ensure timestamp integrity. */ svn_sleep_for_timestamps (); return err; } + +svn_error_t * +svn_client_revert_list (apr_array_header_t *paths, + svn_boolean_t recursive, + svn_client_ctx_t *ctx, + svn_boolean_t warn_on_nonexistence, + apr_pool_t *pool) +{ + int i; + svn_error_t * err = SVN_NO_ERROR; + apr_pool_t *subpool = svn_pool_create (pool); + + for (i = 0; i < paths->nelts; i++) + { + const char *path = ((const char **) (paths->elts))[i]; + + svn_pool_clear (subpool); + + err = revert_1 (path, recursive, ctx, subpool); + if (err == SVN_NO_ERROR) + err = ctx->cancel_func (ctx->cancel_baton); + if (err) + { + if (err->apr_err != SVN_ERR_ENTRY_NOT_FOUND) + goto out; + if (ctx->notify_func) + ctx->notify_func (ctx->notify_baton, path, + svn_wc_notify_skip, + svn_node_none, NULL, + svn_wc_notify_state_missing, + svn_wc_notify_state_missing, + SVN_INVALID_REVNUM); + svn_error_clear (err); + err = SVN_NO_ERROR; + } + } + + out: + + svn_pool_destroy (subpool); + + /* Sleep to ensure timestamp integrity. */ + svn_sleep_for_timestamps (); + return err; +} Index: subversion/clients/cmdline/revert-cmd.c =================================================================== --- subversion/clients/cmdline/revert-cmd.c (revision 7591) +++ subversion/clients/cmdline/revert-cmd.c (working copy) @@ -60,31 +60,6 @@ svn_cl__get_notifier (&ctx->notify_func, &ctx->notify_baton, FALSE, FALSE, FALSE, pool); - subpool = svn_pool_create (pool); - for (i = 0; i < targets->nelts; i++) - { - const char *target = ((const char **) (targets->elts))[i]; - svn_error_t *err; - - err = svn_client_revert (target, recursive, ctx, subpool); - if (err) - { - if (err->apr_err == SVN_ERR_ENTRY_NOT_FOUND) - { - if (!opt_state->quiet) - { - svn_handle_warning (stderr, err); - } - continue; - } - else - return err; - } - - SVN_ERR (svn_cl__check_cancel (ctx->cancel_baton)); - svn_pool_clear (subpool); - } - - svn_pool_destroy (subpool); - return SVN_NO_ERROR; + return svn_client_revert_list(targets, recursive, ctx, + !opt_state->quiet, pool); }