summaryrefslogtreecommitdiff
path: root/subversion/svn/unlock-cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/svn/unlock-cmd.c')
-rw-r--r--subversion/svn/unlock-cmd.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/subversion/svn/unlock-cmd.c b/subversion/svn/unlock-cmd.c
index 0f94d2a2201f..3818d1f2450b 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;
}