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 * Note that *PEG_REVISION will still contain the '@' symbol as the first
50 * character if a peg revision was found. If a trailing '@' symbol was
51 * used to escape other '@' characters in UTF8_TARGET, *PEG_REVISION will
52 * point to the string "@", containing only a single character.
54 * All allocations are done in POOL.
57 svn_opt__split_arg_at_peg_revision(const char **true_target,
58 const char **peg_revision,
59 const char *utf8_target,
62 /* Attempt to transform URL_IN, which is a URL-like user input, into a
64 * - escape IRI characters and some other non-URI characters
65 * - check that no back-path ("..") components are present
66 * - call svn_uri_canonicalize()
67 * URL_IN is in UTF-8 encoding and has no peg revision specifier.
68 * Set *URL_OUT to the result, allocated from POOL.
71 svn_opt__arg_canonicalize_url(const char **url_out,
76 * Attempt to transform PATH_IN, which is a local path-like user input, into a
78 * - Attempt to get the correct capitalization by trying to actually find
80 * - If the path does not exist (which is valid) the given capitalization
82 * - canonicalize the separator ("/") characters
83 * - call svn_dirent_canonicalize()
84 * PATH_IN is in UTF-8 encoding and has no peg revision specifier.
85 * Set *PATH_OUT to the result, allocated from POOL.
88 svn_opt__arg_canonicalize_path(const char **path_out,
93 * Pull remaining target arguments from OS into *TARGETS_P,
94 * converting them to UTF-8, followed by targets from KNOWN_TARGETS
95 * (which might come from, for example, the "--targets" command line
96 * option), which are already in UTF-8.
98 * On each URL target, do some IRI-to-URI encoding and some
99 * auto-escaping. On each local path, canonicalize case and path
102 * Allocate *TARGETS_P and its elements in POOL.
104 * If a path has the same name as a Subversion working copy
105 * administrative directory, return SVN_ERR_RESERVED_FILENAME_SPECIFIED;
106 * if multiple reserved paths are encountered, return a chain of
107 * errors, all of which are SVN_ERR_RESERVED_FILENAME_SPECIFIED. Do
108 * not return this type of error in a chain with any other type of
109 * error, and if this is the only type of error encountered, complete
110 * the operation before returning the error(s).
113 svn_opt__args_to_target_array(apr_array_header_t **targets_p,
115 const apr_array_header_t *known_targets,
119 * Return a human-readable description of @a revision. The result
120 * will be allocated statically or from @a result_pool.
125 svn_opt__revision_to_string(const svn_opt_revision_t *revision,
126 apr_pool_t *result_pool);
129 * Create a revision range structure from two revisions. Return a new range
130 * allocated in @a result_pool with the start and end initialized to
131 * (deep copies of) @a *start_revision and @a *end_revision.
133 svn_opt_revision_range_t *
134 svn_opt__revision_range_create(const svn_opt_revision_t *start_revision,
135 const svn_opt_revision_t *end_revision,
136 apr_pool_t *result_pool);
139 * Create a revision range structure from two revnums. Return a new range
140 * allocated in @a result_pool with the start and end kinds initialized to
141 * #svn_opt_revision_number and values @a start_revnum and @a end_revnum.
143 svn_opt_revision_range_t *
144 svn_opt__revision_range_from_revnums(svn_revnum_t start_revnum,
145 svn_revnum_t end_revnum,
146 apr_pool_t *result_pool);
150 #endif /* __cplusplus */
152 #endif /* SVN_OPT_PRIVATE_H */