diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
commit | cf46733632c7279a9fd0fe6ce26f9185a4ae82a9 (patch) | |
tree | da27775a2161723ef342e91af41a8b51fedef405 /subversion/svn/unlock-cmd.c | |
parent | bb0ef45f7c46b0ae221b26265ef98a768c33f820 (diff) | |
download | subversion-tarball-master.tar.gz |
subversion-1.9.7HEADsubversion-1.9.7master
Diffstat (limited to 'subversion/svn/unlock-cmd.c')
-rw-r--r-- | subversion/svn/unlock-cmd.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/subversion/svn/unlock-cmd.c b/subversion/svn/unlock-cmd.c index 0f94d2a..3818d1f 100644 --- a/subversion/svn/unlock-cmd.c +++ b/subversion/svn/unlock-cmd.c @@ -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; } |