2 * move-cmd.c -- Subversion move command
4 * ====================================================================
5 * Copyright (c) 2000-2006 CollabNet. All rights reserved.
7 * This software is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at http://subversion.tigris.org/license-1.html.
10 * If newer versions of this license are posted there, you may use a
11 * newer version instead, at your option.
13 * This software consists of voluntary contributions made by many
14 * individuals. For exact contribution history, see the revision
15 * history and logs, available at http://subversion.tigris.org/.
16 * ====================================================================
19 /* ==================================================================== */
25 #include "svn_client.h"
26 #include "svn_error.h"
30 #include "svn_private_config.h"
36 /* This implements the `svn_opt_subcommand_t' interface. */
38 svn_cl__move(apr_getopt_t
*os
,
42 svn_cl__opt_state_t
*opt_state
= ((svn_cl__cmd_baton_t
*) baton
)->opt_state
;
43 svn_client_ctx_t
*ctx
= ((svn_cl__cmd_baton_t
*) baton
)->ctx
;
44 apr_array_header_t
*targets
;
46 svn_commit_info_t
*commit_info
= NULL
;
49 SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets
, os
,
53 if (targets
->nelts
< 2)
54 return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS
, 0, NULL
);
56 if (opt_state
->start_revision
.kind
!= svn_opt_revision_unspecified
57 && opt_state
->start_revision
.kind
!= svn_opt_revision_head
)
59 return svn_error_create
60 (SVN_ERR_UNSUPPORTED_FEATURE
, NULL
,
61 _("Cannot specify revisions (except HEAD) with move operations"));
64 if (! opt_state
->quiet
)
65 svn_cl__get_notifier(&ctx
->notify_func2
, &ctx
->notify_baton2
, FALSE
,
68 dst_path
= APR_ARRAY_IDX(targets
, targets
->nelts
- 1, const char *);
69 apr_array_pop(targets
);
71 if (! svn_path_is_url(dst_path
))
73 ctx
->log_msg_func3
= NULL
;
74 if (opt_state
->message
|| opt_state
->filedata
|| opt_state
->revprop_table
)
75 return svn_error_create
76 (SVN_ERR_CL_UNNECESSARY_LOG_MESSAGE
, NULL
,
77 _("Local, non-commit operations do not take a log message "
78 "or revision properties"));
81 if (ctx
->log_msg_func3
)
82 SVN_ERR(svn_cl__make_log_msg_baton(&(ctx
->log_msg_baton3
), opt_state
,
83 NULL
, ctx
->config
, pool
));
85 ctx
->revprop_table
= opt_state
->revprop_table
;
87 err
= svn_client_move5(&commit_info
, targets
, dst_path
, opt_state
->force
,
88 TRUE
, opt_state
->parents
, ctx
, pool
);
91 err
= svn_cl__may_need_force(err
);
93 if (ctx
->log_msg_func3
)
94 SVN_ERR(svn_cl__cleanup_log_msg(ctx
->log_msg_baton3
, err
));
98 if (commit_info
&& ! opt_state
->quiet
)
99 SVN_ERR(svn_cl__print_commit_info(commit_info
, pool
));