1251881Speter/* 2251881Speter * client.h : shared stuff internal to the client library. 3251881Speter * 4251881Speter * ==================================================================== 5251881Speter * Licensed to the Apache Software Foundation (ASF) under one 6251881Speter * or more contributor license agreements. See the NOTICE file 7251881Speter * distributed with this work for additional information 8251881Speter * regarding copyright ownership. The ASF licenses this file 9251881Speter * to you under the Apache License, Version 2.0 (the 10251881Speter * "License"); you may not use this file except in compliance 11251881Speter * with the License. You may obtain a copy of the License at 12251881Speter * 13251881Speter * http://www.apache.org/licenses/LICENSE-2.0 14251881Speter * 15251881Speter * Unless required by applicable law or agreed to in writing, 16251881Speter * software distributed under the License is distributed on an 17251881Speter * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18251881Speter * KIND, either express or implied. See the License for the 19251881Speter * specific language governing permissions and limitations 20251881Speter * under the License. 21251881Speter * ==================================================================== 22251881Speter */ 23251881Speter 24253734Speter 25253734Speter 26251881Speter#ifndef SVN_LIBSVN_CLIENT_H 27251881Speter#define SVN_LIBSVN_CLIENT_H 28251881Speter 29251881Speter 30251881Speter#include <apr_pools.h> 31251881Speter 32251881Speter#include "svn_types.h" 33251881Speter#include "svn_opt.h" 34251881Speter#include "svn_string.h" 35251881Speter#include "svn_error.h" 36251881Speter#include "svn_ra.h" 37251881Speter#include "svn_client.h" 38251881Speter 39251881Speter#include "private/svn_magic.h" 40251881Speter#include "private/svn_client_private.h" 41251881Speter#include "private/svn_diff_tree.h" 42251881Speter#include "private/svn_editor.h" 43251881Speter 44251881Speter#ifdef __cplusplus 45251881Speterextern "C" { 46251881Speter#endif /* __cplusplus */ 47251881Speter 48251881Speter 49289180Speter/* Private client context. 50289180Speter * 51289180Speter * This is what is actually allocated by svn_client_create_context2(), 52289180Speter * which then returns the address of the public_ctx member. */ 53289180Spetertypedef struct svn_client__private_ctx_t 54289180Speter{ 55289180Speter /* Reserved field, always zero, to detect misuse of the private 56289180Speter context as a public client context. */ 57289180Speter apr_uint64_t magic_null; 58251881Speter 59289180Speter /* Reserved field, always set to a known magic number, to identify 60289180Speter this struct as the private client context. */ 61289180Speter apr_uint64_t magic_id; 62251881Speter 63289180Speter /* Total number of bytes transferred over network across all RA sessions. */ 64289180Speter apr_off_t total_progress; 65251881Speter 66289180Speter /* The public context. */ 67289180Speter svn_client_ctx_t public_ctx; 68289180Speter} svn_client__private_ctx_t; 69251881Speter 70251881Speter 71289180Speter/* Given a public client context CTX, return the private context 72289180Speter within which it is allocated. */ 73289180Spetersvn_client__private_ctx_t * 74289180Spetersvn_client__get_private_ctx(svn_client_ctx_t *ctx); 75251881Speter 76251881Speter/* Set *ORIGINAL_REPOS_RELPATH and *ORIGINAL_REVISION to the original location 77251881Speter that served as the source of the copy from which PATH_OR_URL at REVISION was 78251881Speter created, or NULL and SVN_INVALID_REVNUM (respectively) if PATH_OR_URL at 79289180Speter REVISION was not the result of a copy operation. 80289180Speter 81289180Speter If RA_SESSION is not NULL it is an existing session to the repository that 82289180Speter might be reparented temporarily to obtain the information. 83289180Speter */ 84251881Spetersvn_error_t * 85251881Spetersvn_client__get_copy_source(const char **original_repos_relpath, 86251881Speter svn_revnum_t *original_revision, 87251881Speter const char *path_or_url, 88251881Speter const svn_opt_revision_t *revision, 89289180Speter svn_ra_session_t *ra_session, 90251881Speter svn_client_ctx_t *ctx, 91251881Speter apr_pool_t *result_pool, 92251881Speter apr_pool_t *scratch_pool); 93251881Speter 94251881Speter/* Set *START_URL and *START_REVISION (and maybe *END_URL 95251881Speter and *END_REVISION) to the revisions and repository URLs of one 96251881Speter (or two) points of interest along a particular versioned resource's 97251881Speter line of history. PATH as it exists in "peg revision" 98251881Speter REVISION identifies that line of history, and START and END 99251881Speter specify the point(s) of interest (typically the revisions referred 100251881Speter to as the "operative range" for a given operation) along that history. 101251881Speter 102251881Speter START_REVISION and/or END_REVISION may be NULL if not wanted. 103251881Speter END may be NULL or of kind svn_opt_revision_unspecified (in either case 104251881Speter END_URL and END_REVISION are not touched by the function); 105251881Speter START and REVISION may not. 106251881Speter 107251881Speter If PATH is a WC path and REVISION is of kind svn_opt_revision_working, 108251881Speter then look at the PATH's copy-from URL instead of its base URL. 109251881Speter 110251881Speter RA_SESSION should be an open RA session pointing at the URL of PATH, 111251881Speter or NULL, in which case this function will open its own temporary session. 112251881Speter 113251881Speter A NOTE ABOUT FUTURE REPORTING: 114251881Speter 115251881Speter If either START or END are greater than REVISION, then do a 116251881Speter sanity check (since we cannot search future history yet): verify 117251881Speter that PATH in the future revision(s) is the "same object" as the 118251881Speter one pegged by REVISION. In other words, all three objects must 119251881Speter be connected by a single line of history which exactly passes 120251881Speter through PATH at REVISION. If this sanity check fails, return 121251881Speter SVN_ERR_CLIENT_UNRELATED_RESOURCES. If PATH doesn't exist in the future 122251881Speter revision, SVN_ERR_FS_NOT_FOUND may also be returned. 123251881Speter 124251881Speter CTX is the client context baton. 125251881Speter 126251881Speter Use POOL for all allocations. */ 127251881Spetersvn_error_t * 128251881Spetersvn_client__repos_locations(const char **start_url, 129251881Speter svn_revnum_t *start_revision, 130251881Speter const char **end_url, 131251881Speter svn_revnum_t *end_revision, 132251881Speter svn_ra_session_t *ra_session, 133251881Speter const char *path, 134251881Speter const svn_opt_revision_t *revision, 135251881Speter const svn_opt_revision_t *start, 136251881Speter const svn_opt_revision_t *end, 137251881Speter svn_client_ctx_t *ctx, 138251881Speter apr_pool_t *pool); 139251881Speter 140251881Speter/* Trace a line of history of a particular versioned resource back to a 141251881Speter * specific revision. 142251881Speter * 143251881Speter * Set *OP_LOC_P to the location that the object PEG_LOC had in 144251881Speter * revision OP_REVNUM. 145251881Speter * 146251881Speter * RA_SESSION is an open RA session to the correct repository; it may be 147251881Speter * temporarily reparented inside this function. */ 148251881Spetersvn_error_t * 149251881Spetersvn_client__repos_location(svn_client__pathrev_t **op_loc_p, 150251881Speter svn_ra_session_t *ra_session, 151251881Speter const svn_client__pathrev_t *peg_loc, 152251881Speter svn_revnum_t op_revnum, 153251881Speter svn_client_ctx_t *ctx, 154251881Speter apr_pool_t *result_pool, 155251881Speter apr_pool_t *scratch_pool); 156251881Speter 157251881Speter 158251881Speter/* Set *SEGMENTS to an array of svn_location_segment_t * objects, each 159251881Speter representing a reposition location segment for the history of URL 160251881Speter in PEG_REVISION 161251881Speter between END_REVISION and START_REVISION, ordered from oldest 162251881Speter segment to youngest. *SEGMENTS may be empty but it will never 163251881Speter be NULL. 164251881Speter 165251881Speter This is basically a thin de-stream-ifying wrapper around the 166251881Speter svn_ra_get_location_segments() interface, which see for the rules 167251881Speter governing PEG_REVISION, START_REVISION, and END_REVISION. 168251881Speter 169251881Speter RA_SESSION is an RA session open to the repository of URL; it may be 170251881Speter temporarily reparented within this function. 171251881Speter 172251881Speter CTX is the client context baton. 173251881Speter 174251881Speter Use POOL for all allocations. */ 175251881Spetersvn_error_t * 176251881Spetersvn_client__repos_location_segments(apr_array_header_t **segments, 177251881Speter svn_ra_session_t *ra_session, 178251881Speter const char *url, 179251881Speter svn_revnum_t peg_revision, 180251881Speter svn_revnum_t start_revision, 181251881Speter svn_revnum_t end_revision, 182251881Speter svn_client_ctx_t *ctx, 183251881Speter apr_pool_t *pool); 184251881Speter 185251881Speter 186251881Speter/* Find the common ancestor of two locations in a repository. 187251881Speter Ancestry is determined by the 'copy-from' relationship and the normal 188251881Speter successor relationship. 189251881Speter 190251881Speter Set *ANCESTOR_P to the location of the youngest common ancestor of 191251881Speter LOC1 and LOC2. If the locations have no common ancestor (including if 192251881Speter they don't have the same repository root URL), set *ANCESTOR_P to NULL. 193251881Speter 194251881Speter If SESSION is not NULL, use it for retrieving the common ancestor instead 195251881Speter of creating a new session. 196251881Speter 197251881Speter Use the authentication baton cached in CTX to authenticate against 198251881Speter the repository. Use POOL for all allocations. 199251881Speter 200253734Speter See also svn_client__calc_youngest_common_ancestor() to find youngest 201253734Speter common ancestor for already fetched history-as-mergeinfo information. 202253734Speter 203251881Speter*/ 204251881Spetersvn_error_t * 205251881Spetersvn_client__get_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p, 206251881Speter const svn_client__pathrev_t *loc1, 207251881Speter const svn_client__pathrev_t *loc2, 208251881Speter svn_ra_session_t *session, 209251881Speter svn_client_ctx_t *ctx, 210251881Speter apr_pool_t *result_pool, 211251881Speter apr_pool_t *scratch_pool); 212251881Speter 213253734Speter/* Find the common ancestor of two locations in a repository using already 214253734Speter fetched history-as-mergeinfo information. 215253734Speter 216253734Speter Ancestry is determined by the 'copy-from' relationship and the normal 217253734Speter successor relationship. 218253734Speter 219253734Speter Set *ANCESTOR_P to the location of the youngest common ancestor of 220253734Speter LOC1 and LOC2. If the locations have no common ancestor (including if 221253734Speter they don't have the same repository root URL), set *ANCESTOR_P to NULL. 222253734Speter 223253734Speter HISTORY1, HAS_REV_ZERO_HISTORY1, HISTORY2, HAS_REV_ZERO_HISTORY2 are 224253734Speter history-as-mergeinfo information as returned by 225253734Speter svn_client__get_history_as_mergeinfo() for LOC1 and LOC2 respectively. 226253734Speter 227253734Speter See also svn_client__get_youngest_common_ancestor(). 228253734Speter 229253734Speter*/ 230253734Spetersvn_error_t * 231253734Spetersvn_client__calc_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p, 232253734Speter const svn_client__pathrev_t *loc1, 233253734Speter apr_hash_t *history1, 234253734Speter svn_boolean_t has_rev_zero_history1, 235253734Speter const svn_client__pathrev_t *loc2, 236253734Speter apr_hash_t *history2, 237253734Speter svn_boolean_t has_rev_zero_history2, 238253734Speter apr_pool_t *result_pool, 239253734Speter apr_pool_t *scratch_pool); 240253734Speter 241251881Speter/* Ensure that RA_SESSION's session URL matches SESSION_URL, 242251881Speter reparenting that session if necessary. 243251881Speter Store the previous session URL in *OLD_SESSION_URL (so that if the 244251881Speter reparenting is meant to be temporary, the caller can reparent the 245251881Speter session back to where it was). 246251881Speter 247251881Speter If SESSION_URL is NULL, treat this as a magic value meaning "point 248251881Speter the RA session to the root of the repository". 249251881Speter 250251881Speter NOTE: The typical usage pattern for this functions is: 251251881Speter 252251881Speter const char *old_session_url; 253251881Speter SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url, 254251881Speter ra_session, 255251881Speter new_session_url, 256251881Speter pool); 257251881Speter 258251881Speter [...] 259251881Speter 260251881Speter SVN_ERR(svn_ra_reparent(ra_session, old_session_url, pool)); 261251881Speter*/ 262251881Spetersvn_error_t * 263251881Spetersvn_client__ensure_ra_session_url(const char **old_session_url, 264251881Speter svn_ra_session_t *ra_session, 265251881Speter const char *session_url, 266251881Speter apr_pool_t *pool); 267251881Speter 268251881Speter/* ---------------------------------------------------------------- */ 269253734Speter 270253734Speter 271251881Speter/*** RA callbacks ***/ 272251881Speter 273251881Speter 274251881Speter/* CTX is of type "svn_client_ctx_t *". */ 275251881Speter#define SVN_CLIENT__HAS_LOG_MSG_FUNC(ctx) \ 276251881Speter ((ctx)->log_msg_func3 || (ctx)->log_msg_func2 || (ctx)->log_msg_func) 277251881Speter 278251881Speter/* Open an RA session, returning it in *RA_SESSION or a corrected URL 279251881Speter in *CORRECTED_URL. (This function mirrors svn_ra_open4(), which 280251881Speter see, regarding the interpretation and handling of these two parameters.) 281251881Speter 282251881Speter The root of the session is specified by BASE_URL and BASE_DIR_ABSPATH. 283251881Speter 284251881Speter Additional control parameters: 285251881Speter 286251881Speter - COMMIT_ITEMS is an array of svn_client_commit_item_t * 287251881Speter structures, present only for working copy commits, NULL otherwise. 288251881Speter 289251881Speter - WRITE_DAV_PROPS indicates that the RA layer can clear and write 290251881Speter the DAV properties in the working copy of BASE_DIR_ABSPATH. 291251881Speter 292251881Speter - READ_DAV_PROPS indicates that the RA layer should not attempt to 293251881Speter modify the WC props directly, but is still allowed to read them. 294251881Speter 295251881Speter BASE_DIR_ABSPATH may be NULL if the RA operation does not correspond to a 296251881Speter working copy (in which case, WRITE_DAV_PROPS and READ_DAV_PROPS must be 297251881Speter FALSE. 298251881Speter 299251881Speter If WRITE_DAV_PROPS and READ_DAV_PROPS are both FALSE the working copy may 300251881Speter still be used for locating pristine files via their SHA1. 301251881Speter 302251881Speter The calling application's authentication baton is provided in CTX, 303251881Speter and allocations related to this session are performed in POOL. 304251881Speter 305251881Speter NOTE: The reason for the _internal suffix of this function's name is to 306251881Speter avoid confusion with the public API svn_client_open_ra_session(). */ 307251881Spetersvn_error_t * 308251881Spetersvn_client__open_ra_session_internal(svn_ra_session_t **ra_session, 309251881Speter const char **corrected_url, 310251881Speter const char *base_url, 311251881Speter const char *base_dir_abspath, 312251881Speter const apr_array_header_t *commit_items, 313251881Speter svn_boolean_t write_dav_props, 314251881Speter svn_boolean_t read_dav_props, 315251881Speter svn_client_ctx_t *ctx, 316251881Speter apr_pool_t *result_pool, 317251881Speter apr_pool_t *scratch_pool); 318251881Speter 319251881Speter 320251881Spetersvn_error_t * 321251881Spetersvn_client__ra_provide_base(svn_stream_t **contents, 322251881Speter svn_revnum_t *revision, 323251881Speter void *baton, 324251881Speter const char *repos_relpath, 325251881Speter apr_pool_t *result_pool, 326251881Speter apr_pool_t *scratch_pool); 327251881Speter 328251881Speter 329251881Spetersvn_error_t * 330251881Spetersvn_client__ra_provide_props(apr_hash_t **props, 331251881Speter svn_revnum_t *revision, 332251881Speter void *baton, 333251881Speter const char *repos_relpath, 334251881Speter apr_pool_t *result_pool, 335251881Speter apr_pool_t *scratch_pool); 336251881Speter 337251881Speter 338251881Spetersvn_error_t * 339251881Spetersvn_client__ra_get_copysrc_kind(svn_node_kind_t *kind, 340251881Speter void *baton, 341251881Speter const char *repos_relpath, 342251881Speter svn_revnum_t src_revision, 343251881Speter apr_pool_t *scratch_pool); 344251881Speter 345251881Speter 346251881Spetervoid * 347251881Spetersvn_client__ra_make_cb_baton(svn_wc_context_t *wc_ctx, 348251881Speter apr_hash_t *relpath_map, 349251881Speter apr_pool_t *result_pool); 350251881Speter 351251881Speter/* ---------------------------------------------------------------- */ 352253734Speter 353253734Speter 354251881Speter/*** Add/delete ***/ 355251881Speter 356251881Speter/* If AUTOPROPS is not null: Then read automatic properties matching PATH 357251881Speter from AUTOPROPS. AUTOPROPS is is a hash as per 358251881Speter svn_client__get_all_auto_props. Set *PROPERTIES to a hash containing 359251881Speter propname/value pairs (const char * keys mapping to svn_string_t * values). 360251881Speter 361251881Speter If AUTOPROPS is null then set *PROPERTIES to an empty hash. 362251881Speter 363251881Speter If *MIMETYPE is null or "application/octet-stream" then check AUTOPROPS 364251881Speter for a matching svn:mime-type. If AUTOPROPS is null or no match is found 365251881Speter and MAGIC_COOKIE is not NULL, then then try to detect the mime-type with 366251881Speter libmagic. If a mimetype is found then add it to *PROPERTIES and set 367251881Speter *MIMETYPE to the mimetype value or NULL otherwise. 368251881Speter 369251881Speter Allocate the *PROPERTIES and its contents as well as *MIMETYPE, in 370251881Speter RESULT_POOL. Use SCRATCH_POOL for temporary allocations. */ 371251881Spetersvn_error_t *svn_client__get_paths_auto_props( 372251881Speter apr_hash_t **properties, 373251881Speter const char **mimetype, 374251881Speter const char *path, 375251881Speter svn_magic__cookie_t *magic_cookie, 376251881Speter apr_hash_t *autoprops, 377251881Speter svn_client_ctx_t *ctx, 378251881Speter apr_pool_t *result_pool, 379251881Speter apr_pool_t *scratch_pool); 380251881Speter 381251881Speter/* Gather all auto-props from CTX->config (or none if auto-props are 382251881Speter disabled) and all svn:auto-props explicitly set on or inherited 383251881Speter by PATH_OR_URL. 384251881Speter 385251881Speter If PATH_OR_URL is an unversioned WC path then gather the 386251881Speter svn:auto-props inherited by PATH_OR_URL's nearest versioned 387251881Speter parent. 388251881Speter 389251881Speter If PATH_OR_URL is a URL ask for the properties @HEAD, if it is a WC 390251881Speter path as sfor the working properties. 391251881Speter 392251881Speter Store both types of auto-props in *AUTOPROPS, a hash mapping const 393251881Speter char * file patterns to another hash which maps const char * property 394251881Speter names to const char *property values. 395251881Speter 396251881Speter If a given property name exists for the same pattern in both the config 397251881Speter file and in an a svn:auto-props property, the latter overrides the 398251881Speter former. If a given property name exists for the same pattern in two 399251881Speter different inherited svn:auto-props, then the closer path-wise 400251881Speter property overrides the more distant. svn:auto-props explicitly set 401251881Speter on PATH_OR_URL have the highest precedence and override inherited props 402251881Speter and config file settings. 403251881Speter 404251881Speter Allocate *AUTOPROPS in RESULT_POOL. Use SCRATCH_POOL for temporary 405251881Speter allocations. */ 406251881Spetersvn_error_t *svn_client__get_all_auto_props(apr_hash_t **autoprops, 407251881Speter const char *path_or_url, 408251881Speter svn_client_ctx_t *ctx, 409251881Speter apr_pool_t *result_pool, 410251881Speter apr_pool_t *scratch_pool); 411251881Speter 412251881Speter/* The main logic for client deletion from a working copy. Deletes PATH 413251881Speter from CTX->WC_CTX. If PATH (or any item below a directory PATH) is 414251881Speter modified the delete will fail and return an error unless FORCE or KEEP_LOCAL 415251881Speter is TRUE. 416251881Speter 417251881Speter If KEEP_LOCAL is TRUE then PATH is only scheduled from deletion from the 418251881Speter repository and a local copy of PATH will be kept in the working copy. 419251881Speter 420251881Speter If DRY_RUN is TRUE all the checks are made to ensure that the delete can 421251881Speter occur, but the working copy is not modified. If NOTIFY_FUNC is not 422251881Speter null, it is called with NOTIFY_BATON for each file or directory deleted. */ 423251881Spetersvn_error_t * 424251881Spetersvn_client__wc_delete(const char *local_abspath, 425251881Speter svn_boolean_t force, 426251881Speter svn_boolean_t dry_run, 427251881Speter svn_boolean_t keep_local, 428251881Speter svn_wc_notify_func2_t notify_func, 429251881Speter void *notify_baton, 430251881Speter svn_client_ctx_t *ctx, 431251881Speter apr_pool_t *pool); 432251881Speter 433251881Speter 434251881Speter/* Like svn_client__wc_delete(), but deletes multiple TARGETS efficiently. */ 435251881Spetersvn_error_t * 436251881Spetersvn_client__wc_delete_many(const apr_array_header_t *targets, 437251881Speter svn_boolean_t force, 438251881Speter svn_boolean_t dry_run, 439251881Speter svn_boolean_t keep_local, 440251881Speter svn_wc_notify_func2_t notify_func, 441251881Speter void *notify_baton, 442251881Speter svn_client_ctx_t *ctx, 443251881Speter apr_pool_t *pool); 444251881Speter 445251881Speter 446289180Speter/* Make LOCAL_ABSPATH and add it to the working copy, optionally making all 447289180Speter the intermediate parent directories if MAKE_PARENTS is TRUE. */ 448251881Spetersvn_error_t * 449289180Spetersvn_client__make_local_parents(const char *local_abspath, 450251881Speter svn_boolean_t make_parents, 451251881Speter svn_client_ctx_t *ctx, 452251881Speter apr_pool_t *pool); 453251881Speter 454251881Speter/* ---------------------------------------------------------------- */ 455253734Speter 456253734Speter 457251881Speter/*** Checkout, update and switch ***/ 458251881Speter 459251881Speter/* Update a working copy LOCAL_ABSPATH to REVISION, and (if not NULL) set 460251881Speter RESULT_REV to the update revision. 461251881Speter 462251881Speter If DEPTH is svn_depth_unknown, then use whatever depth is already 463251881Speter set for LOCAL_ABSPATH, or @c svn_depth_infinity if LOCAL_ABSPATH does 464251881Speter not exist. 465251881Speter 466251881Speter Else if DEPTH is svn_depth_infinity, then update fully recursively 467251881Speter (resetting the existing depth of the working copy if necessary). 468251881Speter Else if DEPTH is svn_depth_files, update all files under LOCAL_ABSPATH (if 469251881Speter any), but exclude any subdirectories. Else if DEPTH is 470251881Speter svn_depth_immediates, update all files and include immediate 471251881Speter subdirectories (at svn_depth_empty). Else if DEPTH is 472251881Speter svn_depth_empty, just update LOCAL_ABSPATH; if LOCAL_ABSPATH is a 473251881Speter directory, that means touching only its properties not its entries. 474251881Speter 475251881Speter If DEPTH_IS_STICKY is set and DEPTH is not svn_depth_unknown, then 476251881Speter in addition to updating LOCAL_ABSPATH, also set its sticky ambient depth 477251881Speter value to DEPTH. 478251881Speter 479251881Speter If IGNORE_EXTERNALS is true, do no externals processing. 480251881Speter 481251881Speter Set *TIMESTAMP_SLEEP to TRUE if a sleep is required; otherwise do not 482251881Speter change *TIMESTAMP_SLEEP. The output will be valid even if the function 483251881Speter returns an error. 484251881Speter 485251881Speter If ALLOW_UNVER_OBSTRUCTIONS is TRUE, unversioned children of LOCAL_ABSPATH 486251881Speter that obstruct items added from the repos are tolerated; if FALSE, 487251881Speter these obstructions cause the update to fail. 488251881Speter 489251881Speter If ADDS_AS_MODIFICATION is TRUE, local additions are handled as 490251881Speter modifications on added nodes. 491251881Speter 492251881Speter If INNERUPDATE is true, no anchor check is performed on the update target. 493251881Speter 494251881Speter If MAKE_PARENTS is true, allow the update to calculate and checkout 495251881Speter (with depth=empty) any parent directories of the requested update 496251881Speter target which are missing from the working copy. 497251881Speter 498289180Speter If RA_SESSION is NOT NULL, it may be used to avoid creating a new 499289180Speter session. The session may point to a different URL after returning. 500289180Speter 501251881Speter NOTE: You may not specify both INNERUPDATE and MAKE_PARENTS as true. 502251881Speter*/ 503251881Spetersvn_error_t * 504251881Spetersvn_client__update_internal(svn_revnum_t *result_rev, 505289180Speter svn_boolean_t *timestamp_sleep, 506251881Speter const char *local_abspath, 507251881Speter const svn_opt_revision_t *revision, 508251881Speter svn_depth_t depth, 509251881Speter svn_boolean_t depth_is_sticky, 510251881Speter svn_boolean_t ignore_externals, 511251881Speter svn_boolean_t allow_unver_obstructions, 512251881Speter svn_boolean_t adds_as_modification, 513251881Speter svn_boolean_t make_parents, 514251881Speter svn_boolean_t innerupdate, 515289180Speter svn_ra_session_t *ra_session, 516251881Speter svn_client_ctx_t *ctx, 517251881Speter apr_pool_t *pool); 518251881Speter 519251881Speter/* Checkout into LOCAL_ABSPATH a working copy of URL at REVISION, and (if not 520251881Speter NULL) set RESULT_REV to the checked out revision. 521251881Speter 522251881Speter If DEPTH is svn_depth_infinity, then check out fully recursively. 523251881Speter Else if DEPTH is svn_depth_files, checkout all files under LOCAL_ABSPATH (if 524251881Speter any), but not subdirectories. Else if DEPTH is 525251881Speter svn_depth_immediates, check out all files and include immediate 526251881Speter subdirectories (at svn_depth_empty). Else if DEPTH is 527251881Speter svn_depth_empty, just check out LOCAL_ABSPATH, with none of its entries. 528251881Speter 529251881Speter DEPTH must be a definite depth, not (e.g.) svn_depth_unknown. 530251881Speter 531251881Speter If IGNORE_EXTERNALS is true, do no externals processing. 532251881Speter 533251881Speter Set *TIMESTAMP_SLEEP to TRUE if a sleep is required; otherwise do not 534251881Speter change *TIMESTAMP_SLEEP. The output will be valid even if the function 535251881Speter returns an error. 536251881Speter 537251881Speter If ALLOW_UNVER_OBSTRUCTIONS is TRUE, 538251881Speter unversioned children of LOCAL_ABSPATH that obstruct items added from 539251881Speter the repos are tolerated; if FALSE, these obstructions cause the checkout 540251881Speter to fail. 541251881Speter 542289180Speter If RA_SESSION is NOT NULL, it may be used to avoid creating a new 543289180Speter session. The session may point to a different URL after returning. 544251881Speter */ 545251881Spetersvn_error_t * 546251881Spetersvn_client__checkout_internal(svn_revnum_t *result_rev, 547289180Speter svn_boolean_t *timestamp_sleep, 548251881Speter const char *URL, 549251881Speter const char *local_abspath, 550251881Speter const svn_opt_revision_t *peg_revision, 551251881Speter const svn_opt_revision_t *revision, 552251881Speter svn_depth_t depth, 553251881Speter svn_boolean_t ignore_externals, 554251881Speter svn_boolean_t allow_unver_obstructions, 555289180Speter svn_ra_session_t *ra_session, 556251881Speter svn_client_ctx_t *ctx, 557251881Speter apr_pool_t *pool); 558251881Speter 559251881Speter/* Switch a working copy PATH to URL@PEG_REVISION at REVISION, and (if not 560251881Speter NULL) set RESULT_REV to the switch revision. A write lock will be 561251881Speter acquired and released if not held. Only switch as deeply as DEPTH 562251881Speter indicates. 563251881Speter 564251881Speter Set *TIMESTAMP_SLEEP to TRUE if a sleep is required; otherwise do not 565251881Speter change *TIMESTAMP_SLEEP. The output will be valid even if the function 566251881Speter returns an error. 567251881Speter 568251881Speter If IGNORE_EXTERNALS is true, don't process externals. 569251881Speter 570251881Speter If ALLOW_UNVER_OBSTRUCTIONS is TRUE, unversioned children of PATH 571251881Speter that obstruct items added from the repos are tolerated; if FALSE, 572251881Speter these obstructions cause the switch to fail. 573251881Speter 574251881Speter DEPTH and DEPTH_IS_STICKY behave as for svn_client__update_internal(). 575251881Speter 576251881Speter If IGNORE_ANCESTRY is true, don't perform a common ancestry check 577251881Speter between the PATH and URL; otherwise, do, and return 578251881Speter SVN_ERR_CLIENT_UNRELATED_RESOURCES if they aren't related. 579251881Speter*/ 580251881Spetersvn_error_t * 581251881Spetersvn_client__switch_internal(svn_revnum_t *result_rev, 582251881Speter const char *path, 583251881Speter const char *url, 584251881Speter const svn_opt_revision_t *peg_revision, 585251881Speter const svn_opt_revision_t *revision, 586251881Speter svn_depth_t depth, 587251881Speter svn_boolean_t depth_is_sticky, 588251881Speter svn_boolean_t ignore_externals, 589251881Speter svn_boolean_t allow_unver_obstructions, 590251881Speter svn_boolean_t ignore_ancestry, 591251881Speter svn_boolean_t *timestamp_sleep, 592251881Speter svn_client_ctx_t *ctx, 593251881Speter apr_pool_t *pool); 594251881Speter 595251881Speter/* ---------------------------------------------------------------- */ 596253734Speter 597253734Speter 598251881Speter/*** Inheritable Properties ***/ 599251881Speter 600251881Speter/* Convert any svn_prop_inherited_item_t elements in INHERITED_PROPS which 601251881Speter have repository root relative path PATH_OR_URL structure members to URLs 602251881Speter using REPOS_ROOT_URL. Changes to the contents of INHERITED_PROPS are 603251881Speter allocated in RESULT_POOL. SCRATCH_POOL is used for temporary 604251881Speter allocations. */ 605251881Spetersvn_error_t * 606251881Spetersvn_client__iprop_relpaths_to_urls(apr_array_header_t *inherited_props, 607251881Speter const char *repos_root_url, 608251881Speter apr_pool_t *result_pool, 609251881Speter apr_pool_t *scratch_pool); 610251881Speter 611251881Speter/* Fetch the inherited properties for the base of LOCAL_ABSPATH as well 612251881Speter as any WC roots under LOCAL_ABSPATH (as limited by DEPTH) using 613251881Speter RA_SESSION. Store the results in *WCROOT_IPROPS, a hash mapping 614251881Speter const char * absolute working copy paths to depth-first ordered arrays 615251881Speter of svn_prop_inherited_item_t * structures. 616251881Speter 617251881Speter Any svn_prop_inherited_item_t->path_or_url members returned in 618251881Speter *WCROOT_IPROPS are repository relative paths. 619251881Speter 620251881Speter If LOCAL_ABSPATH has no base then do nothing. 621251881Speter 622251881Speter RA_SESSION should be an open RA session pointing at the URL of PATH, 623251881Speter or NULL, in which case this function will use its own temporary session. 624251881Speter 625251881Speter Allocate *WCROOT_IPROPS in RESULT_POOL, use SCRATCH_POOL for temporary 626251881Speter allocations. 627251881Speter 628251881Speter If one or more of the paths are not available in the repository at the 629251881Speter specified revision, these paths will not be added to the hashtable. 630251881Speter*/ 631251881Spetersvn_error_t * 632251881Spetersvn_client__get_inheritable_props(apr_hash_t **wcroot_iprops, 633251881Speter const char *local_abspath, 634251881Speter svn_revnum_t revision, 635251881Speter svn_depth_t depth, 636251881Speter svn_ra_session_t *ra_session, 637251881Speter svn_client_ctx_t *ctx, 638251881Speter apr_pool_t *result_pool, 639251881Speter apr_pool_t *scratch_pool); 640251881Speter 641251881Speter/* ---------------------------------------------------------------- */ 642253734Speter 643253734Speter 644251881Speter/*** Editor for repository diff ***/ 645251881Speter 646251881Speter/* Create an editor for a pure repository comparison, i.e. comparing one 647251881Speter repository version against the other. 648251881Speter 649251881Speter DIFF_CALLBACKS/DIFF_CMD_BATON represent the callback that implements 650251881Speter the comparison. 651251881Speter 652251881Speter DEPTH is the depth to recurse. 653251881Speter 654251881Speter RA_SESSION is an RA session through which this editor may fetch 655251881Speter properties, file contents and directory listings of the 'old' side of the 656251881Speter diff. It is a separate RA session from the one through which this editor 657251881Speter is being driven. REVISION is the revision number of the 'old' side of 658251881Speter the diff. 659251881Speter 660251881Speter If TEXT_DELTAS is FALSE, then do not expect text deltas from the edit 661251881Speter drive, nor send the 'before' and 'after' texts to the diff callbacks; 662251881Speter instead, send empty files to the diff callbacks if there was a change. 663251881Speter This must be FALSE if the edit producer is not sending text deltas, 664251881Speter otherwise the file content checksum comparisons will fail. 665251881Speter 666251881Speter EDITOR/EDIT_BATON return the newly created editor and baton. 667251881Speter 668251881Speter @since New in 1.8. 669251881Speter */ 670251881Spetersvn_error_t * 671251881Spetersvn_client__get_diff_editor2(const svn_delta_editor_t **editor, 672251881Speter void **edit_baton, 673251881Speter svn_ra_session_t *ra_session, 674251881Speter svn_depth_t depth, 675251881Speter svn_revnum_t revision, 676251881Speter svn_boolean_t text_deltas, 677251881Speter const svn_diff_tree_processor_t *processor, 678251881Speter svn_cancel_func_t cancel_func, 679251881Speter void *cancel_baton, 680251881Speter apr_pool_t *result_pool); 681251881Speter 682251881Speter/* ---------------------------------------------------------------- */ 683253734Speter 684253734Speter 685251881Speter/*** Copy Stuff ***/ 686251881Speter 687251881Speter/* This structure is used to associate a specific copy or move SRC with a 688251881Speter specific copy or move destination. It also contains information which 689251881Speter various helper functions may need. Not every copy function uses every 690251881Speter field. 691251881Speter*/ 692251881Spetertypedef struct svn_client__copy_pair_t 693251881Speter{ 694251881Speter /* The absolute source path or url. */ 695251881Speter const char *src_abspath_or_url; 696251881Speter 697251881Speter /* The base name of the object. It should be the same for both src 698251881Speter and dst. */ 699251881Speter const char *base_name; 700251881Speter 701251881Speter /* The node kind of the source */ 702251881Speter svn_node_kind_t src_kind; 703251881Speter 704251881Speter /* The original source name. (Used when the source gets overwritten by a 705251881Speter peg revision lookup.) */ 706251881Speter const char *src_original; 707251881Speter 708251881Speter /* The source operational revision. */ 709251881Speter svn_opt_revision_t src_op_revision; 710251881Speter 711251881Speter /* The source peg revision. */ 712251881Speter svn_opt_revision_t src_peg_revision; 713251881Speter 714251881Speter /* The source revision number. */ 715251881Speter svn_revnum_t src_revnum; 716251881Speter 717251881Speter /* The absolute destination path or url */ 718251881Speter const char *dst_abspath_or_url; 719251881Speter 720251881Speter /* The absolute source path or url of the destination's parent. */ 721251881Speter const char *dst_parent_abspath; 722251881Speter} svn_client__copy_pair_t; 723251881Speter 724251881Speter/* ---------------------------------------------------------------- */ 725253734Speter 726253734Speter 727251881Speter/*** Commit Stuff ***/ 728251881Speter 729362181Sdim/* The "Harvest Committables" System 730251881Speter 731362181Sdim The commit process requires, per repository, a single drive of a 732251881Speter commit editor which is based not on working copy paths, but on 733362181Sdim URLs. The on-disk working copy hierarchy does not, in general, 734362181Sdim map to a similar in-repository hierarchy, due to switched subtrees 735362181Sdim and disjoint working copies. 736251881Speter 737362181Sdim Also we wish to know exactly what would be committed, in advance of 738362181Sdim the commit, so that a log message editor can be initially populated 739362181Sdim with this information. 740251881Speter 741251881Speter The primary goal of this system is very straightforward: harvest 742251881Speter all commit candidate information up front, and cache enough info in 743251881Speter the process to use this to drive a URL-sorted commit. 744251881Speter 745362181Sdim The idea is that commit-y processes ('svn mkdir URL', 'svn delete URL', 746251881Speter 'svn commit', 'svn copy WC_PATH URL', 'svn copy URL1 URL2', 'svn 747251881Speter move URL1 URL2', others?) generate the cached commit candidate 748251881Speter information, and hand this information off to a consumer which is 749251881Speter responsible for driving the RA layer's commit editor in a 750251881Speter URL-depth-first fashion and reporting back the post-commit 751251881Speter information. 752251881Speter 753251881Speter*/ 754251881Speter 755251881Speter/* Structure that contains an apr_hash_t * hash of apr_array_header_t * 756251881Speter arrays of svn_client_commit_item3_t * structures; keyed by the 757251881Speter canonical repository URLs. For faster lookup, it also provides 758251881Speter an hash index keyed by the local absolute path. */ 759251881Spetertypedef struct svn_client__committables_t 760251881Speter{ 761251881Speter /* apr_array_header_t array of svn_client_commit_item3_t structures 762251881Speter keyed by canonical repository URL */ 763251881Speter apr_hash_t *by_repository; 764251881Speter 765251881Speter /* svn_client_commit_item3_t structures keyed by local absolute path 766251881Speter (path member in the respective structures). 767251881Speter 768251881Speter This member is for fast lookup only, i.e. whether there is an 769251881Speter entry for the given path or not, but it will only allow for one 770251881Speter entry per absolute path (in case of duplicate entries in the 771251881Speter above arrays). The "canonical" data storage containing all item 772251881Speter is by_repository. */ 773251881Speter apr_hash_t *by_path; 774251881Speter 775251881Speter} svn_client__committables_t; 776251881Speter 777251881Speter/* Callback for the commit harvester to check if a node exists at the specified 778251881Speter url */ 779251881Spetertypedef svn_error_t *(*svn_client__check_url_kind_t)(void *baton, 780251881Speter svn_node_kind_t *kind, 781251881Speter const char *url, 782251881Speter svn_revnum_t revision, 783251881Speter apr_pool_t *scratch_pool); 784251881Speter 785251881Speter/* Recursively crawl a set of working copy paths (BASE_DIR_ABSPATH + each 786251881Speter item in the TARGETS array) looking for commit candidates, locking 787251881Speter working copy directories as the crawl progresses. For each 788251881Speter candidate found: 789251881Speter 790251881Speter - create svn_client_commit_item3_t for the candidate. 791251881Speter 792251881Speter - add the structure to an apr_array_header_t array of commit 793251881Speter items that are in the same repository, creating a new array if 794251881Speter necessary. 795251881Speter 796251881Speter - add (or update) a reference to this array to the by_repository 797251881Speter hash within COMMITTABLES and update the by_path member as well- 798251881Speter 799251881Speter - if the candidate has a lock token, add it to the LOCK_TOKENS hash. 800251881Speter 801251881Speter - if the candidate is a directory scheduled for deletion, crawl 802362181Sdim the directory's children recursively for any lock tokens and 803251881Speter add them to the LOCK_TOKENS array. 804251881Speter 805251881Speter At the successful return of this function, COMMITTABLES will point 806251881Speter a new svn_client__committables_t*. LOCK_TOKENS will point to a hash 807251881Speter table with const char * lock tokens, keyed on const char * URLs. 808251881Speter 809251881Speter If DEPTH is specified, descend (or not) into each target in TARGETS 810251881Speter as specified by DEPTH; the behavior is the same as that described 811251881Speter for svn_client_commit4(). 812251881Speter 813251881Speter If DEPTH_EMPTY_START is >= 0, all targets after index DEPTH_EMPTY_START 814251881Speter in TARGETS are handled as having svn_depth_empty. 815251881Speter 816251881Speter If JUST_LOCKED is TRUE, treat unmodified items with lock tokens as 817251881Speter commit candidates. 818251881Speter 819251881Speter If CHANGELISTS is non-NULL, it is an array of const char * 820251881Speter changelist names used as a restrictive filter 821251881Speter when harvesting committables; that is, don't add a path to 822251881Speter COMMITTABLES unless it's a member of one of those changelists. 823251881Speter 824251881Speter If CTX->CANCEL_FUNC is non-null, it will be called with 825251881Speter CTX->CANCEL_BATON while harvesting to determine if the client has 826251881Speter cancelled the operation. */ 827251881Spetersvn_error_t * 828251881Spetersvn_client__harvest_committables(svn_client__committables_t **committables, 829251881Speter apr_hash_t **lock_tokens, 830251881Speter const char *base_dir_abspath, 831251881Speter const apr_array_header_t *targets, 832251881Speter int depth_empty_start, 833251881Speter svn_depth_t depth, 834251881Speter svn_boolean_t just_locked, 835251881Speter const apr_array_header_t *changelists, 836251881Speter svn_client__check_url_kind_t check_url_func, 837251881Speter void *check_url_baton, 838251881Speter svn_client_ctx_t *ctx, 839251881Speter apr_pool_t *result_pool, 840251881Speter apr_pool_t *scratch_pool); 841251881Speter 842251881Speter 843251881Speter/* Recursively crawl each absolute working copy path SRC in COPY_PAIRS, 844251881Speter harvesting commit_items into a COMMITABLES structure as if every entry 845251881Speter at or below the SRC was to be committed as a set of adds (mostly with 846251881Speter history) to a new repository URL (DST in COPY_PAIRS). 847251881Speter 848251881Speter If CTX->CANCEL_FUNC is non-null, it will be called with 849251881Speter CTX->CANCEL_BATON while harvesting to determine if the client has 850251881Speter cancelled the operation. */ 851251881Spetersvn_error_t * 852251881Spetersvn_client__get_copy_committables(svn_client__committables_t **committables, 853251881Speter const apr_array_header_t *copy_pairs, 854251881Speter svn_client__check_url_kind_t check_url_func, 855251881Speter void *check_url_baton, 856251881Speter svn_client_ctx_t *ctx, 857251881Speter apr_pool_t *result_pool, 858251881Speter apr_pool_t *scratch_pool); 859251881Speter 860251881Speter/* Rewrite the COMMIT_ITEMS array to be sorted by URL. Also, discover 861251881Speter a common *BASE_URL for the items in the array, and rewrite those 862251881Speter items' URLs to be relative to that *BASE_URL. 863251881Speter 864251881Speter COMMIT_ITEMS is an array of (svn_client_commit_item3_t *) items. 865251881Speter 866251881Speter Afterwards, some of the items in COMMIT_ITEMS may contain data 867251881Speter allocated in POOL. */ 868251881Spetersvn_error_t * 869251881Spetersvn_client__condense_commit_items(const char **base_url, 870251881Speter apr_array_header_t *commit_items, 871251881Speter apr_pool_t *pool); 872251881Speter 873362181Sdim/* Rewrite the COMMIT_ITEMS array to be sorted by URL. 874362181Sdim Rewrite the items' URLs to be relative to BASE_URL. 875362181Sdim 876362181Sdim COMMIT_ITEMS is an array of (svn_client_commit_item3_t *) items. 877362181Sdim 878362181Sdim Afterwards, some of the items in COMMIT_ITEMS may contain data 879362181Sdim allocated in POOL. */ 880362181Sdimsvn_error_t * 881362181Sdimsvn_client__condense_commit_items2(const char *base_url, 882362181Sdim apr_array_header_t *commit_items, 883362181Sdim apr_pool_t *pool); 884362181Sdim 885251881Speter/* Commit the items in the COMMIT_ITEMS array using EDITOR/EDIT_BATON 886251881Speter to describe the committed local mods. Prior to this call, 887251881Speter COMMIT_ITEMS should have been run through (and BASE_URL generated 888251881Speter by) svn_client__condense_commit_items(). 889251881Speter 890251881Speter COMMIT_ITEMS is an array of (svn_client_commit_item3_t *) items. 891251881Speter 892251881Speter CTX->NOTIFY_FUNC/CTX->BATON will be called as the commit progresses, as 893251881Speter a way of describing actions to the application layer (if non NULL). 894251881Speter 895251881Speter NOTIFY_PATH_PREFIX will be passed to CTX->notify_func2() as the 896251881Speter common absolute path prefix of the committed paths. It can be NULL. 897251881Speter 898251881Speter If SHA1_CHECKSUMS is not NULL, set *SHA1_CHECKSUMS to a hash containing, 899251881Speter for each file transmitted, a mapping from the commit-item's (const 900251881Speter char *) path to the (const svn_checksum_t *) SHA1 checksum of its new text 901251881Speter base. 902251881Speter 903251881Speter Use RESULT_POOL for all allocating the resulting hashes and SCRATCH_POOL 904251881Speter for temporary allocations. 905251881Speter */ 906251881Spetersvn_error_t * 907251881Spetersvn_client__do_commit(const char *base_url, 908251881Speter const apr_array_header_t *commit_items, 909251881Speter const svn_delta_editor_t *editor, 910251881Speter void *edit_baton, 911251881Speter const char *notify_path_prefix, 912251881Speter apr_hash_t **sha1_checksums, 913251881Speter svn_client_ctx_t *ctx, 914251881Speter apr_pool_t *result_pool, 915251881Speter apr_pool_t *scratch_pool); 916251881Speter 917251881Speter 918253734Speter 919253734Speter 920251881Speter/*** Externals (Modules) ***/ 921251881Speter 922251881Speter/* Handle changes to the svn:externals property described by EXTERNALS_NEW, 923251881Speter and AMBIENT_DEPTHS. The tree's top level directory 924251881Speter is at TARGET_ABSPATH which has a root URL of REPOS_ROOT_URL. 925251881Speter A write lock should be held. 926251881Speter 927251881Speter For each changed value of the property, discover the nature of the 928251881Speter change and behave appropriately -- either check a new "external" 929251881Speter subdir, or call svn_wc_remove_from_revision_control() on an 930251881Speter existing one, or both. 931251881Speter 932251881Speter TARGET_ABSPATH is the root of the driving operation and 933251881Speter REQUESTED_DEPTH is the requested depth of the driving operation 934251881Speter (e.g., update, switch, etc). If it is neither svn_depth_infinity 935251881Speter nor svn_depth_unknown, then changes to svn:externals will have no 936251881Speter effect. If REQUESTED_DEPTH is svn_depth_unknown, then the ambient 937251881Speter depth of each working copy directory holding an svn:externals value 938251881Speter will determine whether that value is interpreted there (the ambient 939251881Speter depth must be svn_depth_infinity). If REQUESTED_DEPTH is 940251881Speter svn_depth_infinity, then it is presumed to be expanding any 941251881Speter shallower ambient depth, so changes to svn:externals values will be 942251881Speter interpreted. 943251881Speter 944251881Speter Pass NOTIFY_FUNC with NOTIFY_BATON along to svn_client_checkout(). 945251881Speter 946251881Speter Set *TIMESTAMP_SLEEP to TRUE if a sleep is required; otherwise do not 947251881Speter change *TIMESTAMP_SLEEP. The output will be valid even if the function 948251881Speter returns an error. 949251881Speter 950289180Speter If RA_SESSION is NOT NULL, it may be used to avoid creating a new 951289180Speter session. The session may point to a different URL after returning. 952289180Speter 953251881Speter Use POOL for temporary allocation. */ 954251881Spetersvn_error_t * 955251881Spetersvn_client__handle_externals(apr_hash_t *externals_new, 956251881Speter apr_hash_t *ambient_depths, 957251881Speter const char *repos_root_url, 958251881Speter const char *target_abspath, 959251881Speter svn_depth_t requested_depth, 960251881Speter svn_boolean_t *timestamp_sleep, 961289180Speter svn_ra_session_t *ra_session, 962251881Speter svn_client_ctx_t *ctx, 963251881Speter apr_pool_t *pool); 964251881Speter 965251881Speter 966251881Speter/* Export externals definitions described by EXTERNALS, a hash of the 967251881Speter form returned by svn_wc_edited_externals() (which see). The external 968251881Speter items will be exported instead of checked out -- they will have no 969251881Speter administrative subdirectories. 970251881Speter 971251881Speter The checked out or exported tree's top level directory is at 972251881Speter TO_ABSPATH and corresponds to FROM_URL URL in the repository, which 973251881Speter has a root URL of REPOS_ROOT_URL. 974251881Speter 975251881Speter REQUESTED_DEPTH is the requested_depth of the driving operation; it 976251881Speter behaves as for svn_client__handle_externals(), except that ambient 977251881Speter depths are presumed to be svn_depth_infinity. 978251881Speter 979251881Speter NATIVE_EOL is the value passed as NATIVE_EOL when exporting. 980251881Speter 981251881Speter Use POOL for temporary allocation. */ 982251881Spetersvn_error_t * 983251881Spetersvn_client__export_externals(apr_hash_t *externals, 984251881Speter const char *from_url, 985251881Speter const char *to_abspath, 986251881Speter const char *repos_root_url, 987251881Speter svn_depth_t requested_depth, 988251881Speter const char *native_eol, 989251881Speter svn_boolean_t ignore_keywords, 990251881Speter svn_client_ctx_t *ctx, 991251881Speter apr_pool_t *pool); 992251881Speter 993251881Speter/* Baton for svn_client__dirent_fetcher */ 994251881Speterstruct svn_client__dirent_fetcher_baton_t 995251881Speter{ 996251881Speter svn_ra_session_t *ra_session; 997251881Speter svn_revnum_t target_revision; 998251881Speter const char *anchor_url; 999251881Speter}; 1000251881Speter 1001251881Speter/* Implements svn_wc_dirents_func_t for update and switch handling. Assumes 1002251881Speter a struct svn_client__dirent_fetcher_baton_t * baton */ 1003251881Spetersvn_error_t * 1004251881Spetersvn_client__dirent_fetcher(void *baton, 1005251881Speter apr_hash_t **dirents, 1006251881Speter const char *repos_root_url, 1007251881Speter const char *repos_relpath, 1008251881Speter apr_pool_t *result_pool, 1009251881Speter apr_pool_t *scratch_pool); 1010251881Speter 1011251881Speter/* Retrieve log messages using the first provided (non-NULL) callback 1012251881Speter in the set of *CTX->log_msg_func3, CTX->log_msg_func2, or 1013251881Speter CTX->log_msg_func. Other arguments same as 1014251881Speter svn_client_get_commit_log3_t. */ 1015251881Spetersvn_error_t * 1016251881Spetersvn_client__get_log_msg(const char **log_msg, 1017251881Speter const char **tmp_file, 1018251881Speter const apr_array_header_t *commit_items, 1019251881Speter svn_client_ctx_t *ctx, 1020251881Speter apr_pool_t *pool); 1021251881Speter 1022251881Speter/* Return the revision properties stored in REVPROP_TABLE_IN, adding 1023251881Speter LOG_MSG as SVN_PROP_REVISION_LOG in *REVPROP_TABLE_OUT, allocated in 1024251881Speter POOL. *REVPROP_TABLE_OUT will map const char * property names to 1025251881Speter svn_string_t values. If REVPROP_TABLE_IN is non-NULL, check that 1026251881Speter it doesn't contain any of the standard Subversion properties. In 1027251881Speter that case, return SVN_ERR_CLIENT_PROPERTY_NAME. */ 1028251881Spetersvn_error_t * 1029251881Spetersvn_client__ensure_revprop_table(apr_hash_t **revprop_table_out, 1030251881Speter const apr_hash_t *revprop_table_in, 1031251881Speter const char *log_msg, 1032251881Speter svn_client_ctx_t *ctx, 1033251881Speter apr_pool_t *pool); 1034251881Speter 1035251881Speter/* Return a potentially translated version of local file LOCAL_ABSPATH 1036251881Speter in NORMAL_STREAM. REVISION must be one of the following: BASE, COMMITTED, 1037251881Speter WORKING. 1038251881Speter 1039251881Speter EXPAND_KEYWORDS operates as per the EXPAND argument to 1040251881Speter svn_subst_stream_translated, which see. If NORMALIZE_EOLS is TRUE and 1041251881Speter LOCAL_ABSPATH requires translation, then normalize the line endings in 1042362181Sdim *NORMAL_STREAM to "\n" if the stream has svn:eol-style set. 1043251881Speter 1044362181Sdim Note that this IS NOT the repository normal form of the stream as that 1045362181Sdim would use "\r\n" if set to CRLF and "\r" if set to CR. 1046362181Sdim 1047362181Sdim The stream is allocated in RESULT_POOL and temporary SCRATCH_POOL is 1048362181Sdim used for temporary allocations. */ 1049251881Spetersvn_error_t * 1050251881Spetersvn_client__get_normalized_stream(svn_stream_t **normal_stream, 1051251881Speter svn_wc_context_t *wc_ctx, 1052251881Speter const char *local_abspath, 1053251881Speter const svn_opt_revision_t *revision, 1054251881Speter svn_boolean_t expand_keywords, 1055251881Speter svn_boolean_t normalize_eols, 1056251881Speter svn_cancel_func_t cancel_func, 1057251881Speter void *cancel_baton, 1058251881Speter apr_pool_t *result_pool, 1059251881Speter apr_pool_t *scratch_pool); 1060251881Speter 1061251881Speter/* Return a set of callbacks to use with the Ev2 shims. */ 1062251881Spetersvn_delta_shim_callbacks_t * 1063251881Spetersvn_client__get_shim_callbacks(svn_wc_context_t *wc_ctx, 1064251881Speter apr_hash_t *relpath_map, 1065251881Speter apr_pool_t *result_pool); 1066251881Speter 1067251881Speter/* Return REVISION unless its kind is 'unspecified' in which case return 1068251881Speter * a pointer to a statically allocated revision structure of kind 'head' 1069251881Speter * if PATH_OR_URL is a URL or 'base' if it is a WC path. */ 1070251881Speterconst svn_opt_revision_t * 1071251881Spetersvn_cl__rev_default_to_head_or_base(const svn_opt_revision_t *revision, 1072251881Speter const char *path_or_url); 1073251881Speter 1074251881Speter/* Return REVISION unless its kind is 'unspecified' in which case return 1075251881Speter * a pointer to a statically allocated revision structure of kind 'head' 1076251881Speter * if PATH_OR_URL is a URL or 'working' if it is a WC path. */ 1077251881Speterconst svn_opt_revision_t * 1078251881Spetersvn_cl__rev_default_to_head_or_working(const svn_opt_revision_t *revision, 1079251881Speter const char *path_or_url); 1080251881Speter 1081251881Speter/* Return REVISION unless its kind is 'unspecified' in which case return 1082251881Speter * PEG_REVISION. */ 1083251881Speterconst svn_opt_revision_t * 1084251881Spetersvn_cl__rev_default_to_peg(const svn_opt_revision_t *revision, 1085251881Speter const svn_opt_revision_t *peg_revision); 1086251881Speter 1087251881Speter/* Call the conflict resolver callback in CTX for each conflict recorded 1088251881Speter * in CONFLICTED_PATHS (const char *abspath keys; ignored values). If 1089251881Speter * CONFLICTS_REMAIN is not NULL, then set *CONFLICTS_REMAIN to true if 1090251881Speter * there are any conflicts among CONFLICTED_PATHS remaining unresolved 1091251881Speter * at the end of this operation, else set it to false. 1092251881Speter */ 1093251881Spetersvn_error_t * 1094251881Spetersvn_client__resolve_conflicts(svn_boolean_t *conflicts_remain, 1095251881Speter apr_hash_t *conflicted_paths, 1096251881Speter svn_client_ctx_t *ctx, 1097251881Speter apr_pool_t *scratch_pool); 1098251881Speter 1099362181Sdim/* Produce a diff with depth DEPTH between the file or directory at 1100362181Sdim * LEFT_ABSPATH and the file or directory at RIGHT_ABSPATH, reporting 1101362181Sdim * differences to DIFF_PROCESSOR. 1102289180Speter * 1103362181Sdim * The files and directories involved may be part of a working copy or 1104362181Sdim * they may be unversioned. For versioned files, show property changes, 1105362181Sdim * too. 1106362181Sdim * 1107362181Sdim * No copy or move information is reported to the diff processor. 1108362181Sdim * 1109362181Sdim * Anchor the DIFF_PROCESSOR at the requested diff targets (LEFT_ABSPATH, 1110362181Sdim * RIGHT_ABSPATH). As any children reached by recursion are matched by 1111362181Sdim * name, a diff processor relpath applies equally to both sides of the diff. 1112289180Speter */ 1113289180Spetersvn_error_t * 1114362181Sdimsvn_client__arbitrary_nodes_diff(const char *left_abspath, 1115289180Speter const char *right_abspath, 1116289180Speter svn_depth_t depth, 1117289180Speter const svn_diff_tree_processor_t *diff_processor, 1118289180Speter svn_client_ctx_t *ctx, 1119289180Speter apr_pool_t *scratch_pool); 1120253734Speter 1121253734Speter 1122289180Speter/* Helper for the remote case of svn_client_propget. 1123289180Speter * 1124289180Speter * If PROPS is not null, then get the value of property PROPNAME in 1125289180Speter * REVNUM, using RA_SESSION. Store the value ('svn_string_t *') in 1126289180Speter * PROPS, under the path key "TARGET_PREFIX/TARGET_RELATIVE" 1127289180Speter * ('const char *'). 1128289180Speter * 1129289180Speter * If INHERITED_PROPS is not null, then set *INHERITED_PROPS to a 1130289180Speter * depth-first ordered array of svn_prop_inherited_item_t * structures 1131289180Speter * representing the PROPNAME properties inherited by the target. If 1132289180Speter * INHERITABLE_PROPS in not null and no inheritable properties are found, 1133289180Speter * then set *INHERITED_PROPS to an empty array. 1134289180Speter * 1135289180Speter * Recurse according to DEPTH, similarly to svn_client_propget3(). 1136289180Speter * 1137289180Speter * KIND is the kind of the node at "TARGET_PREFIX/TARGET_RELATIVE". 1138289180Speter * Yes, caller passes this; it makes the recursion more efficient :-). 1139289180Speter * 1140289180Speter * Allocate PROPS and *INHERITED_PROPS in RESULT_POOL, but do all temporary 1141289180Speter * work in SCRATCH_POOL. The two pools can be the same; recursive 1142289180Speter * calls may use a different SCRATCH_POOL, however. 1143289180Speter */ 1144289180Spetersvn_error_t * 1145289180Spetersvn_client__remote_propget(apr_hash_t *props, 1146289180Speter apr_array_header_t **inherited_props, 1147289180Speter const char *propname, 1148289180Speter const char *target_prefix, 1149289180Speter const char *target_relative, 1150289180Speter svn_node_kind_t kind, 1151289180Speter svn_revnum_t revnum, 1152289180Speter svn_ra_session_t *ra_session, 1153289180Speter svn_depth_t depth, 1154289180Speter apr_pool_t *result_pool, 1155289180Speter apr_pool_t *scratch_pool); 1156289180Speter 1157362181Sdim/* */ 1158362181Sdimtypedef struct merge_source_t 1159362181Sdim{ 1160362181Sdim /* "left" side URL and revision (inclusive iff youngest) */ 1161362181Sdim const svn_client__pathrev_t *loc1; 1162362181Sdim 1163362181Sdim /* "right" side URL and revision (inclusive iff youngest) */ 1164362181Sdim const svn_client__pathrev_t *loc2; 1165362181Sdim 1166362181Sdim /* True iff LOC1 is an ancestor of LOC2 or vice-versa (history-wise). */ 1167362181Sdim svn_boolean_t ancestral; 1168362181Sdim} merge_source_t; 1169362181Sdim 1170362181Sdim/* Description of the merge target root node (a WC working node) */ 1171362181Sdimtypedef struct merge_target_t 1172362181Sdim{ 1173362181Sdim /* Absolute path to the WC node */ 1174362181Sdim const char *abspath; 1175362181Sdim 1176362181Sdim /* The repository location of the base node of the target WC. If the node 1177362181Sdim * is locally added, then URL & REV are NULL & SVN_INVALID_REVNUM. 1178362181Sdim * REPOS_ROOT_URL and REPOS_UUID are always valid. */ 1179362181Sdim svn_client__pathrev_t loc; 1180362181Sdim 1181362181Sdim} merge_target_t; 1182362181Sdim 1183362181Sdim/* 1184362181Sdim * Similar API to svn_client_merge_peg5(). 1185362181Sdim */ 1186362181Sdimsvn_error_t * 1187362181Sdimsvn_client__merge_elements(svn_boolean_t *use_sleep, 1188362181Sdim apr_array_header_t *merge_sources, 1189362181Sdim merge_target_t *target, 1190362181Sdim svn_ra_session_t *ra_session, 1191362181Sdim svn_boolean_t diff_ignore_ancestry, 1192362181Sdim svn_boolean_t force_delete, 1193362181Sdim svn_boolean_t dry_run, 1194362181Sdim const apr_array_header_t *merge_options, 1195362181Sdim svn_client_ctx_t *ctx, 1196362181Sdim apr_pool_t *result_pool, 1197362181Sdim apr_pool_t *scratch_pool); 1198362181Sdim 1199362181Sdim/* Data for reporting when a merge aborted because of raising conflicts. 1200362181Sdim * 1201362181Sdim * ### TODO: More info, including the ranges (or other parameters) the user 1202362181Sdim * needs to complete the merge. 1203362181Sdim */ 1204362181Sdimtypedef struct svn_client__conflict_report_t 1205362181Sdim{ 1206362181Sdim const char *target_abspath; 1207362181Sdim /* The revision range during which conflicts were raised */ 1208362181Sdim const merge_source_t *conflicted_range; 1209362181Sdim /* Was the conflicted range the last range in the whole requested merge? */ 1210362181Sdim svn_boolean_t was_last_range; 1211362181Sdim} svn_client__conflict_report_t; 1212362181Sdim 1213362181Sdim/* Create and return an error structure appropriate for the unmerged 1214362181Sdim revisions range(s). */ 1215362181Sdimsvn_error_t * 1216362181Sdimsvn_client__make_merge_conflict_error(svn_client__conflict_report_t *report, 1217362181Sdim apr_pool_t *scratch_pool); 1218362181Sdim 1219362181Sdim/* The body of svn_client_merge5(), which see for details. */ 1220362181Sdimsvn_error_t * 1221362181Sdimsvn_client__merge_locked(svn_client__conflict_report_t **conflict_report, 1222362181Sdim const char *source1, 1223362181Sdim const svn_opt_revision_t *revision1, 1224362181Sdim const char *source2, 1225362181Sdim const svn_opt_revision_t *revision2, 1226362181Sdim const char *target_abspath, 1227362181Sdim svn_depth_t depth, 1228362181Sdim svn_boolean_t ignore_mergeinfo, 1229362181Sdim svn_boolean_t diff_ignore_ancestry, 1230362181Sdim svn_boolean_t force_delete, 1231362181Sdim svn_boolean_t record_only, 1232362181Sdim svn_boolean_t dry_run, 1233362181Sdim svn_boolean_t allow_mixed_rev, 1234362181Sdim const apr_array_header_t *merge_options, 1235362181Sdim svn_client_ctx_t *ctx, 1236362181Sdim apr_pool_t *result_pool, 1237362181Sdim apr_pool_t *scratch_pool); 1238362181Sdim 1239251881Speter#ifdef __cplusplus 1240251881Speter} 1241251881Speter#endif /* __cplusplus */ 1242251881Speter 1243251881Speter#endif /* SVN_LIBSVN_CLIENT_H */ 1244