2 * client.h : shared stuff internal to the client library.
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
21 * ====================================================================
26 #ifndef SVN_LIBSVN_CLIENT_H
27 #define SVN_LIBSVN_CLIENT_H
30 #include <apr_pools.h>
32 #include "svn_types.h"
34 #include "svn_string.h"
35 #include "svn_error.h"
37 #include "svn_client.h"
39 #include "private/svn_magic.h"
40 #include "private/svn_client_private.h"
41 #include "private/svn_diff_tree.h"
42 #include "private/svn_editor.h"
46 #endif /* __cplusplus */
48 /* Set *REVNUM to the revision number identified by REVISION.
50 If REVISION->kind is svn_opt_revision_number, just use
51 REVISION->value.number, ignoring LOCAL_ABSPATH and RA_SESSION.
53 Else if REVISION->kind is svn_opt_revision_committed,
54 svn_opt_revision_previous, or svn_opt_revision_base, or
55 svn_opt_revision_working, then the revision can be identified
56 purely based on the working copy's administrative information for
57 LOCAL_ABSPATH, so RA_SESSION is ignored. If LOCAL_ABSPATH is not
58 under revision control, return SVN_ERR_UNVERSIONED_RESOURCE, or if
59 LOCAL_ABSPATH is null, return SVN_ERR_CLIENT_VERSIONED_PATH_REQUIRED.
61 Else if REVISION->kind is svn_opt_revision_date or
62 svn_opt_revision_head, then RA_SESSION is used to retrieve the
63 revision from the repository (using REVISION->value.date in the
64 former case), and LOCAL_ABSPATH is ignored. If RA_SESSION is null,
65 return SVN_ERR_CLIENT_RA_ACCESS_REQUIRED.
67 Else if REVISION->kind is svn_opt_revision_unspecified, set
68 *REVNUM to SVN_INVALID_REVNUM.
70 If YOUNGEST_REV is non-NULL, it is an in/out parameter. If
71 *YOUNGEST_REV is valid, use it as the youngest revision in the
72 repository (regardless of reality) -- don't bother to lookup the
73 true value for HEAD, and don't return any value in *REVNUM greater
74 than *YOUNGEST_REV. If *YOUNGEST_REV is not valid, and a HEAD
75 lookup is required to populate *REVNUM, then also populate
76 *YOUNGEST_REV with the result. This is useful for making multiple
77 serialized calls to this function with a basically static view of
78 the repository, avoiding race conditions which could occur between
79 multiple invocations with HEAD lookup requests.
81 Else return SVN_ERR_CLIENT_BAD_REVISION.
83 Use SCRATCH_POOL for any temporary allocation. */
85 svn_client__get_revision_number(svn_revnum_t *revnum,
86 svn_revnum_t *youngest_rev,
87 svn_wc_context_t *wc_ctx,
88 const char *local_abspath,
89 svn_ra_session_t *ra_session,
90 const svn_opt_revision_t *revision,
91 apr_pool_t *scratch_pool);
93 /* Set *ORIGINAL_REPOS_RELPATH and *ORIGINAL_REVISION to the original location
94 that served as the source of the copy from which PATH_OR_URL at REVISION was
95 created, or NULL and SVN_INVALID_REVNUM (respectively) if PATH_OR_URL at
96 REVISION was not the result of a copy operation. */
98 svn_client__get_copy_source(const char **original_repos_relpath,
99 svn_revnum_t *original_revision,
100 const char *path_or_url,
101 const svn_opt_revision_t *revision,
102 svn_client_ctx_t *ctx,
103 apr_pool_t *result_pool,
104 apr_pool_t *scratch_pool);
106 /* Set *START_URL and *START_REVISION (and maybe *END_URL
107 and *END_REVISION) to the revisions and repository URLs of one
108 (or two) points of interest along a particular versioned resource's
109 line of history. PATH as it exists in "peg revision"
110 REVISION identifies that line of history, and START and END
111 specify the point(s) of interest (typically the revisions referred
112 to as the "operative range" for a given operation) along that history.
114 START_REVISION and/or END_REVISION may be NULL if not wanted.
115 END may be NULL or of kind svn_opt_revision_unspecified (in either case
116 END_URL and END_REVISION are not touched by the function);
117 START and REVISION may not.
119 If PATH is a WC path and REVISION is of kind svn_opt_revision_working,
120 then look at the PATH's copy-from URL instead of its base URL.
122 RA_SESSION should be an open RA session pointing at the URL of PATH,
123 or NULL, in which case this function will open its own temporary session.
125 A NOTE ABOUT FUTURE REPORTING:
127 If either START or END are greater than REVISION, then do a
128 sanity check (since we cannot search future history yet): verify
129 that PATH in the future revision(s) is the "same object" as the
130 one pegged by REVISION. In other words, all three objects must
131 be connected by a single line of history which exactly passes
132 through PATH at REVISION. If this sanity check fails, return
133 SVN_ERR_CLIENT_UNRELATED_RESOURCES. If PATH doesn't exist in the future
134 revision, SVN_ERR_FS_NOT_FOUND may also be returned.
136 CTX is the client context baton.
138 Use POOL for all allocations. */
140 svn_client__repos_locations(const char **start_url,
141 svn_revnum_t *start_revision,
142 const char **end_url,
143 svn_revnum_t *end_revision,
144 svn_ra_session_t *ra_session,
146 const svn_opt_revision_t *revision,
147 const svn_opt_revision_t *start,
148 const svn_opt_revision_t *end,
149 svn_client_ctx_t *ctx,
152 /* Trace a line of history of a particular versioned resource back to a
155 * Set *OP_LOC_P to the location that the object PEG_LOC had in
156 * revision OP_REVNUM.
158 * RA_SESSION is an open RA session to the correct repository; it may be
159 * temporarily reparented inside this function. */
161 svn_client__repos_location(svn_client__pathrev_t **op_loc_p,
162 svn_ra_session_t *ra_session,
163 const svn_client__pathrev_t *peg_loc,
164 svn_revnum_t op_revnum,
165 svn_client_ctx_t *ctx,
166 apr_pool_t *result_pool,
167 apr_pool_t *scratch_pool);
170 /* Set *SEGMENTS to an array of svn_location_segment_t * objects, each
171 representing a reposition location segment for the history of URL
173 between END_REVISION and START_REVISION, ordered from oldest
174 segment to youngest. *SEGMENTS may be empty but it will never
177 This is basically a thin de-stream-ifying wrapper around the
178 svn_ra_get_location_segments() interface, which see for the rules
179 governing PEG_REVISION, START_REVISION, and END_REVISION.
181 RA_SESSION is an RA session open to the repository of URL; it may be
182 temporarily reparented within this function.
184 CTX is the client context baton.
186 Use POOL for all allocations. */
188 svn_client__repos_location_segments(apr_array_header_t **segments,
189 svn_ra_session_t *ra_session,
191 svn_revnum_t peg_revision,
192 svn_revnum_t start_revision,
193 svn_revnum_t end_revision,
194 svn_client_ctx_t *ctx,
198 /* Find the common ancestor of two locations in a repository.
199 Ancestry is determined by the 'copy-from' relationship and the normal
200 successor relationship.
202 Set *ANCESTOR_P to the location of the youngest common ancestor of
203 LOC1 and LOC2. If the locations have no common ancestor (including if
204 they don't have the same repository root URL), set *ANCESTOR_P to NULL.
206 If SESSION is not NULL, use it for retrieving the common ancestor instead
207 of creating a new session.
209 Use the authentication baton cached in CTX to authenticate against
210 the repository. Use POOL for all allocations.
212 See also svn_client__calc_youngest_common_ancestor() to find youngest
213 common ancestor for already fetched history-as-mergeinfo information.
215 See also svn_client__youngest_common_ancestor().
218 svn_client__get_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p,
219 const svn_client__pathrev_t *loc1,
220 const svn_client__pathrev_t *loc2,
221 svn_ra_session_t *session,
222 svn_client_ctx_t *ctx,
223 apr_pool_t *result_pool,
224 apr_pool_t *scratch_pool);
226 /* Find the common ancestor of two locations in a repository using already
227 fetched history-as-mergeinfo information.
229 Ancestry is determined by the 'copy-from' relationship and the normal
230 successor relationship.
232 Set *ANCESTOR_P to the location of the youngest common ancestor of
233 LOC1 and LOC2. If the locations have no common ancestor (including if
234 they don't have the same repository root URL), set *ANCESTOR_P to NULL.
236 HISTORY1, HAS_REV_ZERO_HISTORY1, HISTORY2, HAS_REV_ZERO_HISTORY2 are
237 history-as-mergeinfo information as returned by
238 svn_client__get_history_as_mergeinfo() for LOC1 and LOC2 respectively.
240 See also svn_client__get_youngest_common_ancestor().
244 svn_client__calc_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p,
245 const svn_client__pathrev_t *loc1,
246 apr_hash_t *history1,
247 svn_boolean_t has_rev_zero_history1,
248 const svn_client__pathrev_t *loc2,
249 apr_hash_t *history2,
250 svn_boolean_t has_rev_zero_history2,
251 apr_pool_t *result_pool,
252 apr_pool_t *scratch_pool);
254 /* Ensure that RA_SESSION's session URL matches SESSION_URL,
255 reparenting that session if necessary.
256 Store the previous session URL in *OLD_SESSION_URL (so that if the
257 reparenting is meant to be temporary, the caller can reparent the
258 session back to where it was).
260 If SESSION_URL is NULL, treat this as a magic value meaning "point
261 the RA session to the root of the repository".
263 NOTE: The typical usage pattern for this functions is:
265 const char *old_session_url;
266 SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url,
273 SVN_ERR(svn_ra_reparent(ra_session, old_session_url, pool));
276 svn_client__ensure_ra_session_url(const char **old_session_url,
277 svn_ra_session_t *ra_session,
278 const char *session_url,
281 /* ---------------------------------------------------------------- */
284 /*** RA callbacks ***/
287 /* CTX is of type "svn_client_ctx_t *". */
288 #define SVN_CLIENT__HAS_LOG_MSG_FUNC(ctx) \
289 ((ctx)->log_msg_func3 || (ctx)->log_msg_func2 || (ctx)->log_msg_func)
291 /* Open an RA session, returning it in *RA_SESSION or a corrected URL
292 in *CORRECTED_URL. (This function mirrors svn_ra_open4(), which
293 see, regarding the interpretation and handling of these two parameters.)
295 The root of the session is specified by BASE_URL and BASE_DIR_ABSPATH.
297 Additional control parameters:
299 - COMMIT_ITEMS is an array of svn_client_commit_item_t *
300 structures, present only for working copy commits, NULL otherwise.
302 - WRITE_DAV_PROPS indicates that the RA layer can clear and write
303 the DAV properties in the working copy of BASE_DIR_ABSPATH.
305 - READ_DAV_PROPS indicates that the RA layer should not attempt to
306 modify the WC props directly, but is still allowed to read them.
308 BASE_DIR_ABSPATH may be NULL if the RA operation does not correspond to a
309 working copy (in which case, WRITE_DAV_PROPS and READ_DAV_PROPS must be
312 If WRITE_DAV_PROPS and READ_DAV_PROPS are both FALSE the working copy may
313 still be used for locating pristine files via their SHA1.
315 The calling application's authentication baton is provided in CTX,
316 and allocations related to this session are performed in POOL.
318 NOTE: The reason for the _internal suffix of this function's name is to
319 avoid confusion with the public API svn_client_open_ra_session(). */
321 svn_client__open_ra_session_internal(svn_ra_session_t **ra_session,
322 const char **corrected_url,
323 const char *base_url,
324 const char *base_dir_abspath,
325 const apr_array_header_t *commit_items,
326 svn_boolean_t write_dav_props,
327 svn_boolean_t read_dav_props,
328 svn_client_ctx_t *ctx,
329 apr_pool_t *result_pool,
330 apr_pool_t *scratch_pool);
334 svn_client__ra_provide_base(svn_stream_t **contents,
335 svn_revnum_t *revision,
337 const char *repos_relpath,
338 apr_pool_t *result_pool,
339 apr_pool_t *scratch_pool);
343 svn_client__ra_provide_props(apr_hash_t **props,
344 svn_revnum_t *revision,
346 const char *repos_relpath,
347 apr_pool_t *result_pool,
348 apr_pool_t *scratch_pool);
352 svn_client__ra_get_copysrc_kind(svn_node_kind_t *kind,
354 const char *repos_relpath,
355 svn_revnum_t src_revision,
356 apr_pool_t *scratch_pool);
360 svn_client__ra_make_cb_baton(svn_wc_context_t *wc_ctx,
361 apr_hash_t *relpath_map,
362 apr_pool_t *result_pool);
364 /* ---------------------------------------------------------------- */
369 /* If AUTOPROPS is not null: Then read automatic properties matching PATH
370 from AUTOPROPS. AUTOPROPS is is a hash as per
371 svn_client__get_all_auto_props. Set *PROPERTIES to a hash containing
372 propname/value pairs (const char * keys mapping to svn_string_t * values).
374 If AUTOPROPS is null then set *PROPERTIES to an empty hash.
376 If *MIMETYPE is null or "application/octet-stream" then check AUTOPROPS
377 for a matching svn:mime-type. If AUTOPROPS is null or no match is found
378 and MAGIC_COOKIE is not NULL, then then try to detect the mime-type with
379 libmagic. If a mimetype is found then add it to *PROPERTIES and set
380 *MIMETYPE to the mimetype value or NULL otherwise.
382 Allocate the *PROPERTIES and its contents as well as *MIMETYPE, in
383 RESULT_POOL. Use SCRATCH_POOL for temporary allocations. */
384 svn_error_t *svn_client__get_paths_auto_props(
385 apr_hash_t **properties,
386 const char **mimetype,
388 svn_magic__cookie_t *magic_cookie,
389 apr_hash_t *autoprops,
390 svn_client_ctx_t *ctx,
391 apr_pool_t *result_pool,
392 apr_pool_t *scratch_pool);
394 /* Gather all auto-props from CTX->config (or none if auto-props are
395 disabled) and all svn:auto-props explicitly set on or inherited
398 If PATH_OR_URL is an unversioned WC path then gather the
399 svn:auto-props inherited by PATH_OR_URL's nearest versioned
402 If PATH_OR_URL is a URL ask for the properties @HEAD, if it is a WC
403 path as sfor the working properties.
405 Store both types of auto-props in *AUTOPROPS, a hash mapping const
406 char * file patterns to another hash which maps const char * property
407 names to const char *property values.
409 If a given property name exists for the same pattern in both the config
410 file and in an a svn:auto-props property, the latter overrides the
411 former. If a given property name exists for the same pattern in two
412 different inherited svn:auto-props, then the closer path-wise
413 property overrides the more distant. svn:auto-props explicitly set
414 on PATH_OR_URL have the highest precedence and override inherited props
415 and config file settings.
417 Allocate *AUTOPROPS in RESULT_POOL. Use SCRATCH_POOL for temporary
419 svn_error_t *svn_client__get_all_auto_props(apr_hash_t **autoprops,
420 const char *path_or_url,
421 svn_client_ctx_t *ctx,
422 apr_pool_t *result_pool,
423 apr_pool_t *scratch_pool);
425 /* Get a list of ignore patterns defined by the svn:global-ignores
426 properties set on, or inherited by, PATH_OR_URL. Store the collected
427 patterns as const char * elements in the array *IGNORES. Allocate
428 *IGNORES and its contents in RESULT_POOL. Use SCRATCH_POOL for
429 temporary allocations. */
430 svn_error_t *svn_client__get_inherited_ignores(apr_array_header_t **ignores,
431 const char *path_or_url,
432 svn_client_ctx_t *ctx,
433 apr_pool_t *result_pool,
434 apr_pool_t *scratch_pool);
436 /* The main logic for client deletion from a working copy. Deletes PATH
437 from CTX->WC_CTX. If PATH (or any item below a directory PATH) is
438 modified the delete will fail and return an error unless FORCE or KEEP_LOCAL
441 If KEEP_LOCAL is TRUE then PATH is only scheduled from deletion from the
442 repository and a local copy of PATH will be kept in the working copy.
444 If DRY_RUN is TRUE all the checks are made to ensure that the delete can
445 occur, but the working copy is not modified. If NOTIFY_FUNC is not
446 null, it is called with NOTIFY_BATON for each file or directory deleted. */
448 svn_client__wc_delete(const char *local_abspath,
450 svn_boolean_t dry_run,
451 svn_boolean_t keep_local,
452 svn_wc_notify_func2_t notify_func,
454 svn_client_ctx_t *ctx,
458 /* Like svn_client__wc_delete(), but deletes multiple TARGETS efficiently. */
460 svn_client__wc_delete_many(const apr_array_header_t *targets,
462 svn_boolean_t dry_run,
463 svn_boolean_t keep_local,
464 svn_wc_notify_func2_t notify_func,
466 svn_client_ctx_t *ctx,
470 /* Make PATH and add it to the working copy, optionally making all the
471 intermediate parent directories if MAKE_PARENTS is TRUE. */
473 svn_client__make_local_parents(const char *path,
474 svn_boolean_t make_parents,
475 svn_client_ctx_t *ctx,
478 /* ---------------------------------------------------------------- */
481 /*** Checkout, update and switch ***/
483 /* Update a working copy LOCAL_ABSPATH to REVISION, and (if not NULL) set
484 RESULT_REV to the update revision.
486 If DEPTH is svn_depth_unknown, then use whatever depth is already
487 set for LOCAL_ABSPATH, or @c svn_depth_infinity if LOCAL_ABSPATH does
490 Else if DEPTH is svn_depth_infinity, then update fully recursively
491 (resetting the existing depth of the working copy if necessary).
492 Else if DEPTH is svn_depth_files, update all files under LOCAL_ABSPATH (if
493 any), but exclude any subdirectories. Else if DEPTH is
494 svn_depth_immediates, update all files and include immediate
495 subdirectories (at svn_depth_empty). Else if DEPTH is
496 svn_depth_empty, just update LOCAL_ABSPATH; if LOCAL_ABSPATH is a
497 directory, that means touching only its properties not its entries.
499 If DEPTH_IS_STICKY is set and DEPTH is not svn_depth_unknown, then
500 in addition to updating LOCAL_ABSPATH, also set its sticky ambient depth
503 If IGNORE_EXTERNALS is true, do no externals processing.
505 Set *TIMESTAMP_SLEEP to TRUE if a sleep is required; otherwise do not
506 change *TIMESTAMP_SLEEP. The output will be valid even if the function
509 If ALLOW_UNVER_OBSTRUCTIONS is TRUE, unversioned children of LOCAL_ABSPATH
510 that obstruct items added from the repos are tolerated; if FALSE,
511 these obstructions cause the update to fail.
513 If ADDS_AS_MODIFICATION is TRUE, local additions are handled as
514 modifications on added nodes.
516 If INNERUPDATE is true, no anchor check is performed on the update target.
518 If MAKE_PARENTS is true, allow the update to calculate and checkout
519 (with depth=empty) any parent directories of the requested update
520 target which are missing from the working copy.
522 NOTE: You may not specify both INNERUPDATE and MAKE_PARENTS as true.
525 svn_client__update_internal(svn_revnum_t *result_rev,
526 const char *local_abspath,
527 const svn_opt_revision_t *revision,
529 svn_boolean_t depth_is_sticky,
530 svn_boolean_t ignore_externals,
531 svn_boolean_t allow_unver_obstructions,
532 svn_boolean_t adds_as_modification,
533 svn_boolean_t make_parents,
534 svn_boolean_t innerupdate,
535 svn_boolean_t *timestamp_sleep,
536 svn_client_ctx_t *ctx,
539 /* Checkout into LOCAL_ABSPATH a working copy of URL at REVISION, and (if not
540 NULL) set RESULT_REV to the checked out revision.
542 If DEPTH is svn_depth_infinity, then check out fully recursively.
543 Else if DEPTH is svn_depth_files, checkout all files under LOCAL_ABSPATH (if
544 any), but not subdirectories. Else if DEPTH is
545 svn_depth_immediates, check out all files and include immediate
546 subdirectories (at svn_depth_empty). Else if DEPTH is
547 svn_depth_empty, just check out LOCAL_ABSPATH, with none of its entries.
549 DEPTH must be a definite depth, not (e.g.) svn_depth_unknown.
551 RA_CACHE is a pointer to a cache of information for the URL at
552 REVISION based on the PEG_REVISION. Any information not in
553 *RA_CACHE is retrieved by a round-trip to the repository. RA_CACHE
554 may be NULL which indicates that no cache information is available.
556 If IGNORE_EXTERNALS is true, do no externals processing.
558 Set *TIMESTAMP_SLEEP to TRUE if a sleep is required; otherwise do not
559 change *TIMESTAMP_SLEEP. The output will be valid even if the function
562 If ALLOW_UNVER_OBSTRUCTIONS is TRUE,
563 unversioned children of LOCAL_ABSPATH that obstruct items added from
564 the repos are tolerated; if FALSE, these obstructions cause the checkout
567 If INNERCHECKOUT is true, no anchor check is performed on the target.
570 svn_client__checkout_internal(svn_revnum_t *result_rev,
572 const char *local_abspath,
573 const svn_opt_revision_t *peg_revision,
574 const svn_opt_revision_t *revision,
576 svn_boolean_t ignore_externals,
577 svn_boolean_t allow_unver_obstructions,
578 svn_boolean_t *timestamp_sleep,
579 svn_client_ctx_t *ctx,
582 /* Switch a working copy PATH to URL@PEG_REVISION at REVISION, and (if not
583 NULL) set RESULT_REV to the switch revision. A write lock will be
584 acquired and released if not held. Only switch as deeply as DEPTH
587 Set *TIMESTAMP_SLEEP to TRUE if a sleep is required; otherwise do not
588 change *TIMESTAMP_SLEEP. The output will be valid even if the function
591 If IGNORE_EXTERNALS is true, don't process externals.
593 If ALLOW_UNVER_OBSTRUCTIONS is TRUE, unversioned children of PATH
594 that obstruct items added from the repos are tolerated; if FALSE,
595 these obstructions cause the switch to fail.
597 DEPTH and DEPTH_IS_STICKY behave as for svn_client__update_internal().
599 If IGNORE_ANCESTRY is true, don't perform a common ancestry check
600 between the PATH and URL; otherwise, do, and return
601 SVN_ERR_CLIENT_UNRELATED_RESOURCES if they aren't related.
604 svn_client__switch_internal(svn_revnum_t *result_rev,
607 const svn_opt_revision_t *peg_revision,
608 const svn_opt_revision_t *revision,
610 svn_boolean_t depth_is_sticky,
611 svn_boolean_t ignore_externals,
612 svn_boolean_t allow_unver_obstructions,
613 svn_boolean_t ignore_ancestry,
614 svn_boolean_t *timestamp_sleep,
615 svn_client_ctx_t *ctx,
618 /* ---------------------------------------------------------------- */
621 /*** Inheritable Properties ***/
623 /* Convert any svn_prop_inherited_item_t elements in INHERITED_PROPS which
624 have repository root relative path PATH_OR_URL structure members to URLs
625 using REPOS_ROOT_URL. Changes to the contents of INHERITED_PROPS are
626 allocated in RESULT_POOL. SCRATCH_POOL is used for temporary
629 svn_client__iprop_relpaths_to_urls(apr_array_header_t *inherited_props,
630 const char *repos_root_url,
631 apr_pool_t *result_pool,
632 apr_pool_t *scratch_pool);
634 /* Fetch the inherited properties for the base of LOCAL_ABSPATH as well
635 as any WC roots under LOCAL_ABSPATH (as limited by DEPTH) using
636 RA_SESSION. Store the results in *WCROOT_IPROPS, a hash mapping
637 const char * absolute working copy paths to depth-first ordered arrays
638 of svn_prop_inherited_item_t * structures.
640 Any svn_prop_inherited_item_t->path_or_url members returned in
641 *WCROOT_IPROPS are repository relative paths.
643 If LOCAL_ABSPATH has no base then do nothing.
645 RA_SESSION should be an open RA session pointing at the URL of PATH,
646 or NULL, in which case this function will use its own temporary session.
648 Allocate *WCROOT_IPROPS in RESULT_POOL, use SCRATCH_POOL for temporary
651 If one or more of the paths are not available in the repository at the
652 specified revision, these paths will not be added to the hashtable.
655 svn_client__get_inheritable_props(apr_hash_t **wcroot_iprops,
656 const char *local_abspath,
657 svn_revnum_t revision,
659 svn_ra_session_t *ra_session,
660 svn_client_ctx_t *ctx,
661 apr_pool_t *result_pool,
662 apr_pool_t *scratch_pool);
664 /* ---------------------------------------------------------------- */
667 /*** Editor for repository diff ***/
669 /* Create an editor for a pure repository comparison, i.e. comparing one
670 repository version against the other.
672 DIFF_CALLBACKS/DIFF_CMD_BATON represent the callback that implements
675 DEPTH is the depth to recurse.
677 RA_SESSION is an RA session through which this editor may fetch
678 properties, file contents and directory listings of the 'old' side of the
679 diff. It is a separate RA session from the one through which this editor
680 is being driven. REVISION is the revision number of the 'old' side of
683 If TEXT_DELTAS is FALSE, then do not expect text deltas from the edit
684 drive, nor send the 'before' and 'after' texts to the diff callbacks;
685 instead, send empty files to the diff callbacks if there was a change.
686 This must be FALSE if the edit producer is not sending text deltas,
687 otherwise the file content checksum comparisons will fail.
689 EDITOR/EDIT_BATON return the newly created editor and baton.
694 svn_client__get_diff_editor2(const svn_delta_editor_t **editor,
696 svn_ra_session_t *ra_session,
698 svn_revnum_t revision,
699 svn_boolean_t text_deltas,
700 const svn_diff_tree_processor_t *processor,
701 svn_cancel_func_t cancel_func,
703 apr_pool_t *result_pool);
705 /* ---------------------------------------------------------------- */
708 /*** Editor for diff summary ***/
710 /* Set *CALLBACKS and *CALLBACK_BATON to a set of diff callbacks that will
711 report a diff summary, i.e. only providing information about the changed
712 items without the text deltas.
714 TARGET is the target path, relative to the anchor, of the diff.
716 SUMMARIZE_FUNC is called with SUMMARIZE_BATON as parameter by the
717 created callbacks for each changed item.
720 svn_client__get_diff_summarize_callbacks(
721 svn_wc_diff_callbacks4_t **callbacks,
722 void **callback_baton,
724 svn_boolean_t reversed,
725 svn_client_diff_summarize_func_t summarize_func,
726 void *summarize_baton,
729 /* ---------------------------------------------------------------- */
734 /* This structure is used to associate a specific copy or move SRC with a
735 specific copy or move destination. It also contains information which
736 various helper functions may need. Not every copy function uses every
739 typedef struct svn_client__copy_pair_t
741 /* The absolute source path or url. */
742 const char *src_abspath_or_url;
744 /* The base name of the object. It should be the same for both src
746 const char *base_name;
748 /* The node kind of the source */
749 svn_node_kind_t src_kind;
751 /* The original source name. (Used when the source gets overwritten by a
752 peg revision lookup.) */
753 const char *src_original;
755 /* The source operational revision. */
756 svn_opt_revision_t src_op_revision;
758 /* The source peg revision. */
759 svn_opt_revision_t src_peg_revision;
761 /* The source revision number. */
762 svn_revnum_t src_revnum;
764 /* The absolute destination path or url */
765 const char *dst_abspath_or_url;
767 /* The absolute source path or url of the destination's parent. */
768 const char *dst_parent_abspath;
769 } svn_client__copy_pair_t;
771 /* ---------------------------------------------------------------- */
774 /*** Commit Stuff ***/
776 /* WARNING: This is all new, untested, un-peer-reviewed conceptual
779 The day that 'svn switch' came into existence, our old commit
780 crawler (svn_wc_crawl_local_mods) became obsolete. It relied far
781 too heavily on the on-disk hierarchy of files and directories, and
782 simply had no way to support disjoint working copy trees or nest
783 working copies. The primary reason for this is that commit
784 process, in order to guarantee atomicity, is a single drive of a
785 commit editor which is based not on working copy paths, but on
786 URLs. With the completion of 'svn switch', it became all too
787 likely that the on-disk working copy hierarchy would no longer be
788 guaranteed to map to a similar in-repository hierarchy.
790 Aside from this new brokenness of the old system, an unrelated
791 feature request had cropped up -- the ability to know in advance of
792 your commit, exactly what would be committed (so that log messages
793 could be initially populated with this information). Since the old
794 crawler discovered commit candidates while in the process of
795 committing, it was impossible to harvest this information upfront.
796 As a workaround, svn_wc_statuses() was used to stat the whole
797 working copy for changes before the commit started...and then the
798 commit would again stat the whole tree for changes.
800 Enter the new system.
802 The primary goal of this system is very straightforward: harvest
803 all commit candidate information up front, and cache enough info in
804 the process to use this to drive a URL-sorted commit.
806 *** END-OF-KNOWLEDGE ***
808 The prototypes below are still in development. In general, the
809 idea is that commit-y processes ('svn mkdir URL', 'svn delete URL',
810 'svn commit', 'svn copy WC_PATH URL', 'svn copy URL1 URL2', 'svn
811 move URL1 URL2', others?) generate the cached commit candidate
812 information, and hand this information off to a consumer which is
813 responsible for driving the RA layer's commit editor in a
814 URL-depth-first fashion and reporting back the post-commit
819 /* Structure that contains an apr_hash_t * hash of apr_array_header_t *
820 arrays of svn_client_commit_item3_t * structures; keyed by the
821 canonical repository URLs. For faster lookup, it also provides
822 an hash index keyed by the local absolute path. */
823 typedef struct svn_client__committables_t
825 /* apr_array_header_t array of svn_client_commit_item3_t structures
826 keyed by canonical repository URL */
827 apr_hash_t *by_repository;
829 /* svn_client_commit_item3_t structures keyed by local absolute path
830 (path member in the respective structures).
832 This member is for fast lookup only, i.e. whether there is an
833 entry for the given path or not, but it will only allow for one
834 entry per absolute path (in case of duplicate entries in the
835 above arrays). The "canonical" data storage containing all item
839 } svn_client__committables_t;
841 /* Callback for the commit harvester to check if a node exists at the specified
843 typedef svn_error_t *(*svn_client__check_url_kind_t)(void *baton,
844 svn_node_kind_t *kind,
846 svn_revnum_t revision,
847 apr_pool_t *scratch_pool);
849 /* Recursively crawl a set of working copy paths (BASE_DIR_ABSPATH + each
850 item in the TARGETS array) looking for commit candidates, locking
851 working copy directories as the crawl progresses. For each
854 - create svn_client_commit_item3_t for the candidate.
856 - add the structure to an apr_array_header_t array of commit
857 items that are in the same repository, creating a new array if
860 - add (or update) a reference to this array to the by_repository
861 hash within COMMITTABLES and update the by_path member as well-
863 - if the candidate has a lock token, add it to the LOCK_TOKENS hash.
865 - if the candidate is a directory scheduled for deletion, crawl
866 the directories children recursively for any lock tokens and
867 add them to the LOCK_TOKENS array.
869 At the successful return of this function, COMMITTABLES will point
870 a new svn_client__committables_t*. LOCK_TOKENS will point to a hash
871 table with const char * lock tokens, keyed on const char * URLs.
873 If DEPTH is specified, descend (or not) into each target in TARGETS
874 as specified by DEPTH; the behavior is the same as that described
875 for svn_client_commit4().
877 If DEPTH_EMPTY_START is >= 0, all targets after index DEPTH_EMPTY_START
878 in TARGETS are handled as having svn_depth_empty.
880 If JUST_LOCKED is TRUE, treat unmodified items with lock tokens as
883 If CHANGELISTS is non-NULL, it is an array of const char *
884 changelist names used as a restrictive filter
885 when harvesting committables; that is, don't add a path to
886 COMMITTABLES unless it's a member of one of those changelists.
888 If CTX->CANCEL_FUNC is non-null, it will be called with
889 CTX->CANCEL_BATON while harvesting to determine if the client has
890 cancelled the operation. */
892 svn_client__harvest_committables(svn_client__committables_t **committables,
893 apr_hash_t **lock_tokens,
894 const char *base_dir_abspath,
895 const apr_array_header_t *targets,
896 int depth_empty_start,
898 svn_boolean_t just_locked,
899 const apr_array_header_t *changelists,
900 svn_client__check_url_kind_t check_url_func,
901 void *check_url_baton,
902 svn_client_ctx_t *ctx,
903 apr_pool_t *result_pool,
904 apr_pool_t *scratch_pool);
907 /* Recursively crawl each absolute working copy path SRC in COPY_PAIRS,
908 harvesting commit_items into a COMMITABLES structure as if every entry
909 at or below the SRC was to be committed as a set of adds (mostly with
910 history) to a new repository URL (DST in COPY_PAIRS).
912 If CTX->CANCEL_FUNC is non-null, it will be called with
913 CTX->CANCEL_BATON while harvesting to determine if the client has
914 cancelled the operation. */
916 svn_client__get_copy_committables(svn_client__committables_t **committables,
917 const apr_array_header_t *copy_pairs,
918 svn_client__check_url_kind_t check_url_func,
919 void *check_url_baton,
920 svn_client_ctx_t *ctx,
921 apr_pool_t *result_pool,
922 apr_pool_t *scratch_pool);
924 /* A qsort()-compatible sort routine for sorting an array of
925 svn_client_commit_item_t *'s by their URL member. */
926 int svn_client__sort_commit_item_urls(const void *a, const void *b);
929 /* Rewrite the COMMIT_ITEMS array to be sorted by URL. Also, discover
930 a common *BASE_URL for the items in the array, and rewrite those
931 items' URLs to be relative to that *BASE_URL.
933 COMMIT_ITEMS is an array of (svn_client_commit_item3_t *) items.
935 Afterwards, some of the items in COMMIT_ITEMS may contain data
936 allocated in POOL. */
938 svn_client__condense_commit_items(const char **base_url,
939 apr_array_header_t *commit_items,
943 /* Like svn_ra_stat() on the ra session root, but with a compatibility
944 hack for pre-1.2 svnserve that don't support this api. */
946 svn_client__ra_stat_compatible(svn_ra_session_t *ra_session,
948 svn_dirent_t **dirent_p,
949 apr_uint32_t dirent_fields,
950 svn_client_ctx_t *ctx,
951 apr_pool_t *result_pool);
954 /* Commit the items in the COMMIT_ITEMS array using EDITOR/EDIT_BATON
955 to describe the committed local mods. Prior to this call,
956 COMMIT_ITEMS should have been run through (and BASE_URL generated
957 by) svn_client__condense_commit_items().
959 COMMIT_ITEMS is an array of (svn_client_commit_item3_t *) items.
961 CTX->NOTIFY_FUNC/CTX->BATON will be called as the commit progresses, as
962 a way of describing actions to the application layer (if non NULL).
964 NOTIFY_PATH_PREFIX will be passed to CTX->notify_func2() as the
965 common absolute path prefix of the committed paths. It can be NULL.
967 If SHA1_CHECKSUMS is not NULL, set *SHA1_CHECKSUMS to a hash containing,
968 for each file transmitted, a mapping from the commit-item's (const
969 char *) path to the (const svn_checksum_t *) SHA1 checksum of its new text
972 Use RESULT_POOL for all allocating the resulting hashes and SCRATCH_POOL
973 for temporary allocations.
976 svn_client__do_commit(const char *base_url,
977 const apr_array_header_t *commit_items,
978 const svn_delta_editor_t *editor,
980 const char *notify_path_prefix,
981 apr_hash_t **sha1_checksums,
982 svn_client_ctx_t *ctx,
983 apr_pool_t *result_pool,
984 apr_pool_t *scratch_pool);
989 /*** Externals (Modules) ***/
991 /* Handle changes to the svn:externals property described by EXTERNALS_NEW,
992 and AMBIENT_DEPTHS. The tree's top level directory
993 is at TARGET_ABSPATH which has a root URL of REPOS_ROOT_URL.
994 A write lock should be held.
996 For each changed value of the property, discover the nature of the
997 change and behave appropriately -- either check a new "external"
998 subdir, or call svn_wc_remove_from_revision_control() on an
999 existing one, or both.
1001 TARGET_ABSPATH is the root of the driving operation and
1002 REQUESTED_DEPTH is the requested depth of the driving operation
1003 (e.g., update, switch, etc). If it is neither svn_depth_infinity
1004 nor svn_depth_unknown, then changes to svn:externals will have no
1005 effect. If REQUESTED_DEPTH is svn_depth_unknown, then the ambient
1006 depth of each working copy directory holding an svn:externals value
1007 will determine whether that value is interpreted there (the ambient
1008 depth must be svn_depth_infinity). If REQUESTED_DEPTH is
1009 svn_depth_infinity, then it is presumed to be expanding any
1010 shallower ambient depth, so changes to svn:externals values will be
1013 Pass NOTIFY_FUNC with NOTIFY_BATON along to svn_client_checkout().
1015 Set *TIMESTAMP_SLEEP to TRUE if a sleep is required; otherwise do not
1016 change *TIMESTAMP_SLEEP. The output will be valid even if the function
1019 Use POOL for temporary allocation. */
1021 svn_client__handle_externals(apr_hash_t *externals_new,
1022 apr_hash_t *ambient_depths,
1023 const char *repos_root_url,
1024 const char *target_abspath,
1025 svn_depth_t requested_depth,
1026 svn_boolean_t *timestamp_sleep,
1027 svn_client_ctx_t *ctx,
1031 /* Export externals definitions described by EXTERNALS, a hash of the
1032 form returned by svn_wc_edited_externals() (which see). The external
1033 items will be exported instead of checked out -- they will have no
1034 administrative subdirectories.
1036 The checked out or exported tree's top level directory is at
1037 TO_ABSPATH and corresponds to FROM_URL URL in the repository, which
1038 has a root URL of REPOS_ROOT_URL.
1040 REQUESTED_DEPTH is the requested_depth of the driving operation; it
1041 behaves as for svn_client__handle_externals(), except that ambient
1042 depths are presumed to be svn_depth_infinity.
1044 NATIVE_EOL is the value passed as NATIVE_EOL when exporting.
1046 Use POOL for temporary allocation. */
1048 svn_client__export_externals(apr_hash_t *externals,
1049 const char *from_url,
1050 const char *to_abspath,
1051 const char *repos_root_url,
1052 svn_depth_t requested_depth,
1053 const char *native_eol,
1054 svn_boolean_t ignore_keywords,
1055 svn_client_ctx_t *ctx,
1058 /* Baton for svn_client__dirent_fetcher */
1059 struct svn_client__dirent_fetcher_baton_t
1061 svn_ra_session_t *ra_session;
1062 svn_revnum_t target_revision;
1063 const char *anchor_url;
1066 /* Implements svn_wc_dirents_func_t for update and switch handling. Assumes
1067 a struct svn_client__dirent_fetcher_baton_t * baton */
1069 svn_client__dirent_fetcher(void *baton,
1070 apr_hash_t **dirents,
1071 const char *repos_root_url,
1072 const char *repos_relpath,
1073 apr_pool_t *result_pool,
1074 apr_pool_t *scratch_pool);
1076 /* Retrieve log messages using the first provided (non-NULL) callback
1077 in the set of *CTX->log_msg_func3, CTX->log_msg_func2, or
1078 CTX->log_msg_func. Other arguments same as
1079 svn_client_get_commit_log3_t. */
1081 svn_client__get_log_msg(const char **log_msg,
1082 const char **tmp_file,
1083 const apr_array_header_t *commit_items,
1084 svn_client_ctx_t *ctx,
1087 /* Return the revision properties stored in REVPROP_TABLE_IN, adding
1088 LOG_MSG as SVN_PROP_REVISION_LOG in *REVPROP_TABLE_OUT, allocated in
1089 POOL. *REVPROP_TABLE_OUT will map const char * property names to
1090 svn_string_t values. If REVPROP_TABLE_IN is non-NULL, check that
1091 it doesn't contain any of the standard Subversion properties. In
1092 that case, return SVN_ERR_CLIENT_PROPERTY_NAME. */
1094 svn_client__ensure_revprop_table(apr_hash_t **revprop_table_out,
1095 const apr_hash_t *revprop_table_in,
1096 const char *log_msg,
1097 svn_client_ctx_t *ctx,
1100 /* Return a potentially translated version of local file LOCAL_ABSPATH
1101 in NORMAL_STREAM. REVISION must be one of the following: BASE, COMMITTED,
1104 EXPAND_KEYWORDS operates as per the EXPAND argument to
1105 svn_subst_stream_translated, which see. If NORMALIZE_EOLS is TRUE and
1106 LOCAL_ABSPATH requires translation, then normalize the line endings in
1109 Uses SCRATCH_POOL for temporary allocations. */
1111 svn_client__get_normalized_stream(svn_stream_t **normal_stream,
1112 svn_wc_context_t *wc_ctx,
1113 const char *local_abspath,
1114 const svn_opt_revision_t *revision,
1115 svn_boolean_t expand_keywords,
1116 svn_boolean_t normalize_eols,
1117 svn_cancel_func_t cancel_func,
1119 apr_pool_t *result_pool,
1120 apr_pool_t *scratch_pool);
1122 /* Return a set of callbacks to use with the Ev2 shims. */
1123 svn_delta_shim_callbacks_t *
1124 svn_client__get_shim_callbacks(svn_wc_context_t *wc_ctx,
1125 apr_hash_t *relpath_map,
1126 apr_pool_t *result_pool);
1128 /* Return REVISION unless its kind is 'unspecified' in which case return
1129 * a pointer to a statically allocated revision structure of kind 'head'
1130 * if PATH_OR_URL is a URL or 'base' if it is a WC path. */
1131 const svn_opt_revision_t *
1132 svn_cl__rev_default_to_head_or_base(const svn_opt_revision_t *revision,
1133 const char *path_or_url);
1135 /* Return REVISION unless its kind is 'unspecified' in which case return
1136 * a pointer to a statically allocated revision structure of kind 'head'
1137 * if PATH_OR_URL is a URL or 'working' if it is a WC path. */
1138 const svn_opt_revision_t *
1139 svn_cl__rev_default_to_head_or_working(const svn_opt_revision_t *revision,
1140 const char *path_or_url);
1142 /* Return REVISION unless its kind is 'unspecified' in which case return
1144 const svn_opt_revision_t *
1145 svn_cl__rev_default_to_peg(const svn_opt_revision_t *revision,
1146 const svn_opt_revision_t *peg_revision);
1148 /* Call the conflict resolver callback in CTX for each conflict recorded
1149 * in CONFLICTED_PATHS (const char *abspath keys; ignored values). If
1150 * CONFLICTS_REMAIN is not NULL, then set *CONFLICTS_REMAIN to true if
1151 * there are any conflicts among CONFLICTED_PATHS remaining unresolved
1152 * at the end of this operation, else set it to false.
1155 svn_client__resolve_conflicts(svn_boolean_t *conflicts_remain,
1156 apr_hash_t *conflicted_paths,
1157 svn_client_ctx_t *ctx,
1158 apr_pool_t *scratch_pool);
1164 #endif /* __cplusplus */
1166 #endif /* SVN_LIBSVN_CLIENT_H */