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_client_private.h
24 * @brief Subversion-internal client APIs.
27 #ifndef SVN_CLIENT_PRIVATE_H
28 #define SVN_CLIENT_PRIVATE_H
30 #include <apr_pools.h>
33 #include "svn_client.h"
34 #include "svn_types.h"
38 #endif /* __cplusplus */
41 /* Return true if KIND is a revision kind that is dependent on the working
42 * copy. Otherwise, return false. */
43 #define SVN_CLIENT__REVKIND_NEEDS_WC(kind) \
44 ((kind) == svn_opt_revision_base || \
45 (kind) == svn_opt_revision_previous || \
46 (kind) == svn_opt_revision_working || \
47 (kind) == svn_opt_revision_committed) \
49 /* Return true if KIND is a revision kind that the WC can supply without
50 * contacting the repository. Otherwise, return false. */
51 #define SVN_CLIENT__REVKIND_IS_LOCAL_TO_WC(kind) \
52 ((kind) == svn_opt_revision_base || \
53 (kind) == svn_opt_revision_working || \
54 (kind) == svn_opt_revision_committed)
56 /* A location in a repository. */
57 typedef struct svn_client__pathrev_t
59 const char *repos_root_url;
60 const char *repos_uuid;
63 } svn_client__pathrev_t;
65 /* Return a new path-rev structure, allocated in RESULT_POOL,
66 * initialized with deep copies of REPOS_ROOT_URL, REPOS_UUID, REV and URL. */
67 svn_client__pathrev_t *
68 svn_client__pathrev_create(const char *repos_root_url,
69 const char *repos_uuid,
72 apr_pool_t *result_pool);
74 /* Return a new path-rev structure, allocated in RESULT_POOL,
75 * initialized with deep copies of REPOS_ROOT_URL, REPOS_UUID, and REV,
76 * and using the repository-relative RELPATH to construct the URL. */
77 svn_client__pathrev_t *
78 svn_client__pathrev_create_with_relpath(const char *repos_root_url,
79 const char *repos_uuid,
82 apr_pool_t *result_pool);
84 /* Set *PATHREV_P to a new path-rev structure, allocated in RESULT_POOL,
85 * initialized with deep copies of the repository root URL and UUID from
86 * RA_SESSION, and of REV and URL. */
88 svn_client__pathrev_create_with_session(svn_client__pathrev_t **pathrev_p,
89 svn_ra_session_t *ra_session,
92 apr_pool_t *result_pool);
94 /* Return a deep copy of PATHREV, allocated in RESULT_POOL. */
95 svn_client__pathrev_t *
96 svn_client__pathrev_dup(const svn_client__pathrev_t *pathrev,
97 apr_pool_t *result_pool);
99 /* Return a deep copy of PATHREV, with a URI-encoded representation of
100 * RELPATH joined on to the URL. Allocate the result in RESULT_POOL. */
101 svn_client__pathrev_t *
102 svn_client__pathrev_join_relpath(const svn_client__pathrev_t *pathrev,
104 apr_pool_t *result_pool);
106 /* Return the repository-relative relpath of PATHREV. */
108 svn_client__pathrev_relpath(const svn_client__pathrev_t *pathrev,
109 apr_pool_t *result_pool);
111 /* Return the repository-relative fspath of PATHREV. */
113 svn_client__pathrev_fspath(const svn_client__pathrev_t *pathrev,
114 apr_pool_t *result_pool);
116 /* Given PATH_OR_URL, which contains either a working copy path or an
117 absolute URL, a peg revision PEG_REVISION, and a desired revision
118 REVISION, create an RA connection to that object as it exists in
119 that revision, following copy history if necessary. If REVISION is
120 younger than PEG_REVISION, then PATH_OR_URL will be checked to see
121 that it is the same node in both PEG_REVISION and REVISION. If it
122 is not, then @c SVN_ERR_CLIENT_UNRELATED_RESOURCES is returned.
124 BASE_DIR_ABSPATH is the working copy path the ra_session corresponds
125 to. If provided it will be used to read and dav props. So if provided
126 this directory MUST match the session anchor.
128 If PEG_REVISION->kind is 'unspecified', the peg revision is 'head'
129 for a URL or 'working' for a WC path. If REVISION->kind is
130 'unspecified', the operative revision is the peg revision.
132 Store the resulting ra_session in *RA_SESSION_P. Store the final
133 resolved location of the object in *RESOLVED_LOC_P. RESOLVED_LOC_P
134 may be NULL if not wanted.
136 Use authentication baton cached in CTX to authenticate against the
139 Use POOL for all allocations. */
141 svn_client__ra_session_from_path2(svn_ra_session_t **ra_session_p,
142 svn_client__pathrev_t **resolved_loc_p,
143 const char *path_or_url,
144 const char *base_dir_abspath,
145 const svn_opt_revision_t *peg_revision,
146 const svn_opt_revision_t *revision,
147 svn_client_ctx_t *ctx,
150 /* Given PATH_OR_URL, which contains either a working copy path or an
151 absolute URL, a peg revision PEG_REVISION, and a desired revision
152 REVISION, find the path at which that object exists in REVISION,
153 following copy history if necessary. If REVISION is younger than
154 PEG_REVISION, then check that PATH_OR_URL is the same node in both
155 PEG_REVISION and REVISION, and return @c
156 SVN_ERR_CLIENT_UNRELATED_RESOURCES if it is not the same node.
158 If PEG_REVISION->kind is 'unspecified', the peg revision is 'head'
159 for a URL or 'working' for a WC path. If REVISION->kind is
160 'unspecified', the operative revision is the peg revision.
162 Store the actual location of the object in *RESOLVED_LOC_P.
164 RA_SESSION should be an open RA session pointing at the URL of
165 PATH_OR_URL, or NULL, in which case this function will open its own
168 Use authentication baton cached in CTX to authenticate against the
171 Use POOL for all allocations. */
173 svn_client__resolve_rev_and_url(svn_client__pathrev_t **resolved_loc_p,
174 svn_ra_session_t *ra_session,
175 const char *path_or_url,
176 const svn_opt_revision_t *peg_revision,
177 const svn_opt_revision_t *revision,
178 svn_client_ctx_t *ctx,
181 /** Return @c SVN_ERR_ILLEGAL_TARGET if TARGETS contains a mixture of
182 * URLs and paths; otherwise return SVN_NO_ERROR.
187 svn_client__assert_homogeneous_target_type(const apr_array_header_t *targets);
190 /* Create a svn_client_status_t structure *CST for LOCAL_ABSPATH, shallow
191 * copying data from *STATUS wherever possible and retrieving the other values
192 * where needed. Perform temporary allocations in SCRATCH_POOL and allocate the
193 * result in RESULT_POOL
196 svn_client__create_status(svn_client_status_t **cst,
197 svn_wc_context_t *wc_ctx,
198 const char *local_abspath,
199 const svn_wc_status3_t *status,
200 apr_pool_t *result_pool,
201 apr_pool_t *scratch_pool);
203 /* Set *ANCESTOR_URL and *ANCESTOR_REVISION to the URL and revision,
204 * respectively, of the youngest common ancestor of the two locations
205 * PATH_OR_URL1@REV1 and PATH_OR_URL2@REV2. Set *ANCESTOR_RELPATH to
206 * NULL and *ANCESTOR_REVISION to SVN_INVALID_REVNUM if they have no
207 * common ancestor. This function assumes that PATH_OR_URL1@REV1 and
208 * PATH_OR_URL2@REV2 both refer to the same repository.
210 * Use the authentication baton cached in CTX to authenticate against
213 * See also svn_client__get_youngest_common_ancestor().
216 svn_client__youngest_common_ancestor(const char **ancestor_url,
217 svn_revnum_t *ancestor_rev,
218 const char *path_or_url1,
219 const svn_opt_revision_t *revision1,
220 const char *path_or_url2,
221 const svn_opt_revision_t *revision2,
222 svn_client_ctx_t *ctx,
223 apr_pool_t *result_pool,
224 apr_pool_t *scratch_pool);
226 /* Get the repository location of the base node at LOCAL_ABSPATH.
228 * A pathrev_t wrapper around svn_wc__node_get_base().
230 * Set *BASE_P to the location that this node was checked out at or last
231 * updated/switched to, regardless of any uncommitted changes (delete,
232 * replace and/or copy-here/move-here).
234 * If there is no base node at LOCAL_ABSPATH (such as when there is a
235 * locally added/copied/moved-here node that is not part of a replace),
236 * set *BASE_P to NULL.
239 svn_client__wc_node_get_base(svn_client__pathrev_t **base_p,
240 const char *wc_abspath,
241 svn_wc_context_t *wc_ctx,
242 apr_pool_t *result_pool,
243 apr_pool_t *scratch_pool);
245 /* Get the original location of the WC node at LOCAL_ABSPATH.
247 * A pathrev_t wrapper around svn_wc__node_get_origin().
249 * Set *ORIGIN_P to the origin of the WC node at WC_ABSPATH. If the node
250 * is a local copy, give the copy-from location. If the node is locally
251 * added or deleted, set *ORIGIN_P to NULL.
254 svn_client__wc_node_get_origin(svn_client__pathrev_t **origin_p,
255 const char *wc_abspath,
256 svn_client_ctx_t *ctx,
257 apr_pool_t *result_pool,
258 apr_pool_t *scratch_pool);
260 /* Produce a diff with depth DEPTH between two files or two directories at
261 * LOCAL_ABSPATH1 and LOCAL_ABSPATH2, using the provided diff callbacks to
262 * show changes in files. The files and directories involved may be part of
263 * a working copy or they may be unversioned. For versioned files, show
264 * property changes, too. */
266 svn_client__arbitrary_nodes_diff(const char *local_abspath1,
267 const char *local_abspath2,
269 const svn_wc_diff_callbacks4_t *callbacks,
270 void *callback_baton,
271 svn_client_ctx_t *ctx,
272 apr_pool_t *scratch_pool);
274 /* Copy the file or directory on URL in some repository to DST_ABSPATH,
275 * copying node information and properties. Resolve URL using PEG_REV and
278 * If URL specifies a directory, create the copy using depth DEPTH.
280 * If MAKE_PARENTS is TRUE and DST_ABSPATH doesn't have an added parent
281 * create missing parent directories
284 svn_client__copy_foreign(const char *url,
285 const char *dst_abspath,
286 svn_opt_revision_t *peg_revision,
287 svn_opt_revision_t *revision,
289 svn_boolean_t make_parents,
290 svn_boolean_t already_locked,
291 svn_client_ctx_t *ctx,
292 apr_pool_t *scratch_pool);
294 /* Same as the public svn_client_mergeinfo_log2 API, except for the addition
295 * of the TARGET_MERGEINFO_CATALOG and RESULT_POOL parameters.
297 * If TARGET_MERGEINFO_CATALOG is NULL then this acts exactly as the public
298 * API. If *TARGET_MERGEINFO_CATALOG is NULL, then *TARGET_MERGEINFO_CATALOG
299 * is set to the a mergeinfo catalog representing the mergeinfo on
300 * TARGET_PATH_OR_URL@TARGET_PEG_REVISION at DEPTH, (like the public API only
301 * depths of svn_depth_empty or svn_depth_infinity are supported) allocated in
302 * RESULT_POOL. Finally, if *TARGET_MERGEINFO_CATALOG is non-NULL, then it is
303 * assumed to be a mergeinfo catalog representing the mergeinfo on
304 * TARGET_PATH_OR_URL@TARGET_PEG_REVISION at DEPTH.
306 * The keys for the subtree mergeinfo are the repository root-relative
307 * paths of TARGET_PATH_OR_URL and/or its subtrees, regardless of whether
308 * TARGET_PATH_OR_URL is a URL or WC path.
311 svn_client__mergeinfo_log(svn_boolean_t finding_merged,
312 const char *target_path_or_url,
313 const svn_opt_revision_t *target_peg_revision,
314 svn_mergeinfo_catalog_t *target_mergeinfo_catalog,
315 const char *source_path_or_url,
316 const svn_opt_revision_t *source_peg_revision,
317 const svn_opt_revision_t *source_start_revision,
318 const svn_opt_revision_t *source_end_revision,
319 svn_log_entry_receiver_t log_receiver,
320 void *log_receiver_baton,
321 svn_boolean_t discover_changed_paths,
323 const apr_array_header_t *revprops,
324 svn_client_ctx_t *ctx,
325 apr_pool_t *result_pool,
326 apr_pool_t *scratch_pool);
330 #endif /* __cplusplus */
332 #endif /* SVN_CLIENT_PRIVATE_H */