svn_client_private.h revision 299742
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#include "private/svn_diff_tree.h" 37 38#ifdef __cplusplus 39extern "C" { 40#endif /* __cplusplus */ 41 42 43/* Set *REVNUM to the revision number identified by REVISION. 44 45 If REVISION->kind is svn_opt_revision_number, just use 46 REVISION->value.number, ignoring LOCAL_ABSPATH and RA_SESSION. 47 48 Else if REVISION->kind is svn_opt_revision_committed, 49 svn_opt_revision_previous, or svn_opt_revision_base, or 50 svn_opt_revision_working, then the revision can be identified 51 purely based on the working copy's administrative information for 52 LOCAL_ABSPATH, so RA_SESSION is ignored. If LOCAL_ABSPATH is not 53 under revision control, return SVN_ERR_UNVERSIONED_RESOURCE, or if 54 LOCAL_ABSPATH is null, return SVN_ERR_CLIENT_VERSIONED_PATH_REQUIRED. 55 56 Else if REVISION->kind is svn_opt_revision_date or 57 svn_opt_revision_head, then RA_SESSION is used to retrieve the 58 revision from the repository (using REVISION->value.date in the 59 former case), and LOCAL_ABSPATH is ignored. If RA_SESSION is null, 60 return SVN_ERR_CLIENT_RA_ACCESS_REQUIRED. 61 62 Else if REVISION->kind is svn_opt_revision_unspecified, set 63 *REVNUM to SVN_INVALID_REVNUM. 64 65 If YOUNGEST_REV is non-NULL, it is an in/out parameter. If 66 *YOUNGEST_REV is valid, use it as the youngest revision in the 67 repository (regardless of reality) -- don't bother to lookup the 68 true value for HEAD, and don't return any value in *REVNUM greater 69 than *YOUNGEST_REV. If *YOUNGEST_REV is not valid, and a HEAD 70 lookup is required to populate *REVNUM, then also populate 71 *YOUNGEST_REV with the result. This is useful for making multiple 72 serialized calls to this function with a basically static view of 73 the repository, avoiding race conditions which could occur between 74 multiple invocations with HEAD lookup requests. 75 76 Else return SVN_ERR_CLIENT_BAD_REVISION. 77 78 Use SCRATCH_POOL for any temporary allocation. */ 79svn_error_t * 80svn_client__get_revision_number(svn_revnum_t *revnum, 81 svn_revnum_t *youngest_rev, 82 svn_wc_context_t *wc_ctx, 83 const char *local_abspath, 84 svn_ra_session_t *ra_session, 85 const svn_opt_revision_t *revision, 86 apr_pool_t *scratch_pool); 87 88/* Return true if KIND is a revision kind that is dependent on the working 89 * copy. Otherwise, return false. */ 90#define SVN_CLIENT__REVKIND_NEEDS_WC(kind) \ 91 ((kind) == svn_opt_revision_base || \ 92 (kind) == svn_opt_revision_previous || \ 93 (kind) == svn_opt_revision_working || \ 94 (kind) == svn_opt_revision_committed) \ 95 96/* Return true if KIND is a revision kind that the WC can supply without 97 * contacting the repository. Otherwise, return false. */ 98#define SVN_CLIENT__REVKIND_IS_LOCAL_TO_WC(kind) \ 99 ((kind) == svn_opt_revision_base || \ 100 (kind) == svn_opt_revision_working || \ 101 (kind) == svn_opt_revision_committed) 102 103/* A location in a repository. */ 104typedef struct svn_client__pathrev_t 105{ 106 const char *repos_root_url; 107 const char *repos_uuid; 108 svn_revnum_t rev; 109 const char *url; 110} svn_client__pathrev_t; 111 112/* Return a new path-rev structure, allocated in RESULT_POOL, 113 * initialized with deep copies of REPOS_ROOT_URL, REPOS_UUID, REV and URL. */ 114svn_client__pathrev_t * 115svn_client__pathrev_create(const char *repos_root_url, 116 const char *repos_uuid, 117 svn_revnum_t rev, 118 const char *url, 119 apr_pool_t *result_pool); 120 121/* Return a new path-rev structure, allocated in RESULT_POOL, 122 * initialized with deep copies of REPOS_ROOT_URL, REPOS_UUID, and REV, 123 * and using the repository-relative RELPATH to construct the URL. */ 124svn_client__pathrev_t * 125svn_client__pathrev_create_with_relpath(const char *repos_root_url, 126 const char *repos_uuid, 127 svn_revnum_t rev, 128 const char *relpath, 129 apr_pool_t *result_pool); 130 131/* Set *PATHREV_P to a new path-rev structure, allocated in RESULT_POOL, 132 * initialized with deep copies of the repository root URL and UUID from 133 * RA_SESSION, and of REV and URL. */ 134svn_error_t * 135svn_client__pathrev_create_with_session(svn_client__pathrev_t **pathrev_p, 136 svn_ra_session_t *ra_session, 137 svn_revnum_t rev, 138 const char *url, 139 apr_pool_t *result_pool); 140 141/* Return a deep copy of PATHREV, allocated in RESULT_POOL. */ 142svn_client__pathrev_t * 143svn_client__pathrev_dup(const svn_client__pathrev_t *pathrev, 144 apr_pool_t *result_pool); 145 146/* Return a deep copy of PATHREV, with a URI-encoded representation of 147 * RELPATH joined on to the URL. Allocate the result in RESULT_POOL. */ 148svn_client__pathrev_t * 149svn_client__pathrev_join_relpath(const svn_client__pathrev_t *pathrev, 150 const char *relpath, 151 apr_pool_t *result_pool); 152 153/* Return the repository-relative relpath of PATHREV. */ 154const char * 155svn_client__pathrev_relpath(const svn_client__pathrev_t *pathrev, 156 apr_pool_t *result_pool); 157 158/* Return the repository-relative fspath of PATHREV. */ 159const char * 160svn_client__pathrev_fspath(const svn_client__pathrev_t *pathrev, 161 apr_pool_t *result_pool); 162 163/* Given PATH_OR_URL, which contains either a working copy path or an 164 absolute URL, a peg revision PEG_REVISION, and a desired revision 165 REVISION, create an RA connection to that object as it exists in 166 that revision, following copy history if necessary. If REVISION is 167 younger than PEG_REVISION, then PATH_OR_URL will be checked to see 168 that it is the same node in both PEG_REVISION and REVISION. If it 169 is not, then @c SVN_ERR_CLIENT_UNRELATED_RESOURCES is returned. 170 171 BASE_DIR_ABSPATH is the working copy path the ra_session corresponds 172 to. If provided it will be used to read and dav props. So if provided 173 this directory MUST match the session anchor. 174 175 If PEG_REVISION->kind is 'unspecified', the peg revision is 'head' 176 for a URL or 'working' for a WC path. If REVISION->kind is 177 'unspecified', the operative revision is the peg revision. 178 179 Store the resulting ra_session in *RA_SESSION_P. Store the final 180 resolved location of the object in *RESOLVED_LOC_P. RESOLVED_LOC_P 181 may be NULL if not wanted. 182 183 Use authentication baton cached in CTX to authenticate against the 184 repository. 185 186 Use POOL for all allocations. */ 187svn_error_t * 188svn_client__ra_session_from_path2(svn_ra_session_t **ra_session_p, 189 svn_client__pathrev_t **resolved_loc_p, 190 const char *path_or_url, 191 const char *base_dir_abspath, 192 const svn_opt_revision_t *peg_revision, 193 const svn_opt_revision_t *revision, 194 svn_client_ctx_t *ctx, 195 apr_pool_t *pool); 196 197/* Given PATH_OR_URL, which contains either a working copy path or an 198 absolute URL, a peg revision PEG_REVISION, and a desired revision 199 REVISION, find the path at which that object exists in REVISION, 200 following copy history if necessary. If REVISION is younger than 201 PEG_REVISION, then check that PATH_OR_URL is the same node in both 202 PEG_REVISION and REVISION, and return @c 203 SVN_ERR_CLIENT_UNRELATED_RESOURCES if it is not the same node. 204 205 If PEG_REVISION->kind is 'unspecified', the peg revision is 'head' 206 for a URL or 'working' for a WC path. If REVISION->kind is 207 'unspecified', the operative revision is the peg revision. 208 209 Store the actual location of the object in *RESOLVED_LOC_P. 210 211 RA_SESSION should be an open RA session pointing at the URL of 212 PATH_OR_URL, or NULL, in which case this function will open its own 213 temporary session. 214 215 Use authentication baton cached in CTX to authenticate against the 216 repository. 217 218 Use POOL for all allocations. */ 219svn_error_t * 220svn_client__resolve_rev_and_url(svn_client__pathrev_t **resolved_loc_p, 221 svn_ra_session_t *ra_session, 222 const char *path_or_url, 223 const svn_opt_revision_t *peg_revision, 224 const svn_opt_revision_t *revision, 225 svn_client_ctx_t *ctx, 226 apr_pool_t *pool); 227 228/** Return @c SVN_ERR_ILLEGAL_TARGET if TARGETS contains a mixture of 229 * URLs and paths; otherwise return SVN_NO_ERROR. 230 * 231 * @since New in 1.7. 232 */ 233svn_error_t * 234svn_client__assert_homogeneous_target_type(const apr_array_header_t *targets); 235 236 237/* Create a svn_client_status_t structure *CST for LOCAL_ABSPATH, shallow 238 * copying data from *STATUS wherever possible and retrieving the other values 239 * where needed. Perform temporary allocations in SCRATCH_POOL and allocate the 240 * result in RESULT_POOL 241 */ 242svn_error_t * 243svn_client__create_status(svn_client_status_t **cst, 244 svn_wc_context_t *wc_ctx, 245 const char *local_abspath, 246 const svn_wc_status3_t *status, 247 apr_pool_t *result_pool, 248 apr_pool_t *scratch_pool); 249 250/* Get the repository location of the base node at LOCAL_ABSPATH. 251 * 252 * A pathrev_t wrapper around svn_wc__node_get_base(). 253 * 254 * Set *BASE_P to the location that this node was checked out at or last 255 * updated/switched to, regardless of any uncommitted changes (delete, 256 * replace and/or copy-here/move-here). 257 * 258 * If there is no base node at LOCAL_ABSPATH (such as when there is a 259 * locally added/copied/moved-here node that is not part of a replace), 260 * set *BASE_P to NULL. 261 */ 262svn_error_t * 263svn_client__wc_node_get_base(svn_client__pathrev_t **base_p, 264 const char *wc_abspath, 265 svn_wc_context_t *wc_ctx, 266 apr_pool_t *result_pool, 267 apr_pool_t *scratch_pool); 268 269/* Get the original location of the WC node at LOCAL_ABSPATH. 270 * 271 * A pathrev_t wrapper around svn_wc__node_get_origin(). 272 * 273 * Set *ORIGIN_P to the origin of the WC node at WC_ABSPATH. If the node 274 * is a local copy, give the copy-from location. If the node is locally 275 * added or deleted, set *ORIGIN_P to NULL. 276 */ 277svn_error_t * 278svn_client__wc_node_get_origin(svn_client__pathrev_t **origin_p, 279 const char *wc_abspath, 280 svn_client_ctx_t *ctx, 281 apr_pool_t *result_pool, 282 apr_pool_t *scratch_pool); 283 284/* Copy the file or directory on URL in some repository to DST_ABSPATH, 285 * copying node information and properties. Resolve URL using PEG_REV and 286 * REVISION. 287 * 288 * If URL specifies a directory, create the copy using depth DEPTH. 289 * 290 * If MAKE_PARENTS is TRUE and DST_ABSPATH doesn't have an added parent 291 * create missing parent directories 292 */ 293svn_error_t * 294svn_client__copy_foreign(const char *url, 295 const char *dst_abspath, 296 svn_opt_revision_t *peg_revision, 297 svn_opt_revision_t *revision, 298 svn_depth_t depth, 299 svn_boolean_t make_parents, 300 svn_boolean_t already_locked, 301 svn_client_ctx_t *ctx, 302 apr_pool_t *scratch_pool); 303 304/* Same as the public svn_client_mergeinfo_log2 API, except for the addition 305 * of the TARGET_MERGEINFO_CATALOG and RESULT_POOL parameters. 306 * 307 * If TARGET_MERGEINFO_CATALOG is NULL then this acts exactly as the public 308 * API. If *TARGET_MERGEINFO_CATALOG is NULL, then *TARGET_MERGEINFO_CATALOG 309 * is set to the a mergeinfo catalog representing the mergeinfo on 310 * TARGET_PATH_OR_URL@TARGET_PEG_REVISION at DEPTH, (like the public API only 311 * depths of svn_depth_empty or svn_depth_infinity are supported) allocated in 312 * RESULT_POOL. Finally, if *TARGET_MERGEINFO_CATALOG is non-NULL, then it is 313 * assumed to be a mergeinfo catalog representing the mergeinfo on 314 * TARGET_PATH_OR_URL@TARGET_PEG_REVISION at DEPTH. 315 * 316 * The keys for the subtree mergeinfo are the repository root-relative 317 * paths of TARGET_PATH_OR_URL and/or its subtrees, regardless of whether 318 * TARGET_PATH_OR_URL is a URL or WC path. 319 * 320 * If RA_SESSION is not NULL, use it to obtain merge information instead of 321 * opening a new session. The session might be reparented after usage, so 322 * callers should reparent the session back to their original location if 323 * needed. 324 */ 325svn_error_t * 326svn_client__mergeinfo_log(svn_boolean_t finding_merged, 327 const char *target_path_or_url, 328 const svn_opt_revision_t *target_peg_revision, 329 svn_mergeinfo_catalog_t *target_mergeinfo_catalog, 330 const char *source_path_or_url, 331 const svn_opt_revision_t *source_peg_revision, 332 const svn_opt_revision_t *source_start_revision, 333 const svn_opt_revision_t *source_end_revision, 334 svn_log_entry_receiver_t log_receiver, 335 void *log_receiver_baton, 336 svn_boolean_t discover_changed_paths, 337 svn_depth_t depth, 338 const apr_array_header_t *revprops, 339 svn_client_ctx_t *ctx, 340 svn_ra_session_t *ra_session, 341 apr_pool_t *result_pool, 342 apr_pool_t *scratch_pool); 343 344#ifdef __cplusplus 345} 346#endif /* __cplusplus */ 347 348#endif /* SVN_CLIENT_PRIVATE_H */ 349