2 * commit-cmd.c -- Check changes into the repository.
4 * ====================================================================
5 * Copyright (c) 2000-2007 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 <apr_general.h>
27 #include "svn_error.h"
28 #include "svn_error_codes.h"
30 #include "svn_client.h"
32 #include "svn_error.h"
33 #include "svn_config.h"
38 /* This implements the `svn_opt_subcommand_t' interface. */
40 svn_cl__commit(apr_getopt_t
*os
,
45 svn_cl__opt_state_t
*opt_state
= ((svn_cl__cmd_baton_t
*) baton
)->opt_state
;
46 svn_client_ctx_t
*ctx
= ((svn_cl__cmd_baton_t
*) baton
)->ctx
;
47 apr_array_header_t
*targets
;
48 apr_array_header_t
*condensed_targets
;
51 svn_boolean_t no_unlock
= FALSE
;
52 svn_commit_info_t
*commit_info
= NULL
;
54 SVN_ERR(svn_opt_args_to_target_array2(&targets
, os
,
55 opt_state
->targets
, pool
));
57 /* Add "." if user passed 0 arguments. */
58 svn_opt_push_implicit_dot_target(targets
, pool
);
60 /* Condense the targets (like commit does)... */
61 SVN_ERR(svn_path_condense_targets(&base_dir
,
67 if ((! condensed_targets
) || (! condensed_targets
->nelts
))
69 const char *parent_dir
, *base_name
;
71 SVN_ERR(svn_wc_get_actual_target(base_dir
, &parent_dir
,
74 base_dir
= apr_pstrdup(pool
, parent_dir
);
77 if (! opt_state
->quiet
)
78 svn_cl__get_notifier(&ctx
->notify_func2
, &ctx
->notify_baton2
, FALSE
,
81 if (opt_state
->depth
== svn_depth_unknown
)
82 opt_state
->depth
= svn_depth_infinity
;
84 cfg
= apr_hash_get(ctx
->config
, SVN_CONFIG_CATEGORY_CONFIG
,
87 SVN_ERR(svn_config_get_bool(cfg
, &no_unlock
,
88 SVN_CONFIG_SECTION_MISCELLANY
,
89 SVN_CONFIG_OPTION_NO_UNLOCK
, FALSE
));
91 /* We're creating a new log message baton because we can use our base_dir
92 to store the temp file, instead of the current working directory. The
93 client might not have write access to their working directory, but they
94 better have write access to the directory they're committing. */
95 SVN_ERR(svn_cl__make_log_msg_baton(&(ctx
->log_msg_baton3
),
99 ctx
->revprop_table
= opt_state
->revprop_table
;
102 err
= svn_client_commit4(&commit_info
,
106 opt_state
->keep_changelist
,
107 opt_state
->changelist
,
112 svn_error_t
*root_err
= svn_error_root_cause(err
);
113 if (root_err
->apr_err
== SVN_ERR_UNKNOWN_CHANGELIST
)
115 /* Strip any errors wrapped around this root cause. Note
116 that this handling differs from that of any other
117 commands, because of the way 'commit' internally harvests
118 its list of committables. */
119 root_err
= svn_error_dup(root_err
);
120 svn_error_clear(err
);
124 SVN_ERR(svn_cl__cleanup_log_msg(ctx
->log_msg_baton3
, err
));
125 if (! err
&& ! opt_state
->quiet
)
126 SVN_ERR(svn_cl__print_commit_info(commit_info
, pool
));