2 * cl.h: shared stuff in the command line program
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
21 * ====================================================================
24 /* ==================================================================== */
33 #include <apr_tables.h>
35 #include "svn_client.h"
39 #endif /* __cplusplus */
42 /*** Command dispatch. ***/
44 /* Hold results of option processing that are shared by multiple
46 typedef struct svn_cl__opt_state_t
48 /* An array of svn_opt_revision_range_t *'s representing revisions
49 ranges indicated on the command-line via the -r and -c options.
50 For each range in the list, if only one revision was provided
51 (-rN), its 'end' member remains 'svn_opt_revision_unspecified'.
52 This array always has at least one element, even if that is a
53 null range in which both ends are 'svn_opt_revision_unspecified'. */
54 apr_array_header_t *revision_ranges;
56 /* These are simply a copy of the range start and end values present
57 in the first item of the revision_ranges list. */
58 svn_opt_revision_t start_revision;
59 svn_opt_revision_t end_revision;
61 /* Flag which is only set if the '-c' option was used. */
62 svn_boolean_t used_change_arg;
64 /* Flag which is only set if the '-r' option was used. */
65 svn_boolean_t used_revision_arg;
67 /* Max number of log messages to get back from svn_client_log2. */
70 /* After option processing is done, reflects the switch actually
71 given on the command line, or svn_depth_unknown if none. */
74 svn_boolean_t quiet; /* sssh...avoid unnecessary output */
75 svn_boolean_t non_interactive; /* do no interactive prompting */
76 svn_boolean_t version; /* print version information */
77 svn_boolean_t verbose; /* be verbose */
78 svn_boolean_t strict; /* do strictly what was requested */
79 const char *encoding; /* the locale/encoding of the data*/
80 svn_boolean_t help; /* print usage message */
81 const char *auth_username; /* auth username */ /* UTF-8! */
82 const char *auth_password; /* auth password */ /* UTF-8! */
83 apr_array_header_t *targets; /* target list from file */ /* UTF-8! */
84 svn_boolean_t no_auth_cache; /* do not cache authentication information */
85 svn_boolean_t stop_on_copy; /* don't cross copies during processing */
86 const char *config_dir; /* over-riding configuration directory */
87 apr_array_header_t *config_options; /* over-riding configuration options */
88 svn_boolean_t all_revprops; /* retrieve all revprops */
89 svn_boolean_t no_revprops; /* retrieve no revprops */
90 apr_hash_t *revprop_table; /* table of revision properties to get/set */
91 svn_boolean_t use_merge_history; /* use/display extra merge information */
92 /* trust server SSL certs that would otherwise be rejected as "untrusted" */
93 svn_boolean_t trust_server_cert_unknown_ca;
94 svn_boolean_t trust_server_cert_cn_mismatch;
95 svn_boolean_t trust_server_cert_expired;
96 svn_boolean_t trust_server_cert_not_yet_valid;
97 svn_boolean_t trust_server_cert_other_failure;
98 apr_array_header_t* search_patterns; /* pattern arguments for --search */
99 } svn_cl__opt_state_t;
102 typedef struct svn_cl__cmd_baton_t
104 svn_cl__opt_state_t *opt_state;
105 svn_client_ctx_t *ctx;
106 } svn_cl__cmd_baton_t;
109 /* Declare all the command procedures */
119 /* See definition in main.c for documentation. */
120 extern const svn_opt_subcommand_desc2_t svn_cl__cmd_table[];
122 /* See definition in main.c for documentation. */
123 extern const int svn_cl__global_options[];
125 /* See definition in main.c for documentation. */
126 extern const apr_getopt_option_t svn_cl__options[];
129 /* A helper for the many subcommands that wish to merely warn when
130 * invoked on an unversioned, nonexistent, or otherwise innocuously
131 * errorful resource. Meant to be wrapped with SVN_ERR().
133 * If ERR is null, return SVN_NO_ERROR.
135 * Else if ERR->apr_err is one of the error codes supplied in varargs,
136 * then handle ERR as a warning (unless QUIET is true), clear ERR, and
137 * return SVN_NO_ERROR, and push the value of ERR->apr_err into the
138 * ERRORS_SEEN array, if ERRORS_SEEN is not NULL.
142 * Typically, error codes like SVN_ERR_UNVERSIONED_RESOURCE,
143 * SVN_ERR_ENTRY_NOT_FOUND, etc, are supplied in varargs. Don't
144 * forget to terminate the argument list with 0 (or APR_SUCCESS).
147 svn_cl__try(svn_error_t *err,
148 apr_array_header_t *errors_seen,
153 /* Our cancellation callback. */
154 extern svn_cancel_func_t svn_cl__check_cancel;
158 /*** Notification functions to display results on the terminal. */
160 /* Set *NOTIFY_FUNC_P and *NOTIFY_BATON_P to a notifier/baton for all
161 * operations, allocated in POOL.
164 svn_cl__get_notifier(svn_wc_notify_func2_t *notify_func_p,
165 void **notify_baton_p,
168 /* Make the notifier for use with BATON print the appropriate summary
169 * line at the end of the output.
172 svn_cl__notifier_mark_export(void *baton);
174 /* Like svn_client_args_to_target_array() but, if the only error is that some
175 * arguments are reserved file names, then print warning messages for those
176 * targets, store the rest of the targets in TARGETS_P and return success. */
178 svn_cl__args_to_target_array_print_reserved(apr_array_header_t **targets_p,
180 const apr_array_header_t *known_targets,
181 svn_client_ctx_t *ctx,
182 svn_boolean_t keep_dest_origpath_on_truepath_collision,
185 /* Return an error if TARGET is a URL; otherwise return SVN_NO_ERROR. */
187 svn_cl__check_target_is_local_path(const char *target);
189 /* Return a copy of PATH, converted to the local path style, skipping
190 * PARENT_PATH if it is non-null and is a parent of or equal to PATH.
192 * This function assumes PARENT_PATH and PATH are both absolute "dirents"
193 * or both relative "dirents". */
195 svn_cl__local_style_skip_ancestor(const char *parent_path,
201 #endif /* __cplusplus */
203 #endif /* SVN_CL_H */