]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/svnbench/cl.h
MFC r275385 (by bapt):
[FreeBSD/stable/10.git] / contrib / subversion / subversion / svnbench / cl.h
1 /*
2  * cl.h:  shared stuff in the command line program
3  *
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
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
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
20  *    under the License.
21  * ====================================================================
22  */
23
24 /* ==================================================================== */
25
26
27 \f
28 #ifndef SVN_CL_H
29 #define SVN_CL_H
30
31 /*** Includes. ***/
32
33 #include <apr_tables.h>
34
35 #include "svn_client.h"
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
40
41 \f
42 /*** Command dispatch. ***/
43
44 /* Hold results of option processing that are shared by multiple
45    commands. */
46 typedef struct svn_cl__opt_state_t
47 {
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;
55
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;
60
61   /* Flag which is only set if the '-c' option was used. */
62   svn_boolean_t used_change_arg;
63
64   /* Flag which is only set if the '-r' option was used. */
65   svn_boolean_t used_revision_arg;
66
67   /* Max number of log messages to get back from svn_client_log2. */
68   int limit;
69
70   /* After option processing is done, reflects the switch actually
71      given on the command line, or svn_depth_unknown if none. */
72   svn_depth_t depth;
73
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 } svn_cl__opt_state_t;
99
100
101 typedef struct svn_cl__cmd_baton_t
102 {
103   svn_cl__opt_state_t *opt_state;
104   svn_client_ctx_t *ctx;
105 } svn_cl__cmd_baton_t;
106
107
108 /* Declare all the command procedures */
109 svn_opt_subcommand_t
110   svn_cl__help,
111   svn_cl__null_blame,
112   svn_cl__null_export,
113   svn_cl__null_list,
114   svn_cl__null_log,
115   svn_cl__null_info;
116
117
118 /* See definition in main.c for documentation. */
119 extern const svn_opt_subcommand_desc2_t svn_cl__cmd_table[];
120
121 /* See definition in main.c for documentation. */
122 extern const int svn_cl__global_options[];
123
124 /* See definition in main.c for documentation. */
125 extern const apr_getopt_option_t svn_cl__options[];
126
127 \f
128 /* A helper for the many subcommands that wish to merely warn when
129  * invoked on an unversioned, nonexistent, or otherwise innocuously
130  * errorful resource.  Meant to be wrapped with SVN_ERR().
131  *
132  * If ERR is null, return SVN_NO_ERROR.
133  *
134  * Else if ERR->apr_err is one of the error codes supplied in varargs,
135  * then handle ERR as a warning (unless QUIET is true), clear ERR, and
136  * return SVN_NO_ERROR, and push the value of ERR->apr_err into the
137  * ERRORS_SEEN array, if ERRORS_SEEN is not NULL.
138  *
139  * Else return ERR.
140  *
141  * Typically, error codes like SVN_ERR_UNVERSIONED_RESOURCE,
142  * SVN_ERR_ENTRY_NOT_FOUND, etc, are supplied in varargs.  Don't
143  * forget to terminate the argument list with 0 (or APR_SUCCESS).
144  */
145 svn_error_t *
146 svn_cl__try(svn_error_t *err,
147             apr_array_header_t *errors_seen,
148             svn_boolean_t quiet,
149             ...);
150
151 \f
152 /* Our cancellation callback. */
153 svn_error_t *
154 svn_cl__check_cancel(void *baton);
155
156
157 \f
158 /*** Notification functions to display results on the terminal. */
159
160 /* Set *NOTIFY_FUNC_P and *NOTIFY_BATON_P to a notifier/baton for all
161  * operations, allocated in POOL.
162  */
163 svn_error_t *
164 svn_cl__get_notifier(svn_wc_notify_func2_t *notify_func_p,
165                      void **notify_baton_p,
166                      apr_pool_t *pool);
167
168 /* Make the notifier for use with BATON print the appropriate summary
169  * line at the end of the output.
170  */
171 svn_error_t *
172 svn_cl__notifier_mark_export(void *baton);
173
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. */
177 svn_error_t *
178 svn_cl__args_to_target_array_print_reserved(apr_array_header_t **targets_p,
179                                             apr_getopt_t *os,
180                                             const apr_array_header_t *known_targets,
181                                             svn_client_ctx_t *ctx,
182                                             svn_boolean_t keep_dest_origpath_on_truepath_collision,
183                                             apr_pool_t *pool);
184
185 /* Return an error if TARGET is a URL; otherwise return SVN_NO_ERROR. */
186 svn_error_t *
187 svn_cl__check_target_is_local_path(const char *target);
188
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.
191  *
192  * This function assumes PARENT_PATH and PATH are both absolute "dirents"
193  * or both relative "dirents". */
194 const char *
195 svn_cl__local_style_skip_ancestor(const char *parent_path,
196                                   const char *path,
197                                   apr_pool_t *pool);
198
199 #ifdef __cplusplus
200 }
201 #endif /* __cplusplus */
202
203 #endif /* SVN_CL_H */