cl.h revision 362181
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 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 38extern "C" { 39#endif /* __cplusplus */ 40 41 42/*** Command dispatch. ***/ 43 44/* Hold results of option processing that are shared by multiple 45 commands. */ 46typedef 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 apr_array_header_t* search_patterns; /* pattern arguments for --search */ 99} svn_cl__opt_state_t; 100 101 102typedef struct svn_cl__cmd_baton_t 103{ 104 svn_cl__opt_state_t *opt_state; 105 svn_client_ctx_t *ctx; 106} svn_cl__cmd_baton_t; 107 108 109/* Declare all the command procedures */ 110svn_opt_subcommand_t 111 svn_cl__help, 112 svn_cl__null_blame, 113 svn_cl__null_export, 114 svn_cl__null_list, 115 svn_cl__null_log, 116 svn_cl__null_info; 117 118 119/* See definition in main.c for documentation. */ 120extern const svn_opt_subcommand_desc3_t svn_cl__cmd_table[]; 121 122/* See definition in main.c for documentation. */ 123extern const int svn_cl__global_options[]; 124 125/* See definition in main.c for documentation. */ 126extern const apr_getopt_option_t svn_cl__options[]; 127 128 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(). 132 * 133 * If ERR is null, return SVN_NO_ERROR. 134 * 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. 139 * 140 * Else return ERR. 141 * 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). 145 */ 146svn_error_t * 147svn_cl__try(svn_error_t *err, 148 apr_array_header_t *errors_seen, 149 svn_boolean_t quiet, 150 ...); 151 152 153/* Our cancellation callback. */ 154extern svn_cancel_func_t svn_cl__check_cancel; 155 156 157 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 */ 163svn_error_t * 164svn_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 */ 171svn_error_t * 172svn_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. */ 177svn_error_t * 178svn_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. */ 186svn_error_t * 187svn_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". */ 194const char * 195svn_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 */ 204