3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
20 * ====================================================================
23 * @file svn_opt_private.h
24 * @brief Subversion-internal option parsing APIs.
27 #ifndef SVN_OPT_PRIVATE_H
28 #define SVN_OPT_PRIVATE_H
30 #include <apr_pools.h>
31 #include <apr_tables.h>
32 #include <apr_getopt.h>
34 #include "svn_error.h"
38 #endif /* __cplusplus */
40 /* Extract the peg revision, if any, from UTF8_TARGET.
42 * If PEG_REVISION is not NULL, return the peg revision in *PEG_REVISION.
43 * *PEG_REVISION will be an empty string if no peg revision is found.
44 * Return the true target portion in *TRUE_TARGET.
46 * UTF8_TARGET need not be canonical. *TRUE_TARGET will not be canonical
47 * unless UTF8_TARGET is.
49 * It is an error if *TRUE_TARGET results in the empty string after the
50 * split, which happens in case UTF8_TARGET has a leading '@' character
51 * with no additional '@' characters to escape the first '@'.
53 * Note that *PEG_REVISION will still contain the '@' symbol as the first
54 * character if a peg revision was found. If a trailing '@' symbol was
55 * used to escape other '@' characters in UTF8_TARGET, *PEG_REVISION will
56 * point to the string "@", containing only a single character.
58 * All allocations are done in POOL.
61 svn_opt__split_arg_at_peg_revision(const char **true_target,
62 const char **peg_revision,
63 const char *utf8_target,
66 /* Attempt to transform URL_IN, which is a URL-like user input, into a
68 * - escape IRI characters and some other non-URI characters
69 * - check that no back-path ("..") components are present
70 * - call svn_uri_canonicalize()
71 * URL_IN is in UTF-8 encoding and has no peg revision specifier.
72 * Set *URL_OUT to the result, allocated from POOL.
75 svn_opt__arg_canonicalize_url(const char **url_out,
80 * Attempt to transform PATH_IN, which is a local path-like user input, into a
82 * - Attempt to get the correct capitalization by trying to actually find
84 * - If the path does not exist (which is valid) the given capitalization
86 * - canonicalize the separator ("/") characters
87 * - call svn_dirent_canonicalize()
88 * PATH_IN is in UTF-8 encoding and has no peg revision specifier.
89 * Set *PATH_OUT to the result, allocated from POOL.
92 svn_opt__arg_canonicalize_path(const char **path_out,
97 * Pull remaining target arguments from OS into *TARGETS_P,
98 * converting them to UTF-8, followed by targets from KNOWN_TARGETS
99 * (which might come from, for example, the "--targets" command line
100 * option), which are already in UTF-8.
102 * On each URL target, do some IRI-to-URI encoding and some
103 * auto-escaping. On each local path, canonicalize case and path
106 * Allocate *TARGETS_P and its elements in POOL.
108 * If a path has the same name as a Subversion working copy
109 * administrative directory, return SVN_ERR_RESERVED_FILENAME_SPECIFIED;
110 * if multiple reserved paths are encountered, return a chain of
111 * errors, all of which are SVN_ERR_RESERVED_FILENAME_SPECIFIED. Do
112 * not return this type of error in a chain with any other type of
113 * error, and if this is the only type of error encountered, complete
114 * the operation before returning the error(s).
117 svn_opt__args_to_target_array(apr_array_header_t **targets_p,
119 const apr_array_header_t *known_targets,
123 * Return a human-readable description of @a revision. The result
124 * will be allocated statically or from @a result_pool.
129 svn_opt__revision_to_string(const svn_opt_revision_t *revision,
130 apr_pool_t *result_pool);
133 * Create a revision range structure from two revisions. Return a new range
134 * allocated in @a result_pool with the start and end initialized to
135 * (deep copies of) @a *start_revision and @a *end_revision.
137 svn_opt_revision_range_t *
138 svn_opt__revision_range_create(const svn_opt_revision_t *start_revision,
139 const svn_opt_revision_t *end_revision,
140 apr_pool_t *result_pool);
143 * Create a revision range structure from two revnums. Return a new range
144 * allocated in @a result_pool with the start and end kinds initialized to
145 * #svn_opt_revision_number and values @a start_revnum and @a end_revnum.
147 svn_opt_revision_range_t *
148 svn_opt__revision_range_from_revnums(svn_revnum_t start_revnum,
149 svn_revnum_t end_revnum,
150 apr_pool_t *result_pool);
154 #endif /* __cplusplus */
156 #endif /* SVN_OPT_PRIVATE_H */