1 |
/** |
2 |
* @copyright |
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 |
11 |
* |
12 |
* http://www.apache.org/licenses/LICENSE-2.0 |
13 |
* |
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 |
19 |
* under the License. |
20 |
* ==================================================================== |
21 |
* @endcopyright |
22 |
* |
23 |
* @file svn_client_private.h |
24 |
* @brief Subversion-internal client APIs. |
25 |
*/ |
26 |
|
27 |
#ifndef SVN_CLIENT_PRIVATE_H |
28 |
#define SVN_CLIENT_PRIVATE_H |
29 |
|
30 |
#include <apr_pools.h> |
31 |
|
32 |
#include "svn_ra.h" |
33 |
#include "svn_client.h" |
34 |
#include "svn_types.h" |
35 |
|
36 |
#ifdef __cplusplus |
37 |
extern "C" { |
38 |
#endif /* __cplusplus */ |
39 |
|
40 |
|
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) \ |
48 |
|
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) |
55 |
|
56 |
/* A location in a repository. */ |
57 |
typedef struct svn_client__pathrev_t |
58 |
{ |
59 |
const char *repos_root_url; |
60 |
const char *repos_uuid; |
61 |
svn_revnum_t rev; |
62 |
const char *url; |
63 |
} svn_client__pathrev_t; |
64 |
|
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, |
70 |
svn_revnum_t rev, |
71 |
const char *url, |
72 |
apr_pool_t *result_pool); |
73 |
|
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, |
80 |
svn_revnum_t rev, |
81 |
const char *relpath, |
82 |
apr_pool_t *result_pool); |
83 |
|
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. */ |
87 |
svn_error_t * |
88 |
svn_client__pathrev_create_with_session(svn_client__pathrev_t **pathrev_p, |
89 |
svn_ra_session_t *ra_session, |
90 |
svn_revnum_t rev, |
91 |
const char *url, |
92 |
apr_pool_t *result_pool); |
93 |
|
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); |
98 |
|
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, |
103 |
const char *relpath, |
104 |
apr_pool_t *result_pool); |
105 |
|
106 |
/* Return the repository-relative relpath of PATHREV. */ |
107 |
const char * |
108 |
svn_client__pathrev_relpath(const svn_client__pathrev_t *pathrev, |
109 |
apr_pool_t *result_pool); |
110 |
|
111 |
/* Return the repository-relative fspath of PATHREV. */ |
112 |
const char * |
113 |
svn_client__pathrev_fspath(const svn_client__pathrev_t *pathrev, |
114 |
apr_pool_t *result_pool); |
115 |
|
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. |
123 |
|
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. |
127 |
|
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. |
131 |
|
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. |
135 |
|
136 |
Use authentication baton cached in CTX to authenticate against the |
137 |
repository. |
138 |
|
139 |
Use POOL for all allocations. */ |
140 |
svn_error_t * |
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, |
148 |
apr_pool_t *pool); |
149 |
|
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. |
157 |
|
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. |
161 |
|
162 |
Store the actual location of the object in *RESOLVED_LOC_P. |
163 |
|
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 |
166 |
temporary session. |
167 |
|
168 |
Use authentication baton cached in CTX to authenticate against the |
169 |
repository. |
170 |
|
171 |
Use POOL for all allocations. */ |
172 |
svn_error_t * |
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, |
179 |
apr_pool_t *pool); |
180 |
|
181 |
/** Return @c SVN_ERR_ILLEGAL_TARGET if TARGETS contains a mixture of |
182 |
* URLs and paths; otherwise return SVN_NO_ERROR. |
183 |
* |
184 |
* @since New in 1.7. |
185 |
*/ |
186 |
svn_error_t * |
187 |
svn_client__assert_homogeneous_target_type(const apr_array_header_t *targets); |
188 |
|
189 |
|
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 |
194 |
*/ |
195 |
svn_error_t * |
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); |
202 |
|
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. |
209 |
* |
210 |
* Use the authentication baton cached in CTX to authenticate against |
211 |
* the repository. |
212 |
* |
213 |
* See also svn_client__get_youngest_common_ancestor(). |
214 |
*/ |
215 |
svn_error_t * |
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); |
225 |
|
226 |
/* Get the repository location of the base node at LOCAL_ABSPATH. |
227 |
* |
228 |
* A pathrev_t wrapper around svn_wc__node_get_base(). |
229 |
* |
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). |
233 |
* |
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. |
237 |
*/ |
238 |
svn_error_t * |
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); |
244 |
|
245 |
/* Get the original location of the WC node at LOCAL_ABSPATH. |
246 |
* |
247 |
* A pathrev_t wrapper around svn_wc__node_get_origin(). |
248 |
* |
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. |
252 |
*/ |
253 |
svn_error_t * |
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); |
259 |
|
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. */ |
265 |
svn_error_t * |
266 |
svn_client__arbitrary_nodes_diff(const char *local_abspath1, |
267 |
const char *local_abspath2, |
268 |
svn_depth_t depth, |
269 |
const svn_wc_diff_callbacks4_t *callbacks, |
270 |
void *callback_baton, |
271 |
svn_client_ctx_t *ctx, |
272 |
apr_pool_t *scratch_pool); |
273 |
|
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 |
276 |
* REVISION. |
277 |
* |
278 |
* If URL specifies a directory, create the copy using depth DEPTH. |
279 |
* |
280 |
* If MAKE_PARENTS is TRUE and DST_ABSPATH doesn't have an added parent |
281 |
* create missing parent directories |
282 |
*/ |
283 |
svn_error_t * |
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, |
288 |
svn_depth_t depth, |
289 |
svn_boolean_t make_parents, |
290 |
svn_boolean_t already_locked, |
291 |
svn_client_ctx_t *ctx, |
292 |
apr_pool_t *scratch_pool); |
293 |
|
294 |
/* Same as the public svn_client_mergeinfo_log2 API, except for the addition |
295 |
* of the TARGET_MERGEINFO_CATALOG and RESULT_POOL parameters. |
296 |
* |
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. |
305 |
* |
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. |
309 |
* |
310 |
* If RA_SESSION is not NULL, use it to obtain merge information instead of |
311 |
* opening a new session. The session might be reparented after usage, so |
312 |
* callers should reparent the session back to their original location if |
313 |
* needed. |
314 |
*/ |
315 |
svn_error_t * |
316 |
svn_client__mergeinfo_log(svn_boolean_t finding_merged, |
317 |
const char *target_path_or_url, |
318 |
const svn_opt_revision_t *target_peg_revision, |
319 |
svn_mergeinfo_catalog_t *target_mergeinfo_catalog, |
320 |
const char *source_path_or_url, |
321 |
const svn_opt_revision_t *source_peg_revision, |
322 |
const svn_opt_revision_t *source_start_revision, |
323 |
const svn_opt_revision_t *source_end_revision, |
324 |
svn_log_entry_receiver_t log_receiver, |
325 |
void *log_receiver_baton, |
326 |
svn_boolean_t discover_changed_paths, |
327 |
svn_depth_t depth, |
328 |
const apr_array_header_t *revprops, |
329 |
svn_client_ctx_t *ctx, |
330 |
svn_ra_session_t *ra_session, |
331 |
apr_pool_t *result_pool, |
332 |
apr_pool_t *scratch_pool); |
333 |
|
334 |
#ifdef __cplusplus |
335 |
} |
336 |
#endif /* __cplusplus */ |
337 |
|
338 |
#endif /* SVN_CLIENT_PRIVATE_H */ |