3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
20 * ====================================================================
24 * @brief The Subversion Working Copy Library - Metadata/Base-Text Support
30 * - Ability to manipulate working copy's administrative files.
33 * - The main working copy library
41 #include "svn_types.h"
42 #include "svn_error.h"
43 #include "svn_config.h"
46 #include "private/svn_skel.h"
47 #include "private/svn_sqlite.h"
48 #include "private/svn_wc_private.h"
50 #include "svn_private_config.h"
54 #endif /* __cplusplus */
56 /* INTERFACE CONVENTIONS
60 There are numerous functions within this API which take a (large) number
61 of "out" parameters. These are listed individually, rather than combined
62 into a struct, so that a caller can be fine-grained about the which
63 pieces of information are being requested. In many cases, only a subset
64 is required, so the implementation can perform various optimizations
65 to fulfill the limited request for information.
70 wc_db uses the dual-pool paradigm for all of its functions. Any OUT
71 parameter will be allocated within the result pool, and all temporary
72 allocations will be performed within the scratch pool.
74 The pool that DB is allocated within (the "state" pool) is only used
75 for a few, limited allocations to track each of the working copy roots
76 that the DB is asked to operate upon. The memory usage on this pool
77 is O(# wcroots), which should normally be one or a few. Custom clients
78 which hold open structures over a significant period of time should
79 pay particular attention to the number of roots touched, and the
80 resulting impact on memory consumption (which should still be minimal).
86 - any output arguments
89 - any other input arguments
94 This parameter is the primary context for all operations on the
95 metadata for working copies. This parameter is passed to almost every
96 function, and maintains information and state about every working
97 copy "touched" by any of the APIs in this interface.
100 All *_ABSPATH parameters in this API are absolute paths in the local
101 filesystem, represented in Subversion internal canonical form.
104 This parameter specifies a particular *versioned* node in the local
105 filesystem. From this node, a working copy root is implied, and will
106 be used for the given API operation.
109 This parameter is similar to LOCAL_ABSPATH, but the semantics of the
110 parameter and operation require the node to be a directory within
114 This is a "Working copy Root Indicator" path. This refers to a location
115 in the local filesystem that is anywhere inside a working copy. The given
116 operation will be performed within the context of the root of that
117 working copy. This does not necessarily need to refer to a specific
118 versioned node or the root of a working copy (although it can) -- any
119 location, existing or not, is sufficient, as long as it is inside a
121 ### TODO: Define behaviour for switches and externals.
122 ### Preference has been stated that WRI_ABSPATH should imply the root
123 ### of the parent WC of all switches and externals, but that may
124 ### not play out well, especially with multiple repositories involved.
127 /* Context data structure for interacting with the administrative data. */
128 typedef struct svn_wc__db_t svn_wc__db_t;
131 /* Enumerated values describing the state of a node. */
132 typedef enum svn_wc__db_status_t {
133 /* The node is present and has no known modifications applied to it. */
134 svn_wc__db_status_normal,
136 /* The node has been added (potentially obscuring a delete or move of
137 the BASE node; see HAVE_BASE param [### What param? This is an enum
138 not a function.] ). The text will be marked as
139 modified, and if properties exist, they will be marked as modified.
141 In many cases svn_wc__db_status_added means any of added, moved-here
142 or copied-here. See individual functions for clarification and
143 svn_wc__db_scan_addition() to get more details. */
144 svn_wc__db_status_added,
146 /* This node has been added with history, based on the move source.
147 Text and property modifications are based on whether changes have
148 been made against their pristine versions. */
149 svn_wc__db_status_moved_here,
151 /* This node has been added with history, based on the copy source.
152 Text and property modifications are based on whether changes have
153 been made against their pristine versions. */
154 svn_wc__db_status_copied,
156 /* This node has been deleted. No text or property modifications
158 svn_wc__db_status_deleted,
160 /* This node was named by the server, but no information was provided. */
161 svn_wc__db_status_server_excluded,
163 /* This node has been administratively excluded. */
164 svn_wc__db_status_excluded,
166 /* This node is not present in this revision. This typically happens
167 when a node is deleted and committed without updating its parent.
168 The parent revision indicates it should be present, but this node's
169 revision states otherwise. */
170 svn_wc__db_status_not_present,
172 /* This node is known, but its information is incomplete. Generally,
173 it should be treated similar to the other missing status values
174 until some (later) process updates the node with its data.
176 When the incomplete status applies to a directory, the list of
177 children and the list of its base properties as recorded in the
178 working copy do not match their working copy versions.
179 The update editor can complete a directory by using a different
181 svn_wc__db_status_incomplete,
183 /* The BASE node has been marked as deleted. Only used as an internal
184 status in wc_db.c and entries.c. */
185 svn_wc__db_status_base_deleted
187 } svn_wc__db_status_t;
189 /* Lock information. We write/read it all as one, so let's use a struct
191 typedef struct svn_wc__db_lock_t {
195 /* The owner of the lock, possibly NULL */
198 /* A comment about the lock, possibly NULL */
201 /* The date the lock was created */
206 /* ### NOTE: I have not provided docstrings for most of this file at this
207 ### point in time. The shape and extent of this API is still in massive
208 ### flux. I'm iterating in public, but do not want to doc until it feels
209 ### like it is "Right".
212 /* ### where/how to handle: text_time, locks, working_size */
216 @defgroup svn_wc__db_admin General administrative functions
220 /* Open a working copy administrative database context.
222 This context is (initially) not associated with any particular working
223 copy directory or working copy root (wcroot). As operations are performed,
224 this context will load the appropriate wcroot information.
226 The context is returned in DB.
228 CONFIG should hold the various configuration options that may apply to
229 the administrative operation. It should live at least as long as the
230 RESULT_POOL parameter.
232 When OPEN_WITHOUT_UPGRADE is TRUE, then the working copy databases will
233 be opened even when an old database format is found/detected during
234 the operation of a wc_db API). If open_without_upgrade is FALSE and an
235 upgrade is required, then SVN_ERR_WC_UPGRADE_REQUIRED will be returned
237 Passing TRUE will allow a bare minimum of APIs to function (most notably,
238 the temp_get_format() function will always return a value) since most of
239 these APIs expect a current-format database to be present.
241 If ENFORCE_EMPTY_WQ is TRUE, then any databases with stale work items in
242 their work queue will raise an error when they are opened. The operation
243 will raise SVN_ERR_WC_CLEANUP_REQUIRED. Passing FALSE for this routine
244 means that the work queue is being processed (via 'svn cleanup') and all
245 operations should be allowed.
247 The DB will be closed when RESULT_POOL is cleared. It may also be closed
248 manually using svn_wc__db_close(). In particular, this will close any
249 SQLite databases that have been opened and cached.
251 The context is allocated in RESULT_POOL. This pool is *retained* and used
252 for future allocations within the DB. Be forewarned about unbounded
253 memory growth if this DB is used across an unbounded number of wcroots
254 and versioned directories.
256 Temporary allocations will be made in SCRATCH_POOL.
259 svn_wc__db_open(svn_wc__db_t **db,
260 svn_config_t *config,
261 svn_boolean_t open_without_upgrade,
262 svn_boolean_t enforce_empty_wq,
263 apr_pool_t *result_pool,
264 apr_pool_t *scratch_pool);
269 svn_wc__db_close(svn_wc__db_t *db);
272 /* Initialize the SDB for LOCAL_ABSPATH, which should be a working copy path.
274 A REPOSITORY row will be constructed for the repository identified by
275 REPOS_ROOT_URL and REPOS_UUID. Neither of these may be NULL.
277 A BASE_NODE row will be created for the directory at REPOS_RELPATH at
278 revision INITIAL_REV.
279 If INITIAL_REV is greater than zero, then the node will be marked as
280 "incomplete" because we don't know its children. Contrary, if the
281 INITIAL_REV is zero, then this directory should represent the root and
282 we know it has no children, so the node is complete.
284 ### Is there any benefit to marking it 'complete' if rev==0? Seems like
285 ### an unnecessary special case.
287 DEPTH is the initial depth of the working copy; it must be a definite
288 depth, not svn_depth_unknown.
290 Use SCRATCH_POOL for temporary allocations.
293 svn_wc__db_init(svn_wc__db_t *db,
294 const char *local_abspath,
295 const char *repos_relpath,
296 const char *repos_root_url,
297 const char *repos_uuid,
298 svn_revnum_t initial_rev,
300 apr_pool_t *scratch_pool);
303 /* Compute the LOCAL_RELPATH for the given LOCAL_ABSPATH, relative
306 The LOCAL_RELPATH is a relative path to the working copy's root. That
307 root will be located by this function, and the path will be relative to
308 that location. If LOCAL_ABSPATH is the wcroot directory, then "" will
311 The LOCAL_RELPATH should ONLY be used for persisting paths to disk.
312 Those paths should not be abspaths, otherwise the working copy cannot
313 be moved. The working copy library should not make these paths visible
314 in its API (which should all be abspaths), and it should not be using
315 relpaths for other processing.
317 LOCAL_RELPATH will be allocated in RESULT_POOL. All other (temporary)
318 allocations will be made in SCRATCH_POOL.
320 This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE
324 svn_wc__db_to_relpath(const char **local_relpath,
326 const char *wri_abspath,
327 const char *local_abspath,
328 apr_pool_t *result_pool,
329 apr_pool_t *scratch_pool);
332 /* Compute the LOCAL_ABSPATH for a LOCAL_RELPATH located within the working
333 copy identified by WRI_ABSPATH.
335 This is the reverse of svn_wc__db_to_relpath. It should be used for
336 returning a persisted relpath back into an abspath.
338 LOCAL_ABSPATH will be allocated in RESULT_POOL. All other (temporary)
339 allocations will be made in SCRATCH_POOL.
341 This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE
345 svn_wc__db_from_relpath(const char **local_abspath,
347 const char *wri_abspath,
348 const char *local_relpath,
349 apr_pool_t *result_pool,
350 apr_pool_t *scratch_pool);
352 /* Compute the working copy root WCROOT_ABSPATH for WRI_ABSPATH using DB.
354 This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE
358 svn_wc__db_get_wcroot(const char **wcroot_abspath,
360 const char *wri_abspath,
361 apr_pool_t *result_pool,
362 apr_pool_t *scratch_pool);
367 /* Different kinds of trees
369 The design doc mentions three different kinds of trees, BASE, WORKING and
370 ACTUAL: http://svn.apache.org/repos/asf/subversion/trunk/notes/wc-ng-design
371 We have different APIs to handle each tree, enumerated below, along with
372 a blurb to explain what that tree represents.
375 /* @defgroup svn_wc__db_base BASE tree management
377 BASE is what we get from the server. It is the *absolute* pristine copy.
378 You need to use checkout, update, switch, or commit to alter your view of
381 In the BASE tree, each node corresponds to a particular node-rev in the
382 repository. It can be a mixed-revision tree. Each node holds either a
383 copy of the node-rev as it exists in the repository (if presence =
384 'normal'), or a place-holder (if presence = 'server-excluded' or 'excluded' or
390 /* Add or replace a directory in the BASE tree.
392 The directory is located at LOCAL_ABSPATH on the local filesystem, and
393 corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the
394 repository, at revision REVISION.
396 The directory properties are given by the PROPS hash (which is
397 const char *name => const svn_string_t *).
399 The last-change information is given by <CHANGED_REV, CHANGED_DATE,
402 The directory's children are listed in CHILDREN, as an array of
403 const char *. The child nodes do NOT have to exist when this API
404 is called. For each child node which does not exists, an "incomplete"
405 node will be added. These child nodes will be added regardless of
406 the DEPTH value. The caller must sort out which must be recorded,
407 and which must be omitted.
409 This subsystem does not use DEPTH, but it can be recorded here in
410 the BASE tree for higher-level code to use.
412 If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified
415 If CONFLICT is not NULL, then it describes a conflict for this node. The
416 node will be record as conflicted (in ACTUAL).
418 If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS
419 as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or
420 when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in
421 ACTUAL, to mark the properties unmodified.
423 If NEW_IPROPS is not NULL, then it is a depth-first ordered array of
424 svn_prop_inherited_item_t * structures that is set as the base node's
425 inherited_properties.
427 Any work items that are necessary as part of this node construction may
428 be passed in WORK_ITEMS.
430 All temporary allocations will be made in SCRATCH_POOL.
433 svn_wc__db_base_add_directory(svn_wc__db_t *db,
434 const char *local_abspath,
435 const char *wri_abspath,
436 const char *repos_relpath,
437 const char *repos_root_url,
438 const char *repos_uuid,
439 svn_revnum_t revision,
440 const apr_hash_t *props,
441 svn_revnum_t changed_rev,
442 apr_time_t changed_date,
443 const char *changed_author,
444 const apr_array_header_t *children,
446 apr_hash_t *dav_cache,
447 const svn_skel_t *conflict,
448 svn_boolean_t update_actual_props,
449 apr_hash_t *new_actual_props,
450 apr_array_header_t *new_iprops,
451 const svn_skel_t *work_items,
452 apr_pool_t *scratch_pool);
454 /* Add a new directory in BASE, whether WORKING nodes exist or not. Mark it
455 as incomplete and with revision REVISION. If REPOS_RELPATH is not NULL,
456 apply REPOS_RELPATH, REPOS_ROOT_URL and REPOS_UUID.
457 Perform all temporary allocations in SCRATCH_POOL.
460 svn_wc__db_base_add_incomplete_directory(svn_wc__db_t *db,
461 const char *local_abspath,
462 const char *repos_relpath,
463 const char *repos_root_url,
464 const char *repos_uuid,
465 svn_revnum_t revision,
467 svn_boolean_t insert_base_deleted,
468 svn_boolean_t delete_working,
469 svn_skel_t *conflict,
470 svn_skel_t *work_items,
471 apr_pool_t *scratch_pool);
474 /* Add or replace a file in the BASE tree.
476 The file is located at LOCAL_ABSPATH on the local filesystem, and
477 corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the
478 repository, at revision REVISION.
480 The file properties are given by the PROPS hash (which is
481 const char *name => const svn_string_t *).
483 The last-change information is given by <CHANGED_REV, CHANGED_DATE,
486 The checksum of the file contents is given in CHECKSUM. An entry in
487 the pristine text base is NOT required when this API is called.
489 If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified
492 If CONFLICT is not NULL, then it describes a conflict for this node. The
493 node will be record as conflicted (in ACTUAL).
495 If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS
496 as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or
497 when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in
498 ACTUAL, to mark the properties unmodified.
500 Any work items that are necessary as part of this node construction may
501 be passed in WORK_ITEMS.
503 Unless KEEP_RECORDED_INFO is set to TRUE, recorded size and timestamp values
506 All temporary allocations will be made in SCRATCH_POOL.
509 svn_wc__db_base_add_file(svn_wc__db_t *db,
510 const char *local_abspath,
511 const char *wri_abspath,
512 const char *repos_relpath,
513 const char *repos_root_url,
514 const char *repos_uuid,
515 svn_revnum_t revision,
516 const apr_hash_t *props,
517 svn_revnum_t changed_rev,
518 apr_time_t changed_date,
519 const char *changed_author,
520 const svn_checksum_t *checksum,
521 apr_hash_t *dav_cache,
522 svn_boolean_t delete_working,
523 svn_boolean_t update_actual_props,
524 apr_hash_t *new_actual_props,
525 apr_array_header_t *new_iprops,
526 svn_boolean_t keep_recorded_info,
527 svn_boolean_t insert_base_deleted,
528 const svn_skel_t *conflict,
529 const svn_skel_t *work_items,
530 apr_pool_t *scratch_pool);
533 /* Add or replace a symlink in the BASE tree.
535 The symlink is located at LOCAL_ABSPATH on the local filesystem, and
536 corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the
537 repository, at revision REVISION.
539 The symlink's properties are given by the PROPS hash (which is
540 const char *name => const svn_string_t *).
542 The last-change information is given by <CHANGED_REV, CHANGED_DATE,
545 The target of the symlink is specified by TARGET.
547 If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified
550 If CONFLICT is not NULL, then it describes a conflict for this node. The
551 node will be record as conflicted (in ACTUAL).
553 If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS
554 as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or
555 when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in
556 ACTUAL, to mark the properties unmodified.
558 Any work items that are necessary as part of this node construction may
559 be passed in WORK_ITEMS.
561 All temporary allocations will be made in SCRATCH_POOL.
563 /* ### KFF: This is an interesting question, because currently
564 ### symlinks are versioned as regular files with the svn:special
565 ### property; then the file's text contents indicate that it is a
566 ### symlink and where that symlink points. That's for portability:
567 ### you can check 'em out onto a platform that doesn't support
568 ### symlinks, and even modify the link and check it back in. It's
569 ### a great solution; but then the question for wc-ng is:
571 ### Suppose you check out a symlink on platform X and platform Y.
572 ### X supports symlinks; Y does not. Should the wc-ng storage for
573 ### those two be the same? I mean, on platform Y, the file is just
574 ### going to look and behave like a regular file. It would be sort
575 ### of odd for the wc-ng storage for that file to be of a different
576 ### type from all the other files. (On the other hand, maybe it's
577 ### weird today that the wc-1 storage for a working symlink is to
578 ### be like a regular file (i.e., regular text-base and whatnot).
580 ### I'm still feeling my way around this problem; just pointing out
583 ### gjs: symlinks are stored in the database as first-class objects,
584 ### rather than in the filesystem as "special" regular files. thus,
585 ### all portability concerns are moot. higher-levels can figure out
586 ### how to represent the link in ACTUAL. higher-levels can also
587 ### deal with translating to/from the svn:special property and
588 ### the plain-text file contents.
589 ### dlr: What about hard links? At minimum, mention in doc string.
592 svn_wc__db_base_add_symlink(svn_wc__db_t *db,
593 const char *local_abspath,
594 const char *wri_abspath,
595 const char *repos_relpath,
596 const char *repos_root_url,
597 const char *repos_uuid,
598 svn_revnum_t revision,
599 const apr_hash_t *props,
600 svn_revnum_t changed_rev,
601 apr_time_t changed_date,
602 const char *changed_author,
604 apr_hash_t *dav_cache,
605 svn_boolean_t delete_working,
606 svn_boolean_t update_actual_props,
607 apr_hash_t *new_actual_props,
608 apr_array_header_t *new_iprops,
609 svn_boolean_t keep_recorded_info,
610 svn_boolean_t insert_base_deleted,
611 const svn_skel_t *conflict,
612 const svn_skel_t *work_items,
613 apr_pool_t *scratch_pool);
616 /* Create a node in the BASE tree that is present in name only.
618 The new node will be located at LOCAL_ABSPATH, and correspond to the
619 repository node described by <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID>
620 at revision REVISION.
622 The node's kind is described by KIND, and the reason for its absence
623 is specified by STATUS. Only these values are allowed for STATUS:
625 svn_wc__db_status_server_excluded
626 svn_wc__db_status_excluded
628 If CONFLICT is not NULL, then it describes a conflict for this node. The
629 node will be record as conflicted (in ACTUAL).
631 Any work items that are necessary as part of this node construction may
632 be passed in WORK_ITEMS.
634 All temporary allocations will be made in SCRATCH_POOL.
637 svn_wc__db_base_add_excluded_node(svn_wc__db_t *db,
638 const char *local_abspath,
639 const char *repos_relpath,
640 const char *repos_root_url,
641 const char *repos_uuid,
642 svn_revnum_t revision,
643 svn_node_kind_t kind,
644 svn_wc__db_status_t status,
645 const svn_skel_t *conflict,
646 const svn_skel_t *work_items,
647 apr_pool_t *scratch_pool);
650 /* Create a node in the BASE tree that is present in name only.
652 The new node will be located at LOCAL_ABSPATH, and correspond to the
653 repository node described by <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID>
654 at revision REVISION.
656 The node's kind is described by KIND, and the reason for its absence
657 is 'svn_wc__db_status_not_present'.
659 If CONFLICT is not NULL, then it describes a conflict for this node. The
660 node will be record as conflicted (in ACTUAL).
662 Any work items that are necessary as part of this node construction may
663 be passed in WORK_ITEMS.
665 All temporary allocations will be made in SCRATCH_POOL.
668 svn_wc__db_base_add_not_present_node(svn_wc__db_t *db,
669 const char *local_abspath,
670 const char *repos_relpath,
671 const char *repos_root_url,
672 const char *repos_uuid,
673 svn_revnum_t revision,
674 svn_node_kind_t kind,
675 const svn_skel_t *conflict,
676 const svn_skel_t *work_items,
677 apr_pool_t *scratch_pool);
680 /* Remove a node and all its descendants from the BASE tree. This handles
681 the deletion of a tree from the update editor and some file external
684 The node to remove is indicated by LOCAL_ABSPATH from the local
687 This operation *installs* workqueue operations to update the local
688 filesystem after the database operation.
690 To maintain a consistent database this function will also remove
691 any working node that marks LOCAL_ABSPATH as base-deleted. If this
692 results in there being no working node for LOCAL_ABSPATH then any
693 actual node will be removed if the actual node does not mark a
696 If KEEP_AS_WORKING is TRUE, then the base tree is copied to higher
697 layers as a copy of itself before deleting the BASE nodes.
699 If KEEP_AS_WORKING is FALSE, and QUEUE_DELETES is TRUE, also queue
700 workqueue items to delete all in-wc representations that aren't
701 shadowed by higher layers.
702 (With KEEP_AS_WORKING TRUE, this is a no-op, as everything is
703 automatically shadowed by the created copy)
705 If REMOVE_LOCKS is TRUE, all locks of this node and any subnodes
706 are also removed. This is to be done during commit of deleted nodes.
708 If NOT_PRESENT_REVISION specifies a valid revision a not-present
709 node is installed in BASE node with kind NOT_PRESENT_KIND after
712 If CONFLICT and/or WORK_ITEMS are passed they are installed as part
713 of the operation, after the work items inserted by the operation
717 svn_wc__db_base_remove(svn_wc__db_t *db,
718 const char *local_abspath,
719 svn_boolean_t keep_as_working,
720 svn_boolean_t queue_deletes,
721 svn_boolean_t remove_locks,
722 svn_revnum_t not_present_revision,
723 svn_skel_t *conflict,
724 svn_skel_t *work_items,
725 apr_pool_t *scratch_pool);
728 /* Retrieve information about a node in the BASE tree.
730 For the BASE node implied by LOCAL_ABSPATH from the local filesystem,
731 return information in the provided OUT parameters. Each OUT parameter
732 may be NULL, indicating that specific item is not requested.
734 If there is no information about this node, then SVN_ERR_WC_PATH_NOT_FOUND
737 The OUT parameters, and their "not available" values are:
738 STATUS n/a (always available)
739 KIND n/a (always available)
740 REVISION SVN_INVALID_REVNUM
741 REPOS_RELPATH NULL (caller should scan up)
742 REPOS_ROOT_URL NULL (caller should scan up)
743 REPOS_UUID NULL (caller should scan up)
744 CHANGED_REV SVN_INVALID_REVNUM
747 DEPTH svn_depth_unknown
757 If the STATUS is normal, the REPOS_* values will be non-NULL.
759 If DEPTH is requested, and the node is NOT a directory, then the
760 value will be set to svn_depth_unknown. If LOCAL_ABSPATH is a link,
761 it's up to the caller to resolve depth for the link's target.
763 If CHECKSUM is requested, and the node is NOT a file, then it will
766 If TARGET is requested, and the node is NOT a symlink, then it will
769 *PROPS maps "const char *" names to "const svn_string_t *" values. If
770 the base node is capable of having properties but has none, set
771 *PROPS to an empty hash. If its status is such that it cannot have
772 properties, set *PROPS to NULL.
774 If UPDATE_ROOT is requested, set it to TRUE if the node should only
775 be updated when it is the root of an update (e.g. file externals).
777 All returned data will be allocated in RESULT_POOL. All temporary
778 allocations will be made in SCRATCH_POOL.
781 svn_wc__db_base_get_info(svn_wc__db_status_t *status,
782 svn_node_kind_t *kind,
783 svn_revnum_t *revision,
784 const char **repos_relpath,
785 const char **repos_root_url,
786 const char **repos_uuid,
787 svn_revnum_t *changed_rev,
788 apr_time_t *changed_date,
789 const char **changed_author,
791 const svn_checksum_t **checksum,
793 svn_wc__db_lock_t **lock,
794 svn_boolean_t *had_props,
796 svn_boolean_t *update_root,
798 const char *local_abspath,
799 apr_pool_t *result_pool,
800 apr_pool_t *scratch_pool);
802 /* Structure returned by svn_wc__db_base_get_children_info. Only has the
803 fields needed by the adm crawler. */
804 struct svn_wc__db_base_info_t {
805 svn_wc__db_status_t status;
806 svn_node_kind_t kind;
808 const char *repos_relpath;
809 const char *repos_root_url;
811 svn_boolean_t update_root;
812 svn_wc__db_lock_t *lock;
815 /* Return in *NODES a hash mapping name->struct svn_wc__db_base_info_t for
816 the children of DIR_ABSPATH at op_depth 0.
819 svn_wc__db_base_get_children_info(apr_hash_t **nodes,
821 const char *dir_abspath,
822 apr_pool_t *result_pool,
823 apr_pool_t *scratch_pool);
826 /* Set *PROPS to the properties of the node LOCAL_ABSPATH in the BASE tree.
828 *PROPS maps "const char *" names to "const svn_string_t *" values.
829 If the node has no properties, set *PROPS to an empty hash.
830 *PROPS will never be set to NULL.
831 If the node is not present in the BASE tree (with presence 'normal'
832 or 'incomplete'), return an error.
833 Allocate *PROPS and its keys and values in RESULT_POOL.
836 svn_wc__db_base_get_props(apr_hash_t **props,
838 const char *local_abspath,
839 apr_pool_t *result_pool,
840 apr_pool_t *scratch_pool);
843 /* Return a list of the BASE tree node's children's names.
845 For the node indicated by LOCAL_ABSPATH, this function will return
846 the names of all of its children in the array CHILDREN. The array
847 elements are const char * values.
849 If the node is not a directory, then SVN_ERR_WC_NOT_WORKING_COPY will
852 All returned data will be allocated in RESULT_POOL. All temporary
853 allocations will be made in SCRATCH_POOL.
856 svn_wc__db_base_get_children(const apr_array_header_t **children,
858 const char *local_abspath,
859 apr_pool_t *result_pool,
860 apr_pool_t *scratch_pool);
863 /* Set the dav cache for LOCAL_ABSPATH to PROPS. Use SCRATCH_POOL for
864 temporary allocations. */
866 svn_wc__db_base_set_dav_cache(svn_wc__db_t *db,
867 const char *local_abspath,
868 const apr_hash_t *props,
869 apr_pool_t *scratch_pool);
872 /* Retrieve the dav cache for LOCAL_ABSPATH into *PROPS, allocated in
873 RESULT_POOL. Use SCRATCH_POOL for temporary allocations. Return
874 SVN_ERR_WC_PATH_NOT_FOUND if no dav cache can be located for
875 LOCAL_ABSPATH in DB. */
877 svn_wc__db_base_get_dav_cache(apr_hash_t **props,
879 const char *local_abspath,
880 apr_pool_t *result_pool,
881 apr_pool_t *scratch_pool);
883 /* Recursively clear the dav cache for LOCAL_ABSPATH. Use
884 SCRATCH_POOL for temporary allocations. */
886 svn_wc__db_base_clear_dav_cache_recursive(svn_wc__db_t *db,
887 const char *local_abspath,
888 apr_pool_t *scratch_pool);
890 /* Set LOCK_TOKENS to a hash mapping const char * full URLs to const char *
891 * lock tokens for every base node at or under LOCAL_ABSPATH in DB which has
892 * such a lock token set on it.
893 * Allocate the hash and all items therein from RESULT_POOL. */
895 svn_wc__db_base_get_lock_tokens_recursive(apr_hash_t **lock_tokens,
897 const char *local_abspath,
898 apr_pool_t *result_pool,
899 apr_pool_t *scratch_pool);
901 /* ### anything else needed for maintaining the BASE tree? */
906 /* @defgroup svn_wc__db_pristine Pristine ("text base") management
910 /* Set *PRISTINE_ABSPATH to the path to the pristine text file
911 identified by SHA1_CHECKSUM. Error if it does not exist.
913 ### This is temporary - callers should not be looking at the file
916 Allocate the path in RESULT_POOL. */
918 svn_wc__db_pristine_get_path(const char **pristine_abspath,
920 const char *wri_abspath,
921 const svn_checksum_t *checksum,
922 apr_pool_t *result_pool,
923 apr_pool_t *scratch_pool);
925 /* Set *PRISTINE_ABSPATH to the path under WCROOT_ABSPATH that will be
926 used by the pristine text identified by SHA1_CHECKSUM. The file
930 svn_wc__db_pristine_get_future_path(const char **pristine_abspath,
931 const char *wcroot_abspath,
932 const svn_checksum_t *sha1_checksum,
933 apr_pool_t *result_pool,
934 apr_pool_t *scratch_pool);
937 /* If requested set *CONTENTS to a readable stream that will yield the pristine
938 text identified by SHA1_CHECKSUM (must be a SHA-1 checksum) within the WC
939 identified by WRI_ABSPATH in DB.
941 If requested set *SIZE to the size of the pristine stream in bytes,
943 Even if the pristine text is removed from the store while it is being
944 read, the stream will remain valid and readable until it is closed.
946 Allocate the stream in RESULT_POOL. */
948 svn_wc__db_pristine_read(svn_stream_t **contents,
949 svn_filesize_t *size,
951 const char *wri_abspath,
952 const svn_checksum_t *sha1_checksum,
953 apr_pool_t *result_pool,
954 apr_pool_t *scratch_pool);
957 /* Set *TEMP_DIR_ABSPATH to a directory in which the caller should create
958 a uniquely named file for later installation as a pristine text file.
960 The directory is guaranteed to be one that svn_wc__db_pristine_install()
961 can use: specifically, one from which it can atomically move the file.
963 Allocate *TEMP_DIR_ABSPATH in RESULT_POOL. */
965 svn_wc__db_pristine_get_tempdir(const char **temp_dir_abspath,
967 const char *wri_abspath,
968 apr_pool_t *result_pool,
969 apr_pool_t *scratch_pool);
972 /* Install the file TEMPFILE_ABSPATH (which is sitting in a directory given by
973 svn_wc__db_pristine_get_tempdir()) into the pristine data store, to be
974 identified by the SHA-1 checksum of its contents, SHA1_CHECKSUM, and whose
975 MD-5 checksum is MD5_CHECKSUM. */
977 svn_wc__db_pristine_install(svn_wc__db_t *db,
978 const char *tempfile_abspath,
979 const svn_checksum_t *sha1_checksum,
980 const svn_checksum_t *md5_checksum,
981 apr_pool_t *scratch_pool);
984 /* Set *MD5_CHECKSUM to the MD-5 checksum of a pristine text
985 identified by its SHA-1 checksum SHA1_CHECKSUM. Return an error
986 if the pristine text does not exist or its MD5 checksum is not found.
988 Allocate *MD5_CHECKSUM in RESULT_POOL. */
990 svn_wc__db_pristine_get_md5(const svn_checksum_t **md5_checksum,
992 const char *wri_abspath,
993 const svn_checksum_t *sha1_checksum,
994 apr_pool_t *result_pool,
995 apr_pool_t *scratch_pool);
998 /* Set *SHA1_CHECKSUM to the SHA-1 checksum of a pristine text
999 identified by its MD-5 checksum MD5_CHECKSUM. Return an error
1000 if the pristine text does not exist or its SHA-1 checksum is not found.
1002 Note: The MD-5 checksum is not strictly guaranteed to be unique in the
1003 database table, although duplicates are expected to be extremely rare.
1004 ### TODO: The behaviour is currently unspecified if the MD-5 checksum is
1005 not unique. Need to see whether this function is going to stay in use,
1006 and, if so, address this somehow.
1008 Allocate *SHA1_CHECKSUM in RESULT_POOL. */
1010 svn_wc__db_pristine_get_sha1(const svn_checksum_t **sha1_checksum,
1012 const char *wri_abspath,
1013 const svn_checksum_t *md5_checksum,
1014 apr_pool_t *result_pool,
1015 apr_pool_t *scratch_pool);
1018 /* If necessary transfers the PRISTINE files of the tree rooted at
1019 SRC_LOCAL_ABSPATH to the working copy identified by DST_WRI_ABSPATH. */
1021 svn_wc__db_pristine_transfer(svn_wc__db_t *db,
1022 const char *src_local_abspath,
1023 const char *dst_wri_abspath,
1024 svn_cancel_func_t cancel_func,
1026 apr_pool_t *scratch_pool);
1028 /* Remove the pristine text with SHA-1 checksum SHA1_CHECKSUM from the
1029 * pristine store, iff it is not referenced by any of the (other) WC DB
1032 svn_wc__db_pristine_remove(svn_wc__db_t *db,
1033 const char *wri_abspath,
1034 const svn_checksum_t *sha1_checksum,
1035 apr_pool_t *scratch_pool);
1038 /* Remove all unreferenced pristines in the WC of WRI_ABSPATH in DB. */
1040 svn_wc__db_pristine_cleanup(svn_wc__db_t *db,
1041 const char *wri_abspath,
1042 apr_pool_t *scratch_pool);
1045 /* Set *PRESENT to true if the pristine store for WRI_ABSPATH in DB contains
1046 a pristine text with SHA-1 checksum SHA1_CHECKSUM, and to false otherwise.
1049 svn_wc__db_pristine_check(svn_boolean_t *present,
1051 const char *wri_abspath,
1052 const svn_checksum_t *sha1_checksum,
1053 apr_pool_t *scratch_pool);
1055 /* @defgroup svn_wc__db_external External management
1058 /* Adds (or overwrites) a file external LOCAL_ABSPATH to the working copy
1059 identified by WRI_ABSPATH.
1061 It updates both EXTERNALS and NODES in one atomic step.
1064 svn_wc__db_external_add_file(svn_wc__db_t *db,
1065 const char *local_abspath,
1066 const char *wri_abspath,
1068 const char *repos_relpath,
1069 const char *repos_root_url,
1070 const char *repos_uuid,
1071 svn_revnum_t revision,
1073 const apr_hash_t *props,
1074 apr_array_header_t *iprops,
1076 svn_revnum_t changed_rev,
1077 apr_time_t changed_date,
1078 const char *changed_author,
1080 const svn_checksum_t *checksum,
1082 const apr_hash_t *dav_cache,
1084 const char *record_ancestor_abspath,
1085 const char *recorded_repos_relpath,
1086 svn_revnum_t recorded_peg_revision,
1087 svn_revnum_t recorded_revision,
1089 svn_boolean_t update_actual_props,
1090 apr_hash_t *new_actual_props,
1092 svn_boolean_t keep_recorded_info,
1093 const svn_skel_t *conflict,
1094 const svn_skel_t *work_items,
1095 apr_pool_t *scratch_pool);
1097 /* Adds (or overwrites) a symlink external LOCAL_ABSPATH to the working copy
1098 identified by WRI_ABSPATH.
1101 svn_wc__db_external_add_symlink(svn_wc__db_t *db,
1102 const char *local_abspath,
1103 const char *wri_abspath,
1105 const char *repos_relpath,
1106 const char *repos_root_url,
1107 const char *repos_uuid,
1108 svn_revnum_t revision,
1110 const apr_hash_t *props,
1112 svn_revnum_t changed_rev,
1113 apr_time_t changed_date,
1114 const char *changed_author,
1118 const apr_hash_t *dav_cache,
1120 const char *record_ancestor_abspath,
1121 const char *recorded_repos_relpath,
1122 svn_revnum_t recorded_peg_revision,
1123 svn_revnum_t recorded_revision,
1125 svn_boolean_t update_actual_props,
1126 apr_hash_t *new_actual_props,
1128 svn_boolean_t keep_recorded_info,
1129 const svn_skel_t *work_items,
1130 apr_pool_t *scratch_pool);
1132 /* Adds (or overwrites) a directory external LOCAL_ABSPATH to the working copy
1133 identified by WRI_ABSPATH.
1135 Directory externals are stored in their own working copy, so one should use
1136 the normal svn_wc__db functions to access the normal working copy
1140 svn_wc__db_external_add_dir(svn_wc__db_t *db,
1141 const char *local_abspath,
1142 const char *wri_abspath,
1144 const char *repos_root_url,
1145 const char *repos_uuid,
1147 const char *record_ancestor_abspath,
1148 const char *recorded_repos_relpath,
1149 svn_revnum_t recorded_peg_revision,
1150 svn_revnum_t recorded_revision,
1152 const svn_skel_t *work_items,
1153 apr_pool_t *scratch_pool);
1155 /* Remove a registered external LOCAL_ABSPATH from the working copy identified
1159 svn_wc__db_external_remove(svn_wc__db_t *db,
1160 const char *local_abspath,
1161 const char *wri_abspath,
1163 const svn_skel_t *work_items,
1164 apr_pool_t *scratch_pool);
1167 /* Reads information on the external LOCAL_ABSPATH as stored in the working
1168 copy identified with WRI_ABSPATH (If NULL the parent directory of
1169 LOCAL_ABSPATH is taken as WRI_ABSPATH).
1171 Return SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not an external in
1174 When STATUS is requested it has one of these values
1175 svn_wc__db_status_normal The external is available
1176 svn_wc__db_status_excluded The external is user excluded
1178 When KIND is requested then the value will be set to the kind of external.
1180 If DEFINING_ABSPATH is requested, then the value will be set to the
1181 absolute path of the directory which originally defined the external.
1182 (The path with the svn:externals property)
1184 If REPOS_ROOT_URL is requested, then the value will be set to the
1185 repository root of the external.
1187 If REPOS_UUID is requested, then the value will be set to the
1188 repository uuid of the external.
1190 If RECORDED_REPOS_RELPATH is requested, then the value will be set to the
1191 original repository relative path inside REPOS_ROOT_URL of the external.
1193 If RECORDED_PEG_REVISION is requested, then the value will be set to the
1194 original recorded operational (peg) revision of the external.
1196 If RECORDED_REVISION is requested, then the value will be set to the
1197 original recorded revision of the external.
1199 Allocate the result in RESULT_POOL and perform temporary allocations in
1203 svn_wc__db_external_read(svn_wc__db_status_t *status,
1204 svn_node_kind_t *kind,
1205 const char **defining_abspath,
1207 const char **repos_root_url,
1208 const char **repos_uuid,
1210 const char **recorded_repos_relpath,
1211 svn_revnum_t *recorded_peg_revision,
1212 svn_revnum_t *recorded_revision,
1215 const char *local_abspath,
1216 const char *wri_abspath,
1217 apr_pool_t *result_pool,
1218 apr_pool_t *scratch_pool);
1220 /* Return in *EXTERNALS a list of svn_wc__committable_external_info_t *
1221 * containing info on externals defined to be checked out below LOCAL_ABSPATH,
1222 * returning only those externals that are not fixed to a specific revision.
1224 * If IMMEDIATES_ONLY is TRUE, only those externals defined to be checked out
1225 * as immediate children of LOCAL_ABSPATH are returned (this is useful for
1226 * treating user requested depth < infinity).
1228 * If there are no externals to be returned, set *EXTERNALS to NULL. Otherwise
1229 * set *EXTERNALS to an APR array newly cleated in RESULT_POOL.
1231 * NOTE: This only returns the externals known by the immediate WC root for
1232 * LOCAL_ABSPATH; i.e.:
1233 * - If there is a further parent WC "above" the immediate WC root, and if
1234 * that parent WC defines externals to live somewhere within this WC, these
1235 * externals will appear to be foreign/unversioned and won't be picked up.
1236 * - Likewise, only the topmost level of externals nestings (externals
1237 * defined within a checked out external dir) is picked up by this function.
1238 * (For recursion, see svn_wc__committable_externals_below().)
1240 * ###TODO: Add a WRI_ABSPATH (wc root indicator) separate from LOCAL_ABSPATH,
1241 * to allow searching any wc-root for externals under LOCAL_ABSPATH, not only
1242 * LOCAL_ABSPATH's most immediate wc-root. */
1244 svn_wc__db_committable_externals_below(apr_array_header_t **externals,
1246 const char *local_abspath,
1247 svn_boolean_t immediates_only,
1248 apr_pool_t *result_pool,
1249 apr_pool_t *scratch_pool);
1251 /* Gets a mapping from const char * local abspaths of externals to the const
1252 char * local abspath of where they are defined for all externals defined
1253 at or below LOCAL_ABSPATH.
1255 ### Returns NULL in *EXTERNALS until we bumped to format 29.
1257 Allocate the result in RESULT_POOL and perform temporary allocations in
1260 svn_wc__db_externals_defined_below(apr_hash_t **externals,
1262 const char *local_abspath,
1263 apr_pool_t *result_pool,
1264 apr_pool_t *scratch_pool);
1266 /* Gather all svn:externals property values from the actual properties on
1267 directories below LOCAL_ABSPATH as a mapping of const char *local_abspath
1268 to const char * property values.
1270 If DEPTHS is not NULL, set *depths to an apr_hash_t* mapping the same
1271 local_abspaths to the const char * ambient depth of the node.
1273 Allocate the result in RESULT_POOL and perform temporary allocations in
1276 svn_wc__db_externals_gather_definitions(apr_hash_t **externals,
1277 apr_hash_t **depths,
1279 const char *local_abspath,
1280 apr_pool_t *result_pool,
1281 apr_pool_t *scratch_pool);
1285 /* @defgroup svn_wc__db_op Operations on WORKING tree
1289 /* Copy the node at SRC_ABSPATH (in NODES and ACTUAL_NODE tables) to
1290 * DST_ABSPATH, both in DB but not necessarily in the same WC. The parent
1291 * of DST_ABSPATH must be a versioned directory.
1293 * This copy is NOT recursive. It simply establishes this one node, plus
1294 * incomplete nodes for the children.
1296 * If IS_MOVE is TRUE, mark this copy operation as the copy-half of
1297 * a move. The delete-half of the move needs to be created separately
1298 * with svn_wc__db_op_delete().
1300 * Add WORK_ITEMS to the work queue. */
1302 svn_wc__db_op_copy(svn_wc__db_t *db,
1303 const char *src_abspath,
1304 const char *dst_abspath,
1305 const char *dst_op_root_abspath,
1306 svn_boolean_t is_move,
1307 const svn_skel_t *work_items,
1308 apr_pool_t *scratch_pool);
1310 /* Checks if LOCAL_ABSPATH represents a move back to its original location,
1311 * and if it is reverts the move while keeping local changes after it has been
1312 * moved from MOVED_FROM_ABSPATH.
1314 * If MOVED_BACK is not NULL, set *MOVED_BACK to TRUE when a move was reverted,
1315 * otherwise to FALSE.
1318 svn_wc__db_op_handle_move_back(svn_boolean_t *moved_back,
1320 const char *local_abspath,
1321 const char *moved_from_abspath,
1322 const svn_skel_t *work_items,
1323 apr_pool_t *scratch_pool);
1326 /* Copy the leaves of the op_depth layer directly shadowed by the operation
1327 * of SRC_ABSPATH (so SRC_ABSPATH must be an op_root) to dst_abspaths
1330 * This operation is recursive. It copies all the descendants at the lower
1331 * layer and adds base-deleted nodes on dst_abspath layer to mark these nodes
1334 * Usually this operation is directly followed by a call to svn_wc__db_op_copy
1335 * which performs the real copy from src_abspath to dst_abspath.
1338 svn_wc__db_op_copy_shadowed_layer(svn_wc__db_t *db,
1339 const char *src_abspath,
1340 const char *dst_abspath,
1341 svn_boolean_t is_move,
1342 apr_pool_t *scratch_pool);
1345 /* Record a copy at LOCAL_ABSPATH from a repository directory.
1347 This copy is NOT recursive. It simply establishes this one node.
1348 CHILDREN must be provided, and incomplete nodes will be constructed
1351 ### arguments docco. */
1353 svn_wc__db_op_copy_dir(svn_wc__db_t *db,
1354 const char *local_abspath,
1355 const apr_hash_t *props,
1356 svn_revnum_t changed_rev,
1357 apr_time_t changed_date,
1358 const char *changed_author,
1359 const char *original_repos_relpath,
1360 const char *original_root_url,
1361 const char *original_uuid,
1362 svn_revnum_t original_revision,
1363 const apr_array_header_t *children,
1364 svn_boolean_t is_move,
1366 const svn_skel_t *conflict,
1367 const svn_skel_t *work_items,
1368 apr_pool_t *scratch_pool);
1371 /* Record a copy at LOCAL_ABSPATH from a repository file.
1373 ### arguments docco. */
1375 svn_wc__db_op_copy_file(svn_wc__db_t *db,
1376 const char *local_abspath,
1377 const apr_hash_t *props,
1378 svn_revnum_t changed_rev,
1379 apr_time_t changed_date,
1380 const char *changed_author,
1381 const char *original_repos_relpath,
1382 const char *original_root_url,
1383 const char *original_uuid,
1384 svn_revnum_t original_revision,
1385 const svn_checksum_t *checksum,
1386 svn_boolean_t update_actual_props,
1387 const apr_hash_t *new_actual_props,
1388 svn_boolean_t is_move,
1389 const svn_skel_t *conflict,
1390 const svn_skel_t *work_items,
1391 apr_pool_t *scratch_pool);
1395 svn_wc__db_op_copy_symlink(svn_wc__db_t *db,
1396 const char *local_abspath,
1397 const apr_hash_t *props,
1398 svn_revnum_t changed_rev,
1399 apr_time_t changed_date,
1400 const char *changed_author,
1401 const char *original_repos_relpath,
1402 const char *original_root_url,
1403 const char *original_uuid,
1404 svn_revnum_t original_revision,
1406 const svn_skel_t *conflict,
1407 const svn_skel_t *work_items,
1408 apr_pool_t *scratch_pool);
1411 /* ### do we need svn_wc__db_op_copy_server_excluded() ?? */
1414 /* ### add a new versioned directory. a list of children is NOT passed
1415 ### since they are added in future, distinct calls to db_op_add_*.
1416 PROPS gives the properties; empty or NULL means none. */
1417 /* ### do we need a CONFLICTS param? */
1419 svn_wc__db_op_add_directory(svn_wc__db_t *db,
1420 const char *local_abspath,
1421 const apr_hash_t *props,
1422 const svn_skel_t *work_items,
1423 apr_pool_t *scratch_pool);
1427 PROPS gives the properties; empty or NULL means none.
1428 ### this file has no "pristine"
1429 ### contents, so a checksum [reference] is not required. */
1430 /* ### do we need a CONFLICTS param? */
1432 svn_wc__db_op_add_file(svn_wc__db_t *db,
1433 const char *local_abspath,
1434 const apr_hash_t *props,
1435 const svn_skel_t *work_items,
1436 apr_pool_t *scratch_pool);
1440 PROPS gives the properties; empty or NULL means none. */
1441 /* ### do we need a CONFLICTS param? */
1443 svn_wc__db_op_add_symlink(svn_wc__db_t *db,
1444 const char *local_abspath,
1446 const apr_hash_t *props,
1447 const svn_skel_t *work_items,
1448 apr_pool_t *scratch_pool);
1451 /* Set the properties of the node LOCAL_ABSPATH in the ACTUAL tree to
1454 PROPS maps "const char *" names to "const svn_string_t *" values.
1455 To specify no properties, PROPS must be an empty hash, not NULL.
1456 If the node is not present, return an error.
1458 If PROPS is NULL, set the properties to be the same as the pristine
1461 If CONFLICT is not NULL, it is used to register a conflict on this
1462 node at the same time the properties are changed.
1464 WORK_ITEMS are inserted into the work queue, as additional things that
1465 need to be completed before the working copy is stable.
1468 If CLEAR_RECORDED_INFO is true, the recorded information for the node
1469 is cleared. (commonly used when updating svn:* magic properties).
1471 NOTE: This will overwrite ALL working properties the node currently
1472 has. There is no db_op_set_prop() function. Callers must read all the
1473 properties, change one, and write all the properties.
1474 ### ugh. this has poor transaction semantics...
1477 NOTE: This will create an entry in the ACTUAL table for the node if it
1478 does not yet have one.
1481 svn_wc__db_op_set_props(svn_wc__db_t *db,
1482 const char *local_abspath,
1484 svn_boolean_t clear_recorded_info,
1485 const svn_skel_t *conflict,
1486 const svn_skel_t *work_items,
1487 apr_pool_t *scratch_pool);
1489 /* Mark LOCAL_ABSPATH, and all children, for deletion.
1491 * This function removes the file externals (and if DELETE_DIR_EXTERNALS is
1492 * TRUE also the directory externals) registered below LOCAL_ABSPATH.
1493 * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes)
1495 * If MOVED_TO_ABSPATH is not NULL, mark the deletion of LOCAL_ABSPATH
1496 * as the delete-half of a move from LOCAL_ABSPATH to MOVED_TO_ABSPATH.
1498 * If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON)
1499 * for each node deleted. While this processing occurs, if CANCEL_FUNC is
1500 * not NULL, then it will be called (with CANCEL_BATON) to detect cancellation
1501 * during the processing.
1503 * Note: the notification (and cancellation) occur outside of a SQLite
1507 svn_wc__db_op_delete(svn_wc__db_t *db,
1508 const char *local_abspath,
1509 const char *moved_to_abspath,
1510 svn_boolean_t delete_dir_externals,
1511 svn_skel_t *conflict,
1512 svn_skel_t *work_items,
1513 svn_cancel_func_t cancel_func,
1515 svn_wc_notify_func2_t notify_func,
1517 apr_pool_t *scratch_pool);
1520 /* Mark all LOCAL_ABSPATH in the TARGETS array, and all of their children,
1523 * This function is more efficient than svn_wc__db_op_delete() because
1524 * only one sqlite transaction is used for all targets.
1525 * It currently lacks support for moves (though this could be changed,
1526 * at which point svn_wc__db_op_delete() becomes redundant).
1528 * This function removes the file externals (and if DELETE_DIR_EXTERNALS is
1529 * TRUE also the directory externals) registered below the targets.
1530 * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes)
1532 * If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON)
1533 * for each node deleted. While this processing occurs, if CANCEL_FUNC is
1534 * not NULL, then it will be called (with CANCEL_BATON) to detect cancellation
1535 * during the processing.
1537 * Note: the notification (and cancellation) occur outside of a SQLite
1541 svn_wc__db_op_delete_many(svn_wc__db_t *db,
1542 apr_array_header_t *targets,
1543 svn_boolean_t delete_dir_externals,
1544 const svn_skel_t *conflict,
1545 svn_cancel_func_t cancel_func,
1547 svn_wc_notify_func2_t notify_func,
1549 apr_pool_t *scratch_pool);
1552 /* ### mark PATH as (possibly) modified. "svn edit" ... right API here? */
1554 svn_wc__db_op_modified(svn_wc__db_t *db,
1555 const char *local_abspath,
1556 apr_pool_t *scratch_pool);
1559 /* ### use NULL to remove from a changelist.
1561 ### NOTE: only depth=svn_depth_empty is supported right now.
1564 svn_wc__db_op_set_changelist(svn_wc__db_t *db,
1565 const char *local_abspath,
1566 const char *new_changelist,
1567 const apr_array_header_t *changelist_filter,
1569 /* ### flip to CANCEL, then NOTIFY. precedent. */
1570 svn_wc_notify_func2_t notify_func,
1572 svn_cancel_func_t cancel_func,
1574 apr_pool_t *scratch_pool);
1576 /* Record CONFLICT on LOCAL_ABSPATH, potentially replacing other conflicts
1577 recorded on LOCAL_ABSPATH.
1579 Users should in most cases pass CONFLICT to another WC_DB call instead of
1580 calling svn_wc__db_op_mark_conflict() directly outside a transaction, to
1581 allow recording atomically with the operation involved.
1583 Any work items that are necessary as part of marking this node conflicted
1584 can be passed in WORK_ITEMS.
1587 svn_wc__db_op_mark_conflict(svn_wc__db_t *db,
1588 const char *local_abspath,
1589 const svn_skel_t *conflict,
1590 const svn_skel_t *work_items,
1591 apr_pool_t *scratch_pool);
1594 /* ### caller maintains ACTUAL, and how the resolution occurred. we're just
1595 ### recording state.
1597 ### I'm not sure that these three values are the best way to do this,
1598 ### but they're handy for now. */
1600 svn_wc__db_op_mark_resolved(svn_wc__db_t *db,
1601 const char *local_abspath,
1602 svn_boolean_t resolved_text,
1603 svn_boolean_t resolved_props,
1604 svn_boolean_t resolved_tree,
1605 const svn_skel_t *work_items,
1606 apr_pool_t *scratch_pool);
1609 /* Revert all local changes which are being maintained in the database,
1610 * including conflict storage, properties and text modification status.
1612 * Returns SVN_ERR_WC_INVALID_OPERATION_DEPTH if the revert is not
1613 * possible, e.g. copy/delete but not a root, or a copy root with
1616 * At present only depth=empty and depth=infinity are supported.
1618 * This function populates the revert list that can be queried to
1619 * determine what was reverted.
1622 svn_wc__db_op_revert(svn_wc__db_t *db,
1623 const char *local_abspath,
1625 apr_pool_t *result_pool,
1626 apr_pool_t *scratch_pool);
1628 /* Query the revert list for LOCAL_ABSPATH and set *REVERTED if the
1629 * path was reverted. Set *MARKER_FILES to a const char *list of
1630 * marker files if any were recorded on LOCAL_ABSPATH.
1632 * Set *COPIED_HERE if the reverted node was copied here and is the
1633 * operation root of the copy.
1634 * Set *KIND to the node kind of the reverted node.
1636 * Removes the row for LOCAL_ABSPATH from the revert list.
1639 svn_wc__db_revert_list_read(svn_boolean_t *reverted,
1640 const apr_array_header_t **marker_files,
1641 svn_boolean_t *copied_here,
1642 svn_node_kind_t *kind,
1644 const char *local_abspath,
1645 apr_pool_t *result_pool,
1646 apr_pool_t *scratch_pool);
1648 /* The type of elements in the array returned by
1649 * svn_wc__db_revert_list_read_copied_children(). */
1650 typedef struct svn_wc__db_revert_list_copied_child_info_t {
1651 const char *abspath;
1652 svn_node_kind_t kind;
1653 } svn_wc__db_revert_list_copied_child_info_t ;
1655 /* Return in *CHILDREN a list of reverted copied nodes at or within
1656 * LOCAL_ABSPATH (which is a reverted file or a reverted directory).
1657 * Allocate *COPIED_CHILDREN and its elements in RESULT_POOL.
1658 * The elements are of type svn_wc__db_revert_list_copied_child_info_t. */
1660 svn_wc__db_revert_list_read_copied_children(const apr_array_header_t **children,
1662 const char *local_abspath,
1663 apr_pool_t *result_pool,
1664 apr_pool_t *scratch_pool);
1667 /* Make revert notifications for all paths in the revert list that are
1668 * equal to LOCAL_ABSPATH or below LOCAL_ABSPATH.
1670 * Removes all the corresponding rows from the revert list.
1672 * ### Pass in cancel_func?
1675 svn_wc__db_revert_list_notify(svn_wc_notify_func2_t notify_func,
1678 const char *local_abspath,
1679 apr_pool_t *scratch_pool);
1681 /* Clean up after svn_wc__db_op_revert by removing the revert list.
1684 svn_wc__db_revert_list_done(svn_wc__db_t *db,
1685 const char *local_abspath,
1686 apr_pool_t *scratch_pool);
1693 /* @defgroup svn_wc__db_read Read operations on the BASE/WORKING tree
1696 These functions query information about nodes in ACTUAL, and returns
1697 the requested information from the appropriate ACTUAL, WORKING, or
1700 For example, asking for the checksum of the pristine version will
1701 return the one recorded in WORKING, or if no WORKING node exists, then
1702 the checksum comes from BASE.
1705 /* Retrieve information about a node.
1707 For the node implied by LOCAL_ABSPATH from the local filesystem, return
1708 information in the provided OUT parameters. Each OUT parameter may be
1709 NULL, indicating that specific item is not requested.
1711 The information returned comes from the BASE tree, as possibly modified
1712 by the WORKING and ACTUAL trees.
1714 If there is no information about the node, then SVN_ERR_WC_PATH_NOT_FOUND
1717 The OUT parameters, and their "not available" values are:
1718 STATUS n/a (always available)
1719 KIND svn_node_unknown (For ACTUAL only nodes)
1720 REVISION SVN_INVALID_REVNUM
1724 CHANGED_REV SVN_INVALID_REVNUM
1727 DEPTH svn_depth_unknown
1731 ORIGINAL_REPOS_RELPATH NULL
1732 ORIGINAL_ROOT_URL NULL
1734 ORIGINAL_REVISION SVN_INVALID_REVNUM
1738 RECORDED_SIZE SVN_INVALID_FILESIZE
1749 HAVE_MORE_WORK FALSE
1752 When STATUS is requested, then it will be one of these values:
1754 svn_wc__db_status_normal
1755 A plain BASE node, with no local changes.
1757 svn_wc__db_status_added
1758 A node has been added/copied/moved to here. See HAVE_BASE to see
1759 if this change overwrites a BASE node. Use scan_addition() to resolve
1760 whether this has been added, copied, or moved, and the details of the
1761 operation (this function only looks at LOCAL_ABSPATH, but resolving
1762 the details requires scanning one or more ancestor nodes).
1764 svn_wc__db_status_deleted
1765 This node has been deleted or moved away. It may be a delete/move of
1766 a BASE node, or a child node of a subtree that was copied/moved to
1767 an ancestor location. Call scan_deletion() to determine the full
1768 details of the operations upon this node.
1770 svn_wc__db_status_server_excluded
1771 The node is versioned/known by the server, but the server has
1772 decided not to provide further information about the node. This
1773 is a BASE node (since changes are not allowed to this node).
1775 svn_wc__db_status_excluded
1776 The node has been excluded from the working copy tree. This may
1777 be an exclusion from the BASE tree, or an exclusion in the
1778 WORKING tree for a child node of a copied/moved parent.
1780 svn_wc__db_status_not_present
1781 This is a node from the BASE tree, has been marked as "not-present"
1782 within this mixed-revision working copy. This node is at a revision
1783 that is not in the tree, contrary to its inclusion in the parent
1786 svn_wc__db_status_incomplete
1787 The BASE is incomplete due to an interrupted operation. An
1788 incomplete WORKING node will be svn_wc__db_status_added.
1790 If REVISION is requested, it will be set to the revision of the
1791 unmodified (BASE) node, or to SVN_INVALID_REVNUM if any structural
1792 changes have been made to that node (that is, if the node has a row in
1795 If DEPTH is requested, and the node is NOT a directory, then
1796 the value will be set to svn_depth_unknown.
1798 If CHECKSUM is requested, and the node is NOT a file, then it will
1801 If TARGET is requested, and the node is NOT a symlink, then it will
1804 If TRANSLATED_SIZE is requested, and the node is NOT a file, then
1805 it will be set to SVN_INVALID_FILESIZE.
1807 If HAVE_WORK is TRUE, the returned information is from the highest WORKING
1808 layer. In that case HAVE_MORE_WORK and HAVE_BASE provide information about
1809 what other layers exist for this node.
1811 If HAVE_WORK is FALSE and HAVE_BASE is TRUE then the information is from
1814 If HAVE_WORK and HAVE_BASE are both FALSE and when retrieving CONFLICTED,
1815 then the node doesn't exist at all.
1817 If OP_ROOT is requested and the node has a WORKING layer, OP_ROOT will be
1818 set to true if this node is the op_root for this layer.
1820 If HAD_PROPS is requested and the node has pristine props, the value will
1823 If PROPS_MOD is requested and the node has property modification the value
1824 will be set to TRUE.
1826 ### add information about the need to scan upwards to get a complete
1827 ### picture of the state of this node.
1829 ### add some documentation about OUT parameter values based on STATUS ??
1831 ### the TEXT_MOD may become an enumerated value at some point to
1832 ### indicate different states of knowledge about text modifications.
1833 ### for example, an "svn edit" command in the future might set a
1834 ### flag indicating administratively-defined modification. and/or we
1835 ### might have a status indicating that we saw it was modified while
1836 ### performing a filesystem traversal.
1838 All returned data will be allocated in RESULT_POOL. All temporary
1839 allocations will be made in SCRATCH_POOL.
1841 /* ### old docco. needs to be incorporated as appropriate. there is
1842 ### some pending, potential changes to the definition of this API,
1843 ### so not worrying about it just yet.
1845 ### if the node has not been committed (after adding):
1846 ### revision will be SVN_INVALID_REVNUM
1847 ### repos_* will be NULL
1848 ### changed_rev will be SVN_INVALID_REVNUM
1849 ### changed_date will be 0
1850 ### changed_author will be NULL
1851 ### status will be svn_wc__db_status_added
1852 ### text_mod will be TRUE
1853 ### prop_mod will be TRUE if any props have been set
1854 ### base_shadowed will be FALSE
1856 ### if the node is not a copy, or a move destination:
1857 ### original_repos_path will be NULL
1858 ### original_root_url will be NULL
1859 ### original_uuid will be NULL
1860 ### original_revision will be SVN_INVALID_REVNUM
1862 ### note that @a base_shadowed can be derived. if the status specifies
1863 ### an add/copy/move *and* there is a corresponding node in BASE, then
1864 ### the BASE has been deleted to open the way for this node.
1867 svn_wc__db_read_info(svn_wc__db_status_t *status, /* ### derived */
1868 svn_node_kind_t *kind,
1869 svn_revnum_t *revision,
1870 const char **repos_relpath,
1871 const char **repos_root_url,
1872 const char **repos_uuid,
1873 svn_revnum_t *changed_rev,
1874 apr_time_t *changed_date,
1875 const char **changed_author,
1876 svn_depth_t *depth, /* dirs only */
1877 const svn_checksum_t **checksum, /* files only */
1878 const char **target, /* symlinks only */
1880 /* ### the following fields if copied/moved (history) */
1881 const char **original_repos_relpath,
1882 const char **original_root_url,
1883 const char **original_uuid,
1884 svn_revnum_t *original_revision,
1886 /* For BASE nodes */
1887 svn_wc__db_lock_t **lock,
1889 /* Recorded for files present in the working copy */
1890 svn_filesize_t *recorded_size,
1891 apr_time_t *recorded_time,
1894 const char **changelist,
1895 svn_boolean_t *conflicted,
1897 /* ### the followed are derived fields */
1898 svn_boolean_t *op_root,
1900 svn_boolean_t *had_props,
1901 svn_boolean_t *props_mod,
1903 svn_boolean_t *have_base,
1904 svn_boolean_t *have_more_work,
1905 svn_boolean_t *have_work,
1908 const char *local_abspath,
1909 apr_pool_t *result_pool,
1910 apr_pool_t *scratch_pool);
1912 /* Structure returned by svn_wc__db_read_children_info. Only has the
1913 fields needed by status. */
1914 struct svn_wc__db_info_t {
1915 svn_wc__db_status_t status;
1916 svn_node_kind_t kind;
1917 svn_revnum_t revnum;
1918 const char *repos_relpath;
1919 const char *repos_root_url;
1920 const char *repos_uuid;
1921 svn_revnum_t changed_rev;
1922 const char *changed_author;
1923 apr_time_t changed_date;
1926 svn_filesize_t recorded_size;
1927 apr_time_t recorded_time;
1929 const char *changelist;
1930 svn_boolean_t conflicted;
1932 svn_boolean_t special;
1934 svn_boolean_t op_root;
1936 svn_boolean_t has_checksum;
1937 svn_boolean_t copied;
1938 svn_boolean_t had_props;
1939 svn_boolean_t props_mod;
1941 svn_boolean_t have_base;
1942 svn_boolean_t have_more_work;
1944 svn_boolean_t locked; /* WC directory lock */
1945 svn_wc__db_lock_t *lock; /* Repository file lock */
1946 svn_boolean_t incomplete; /* TRUE if a working node is incomplete */
1948 const char *moved_to_abspath; /* Only on op-roots. See svn_wc_status3_t. */
1949 svn_boolean_t moved_here; /* Only on op-roots. */
1951 svn_boolean_t file_external;
1954 /* Return in *NODES a hash mapping name->struct svn_wc__db_info_t for
1955 the children of DIR_ABSPATH, and in *CONFLICTS a hash of names in
1958 The results include any path that was a child of a deleted directory that
1959 existed at LOCAL_ABSPATH, even if that directory is now scheduled to be
1960 replaced by the working node at LOCAL_ABSPATH.
1963 svn_wc__db_read_children_info(apr_hash_t **nodes,
1964 apr_hash_t **conflicts,
1966 const char *dir_abspath,
1967 apr_pool_t *result_pool,
1968 apr_pool_t *scratch_pool);
1971 /* Structure returned by svn_wc__db_read_walker_info. Only has the
1972 fields needed by svn_wc__internal_walk_children(). */
1973 struct svn_wc__db_walker_info_t {
1974 svn_wc__db_status_t status;
1975 svn_node_kind_t kind;
1978 /* When a node is deleted in WORKING, some of its information is no longer
1979 available. But in some cases it might still be relevant to obtain this
1980 information even when the information isn't stored in the BASE tree.
1982 This function allows access to that specific information.
1984 When a node is not deleted, this node returns the same information
1985 as svn_wc__db_read_info().
1987 All output arguments are optional and behave in the same way as when
1988 calling svn_wc__db_read_info().
1990 (All other information (like original_*) can be obtained via other apis).
1992 *PROPS maps "const char *" names to "const svn_string_t *" values. If
1993 the pristine node is capable of having properties but has none, set
1994 *PROPS to an empty hash. If its status is such that it cannot have
1995 properties, set *PROPS to NULL.
1998 svn_wc__db_read_pristine_info(svn_wc__db_status_t *status,
1999 svn_node_kind_t *kind,
2000 svn_revnum_t *changed_rev,
2001 apr_time_t *changed_date,
2002 const char **changed_author,
2003 svn_depth_t *depth, /* dirs only */
2004 const svn_checksum_t **checksum, /* files only */
2005 const char **target, /* symlinks only */
2006 svn_boolean_t *had_props,
2009 const char *local_abspath,
2010 apr_pool_t *result_pool,
2011 apr_pool_t *scratch_pool);
2013 /* Gets the information required to install a pristine file to the working copy
2015 Set WCROOT_ABSPATH to the working copy root, SHA1_CHECKSUM to the
2016 checksum of the node (a valid reference into the pristine store)
2017 and PRISTINE_PROPS to the node's pristine properties (to use for
2018 installing the file).
2020 If WRI_ABSPATH is not NULL, check for information in the working copy
2021 identified by WRI_ABSPATH.
2024 svn_wc__db_read_node_install_info(const char **wcroot_abspath,
2025 const svn_checksum_t **sha1_checksum,
2026 apr_hash_t **pristine_props,
2027 apr_time_t *changed_date,
2029 const char *local_abspath,
2030 const char *wri_abspath,
2031 apr_pool_t *result_pool,
2032 apr_pool_t *scratch_pool);
2034 /* Return in *NODES a hash mapping name->struct svn_wc__db_walker_info_t for
2035 the children of DIR_ABSPATH. "name" is the child's name relative to
2036 DIR_ABSPATH, not an absolute path. */
2038 svn_wc__db_read_children_walker_info(apr_hash_t **nodes,
2040 const char *dir_abspath,
2041 apr_pool_t *result_pool,
2042 apr_pool_t *scratch_pool);
2046 * Set *URL to the corresponding url for LOCAL_ABSPATH.
2047 * If the node is added, return the url it will have in the repository.
2050 svn_wc__db_read_url(const char **url,
2052 const char *local_abspath,
2053 apr_pool_t *result_pool,
2054 apr_pool_t *scratch_pool);
2057 /* Set *PROPS to the properties of the node LOCAL_ABSPATH in the ACTUAL
2058 tree (looking through to the WORKING or BASE tree as required).
2060 ### *PROPS will be set to NULL in the following situations:
2063 PROPS maps "const char *" names to "const svn_string_t *" values.
2064 If the node has no properties, set *PROPS to an empty hash.
2065 If the node is not present, return an error.
2066 Allocate *PROPS and its keys and values in RESULT_POOL.
2069 svn_wc__db_read_props(apr_hash_t **props,
2071 const char *local_abspath,
2072 apr_pool_t *result_pool,
2073 apr_pool_t *scratch_pool);
2075 /* Call RECEIVER_FUNC, passing RECEIVER_BATON, an absolute path, and
2076 * a hash table mapping <tt>char *</tt> names onto svn_string_t *
2077 * values for any properties of child nodes of LOCAL_ABSPATH (up to DEPTH).
2079 * If PRISTINE is FALSE, read the properties from the WORKING layer (highest
2080 * op_depth); if PRISTINE is FALSE, local modifications will be visible.
2083 svn_wc__db_read_props_streamily(svn_wc__db_t *db,
2084 const char *local_abspath,
2086 svn_boolean_t pristine,
2087 const apr_array_header_t *changelists,
2088 svn_wc__proplist_receiver_t receiver_func,
2089 void *receiver_baton,
2090 svn_cancel_func_t cancel_func,
2092 apr_pool_t *scratch_pool);
2095 /* Set *PROPS to the properties of the node LOCAL_ABSPATH in the WORKING
2096 tree (looking through to the BASE tree as required).
2098 ### *PROPS will set set to NULL in the following situations:
2099 ### ... tbd. see props.c:svn_wc__get_pristine_props()
2101 *PROPS maps "const char *" names to "const svn_string_t *" values.
2102 If the node has no properties, set *PROPS to an empty hash.
2103 If the node is not present, return an error.
2104 Allocate *PROPS and its keys and values in RESULT_POOL.
2107 svn_wc__db_read_pristine_props(apr_hash_t **props,
2109 const char *local_abspath,
2110 apr_pool_t *result_pool,
2111 apr_pool_t *scratch_pool);
2115 * Set @a *iprops to a depth-first ordered array of
2116 * #svn_prop_inherited_item_t * structures representing the properties
2117 * inherited by @a local_abspath from the ACTUAL tree above
2118 * @a local_abspath (looking through to the WORKING or BASE tree as
2119 * required), up to and including the root of the working copy and
2120 * any cached inherited properties inherited by the root.
2122 * The #svn_prop_inherited_item_t->path_or_url members of the
2123 * #svn_prop_inherited_item_t * structures in @a *iprops are
2124 * paths relative to the repository root URL for cached inherited
2125 * properties and absolute working copy paths otherwise.
2127 * If ACTUAL_PROPS is not NULL, then set *ACTUAL_PROPS to the actual
2128 * properties stored on LOCAL_ABSPATH.
2130 * Allocate @a *iprops in @a result_pool. Use @a scratch_pool
2131 * for temporary allocations.
2134 svn_wc__db_read_inherited_props(apr_array_header_t **iprops,
2135 apr_hash_t **actual_props,
2137 const char *local_abspath,
2138 const char *propname,
2139 apr_pool_t *result_pool,
2140 apr_pool_t *scratch_pool);
2142 /* Read a BASE node's inherited property information.
2144 Set *IPROPS to to a depth-first ordered array of
2145 svn_prop_inherited_item_t * structures representing the cached
2146 inherited properties for the BASE node at LOCAL_ABSPATH.
2148 If no cached properties are found, then set *IPROPS to NULL.
2149 If LOCAL_ABSPATH represents the root of the repository, then set
2150 *IPROPS to an empty array.
2152 Allocate *IPROPS in RESULT_POOL, use SCRATCH_POOL for temporary
2155 svn_wc__db_read_cached_iprops(apr_array_header_t **iprops,
2157 const char *local_abspath,
2158 apr_pool_t *result_pool,
2159 apr_pool_t *scratch_pool);
2161 /* Find BASE nodes with cached inherited properties.
2163 Set *IPROPS_PATHS to a hash mapping const char * absolute working copy
2164 paths to the repos_relpath of the path for each path in the working copy
2165 at or below LOCAL_ABSPATH, limited by DEPTH, that has cached inherited
2166 properties for the BASE node of the path.
2168 Allocate *IPROP_PATHS in RESULT_POOL.
2169 Use SCRATCH_POOL for temporary allocations. */
2171 svn_wc__db_get_children_with_cached_iprops(apr_hash_t **iprop_paths,
2173 const char *local_abspath,
2175 apr_pool_t *result_pool,
2176 apr_pool_t *scratch_pool);
2178 /** Obtain a mapping of const char * local_abspaths to const svn_string_t*
2179 * property values in *VALUES, of all PROPNAME properties on LOCAL_ABSPATH
2180 * and its descendants.
2182 * Allocate the result in RESULT_POOL, and perform temporary allocations in
2186 svn_wc__db_prop_retrieve_recursive(apr_hash_t **values,
2188 const char *local_abspath,
2189 const char *propname,
2190 apr_pool_t *result_pool,
2191 apr_pool_t *scratch_pool);
2193 /* Set *CHILDREN to a new array of the (const char *) basenames of the
2194 immediate children of the working node at LOCAL_ABSPATH in DB.
2196 Return every path that refers to a child of the working node at
2197 LOCAL_ABSPATH. Do not include a path just because it was a child of a
2198 deleted directory that existed at LOCAL_ABSPATH if that directory is now
2199 scheduled to be replaced by the working node at LOCAL_ABSPATH.
2201 Allocate *CHILDREN in RESULT_POOL and do temporary allocations in
2204 ### return some basic info for each child? e.g. kind.
2205 ### maybe the data in _read_get_info should be a structure, and this
2206 ### can return a struct for each one.
2207 ### however: _read_get_info can say "not interested", which isn't the
2208 ### case with a struct. thus, a struct requires fetching and/or
2209 ### computing all info.
2212 svn_wc__db_read_children_of_working_node(const apr_array_header_t **children,
2214 const char *local_abspath,
2215 apr_pool_t *result_pool,
2216 apr_pool_t *scratch_pool);
2218 /* Like svn_wc__db_read_children_of_working_node(), except also include any
2219 path that was a child of a deleted directory that existed at
2220 LOCAL_ABSPATH, even if that directory is now scheduled to be replaced by
2221 the working node at LOCAL_ABSPATH.
2224 svn_wc__db_read_children(const apr_array_header_t **children,
2226 const char *local_abspath,
2227 apr_pool_t *result_pool,
2228 apr_pool_t *scratch_pool);
2230 /* Read into *VICTIMS the basenames of the immediate children of
2231 LOCAL_ABSPATH in DB that are conflicted.
2233 In case of tree conflicts a victim doesn't have to be in the
2236 Allocate *VICTIMS in RESULT_POOL and do temporary allocations in
2238 /* ### This function will probably be removed. */
2240 svn_wc__db_read_conflict_victims(const apr_array_header_t **victims,
2242 const char *local_abspath,
2243 apr_pool_t *result_pool,
2244 apr_pool_t *scratch_pool);
2246 /* Read into *MARKER_FILES the absolute paths of the marker files
2247 of conflicts stored on LOCAL_ABSPATH and its immediate children in DB.
2248 The on-disk files may have been deleted by the user.
2250 Allocate *MARKER_FILES in RESULT_POOL and do temporary allocations
2253 svn_wc__db_get_conflict_marker_files(apr_hash_t **markers,
2255 const char *local_abspath,
2256 apr_pool_t *result_pool,
2257 apr_pool_t *scratch_pool);
2259 /* Read the conflict information recorded on LOCAL_ABSPATH in *CONFLICT,
2260 an editable conflict skel.
2262 If the node exists, but does not have a conflict set *CONFLICT to NULL,
2263 otherwise return a SVN_ERR_WC_PATH_NOT_FOUND error.
2265 Allocate *CONFLICTS in RESULT_POOL and do temporary allocations in
2268 svn_wc__db_read_conflict(svn_skel_t **conflict,
2270 const char *local_abspath,
2271 apr_pool_t *result_pool,
2272 apr_pool_t *scratch_pool);
2275 /* Return the kind of the node in DB at LOCAL_ABSPATH. The WORKING tree will
2276 be examined first, then the BASE tree. If the node is not present in either
2277 tree and ALLOW_MISSING is TRUE, then svn_node_unknown is returned.
2278 If the node is missing and ALLOW_MISSING is FALSE, then it will return
2279 SVN_ERR_WC_PATH_NOT_FOUND.
2281 The SHOW_HIDDEN and SHOW_DELETED flags report certain states as kind none.
2283 When nodes have certain statee they are only reported when:
2284 svn_wc__db_status_not_present when show_hidden && show_deleted
2286 svn_wc__db_status_excluded when show_hidden
2287 svn_wc__db_status_server_excluded when show_hidden
2289 svn_wc__db_status_deleted when show_deleted
2291 In other cases these nodes are reported with *KIND as svn_node_none.
2292 (See also svn_wc_read_kind2()'s documentation)
2294 Uses SCRATCH_POOL for temporary allocations. */
2296 svn_wc__db_read_kind(svn_node_kind_t *kind,
2298 const char *local_abspath,
2299 svn_boolean_t allow_missing,
2300 svn_boolean_t show_deleted,
2301 svn_boolean_t show_hidden,
2302 apr_pool_t *scratch_pool);
2305 /* An analog to svn_wc__entry_is_hidden(). Set *HIDDEN to TRUE if
2306 LOCAL_ABSPATH in DB "is not present, and I haven't scheduled something
2307 over the top of it." */
2309 svn_wc__db_node_hidden(svn_boolean_t *hidden,
2311 const char *local_abspath,
2312 apr_pool_t *scratch_pool);
2314 /* Checks if a node replaces a node in a different layer. Also check if it
2315 replaces a BASE (op_depth 0) node or just a node in a higher layer (a copy).
2316 Finally check if this is the root of the replacement, or if the replacement
2317 is initiated by the parent node.
2319 IS_REPLACE_ROOT (if not NULL) is set to TRUE if the node is the root of a
2320 replacement; otherwise to FALSE.
2322 BASE_REPLACE (if not NULL) is set to TRUE if the node directly or indirectly
2323 replaces a node in the BASE tree; otherwise to FALSE.
2325 IS_REPLACE (if not NULL) is set to TRUE if the node directly replaces a node
2326 in a lower layer; otherwise to FALSE.
2329 svn_wc__db_node_check_replace(svn_boolean_t *is_replace_root,
2330 svn_boolean_t *base_replace,
2331 svn_boolean_t *is_replace,
2333 const char *local_abspath,
2334 apr_pool_t *scratch_pool);
2336 /* ### changelists. return an array, or an iterator interface? how big
2337 ### are these things? are we okay with an in-memory array? examine other
2338 ### changelist usage -- we may already assume the list fits in memory.
2341 /* The DB-private version of svn_wc__is_wcroot(), which see.
2344 svn_wc__db_is_wcroot(svn_boolean_t *is_wcroot,
2346 const char *local_abspath,
2347 apr_pool_t *scratch_pool);
2349 /* Check whether a node is a working copy root and/or switched.
2351 If LOCAL_ABSPATH is the root of a working copy, set *IS_WC_ROOT to TRUE,
2354 If LOCAL_ABSPATH is switched against its parent in the same working copy
2355 set *IS_SWITCHED to TRUE, otherwise to FALSE.
2357 If KIND is not null, set *KIND to the node type of LOCAL_ABSPATH.
2359 Any of the output arguments can be null to specify that the result is not
2360 interesting to the caller.
2362 Use SCRATCH_POOL for temporary allocations.
2365 svn_wc__db_is_switched(svn_boolean_t *is_wcroot,
2366 svn_boolean_t *is_switched,
2367 svn_node_kind_t *kind,
2369 const char *local_abspath,
2370 apr_pool_t *scratch_pool);
2376 /* @defgroup svn_wc__db_global Operations that alter multiple trees
2380 /* Associate LOCAL_DIR_ABSPATH, and all its children with the repository at
2381 at REPOS_ROOT_URL. The relative path to the repos root will not change,
2382 just the repository root. The repos uuid will also remain the same.
2383 This also updates any locks which may exist for the node, as well as any
2384 copyfrom repository information. Finally, the DAV cache (aka
2385 "wcprops") will be reset for affected entries.
2387 Use SCRATCH_POOL for any temporary allocations.
2389 ### local_dir_abspath "should be" the wcroot or a switch root. all URLs
2390 ### under this directory (depth=infinity) will be rewritten.
2392 ### This API had a depth parameter, which was removed, should it be
2393 ### resurrected? What's the purpose if we claim relocate is infinitely
2396 ### Assuming the future ability to copy across repositories, should we
2397 ### refrain from resetting the copyfrom information in this operation?
2400 svn_wc__db_global_relocate(svn_wc__db_t *db,
2401 const char *local_dir_abspath,
2402 const char *repos_root_url,
2403 apr_pool_t *scratch_pool);
2408 ### collapse the WORKING and ACTUAL tree changes down into BASE, called
2409 for each committed node.
2411 NEW_REVISION must be the revision number of the revision created by
2412 the commit. It will become the BASE node's 'revnum' and 'changed_rev'
2413 values in the BASE_NODE table.
2415 CHANGED_REVISION is the new 'last changed' revision. If the node is
2416 modified its value is equivalent to NEW_REVISION, but in case of a
2417 descendant of a copy/move it can be an older revision.
2419 CHANGED_DATE is the (server-side) date of CHANGED_REVISION. It may be 0 if
2420 the revprop is missing on the revision.
2422 CHANGED_AUTHOR is the (server-side) author of CHANGED_REVISION. It may be
2423 NULL if the revprop is missing on the revision.
2425 One or both of NEW_CHECKSUM and NEW_CHILDREN should be NULL. For new:
2426 files: NEW_CHILDREN should be NULL
2427 dirs: NEW_CHECKSUM should be NULL
2428 symlinks: both should be NULL
2430 WORK_ITEMS will be place into the work queue.
2433 svn_wc__db_global_commit(svn_wc__db_t *db,
2434 const char *local_abspath,
2435 svn_revnum_t new_revision,
2436 svn_revnum_t changed_revision,
2437 apr_time_t changed_date,
2438 const char *changed_author,
2439 const svn_checksum_t *new_checksum,
2440 const apr_array_header_t *new_children,
2441 apr_hash_t *new_dav_cache,
2442 svn_boolean_t keep_changelist,
2443 svn_boolean_t no_unlock,
2444 const svn_skel_t *work_items,
2445 apr_pool_t *scratch_pool);
2450 Perform an "update" operation at this node. It will create/modify a BASE
2451 node, and possibly update the ACTUAL tree's node (e.g put the node into
2452 a conflicted state).
2454 ### there may be cases where we need to tweak an existing WORKING node
2456 ### this operations on a single node, but may affect children
2458 ### the repository cannot be changed with this function, but a "switch"
2459 ### (aka changing repos_relpath) is possible
2461 ### one of NEW_CHILDREN, NEW_CHECKSUM, or NEW_TARGET must be provided.
2462 ### the other two values must be NULL.
2463 ### should this be broken out into an update_(directory|file|symlink) ?
2465 ### how does this differ from base_add_*? just the CONFLICT param.
2466 ### the WORK_ITEMS param is new here, but the base_add_* functions
2467 ### should probably grow that. should we instead just (re)use base_add
2468 ### rather than grow a new function?
2470 ### this does not allow a change of depth
2472 ### we do not update a file's TRANSLATED_SIZE here. at some future point,
2473 ### when the file is installed, then a TRANSLATED_SIZE will be set.
2476 svn_wc__db_global_update(svn_wc__db_t *db,
2477 const char *local_abspath,
2478 svn_node_kind_t new_kind,
2479 const char *new_repos_relpath,
2480 svn_revnum_t new_revision,
2481 const apr_hash_t *new_props,
2482 svn_revnum_t new_changed_rev,
2483 apr_time_t new_changed_date,
2484 const char *new_changed_author,
2485 const apr_array_header_t *new_children,
2486 const svn_checksum_t *new_checksum,
2487 const char *new_target,
2488 const apr_hash_t *new_dav_cache,
2489 const svn_skel_t *conflict,
2490 const svn_skel_t *work_items,
2491 apr_pool_t *scratch_pool);
2494 /* Modify the entry of working copy LOCAL_ABSPATH, presumably after an update
2495 of depth DEPTH completes. If LOCAL_ABSPATH doesn't exist, this routine
2498 Set the node's repository relpath, repository root, repository uuid and
2499 revision to NEW_REPOS_RELPATH, NEW_REPOS_ROOT and NEW_REPOS_UUID. If
2500 NEW_REPOS_RELPATH is null, the repository location is untouched; if
2501 NEW_REVISION in invalid, the working revision field is untouched.
2502 The modifications are mutually exclusive. If NEW_REPOS_ROOT is non-NULL,
2503 set the repository root of the entry to NEW_REPOS_ROOT.
2505 If LOCAL_ABSPATH is a directory, then, walk entries below LOCAL_ABSPATH
2506 according to DEPTH thusly:
2508 If DEPTH is svn_depth_infinity, perform the following actions on
2509 every entry below PATH; if svn_depth_immediates, svn_depth_files,
2510 or svn_depth_empty, perform them only on LOCAL_ABSPATH.
2512 If NEW_REVISION is valid, then tweak every entry to have this new
2513 working revision (excluding files that are scheduled for addition
2514 or replacement). Likewise, if BASE_URL is non-null, then rewrite
2515 all urls to be "telescoping" children of the base_url.
2517 EXCLUDE_RELPATHS is a hash containing const char *local_relpath. Nodes
2518 for pathnames contained in EXCLUDE_RELPATHS are not touched by this
2519 function. These pathnames should be paths relative to the wcroot.
2521 If WCROOT_IPROPS is not NULL it is a hash mapping const char * absolute
2522 working copy paths to depth-first ordered arrays of
2523 svn_prop_inherited_item_t * structures. If LOCAL_ABSPATH exists in
2524 WCROOT_IPROPS, then set the hashed value as the node's inherited
2528 svn_wc__db_op_bump_revisions_post_update(svn_wc__db_t *db,
2529 const char *local_abspath,
2531 const char *new_repos_relpath,
2532 const char *new_repos_root_url,
2533 const char *new_repos_uuid,
2534 svn_revnum_t new_revision,
2535 apr_hash_t *exclude_relpaths,
2536 apr_hash_t *wcroot_iprops,
2537 svn_wc_notify_func2_t notify_func,
2539 apr_pool_t *scratch_pool);
2542 /* Record the RECORDED_SIZE and RECORDED_TIME for a versioned node.
2544 This function will record the information within the WORKING node,
2545 if present, or within the BASE tree. If neither node is present, then
2546 SVN_ERR_WC_PATH_NOT_FOUND will be returned.
2548 RECORDED_SIZE may be SVN_INVALID_FILESIZE, which will be recorded
2549 as such, implying "unknown size".
2551 RECORDED_TIME may be 0, which will be recorded as such, implying
2552 "unknown last mod time".
2555 svn_wc__db_global_record_fileinfo(svn_wc__db_t *db,
2556 const char *local_abspath,
2557 svn_filesize_t recorded_size,
2558 apr_time_t recorded_time,
2559 apr_pool_t *scratch_pool);
2562 /* ### post-commit handling.
2563 ### maybe multiple phases?
2564 ### 1) mark a changelist as being-committed
2565 ### 2) collect ACTUAL content, store for future use as TEXTBASE
2566 ### 3) caller performs commit
2567 ### 4) post-commit, integrate changelist into BASE
2574 /* @defgroup svn_wc__db_lock Function to manage the LOCKS table.
2578 /* Add or replace LOCK for LOCAL_ABSPATH to DB. */
2580 svn_wc__db_lock_add(svn_wc__db_t *db,
2581 const char *local_abspath,
2582 const svn_wc__db_lock_t *lock,
2583 apr_pool_t *scratch_pool);
2586 /* Remove any lock for LOCAL_ABSPATH in DB. */
2588 svn_wc__db_lock_remove(svn_wc__db_t *db,
2589 const char *local_abspath,
2590 apr_pool_t *scratch_pool);
2596 /* @defgroup svn_wc__db_scan Functions to scan up a tree for further data.
2600 /* Read a BASE node's repository information.
2602 For the BASE node implied by LOCAL_ABSPATH, its location in the repository
2603 returned in *REPOS_ROOT_URL and *REPOS_UUID will be returned in
2604 *REPOS_RELPATH. Any of the OUT parameters may be NULL, indicating no
2605 interest in that piece of information.
2607 All returned data will be allocated in RESULT_POOL. All temporary
2608 allocations will be made in SCRATCH_POOL.
2610 ### Either delete this function and use _base_get_info instead, or
2611 ### add a 'revision' output to make a complete repository node location
2612 ### and rename to not say 'scan', because it doesn't.
2615 svn_wc__db_scan_base_repos(const char **repos_relpath,
2616 const char **repos_root_url,
2617 const char **repos_uuid,
2619 const char *local_abspath,
2620 apr_pool_t *result_pool,
2621 apr_pool_t *scratch_pool);
2624 /* Scan upwards for information about a known addition to the WORKING tree.
2626 IFF a node's status as returned by svn_wc__db_read_info() is
2627 svn_wc__db_status_added (NOT obstructed_add!), then this function
2628 returns a refined status in *STATUS, which is one of:
2630 svn_wc__db_status_added -- this NODE is a simple add without history.
2631 OP_ROOT_ABSPATH will be set to the topmost node in the added subtree
2632 (implying its parent will be an unshadowed BASE node). The REPOS_*
2633 values will be implied by that ancestor BASE node and this node's
2634 position in the added subtree. ORIGINAL_* will be set to their
2635 NULL values (and SVN_INVALID_REVNUM for ORIGINAL_REVISION).
2637 svn_wc__db_status_copied -- this NODE is the root or child of a copy.
2638 The root of the copy will be stored in OP_ROOT_ABSPATH. Note that
2639 the parent of the operation root could be another WORKING node (from
2640 an add, copy, or move). The REPOS_* values will be implied by the
2641 ancestor unshadowed BASE node. ORIGINAL_* will indicate the source
2644 svn_wc__db_status_incomplete -- this NODE is copied but incomplete.
2646 svn_wc__db_status_moved_here -- this NODE arrived as a result of a move.
2647 The root of the moved nodes will be stored in OP_ROOT_ABSPATH.
2648 Similar to the copied state, its parent may be a WORKING node or a
2649 BASE node. And again, the REPOS_* values are implied by this node's
2650 position in the subtree under the ancestor unshadowed BASE node.
2651 ORIGINAL_* will indicate the source of the move.
2653 All OUT parameters may be NULL to indicate a lack of interest in
2654 that piece of information.
2656 STATUS, OP_ROOT_ABSPATH, and REPOS_* will always be assigned a value
2657 if that information is requested (and assuming a successful return).
2659 ORIGINAL_REPOS_RELPATH will refer to the *root* of the operation. It
2660 does *not* correspond to the node given by LOCAL_ABSPATH. The caller
2661 can use the suffix on LOCAL_ABSPATH (relative to OP_ROOT_ABSPATH) in
2662 order to compute the source node which corresponds to LOCAL_ABSPATH.
2664 If the node given by LOCAL_ABSPATH does not have changes recorded in
2665 the WORKING tree, then SVN_ERR_WC_PATH_NOT_FOUND is returned. If it
2666 doesn't have an "added" status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS
2669 All returned data will be allocated in RESULT_POOL. All temporary
2670 allocations will be made in SCRATCH_POOL.
2673 svn_wc__db_scan_addition(svn_wc__db_status_t *status,
2674 const char **op_root_abspath,
2675 const char **repos_relpath,
2676 const char **repos_root_url,
2677 const char **repos_uuid,
2678 const char **original_repos_relpath,
2679 const char **original_root_url,
2680 const char **original_uuid,
2681 svn_revnum_t *original_revision,
2683 const char *local_abspath,
2684 apr_pool_t *result_pool,
2685 apr_pool_t *scratch_pool);
2687 /* Scan the working copy for move information of the node LOCAL_ABSPATH.
2688 * If LOCAL_ABSPATH return a SVN_ERR_WC_PATH_UNEXPECTED_STATUS error.
2690 * If not NULL *MOVED_FROM_ABSPATH will be set to the previous location
2691 * of LOCAL_ABSPATH, before it or an ancestror was moved.
2693 * If not NULL *OP_ROOT_ABSPATH will be set to the new location of the
2694 * path that was actually moved
2696 * If not NULL *OP_ROOT_MOVED_FROM_ABSPATH will be set to the old location
2697 * of the path that was actually moved.
2699 * If not NULL *MOVED_FROM_DELETE_ABSPATH will be set to the ancestor of the
2700 * moved from location that deletes the original location
2702 * Given a working copy
2707 * You can call this function on D and D/C. When called on D/C all output
2708 * MOVED_FROM_ABSPATH will be A/B/C
2709 * OP_ROOT_ABSPATH will be D
2710 * OP_ROOT_MOVED_FROM_ABSPATH will be A/B
2711 * MOVED_FROM_DELETE_ABSPATH will be A
2714 svn_wc__db_scan_moved(const char **moved_from_abspath,
2715 const char **op_root_abspath,
2716 const char **op_root_moved_from_abspath,
2717 const char **moved_from_delete_abspath,
2719 const char *local_abspath,
2720 apr_pool_t *result_pool,
2721 apr_pool_t *scratch_pool);
2723 /* Scan upwards for additional information about a deleted node.
2725 When a deleted node is discovered in the WORKING tree, the situation
2726 may be quite complex. This function will provide the information to
2727 resolve the circumstances of the deletion.
2729 For discussion purposes, we will start with the most complex example
2730 and then demonstrate simplified examples. Consider node B/W/D/N has been
2731 found as deleted. B is an unmodified directory (thus, only in BASE). W is
2732 "replacement" content that exists in WORKING, shadowing a similar B/W
2733 directory in BASE. D is a deleted subtree in the WORKING tree, and N is
2736 In this example, BASE_DEL_ABSPATH will bet set to B/W. That is the root of
2737 the BASE tree (implicitly) deleted by the replacement. WORK_DEL_ABSPATH
2738 will be set to the subtree deleted within the replacement; in this case,
2739 B/W/D. No move-away took place, so MOVED_TO_ABSPATH is set to NULL.
2741 In another scenario, B/W was moved-away before W was put into the WORKING
2742 tree through an add/copy/move-here. MOVED_TO_ABSPATH will indicate where
2743 B/W was moved to. Note that further operations may have been performed
2744 post-move, but that is not known or reported by this function.
2746 If BASE does not have a B/W, then the WORKING B/W is not a replacement,
2747 but a simple add/copy/move-here. BASE_DEL_ABSPATH will be set to NULL.
2749 If B/W/D does not exist in the WORKING tree (we're only talking about a
2750 deletion of nodes of the BASE tree), then deleting B/W/D would have marked
2751 the subtree for deletion. BASE_DEL_ABSPATH will refer to B/W/D,
2752 MOVED_TO_ABSPATH will be NULL, and WORK_DEL_ABSPATH will be NULL.
2754 If the BASE node B/W/D was moved instead of deleted, then MOVED_TO_ABSPATH
2755 would indicate the target location (and other OUT values as above).
2757 When the user deletes B/W/D from the WORKING tree, there are a few
2758 additional considerations. If B/W is a simple addition (not a copy or
2759 a move-here), then the deletion will simply remove the nodes from WORKING
2760 and possibly leave behind "base-delete" markers in the WORKING tree.
2761 If the source is a copy/moved-here, then the nodes are replaced with
2764 If the user moves-away B/W/D from the WORKING tree, then behavior is
2765 again dependent upon the origination of B/W. For a plain add, the nodes
2766 simply move to the destination; this means that B/W/D ceases to be a
2767 node and so cannot be scanned. For a copy, a deletion is made at B/W/D,
2768 and a new copy (of a subtree of the original source) is made at the
2769 destination. For a move-here, a deletion is made, and a copy is made at
2770 the destination (we do not track multiple moves; the source is moved to
2771 B/W, then B/W/D is deleted; then a copy is made at the destination;
2772 however, note the double-move could have been performed by moving the
2773 subtree first, then moving the source to B/W).
2775 There are three further considerations when resolving a deleted node:
2777 If the BASE B/W/D was deleted explicitly *and* B/W is a replacement,
2778 then the explicit deletion is subsumed by the implicit deletion that
2779 occurred with the B/W replacement. Thus, BASE_DEL_ABSPATH will point
2780 to B/W as the root of the BASE deletion. IOW, we can detect the
2781 explicit move-away, but not an explicit deletion.
2783 If B/W/D/N refers to a node present in the BASE tree, and B/W was
2784 replaced by a shallow subtree, then it is possible for N to be
2785 reported as deleted (from BASE) yet no deletions occurred in the
2786 WORKING tree above N. Thus, WORK_DEL_ABSPATH will be set to NULL.
2789 Summary of OUT parameters:
2791 BASE_DEL_ABSPATH will specify the nearest ancestor of the explicit or
2792 implicit deletion (if any) that applies to the BASE tree.
2794 WORK_DEL_ABSPATH will specify the root of a deleted subtree within
2795 the WORKING tree (note there is no concept of layered delete operations
2796 in WORKING, so there is only one deletion root in the ancestry).
2798 MOVED_TO_ABSPATH will specify the path where this node was moved to
2799 if the node has moved-away.
2801 If the node was moved-away, MOVED_TO_OP_ROOT_ABSPATH will specify the
2802 target path of the root of the move operation. If LOCAL_ABSPATH itself
2803 is the source path of the root of the move operation, then
2804 MOVED_TO_OP_ROOT_ABSPATH equals MOVED_TO_ABSPATH.
2806 All OUT parameters may be set to NULL to indicate a lack of interest in
2807 that piece of information.
2809 If the node given by LOCAL_ABSPATH does not exist, then
2810 SVN_ERR_WC_PATH_NOT_FOUND is returned. If it doesn't have a "deleted"
2811 status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS will be returned.
2813 All returned data will be allocated in RESULT_POOL. All temporary
2814 allocations will be made in SCRATCH_POOL.
2817 svn_wc__db_scan_deletion(const char **base_del_abspath,
2818 const char **moved_to_abspath,
2819 const char **work_del_abspath,
2820 const char **moved_to_op_root_abspath,
2822 const char *local_abspath,
2823 apr_pool_t *result_pool,
2824 apr_pool_t *scratch_pool);
2830 /* @defgroup svn_wc__db_upgrade Functions for upgrading a working copy.
2834 /* Create a new wc.db file for LOCAL_DIR_ABSPATH, which is going to be a
2835 working copy for the repository REPOS_ROOT_URL with uuid REPOS_UUID.
2836 Return the raw sqlite handle, repository id and working copy id
2837 and store the database in WC_DB.
2839 Perform temporary allocations in SCRATCH_POOL. */
2841 svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb,
2842 apr_int64_t *repos_id,
2844 svn_wc__db_t *wc_db,
2845 const char *local_dir_abspath,
2846 const char *repos_root_url,
2847 const char *repos_uuid,
2848 apr_pool_t *scratch_pool);
2852 svn_wc__db_upgrade_apply_dav_cache(svn_sqlite__db_t *sdb,
2853 const char *dir_relpath,
2854 apr_hash_t *cache_values,
2855 apr_pool_t *scratch_pool);
2858 /* ### need much more docco
2860 ### this function should be called within a sqlite transaction. it makes
2861 ### assumptions around this fact.
2863 Apply the various sets of properties to the database nodes based on
2864 their existence/presence, the current state of the node, and the original
2865 format of the working copy which provided these property sets.
2868 svn_wc__db_upgrade_apply_props(svn_sqlite__db_t *sdb,
2869 const char *dir_abspath,
2870 const char *local_relpath,
2871 apr_hash_t *base_props,
2872 apr_hash_t *revert_props,
2873 apr_hash_t *working_props,
2874 int original_format,
2876 apr_pool_t *scratch_pool);
2878 /* Simply insert (or replace) one row in the EXTERNALS table. */
2880 svn_wc__db_upgrade_insert_external(svn_wc__db_t *db,
2881 const char *local_abspath,
2882 svn_node_kind_t kind,
2883 const char *parent_abspath,
2884 const char *def_local_abspath,
2885 const char *repos_relpath,
2886 const char *repos_root_url,
2887 const char *repos_uuid,
2888 svn_revnum_t def_peg_revision,
2889 svn_revnum_t def_revision,
2890 apr_pool_t *scratch_pool);
2892 /* Get the repository identifier corresponding to REPOS_ROOT_URL from the
2893 database in SDB. The value is returned in *REPOS_ID. All allocations
2894 are allocated in SCRATCH_POOL.
2896 NOTE: the row in REPOSITORY must exist. If not, then SVN_ERR_WC_DB_ERROR
2899 ### unclear on whether/how this interface will stay/evolve. */
2901 svn_wc__db_upgrade_get_repos_id(apr_int64_t *repos_id,
2902 svn_sqlite__db_t *sdb,
2903 const char *repos_root_url,
2904 apr_pool_t *scratch_pool);
2906 /* Upgrade the metadata concerning the WC at WCROOT_ABSPATH, in DB,
2907 * to the SVN_WC__VERSION format.
2909 * This function is used for upgrading wc-ng working copies to a newer
2910 * wc-ng format. If a pre-1.7 working copy is found, this function
2911 * returns SVN_ERR_WC_UPGRADE_REQUIRED.
2913 * Upgrading subdirectories of a working copy is not supported.
2914 * If WCROOT_ABSPATH is not a working copy root SVN_ERR_WC_INVALID_OP_ON_CWD
2917 * If BUMPED_FORMAT is not NULL, set *BUMPED_FORMAT to TRUE if the format
2918 * was bumped or to FALSE if the wc was already at the resulting format.
2921 svn_wc__db_bump_format(int *result_format,
2922 svn_boolean_t *bumped_format,
2924 const char *wcroot_abspath,
2925 apr_pool_t *scratch_pool);
2930 /* @defgroup svn_wc__db_wq Work queue manipulation. see workqueue.h
2934 /* In the WCROOT associated with DB and WRI_ABSPATH, add WORK_ITEM to the
2935 wcroot's work queue. Use SCRATCH_POOL for all temporary allocations. */
2937 svn_wc__db_wq_add(svn_wc__db_t *db,
2938 const char *wri_abspath,
2939 const svn_skel_t *work_item,
2940 apr_pool_t *scratch_pool);
2943 /* In the WCROOT associated with DB and WRI_ABSPATH, fetch a work item that
2944 needs to be completed. Its identifier is returned in ID, and the data in
2947 Items are returned in the same order they were queued. This allows for
2948 (say) queueing work on a parent node to be handled before that of its
2951 If there are no work items to be completed, then ID will be set to zero,
2952 and WORK_ITEM to NULL.
2954 If COMPLETED_ID is not 0, the wq item COMPLETED_ID will be marked as
2955 completed before returning the next item.
2957 RESULT_POOL will be used to allocate WORK_ITEM, and SCRATCH_POOL
2958 will be used for all temporary allocations. */
2960 svn_wc__db_wq_fetch_next(apr_uint64_t *id,
2961 svn_skel_t **work_item,
2963 const char *wri_abspath,
2964 apr_uint64_t completed_id,
2965 apr_pool_t *result_pool,
2966 apr_pool_t *scratch_pool);
2968 /* Special variant of svn_wc__db_wq_fetch_next(), which in the same transaction
2969 also records timestamps and sizes for one or more nodes */
2971 svn_wc__db_wq_record_and_fetch_next(apr_uint64_t *id,
2972 svn_skel_t **work_item,
2974 const char *wri_abspath,
2975 apr_uint64_t completed_id,
2976 apr_hash_t *record_map,
2977 apr_pool_t *result_pool,
2978 apr_pool_t *scratch_pool);
2984 /* Note: LEVELS_TO_LOCK is here strictly for backward compat. The access
2985 batons still have the notion of 'levels to lock' and we need to ensure
2986 that they still function correctly, even in the new world. 'levels to
2987 lock' should not be exposed through the wc-ng APIs at all: users either
2988 get to lock the entire tree (rooted at some subdir, of course), or none.
2990 An infinite depth lock is obtained with LEVELS_TO_LOCK set to -1, but until
2991 we move to a single DB only depth 0 is supported.
2994 svn_wc__db_wclock_obtain(svn_wc__db_t *db,
2995 const char *local_abspath,
2997 svn_boolean_t steal_lock,
2998 apr_pool_t *scratch_pool);
3000 /* Set LOCK_ABSPATH to the path of the the directory that owns the
3001 lock on LOCAL_ABSPATH, or NULL, if LOCAL_ABSPATH is not locked. */
3003 svn_wc__db_wclock_find_root(const char **lock_abspath,
3005 const char *local_abspath,
3006 apr_pool_t *result_pool,
3007 apr_pool_t *scratch_pool);
3009 /* Check if somebody has a wclock on LOCAL_ABSPATH */
3011 svn_wc__db_wclocked(svn_boolean_t *locked,
3013 const char *local_abspath,
3014 apr_pool_t *scratch_pool);
3016 /* Release the previously obtained lock on LOCAL_ABSPATH */
3018 svn_wc__db_wclock_release(svn_wc__db_t *db,
3019 const char *local_abspath,
3020 apr_pool_t *scratch_pool);
3022 /* Checks whether DB currently owns a lock to operate on LOCAL_ABSPATH.
3023 If EXACT is TRUE only lock roots are checked. */
3025 svn_wc__db_wclock_owns_lock(svn_boolean_t *own_lock,
3027 const char *local_abspath,
3028 svn_boolean_t exact,
3029 apr_pool_t *scratch_pool);
3033 /* @defgroup svn_wc__db_temp Various temporary functions during transition
3035 ### These functions SHOULD be completely removed before 1.7
3040 /* Removes all references to LOCAL_ABSPATH from DB, while optionally leaving
3043 This operation always recursively removes all nodes at and below
3044 LOCAL_ABSPATH from NODES and ACTUAL.
3046 If NOT_PRESENT_REVISION specifies a valid revision, leave a not_present
3047 BASE node at local_abspath of the specified status and kind.
3048 (Requires an existing BASE node before removing)
3050 If DESTROY_WC is TRUE, this operation *installs* workqueue operations to
3051 update the local filesystem after the database operation. If DESTROY_CHANGES
3052 is FALSE, modified and unversioned files are left after running this
3053 operation (and the WQ). If DESTROY_CHANGES and DESTROY_WC are TRUE,
3054 LOCAL_ABSPATH and everything below it will be removed by the WQ.
3057 Note: Unlike many similar functions it is a valid scenario for this
3058 function to be called on a wcroot! In this case it will just leave the root
3062 svn_wc__db_op_remove_node(svn_boolean_t *left_changes,
3064 const char *local_abspath,
3065 svn_boolean_t destroy_wc,
3066 svn_boolean_t destroy_changes,
3067 svn_revnum_t not_present_revision,
3068 svn_wc__db_status_t not_present_status,
3069 svn_node_kind_t not_present_kind,
3070 const svn_skel_t *conflict,
3071 const svn_skel_t *work_items,
3072 svn_cancel_func_t cancel_func,
3074 apr_pool_t *scratch_pool);
3076 /* Sets the depth of LOCAL_ABSPATH in its working copy to DEPTH using DB.
3078 Returns SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not a BASE directory
3081 svn_wc__db_op_set_base_depth(svn_wc__db_t *db,
3082 const char *local_abspath,
3084 apr_pool_t *scratch_pool);
3086 /* ### temp function. return the FORMAT for the directory LOCAL_ABSPATH. */
3088 svn_wc__db_temp_get_format(int *format,
3090 const char *local_dir_abspath,
3091 apr_pool_t *scratch_pool);
3093 /* ### temp functions to manage/store access batons within the DB. */
3094 svn_wc_adm_access_t *
3095 svn_wc__db_temp_get_access(svn_wc__db_t *db,
3096 const char *local_dir_abspath,
3097 apr_pool_t *scratch_pool);
3099 svn_wc__db_temp_set_access(svn_wc__db_t *db,
3100 const char *local_dir_abspath,
3101 svn_wc_adm_access_t *adm_access,
3102 apr_pool_t *scratch_pool);
3104 svn_wc__db_temp_close_access(svn_wc__db_t *db,
3105 const char *local_dir_abspath,
3106 svn_wc_adm_access_t *adm_access,
3107 apr_pool_t *scratch_pool);
3109 svn_wc__db_temp_clear_access(svn_wc__db_t *db,
3110 const char *local_dir_abspath,
3111 apr_pool_t *scratch_pool);
3113 /* ### shallow hash: abspath -> svn_wc_adm_access_t * */
3115 svn_wc__db_temp_get_all_access(svn_wc__db_t *db,
3116 apr_pool_t *result_pool);
3118 /* ### temp function to open the sqlite database to the appropriate location,
3119 ### then borrow it for a bit.
3120 ### The *only* reason for this function is because entries.c still
3121 ### manually hacks the sqlite database.
3123 ### No matter how tempted you may be DO NOT USE THIS FUNCTION!
3124 ### (if you do, gstein will hunt you down and burn your knee caps off
3125 ### in the middle of the night)
3126 ### "Bet on it." --gstein
3129 svn_wc__db_temp_borrow_sdb(svn_sqlite__db_t **sdb,
3131 const char *local_dir_abspath,
3132 apr_pool_t *scratch_pool);
3135 /* Return a directory in *TEMP_DIR_ABSPATH that is suitable for temporary
3136 files which may need to be moved (atomically and same-device) into the
3137 working copy indicated by WRI_ABSPATH. */
3139 svn_wc__db_temp_wcroot_tempdir(const char **temp_dir_abspath,
3141 const char *wri_abspath,
3142 apr_pool_t *result_pool,
3143 apr_pool_t *scratch_pool);
3145 /* Update the BASE_NODE of directory LOCAL_ABSPATH to be NEW_REPOS_RELPATH
3146 at revision NEW_REV with status incomplete. */
3148 svn_wc__db_temp_op_start_directory_update(svn_wc__db_t *db,
3149 const char *local_abspath,
3150 const char *new_repos_relpath,
3151 svn_revnum_t new_rev,
3152 apr_pool_t *scratch_pool);
3154 /* Marks a directory update started with
3155 svn_wc__db_temp_op_start_directory_update as completed, by removing
3156 the incomplete status */
3158 svn_wc__db_temp_op_end_directory_update(svn_wc__db_t *db,
3159 const char *local_dir_abspath,
3160 apr_pool_t *scratch_pool);
3163 /* Copy the base tree at LOCAL_ABSPATH into the working tree as copy,
3164 leaving any subtree additions and copies as-is. This allows the
3165 base node tree to be removed. */
3167 svn_wc__db_op_make_copy(svn_wc__db_t *db,
3168 const char *local_abspath,
3169 const svn_skel_t *conflicts,
3170 const svn_skel_t *work_items,
3171 apr_pool_t *scratch_pool);
3173 /* Close the wc root LOCAL_ABSPATH and remove any per-directory
3174 handles associated with it. */
3176 svn_wc__db_drop_root(svn_wc__db_t *db,
3177 const char *local_abspath,
3178 apr_pool_t *scratch_pool);
3180 /* Return the OP_DEPTH for LOCAL_RELPATH. */
3182 svn_wc__db_op_depth_for_upgrade(const char *local_relpath);
3184 /* Set *HAVE_WORK TRUE if there is a working layer below the top layer and
3185 *HAVE_BASE if there is a base layer. Set *STATUS to the status of the
3186 highest layer below WORKING */
3188 svn_wc__db_info_below_working(svn_boolean_t *have_base,
3189 svn_boolean_t *have_work,
3190 svn_wc__db_status_t *status,
3192 const char *local_abspath,
3193 apr_pool_t *scratch_pool);
3196 /* Gets an array of const char *local_relpaths of descendants of LOCAL_ABSPATH,
3197 * which itself must be the op root of an addition, copy or move.
3198 * The descendants returned are at the same op_depth, but are to be deleted
3199 * by the commit processing because they are not present in the local copy.
3202 svn_wc__db_get_not_present_descendants(const apr_array_header_t **descendants,
3204 const char *local_abspath,
3205 apr_pool_t *result_pool,
3206 apr_pool_t *scratch_pool);
3208 /* Gather revision status information about a working copy using DB.
3210 * Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision
3211 * numbers found within LOCAL_ABSPATH.
3212 * Only nodes with op_depth zero and presence 'normal' or 'incomplete'
3213 * are considered, so that added, deleted or excluded nodes do not affect
3214 * the result. If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION
3215 * to the lowest and highest committed (i.e. "last changed") revision numbers,
3218 * Indicate in *IS_SPARSE_CHECKOUT whether any of the nodes within
3219 * LOCAL_ABSPATH is sparse.
3220 * Indicate in *IS_MODIFIED whether the working copy has local modifications.
3222 * Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH
3223 * is switched. If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH
3224 * itself is switched. It should be any trailing portion of LOCAL_ABSPATH's
3225 * expected URL, long enough to include any parts that the caller considers
3226 * might be changed by a switch. If it does not match the end of WC_PATH's
3227 * actual URL, then report a "switched" status.
3229 * See also the functions below which provide a subset of this functionality.
3232 svn_wc__db_revision_status(svn_revnum_t *min_revision,
3233 svn_revnum_t *max_revision,
3234 svn_boolean_t *is_sparse_checkout,
3235 svn_boolean_t *is_modified,
3236 svn_boolean_t *is_switched,
3238 const char *local_abspath,
3239 const char *trail_url,
3240 svn_boolean_t committed,
3241 svn_cancel_func_t cancel_func,
3243 apr_pool_t *scratch_pool);
3245 /* Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision
3246 * numbers found within LOCAL_ABSPATH in the working copy using DB.
3247 * Only nodes with op_depth zero and presence 'normal' or 'incomplete'
3248 * are considered, so that added, deleted or excluded nodes do not affect
3249 * the result. If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION
3250 * to the lowest and highest committed (i.e. "last changed") revision numbers,
3251 * respectively. Use SCRATCH_POOL for temporary allocations.
3253 * Either of MIN_REVISION and MAX_REVISION may be passed as NULL if
3254 * the caller doesn't care about that return value.
3256 * This function provides a subset of the functionality of
3257 * svn_wc__db_revision_status() and is more efficient if the caller
3258 * doesn't need all information returned by svn_wc__db_revision_status(). */
3260 svn_wc__db_min_max_revisions(svn_revnum_t *min_revision,
3261 svn_revnum_t *max_revision,
3263 const char *local_abspath,
3264 svn_boolean_t committed,
3265 apr_pool_t *scratch_pool);
3267 /* Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH
3268 * is switched, using DB. Use SCRATCH_POOL for temporary allocations.
3270 * If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH itself
3271 * is switched. It should be any trailing portion of LOCAL_ABSPATH's
3272 * expected URL, long enough to include any parts that the caller considers
3273 * might be changed by a switch. If it does not match the end of WC_PATH's
3274 * actual URL, then report a "switched" status.
3276 * This function provides a subset of the functionality of
3277 * svn_wc__db_revision_status() and is more efficient if the caller
3278 * doesn't need all information returned by svn_wc__db_revision_status(). */
3280 svn_wc__db_has_switched_subtrees(svn_boolean_t *is_switched,
3282 const char *local_abspath,
3283 const char *trail_url,
3284 apr_pool_t *scratch_pool);
3286 /* Set @a *excluded_subtrees to a hash mapping <tt>const char *</tt>
3287 * local absolute paths to <tt>const char *</tt> local absolute paths for
3288 * every path under @a local_abspath in @a db which are excluded by
3289 * the server (e.g. due to authz), or user. If no such paths are found then
3290 * @a *server_excluded_subtrees is set to @c NULL.
3291 * Allocate the hash and all items therein from @a result_pool.
3294 svn_wc__db_get_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
3296 const char *local_abspath,
3297 apr_pool_t *result_pool,
3298 apr_pool_t *scratch_pool);
3300 /* Indicate in *IS_MODIFIED whether the working copy has local modifications,
3301 * using DB. Use SCRATCH_POOL for temporary allocations.
3303 * This function provides a subset of the functionality of
3304 * svn_wc__db_revision_status() and is more efficient if the caller
3305 * doesn't need all information returned by svn_wc__db_revision_status(). */
3307 svn_wc__db_has_local_mods(svn_boolean_t *is_modified,
3309 const char *local_abspath,
3310 svn_cancel_func_t cancel_func,
3312 apr_pool_t *scratch_pool);
3315 /* Verify the consistency of metadata concerning the WC that contains
3316 * WRI_ABSPATH, in DB. Return an error if any problem is found. */
3318 svn_wc__db_verify(svn_wc__db_t *db,
3319 const char *wri_abspath,
3320 apr_pool_t *scratch_pool);
3323 /* Possibly need two structures, one with relpaths and with abspaths?
3324 * Only exposed for testing at present. */
3325 struct svn_wc__db_moved_to_t {
3326 const char *local_relpath; /* moved-to destination */
3327 int op_depth; /* op-root of source */
3330 /* Set *FINAL_ABSPATH to an array of svn_wc__db_moved_to_t for
3331 * LOCAL_ABSPATH after following any and all nested moves.
3332 * Only exposed for testing at present. */
3334 svn_wc__db_follow_moved_to(apr_array_header_t **moved_tos,
3336 const char *local_abspath,
3337 apr_pool_t *result_pool,
3338 apr_pool_t *scratch_pool);
3340 /* Update a moved-away tree conflict victim at VICTIM_ABSPATH with changes
3341 * brought in by the update operation which flagged the tree conflict. */
3343 svn_wc__db_update_moved_away_conflict_victim(svn_wc__db_t *db,
3344 const char *victim_abspath,
3345 svn_wc_notify_func2_t notify_func,
3347 svn_cancel_func_t cancel_func,
3349 apr_pool_t *scratch_pool);
3351 /* LOCAL_ABSPATH is moved to MOVE_DST_ABSPATH. MOVE_SRC_ROOT_ABSPATH
3352 * is the root of the move to MOVE_DST_OP_ROOT_ABSPATH.
3353 * MOVE_SRC_OP_ROOT_ABSPATH is the op-root of the move; it's the same
3354 * as MOVE_SRC_ROOT_ABSPATH except for moves inside deletes when it is
3355 * the op-root of the delete. */
3357 svn_wc__db_base_moved_to(const char **move_dst_abspath,
3358 const char **move_dst_op_root_abspath,
3359 const char **move_src_root_abspath,
3360 const char **move_src_op_root_abspath,
3362 const char *local_abspath,
3363 apr_pool_t *result_pool,
3364 apr_pool_t *scratch_pool);
3366 /* Recover space from the database file for LOCAL_ABSPATH by running
3367 * the "vacuum" command. */
3369 svn_wc__db_vacuum(svn_wc__db_t *db,
3370 const char *local_abspath,
3371 apr_pool_t *scratch_pool);
3373 /* This raises move-edit tree-conflicts on any moves inside the
3374 delete-edit conflict on LOCAL_ABSPATH. This is experimental: see
3375 comment in resolve_conflict_on_node about combining with another
3378 svn_wc__db_resolve_delete_raise_moved_away(svn_wc__db_t *db,
3379 const char *local_abspath,
3380 svn_wc_notify_func2_t notify_func,
3382 apr_pool_t *scratch_pool);
3384 /* Like svn_wc__db_resolve_delete_raise_moved_away this should be
3387 svn_wc__db_resolve_break_moved_away(svn_wc__db_t *db,
3388 const char *local_abspath,
3389 svn_wc_notify_func2_t notify_func,
3391 apr_pool_t *scratch_pool);
3393 /* Break moves for all moved-away children of LOCAL_ABSPATH, within
3394 * a single transaction.
3396 * ### Like svn_wc__db_resolve_delete_raise_moved_away this should be
3399 svn_wc__db_resolve_break_moved_away_children(svn_wc__db_t *db,
3400 const char *local_abspath,
3401 svn_wc_notify_func2_t notify_func,
3403 apr_pool_t *scratch_pool);
3405 /* Set *REQUIRED_ABSPATH to the path that should be locked to ensure
3406 * that the lock covers all paths affected by resolving the conflicts
3407 * in the tree LOCAL_ABSPATH. */
3409 svn_wc__required_lock_for_resolve(const char **required_abspath,
3411 const char *local_abspath,
3412 apr_pool_t *result_pool,
3413 apr_pool_t *scratch_pool);
3419 #endif /* __cplusplus */
3421 #endif /* SVN_WC_DB_H */