Add a subversion 1.7 compatibility module
[svnrdump.git] / svn17_compat.h
blob2c48cd64a70007299734ea55e51c5ecd0fdfcb98
1 /**
2 * @copyright
3 * ====================================================================
4 * This file is derived from code licensed to the Apache
5 * Software Foundation (ASF) under one or more contributor
6 * license agreements. See the NOTICE file distributed with
7 * this file for additional information regarding copyright
8 * ownership. The ASF licenses those portions to you under
9 * the Apache License, Version 2.0 (the "License"); you may
10 * not use those portions except in compliance with the
11 * 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
20 * under the License.
22 * Any code in this file not licensed from the ASF is
23 * original code in the public domain. You may freely use,
24 * modify, distribute, and relicense such code.
25 * ====================================================================
26 * @endcopyright
28 * @file compat.h
29 * @brief SVN 1.7 compatibility routines.
32 #ifndef SVN17_COMPAT_H
33 #define SVN17_COMPAT_H
35 #include <apr.h>
36 #include <apr_pools.h>
38 #include <svn_types.h>
40 /** Join a valid base uri (@a base) with a relative path or uri
41 * (@a component), allocating the result in @a pool. @a component need
42 * not be a single component: it can be a relative path or a '/'
43 * prefixed relative path to join component to the root path of @a base.
45 * If @a component is the empty path, then @a base will be copied and
46 * returned.
48 * If the @a component is an absolute uri, then it is copied and returned.
50 * If @a component starts with a '/' and @a base contains a scheme, the
51 * scheme defined joining rules are applied.
53 * From svn_dirent_uri.h.
55 char *
56 svn_uri_join(const char *base,
57 const char *component,
58 apr_pool_t *pool);
60 /** Get the basename of the specified canonicalized @a relpath. The
61 * basename is defined as the last component of the relpath. If the @a
62 * relpath has only one component then that is returned. The returned
63 * value will have no slashes in it.
65 * Example: svn_relpath_basename("/trunk/foo/bar") -> "bar"
67 * The returned basename will be allocated in @a pool. If @a
68 * pool is NULL a pointer to the basename in @a relpath is returned.
70 * @note If an empty string is passed, then an empty string will be returned.
72 * From svn_dirent_uri.h.
74 const char *
75 svn_relpath_basename(const char *uri,
76 apr_pool_t *pool);
78 /** Gets the name of the specified canonicalized @a dirent as it is known
79 * within its parent directory. If the @a dirent is root, return "". The
80 * returned value will not have slashes in it.
82 * Example: svn_dirent_basename("/foo/bar") -> "bar"
84 * The returned basename will be allocated in @a pool. If @a pool is NULL
85 * a pointer to the basename in @a dirent is returned.
87 * @note If an empty string is passed, then an empty string will be returned.
89 * From svn_dirent_uri.h.
91 const char *
92 svn_dirent_basename(const char *dirent,
93 apr_pool_t *pool);
95 /** Return a new uri like @a uri, but transformed such that some types
96 * of uri specification redundancies are removed.
98 * This involves collapsing redundant "/./" elements, removing
99 * multiple adjacent separator characters, removing trailing
100 * separator characters, and possibly other semantically inoperative
101 * transformations.
103 * If @a uri starts with a schema, this function also normalizes the
104 * escaping of the path component by unescaping characters that don't
105 * need escaping and escaping characters that do need escaping but
106 * weren't.
108 * This functions supports URLs.
110 * The returned uri may be statically allocated or allocated from @a pool.
112 * From svn_dirent_uri.h.
114 const char *
115 svn_uri_canonicalize(const char *uri,
116 apr_pool_t *pool);
118 /** Remove file @a path, a utf8-encoded path. This wraps apr_file_remove(),
119 * converting any error to a Subversion error. If @a ignore_enoent is TRUE, and
120 * the file is not present (APR_STATUS_IS_ENOENT returns TRUE), then no
121 * error will be returned.
123 * From svn_io.h.
125 svn_error_t *
126 svn_io_remove_file2(const char *path,
127 svn_boolean_t ignore_enoent,
128 apr_pool_t *scratch_pool);
130 /* From svn_private_config.h.
132 #define PACKAGE_NAME "subversion"
133 #define N_(x) x
134 #include <locale.h>
135 #include <libintl.h>
136 #define _(x) dgettext(PACKAGE_NAME, x)
138 /** Sets the config options in @a config_options, an apr array containing
139 * svn_cmdline__config_argument_t* elements to the configuration in @a cfg,
140 * a hash mapping of <tt>const char *</tt> configuration file names to
141 * @c svn_config_t *'s. Write warnings to stderr.
143 * Use @a prefix as prefix and @a argument_name in warning messages.
145 * From private/svn_cmdline_private.h.
147 svn_error_t *
148 svn_cmdline__apply_config_options(apr_hash_t *config,
149 const apr_array_header_t *config_options,
150 const char *prefix,
151 const char *argument_name);
153 /** Container for config options parsed with svn_cmdline__parse_config_option
155 * From private/svn_cmdline_private.h.
157 typedef struct svn_cmdline__config_argument_t
159 const char *file;
160 const char *section;
161 const char *option;
162 const char *value;
163 } svn_cmdline__config_argument_t;
165 /** Parser for 'FILE:SECTION:OPTION=[VALUE]'-style option arguments.
167 * Parses @a opt_arg and places its value in @a config_options, an apr array
168 * containing svn_cmdline__config_argument_t* elements, allocating the option
169 * data in @a pool
171 * From private/svn_cmdline_private.h.
173 svn_error_t *
174 svn_cmdline__parse_config_option(apr_array_header_t *config_options,
175 const char *opt_arg,
176 apr_pool_t *pool);
179 #endif /* SVN17_COMPAT_H */