wc_db.h revision 362181
1/**
2 * @copyright
3 * ====================================================================
4 *    Licensed to the Apache Software Foundation (ASF) under one
5 *    or more contributor license agreements.  See the NOTICE file
6 *    distributed with this work for additional information
7 *    regarding copyright ownership.  The ASF licenses this file
8 *    to you under the Apache License, Version 2.0 (the
9 *    "License"); you may not use this file except in compliance
10 *    with the License.  You may obtain a copy of the License at
11 *
12 *      http://www.apache.org/licenses/LICENSE-2.0
13 *
14 *    Unless required by applicable law or agreed to in writing,
15 *    software distributed under the License is distributed on an
16 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 *    KIND, either express or implied.  See the License for the
18 *    specific language governing permissions and limitations
19 *    under the License.
20 * ====================================================================
21 * @endcopyright
22 *
23 * @file wc_db.h
24 * @brief The Subversion Working Copy Library - Metadata/Base-Text Support
25 *
26 * Requires:
27 *            - A working copy
28 *
29 * Provides:
30 *            - Ability to manipulate working copy's administrative files.
31 *
32 * Used By:
33 *            - The main working copy library
34 */
35
36#ifndef SVN_WC_DB_H
37#define SVN_WC_DB_H
38
39#include "svn_wc.h"
40
41#include "svn_types.h"
42#include "svn_error.h"
43#include "svn_config.h"
44#include "svn_io.h"
45
46#include "private/svn_skel.h"
47#include "private/svn_sqlite.h"
48#include "private/svn_wc_private.h"
49
50#include "svn_private_config.h"
51
52#ifdef __cplusplus
53extern "C" {
54#endif /* __cplusplus */
55
56/* INTERFACE CONVENTIONS
57
58   "OUT" PARAMETERS
59
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.
66
67
68   POOLS
69
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.
73
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).
81
82
83   PARAMETER CONVENTIONS
84
85   * Parameter Order
86     - any output arguments
87     - DB
88     - LOCAL_ABSPATH
89     - any other input arguments
90     - RESULT_POOL
91     - SCRATCH_POOL
92
93   * DB
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.
98
99   * *_ABSPATH
100     All *_ABSPATH parameters in this API are absolute paths in the local
101     filesystem, represented in Subversion internal canonical form.
102
103   * LOCAL_ABSPATH
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.
107
108   * LOCAL_DIR_ABSPATH
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
111     the working copy.
112
113   * WRI_ABSPATH
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
120     working copy.
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.
125*/
126
127/* Context data structure for interacting with the administrative data. */
128typedef struct svn_wc__db_t svn_wc__db_t;
129
130
131/* Enumerated values describing the state of a node. */
132typedef 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,
135
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.
140
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,
145
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,
150
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,
155
156    /* This node has been deleted. No text or property modifications
157       will be present. */
158    svn_wc__db_status_deleted,
159
160    /* This node was named by the server, but no information was provided. */
161    svn_wc__db_status_server_excluded,
162
163    /* This node has been administratively excluded. */
164    svn_wc__db_status_excluded,
165
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,
171
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.
175
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
180       update algorithm. */
181    svn_wc__db_status_incomplete,
182
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
186
187} svn_wc__db_status_t;
188
189/* Lock information.  We write/read it all as one, so let's use a struct
190   for convenience.  */
191typedef struct svn_wc__db_lock_t {
192  /* The lock token */
193  const char *token;
194
195  /* The owner of the lock, possibly NULL */
196  const char *owner;
197
198  /* A comment about the lock, possibly NULL */
199  const char *comment;
200
201  /* The date the lock was created */
202  apr_time_t date;
203} svn_wc__db_lock_t;
204
205
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".
210*/
211
212/* ### where/how to handle: text_time, locks, working_size */
213
214
215/*
216  @defgroup svn_wc__db_admin  General administrative functions
217  @{
218*/
219
220/* Open a working copy administrative database context.
221
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.
225
226   The context is returned in DB.
227
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.
231
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
236   from that API.
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.
240
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.
246
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.
250
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.
255
256   Temporary allocations will be made in SCRATCH_POOL.
257*/
258svn_error_t *
259svn_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);
265
266
267/* Close DB.  */
268svn_error_t *
269svn_wc__db_close(svn_wc__db_t *db);
270
271
272/* Initialize the SDB for LOCAL_ABSPATH, which should be a working copy path.
273
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.
276
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.
283
284   ### Is there any benefit to marking it 'complete' if rev==0?  Seems like
285   ### an unnecessary special case.
286
287   DEPTH is the initial depth of the working copy; it must be a definite
288   depth, not svn_depth_unknown.
289
290   Use SCRATCH_POOL for temporary allocations.
291*/
292svn_error_t *
293svn_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,
299                svn_depth_t depth,
300                apr_pool_t *scratch_pool);
301
302
303/* Compute the LOCAL_RELPATH for the given LOCAL_ABSPATH, relative
304   from wri_abspath.
305
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
309   be returned.
310
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.
316
317   LOCAL_RELPATH will be allocated in RESULT_POOL. All other (temporary)
318   allocations will be made in SCRATCH_POOL.
319
320   This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE
321   option.
322*/
323svn_error_t *
324svn_wc__db_to_relpath(const char **local_relpath,
325                      svn_wc__db_t *db,
326                      const char *wri_abspath,
327                      const char *local_abspath,
328                      apr_pool_t *result_pool,
329                      apr_pool_t *scratch_pool);
330
331
332/* Compute the LOCAL_ABSPATH for a LOCAL_RELPATH located within the working
333   copy identified by WRI_ABSPATH.
334
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.
337
338   LOCAL_ABSPATH will be allocated in RESULT_POOL. All other (temporary)
339   allocations will be made in SCRATCH_POOL.
340
341   This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE
342   option.
343 */
344svn_error_t *
345svn_wc__db_from_relpath(const char **local_abspath,
346                        svn_wc__db_t *db,
347                        const char *wri_abspath,
348                        const char *local_relpath,
349                        apr_pool_t *result_pool,
350                        apr_pool_t *scratch_pool);
351
352/* Compute the working copy root WCROOT_ABSPATH for WRI_ABSPATH using DB.
353
354   This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE
355   option.
356 */
357svn_error_t *
358svn_wc__db_get_wcroot(const char **wcroot_abspath,
359                      svn_wc__db_t *db,
360                      const char *wri_abspath,
361                      apr_pool_t *result_pool,
362                      apr_pool_t *scratch_pool);
363
364
365/* @} */
366
367/* Different kinds of trees
368
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.
373*/
374
375/* @defgroup svn_wc__db_base  BASE tree management
376
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
379   the repository.
380
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
385   'not-present').
386
387   @{
388*/
389
390/* Add or replace a directory in the BASE tree.
391
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.
395
396   The directory properties are given by the PROPS hash (which is
397   const char *name => const svn_string_t *).
398
399   The last-change information is given by <CHANGED_REV, CHANGED_DATE,
400   CHANGED_AUTHOR>.
401
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.
408
409   This subsystem does not use DEPTH, but it can be recorded here in
410   the BASE tree for higher-level code to use.
411
412   If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified
413   data.
414
415   If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS
416   as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or
417   when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in
418   ACTUAL, to mark the properties unmodified.
419
420   If NEW_IPROPS is not NULL, then it is a depth-first ordered array of
421   svn_prop_inherited_item_t * structures that is set as the base node's
422   inherited_properties.
423
424   If CONFLICT is not NULL, then it describes a conflict for this node. The
425   node will be record as conflicted (in ACTUAL).
426
427   Any work items that are necessary as part of this node construction may
428   be passed in WORK_ITEMS.
429
430   All temporary allocations will be made in SCRATCH_POOL.
431*/
432svn_error_t *
433svn_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,
445                              svn_depth_t depth,
446                              apr_hash_t *dav_cache,
447                              svn_boolean_t update_actual_props,
448                              apr_hash_t *new_actual_props,
449                              apr_array_header_t *new_iprops,
450                              const svn_skel_t *conflict,
451                              const svn_skel_t *work_items,
452                              apr_pool_t *scratch_pool);
453
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.
458   */
459svn_error_t *
460svn_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,
466                                         svn_depth_t depth,
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);
472
473
474/* Add or replace a file in the BASE tree.
475
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.
479
480   The file properties are given by the PROPS hash (which is
481   const char *name => const svn_string_t *).
482
483   The last-change information is given by <CHANGED_REV, CHANGED_DATE,
484   CHANGED_AUTHOR>.
485
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.
488
489   If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified
490   data.
491
492   If CONFLICT is not NULL, then it describes a conflict for this node. The
493   node will be record as conflicted (in ACTUAL).
494
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.
499
500   Any work items that are necessary as part of this node construction may
501   be passed in WORK_ITEMS.
502
503   Unless KEEP_RECORDED_INFO is set to TRUE, recorded size and timestamp values
504   will be cleared.
505
506   All temporary allocations will be made in SCRATCH_POOL.
507*/
508svn_error_t *
509svn_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);
531
532
533/* Add or replace a symlink in the BASE tree.
534
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.
538
539   The symlink's properties are given by the PROPS hash (which is
540   const char *name => const svn_string_t *).
541
542   The last-change information is given by <CHANGED_REV, CHANGED_DATE,
543   CHANGED_AUTHOR>.
544
545   The target of the symlink is specified by TARGET.
546
547   If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified
548   data.
549
550   If CONFLICT is not NULL, then it describes a conflict for this node. The
551   node will be record as conflicted (in ACTUAL).
552
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.
557
558   Any work items that are necessary as part of this node construction may
559   be passed in WORK_ITEMS.
560
561   All temporary allocations will be made in SCRATCH_POOL.
562*/
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:
570   ###
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).
579   ###
580   ### I'm still feeling my way around this problem; just pointing out
581   ### the issues.
582
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.
590*/
591svn_error_t *
592svn_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,
603                            const char *target,
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);
614
615
616/* Create a node in the BASE tree that is present in name only.
617
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.
621
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:
624
625     svn_wc__db_status_server_excluded
626     svn_wc__db_status_excluded
627
628   If CONFLICT is not NULL, then it describes a conflict for this node. The
629   node will be record as conflicted (in ACTUAL).
630
631   Any work items that are necessary as part of this node construction may
632   be passed in WORK_ITEMS.
633
634   All temporary allocations will be made in SCRATCH_POOL.
635*/
636svn_error_t *
637svn_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);
648
649
650/* Create a node in the BASE tree that is present in name only.
651
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.
655
656   The node's kind is described by KIND, and the reason for its absence
657   is 'svn_wc__db_status_not_present'.
658
659   If CONFLICT is not NULL, then it describes a conflict for this node. The
660   node will be record as conflicted (in ACTUAL).
661
662   Any work items that are necessary as part of this node construction may
663   be passed in WORK_ITEMS.
664
665   All temporary allocations will be made in SCRATCH_POOL.
666*/
667svn_error_t *
668svn_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);
678
679/* Remove a node and all its descendants from the BASE tree. This can
680   be done in two modes:
681
682    * Remove everything, scheduling wq operations to clean up
683      the working copy. (KEEP_WORKING = FALSE)
684
685    * Bump things to WORKING, so the BASE layer is free, but the working
686      copy unmodified, except that everything that was visible from
687      BASE is now a copy of what it used to be. (KEEP_WORKING = TRUE)
688
689   This operation *installs* workqueue operations to update the local
690   filesystem after the database operation.
691
692   To maintain a consistent database this function will also remove
693   any working node that marks LOCAL_ABSPATH as base-deleted.  If this
694   results in there being no working node for LOCAL_ABSPATH then any
695   actual node will be removed if the actual node does not mark a
696   conflict.
697
698
699   If MARK_NOT_PRESENT or MARK_EXCLUDED is TRUE, install a marker
700   of the specified type at the root of the now removed tree, with
701   either the specified revision (or in case of SVN_INVALID_REVNUM)
702   the original revision.
703
704   If CONFLICT and/or WORK_ITEMS are passed they are installed as part
705   of the operation, after the work items inserted by the operation
706   itself.
707*/
708svn_error_t *
709svn_wc__db_base_remove(svn_wc__db_t *db,
710                       const char *local_abspath,
711                       svn_boolean_t keep_working,
712                       svn_boolean_t mark_not_present,
713                       svn_boolean_t mark_excluded,
714                       svn_revnum_t marker_revision,
715                       svn_skel_t *conflict,
716                       svn_skel_t *work_items,
717                       apr_pool_t *scratch_pool);
718
719
720/* Retrieve information about a node in the BASE tree.
721
722   For the BASE node implied by LOCAL_ABSPATH from the local filesystem,
723   return information in the provided OUT parameters. Each OUT parameter
724   may be NULL, indicating that specific item is not requested.
725
726   If there is no information about this node, then SVN_ERR_WC_PATH_NOT_FOUND
727   will be returned.
728
729   The OUT parameters, and their "not available" values are:
730     STATUS             n/a (always available)
731     KIND               n/a (always available)
732     REVISION           SVN_INVALID_REVNUM
733     REPOS_RELPATH      NULL (caller should scan up)
734     REPOS_ROOT_URL     NULL (caller should scan up)
735     REPOS_UUID         NULL (caller should scan up)
736     CHANGED_REV        SVN_INVALID_REVNUM
737     CHANGED_DATE       0
738     CHANGED_AUTHOR     NULL
739     DEPTH              svn_depth_unknown
740     CHECKSUM           NULL
741     TARGET             NULL
742     LOCK               NULL
743
744     HAD_PROPS          FALSE
745     PROPS              NULL
746
747     UPDATE_ROOT        FALSE
748
749   If the STATUS is normal, the REPOS_* values will be non-NULL.
750
751   If DEPTH is requested, and the node is NOT a directory, then the
752   value will be set to svn_depth_unknown. If LOCAL_ABSPATH is a link,
753   it's up to the caller to resolve depth for the link's target.
754
755   If CHECKSUM is requested, and the node is NOT a file, then it will
756   be set to NULL.
757
758   If TARGET is requested, and the node is NOT a symlink, then it will
759   be set to NULL.
760
761   *PROPS maps "const char *" names to "const svn_string_t *" values.  If
762   the base node is capable of having properties but has none, set
763   *PROPS to an empty hash.  If its status is such that it cannot have
764   properties, set *PROPS to NULL.
765
766   If UPDATE_ROOT is requested, set it to TRUE if the node should only
767   be updated when it is the root of an update (e.g. file externals).
768
769   All returned data will be allocated in RESULT_POOL. All temporary
770   allocations will be made in SCRATCH_POOL.
771*/
772svn_error_t *
773svn_wc__db_base_get_info(svn_wc__db_status_t *status,
774                         svn_node_kind_t *kind,
775                         svn_revnum_t *revision,
776                         const char **repos_relpath,
777                         const char **repos_root_url,
778                         const char **repos_uuid,
779                         svn_revnum_t *changed_rev,
780                         apr_time_t *changed_date,
781                         const char **changed_author,
782                         svn_depth_t *depth,
783                         const svn_checksum_t **checksum,
784                         const char **target,
785                         svn_wc__db_lock_t **lock,
786                         svn_boolean_t *had_props,
787                         apr_hash_t **props,
788                         svn_boolean_t *update_root,
789                         svn_wc__db_t *db,
790                         const char *local_abspath,
791                         apr_pool_t *result_pool,
792                         apr_pool_t *scratch_pool);
793
794/* Structure returned by svn_wc__db_base_get_children_info.  Only has the
795   fields needed by the adm crawler. */
796struct svn_wc__db_base_info_t {
797  svn_wc__db_status_t status;
798  svn_node_kind_t kind;
799  svn_revnum_t revnum;
800  const char *repos_relpath;
801  const char *repos_root_url;
802  svn_depth_t depth;
803  svn_boolean_t update_root;
804  svn_wc__db_lock_t *lock;
805};
806
807/* Return in *NODES a hash mapping name->struct svn_wc__db_base_info_t for
808   the children of DIR_ABSPATH at op_depth 0.
809 */
810svn_error_t *
811svn_wc__db_base_get_children_info(apr_hash_t **nodes,
812                                  svn_wc__db_t *db,
813                                  const char *dir_abspath,
814                                  apr_pool_t *result_pool,
815                                  apr_pool_t *scratch_pool);
816
817
818/* Set *PROPS to the properties of the node LOCAL_ABSPATH in the BASE tree.
819
820   *PROPS maps "const char *" names to "const svn_string_t *" values.
821   If the node has no properties, set *PROPS to an empty hash.
822   *PROPS will never be set to NULL.
823   If the node is not present in the BASE tree (with presence 'normal'
824   or 'incomplete'), return an error.
825   Allocate *PROPS and its keys and values in RESULT_POOL.
826*/
827svn_error_t *
828svn_wc__db_base_get_props(apr_hash_t **props,
829                          svn_wc__db_t *db,
830                          const char *local_abspath,
831                          apr_pool_t *result_pool,
832                          apr_pool_t *scratch_pool);
833
834
835/* Return a list of the BASE tree node's children's names.
836
837   For the node indicated by LOCAL_ABSPATH, this function will return
838   the names of all of its children in the array CHILDREN. The array
839   elements are const char * values.
840
841   If the node is not a directory, then SVN_ERR_WC_NOT_WORKING_COPY will
842   be returned.
843
844   All returned data will be allocated in RESULT_POOL. All temporary
845   allocations will be made in SCRATCH_POOL.
846*/
847svn_error_t *
848svn_wc__db_base_get_children(const apr_array_header_t **children,
849                             svn_wc__db_t *db,
850                             const char *local_abspath,
851                             apr_pool_t *result_pool,
852                             apr_pool_t *scratch_pool);
853
854
855/* Set the dav cache for LOCAL_ABSPATH to PROPS.  Use SCRATCH_POOL for
856   temporary allocations. */
857svn_error_t *
858svn_wc__db_base_set_dav_cache(svn_wc__db_t *db,
859                              const char *local_abspath,
860                              const apr_hash_t *props,
861                              apr_pool_t *scratch_pool);
862
863
864/* Retrieve the dav cache for LOCAL_ABSPATH into *PROPS, allocated in
865   RESULT_POOL.  Use SCRATCH_POOL for temporary allocations.  Return
866   SVN_ERR_WC_PATH_NOT_FOUND if no dav cache can be located for
867   LOCAL_ABSPATH in DB.  */
868svn_error_t *
869svn_wc__db_base_get_dav_cache(apr_hash_t **props,
870                              svn_wc__db_t *db,
871                              const char *local_abspath,
872                              apr_pool_t *result_pool,
873                              apr_pool_t *scratch_pool);
874
875/* Recursively clear the dav cache for LOCAL_ABSPATH.  Use
876   SCRATCH_POOL for temporary allocations. */
877svn_error_t *
878svn_wc__db_base_clear_dav_cache_recursive(svn_wc__db_t *db,
879                                          const char *local_abspath,
880                                          apr_pool_t *scratch_pool);
881
882/* Set LOCK_TOKENS to a hash mapping const char * full URLs to const char *
883 * lock tokens for every base node at or under LOCAL_ABSPATH in DB which has
884 * such a lock token set on it.
885 * Allocate the hash and all items therein from RESULT_POOL.  */
886svn_error_t *
887svn_wc__db_base_get_lock_tokens_recursive(apr_hash_t **lock_tokens,
888                                          svn_wc__db_t *db,
889                                          const char *local_abspath,
890                                          apr_pool_t *result_pool,
891                                          apr_pool_t *scratch_pool);
892
893/* ### anything else needed for maintaining the BASE tree? */
894
895
896/* @} */
897
898/* @defgroup svn_wc__db_pristine  Pristine ("text base") management
899   @{
900*/
901
902/* Set *PRISTINE_ABSPATH to the path to the pristine text file
903   identified by SHA1_CHECKSUM.  Error if it does not exist.
904
905   ### This is temporary - callers should not be looking at the file
906   directly.
907
908   Allocate the path in RESULT_POOL. */
909svn_error_t *
910svn_wc__db_pristine_get_path(const char **pristine_abspath,
911                             svn_wc__db_t *db,
912                             const char *wri_abspath,
913                             const svn_checksum_t *checksum,
914                             apr_pool_t *result_pool,
915                             apr_pool_t *scratch_pool);
916
917/* Set *PRISTINE_ABSPATH to the path under WCROOT_ABSPATH that will be
918   used by the pristine text identified by SHA1_CHECKSUM.  The file
919   need not exist.
920 */
921svn_error_t *
922svn_wc__db_pristine_get_future_path(const char **pristine_abspath,
923                                    const char *wcroot_abspath,
924                                    const svn_checksum_t *sha1_checksum,
925                                    apr_pool_t *result_pool,
926                                    apr_pool_t *scratch_pool);
927
928
929/* If requested set *CONTENTS to a readable stream that will yield the pristine
930   text identified by SHA1_CHECKSUM (must be a SHA-1 checksum) within the WC
931   identified by WRI_ABSPATH in DB.
932
933   If requested set *SIZE to the size of the pristine stream in bytes,
934
935   Even if the pristine text is removed from the store while it is being
936   read, the stream will remain valid and readable until it is closed.
937
938   Allocate the stream in RESULT_POOL. */
939svn_error_t *
940svn_wc__db_pristine_read(svn_stream_t **contents,
941                         svn_filesize_t *size,
942                         svn_wc__db_t *db,
943                         const char *wri_abspath,
944                         const svn_checksum_t *sha1_checksum,
945                         apr_pool_t *result_pool,
946                         apr_pool_t *scratch_pool);
947
948/* Baton for svn_wc__db_pristine_install */
949typedef struct svn_wc__db_install_data_t
950               svn_wc__db_install_data_t;
951
952/* Open a writable stream to a temporary text base, ready for installing
953   into the pristine store.  Set *STREAM to the opened stream.  The temporary
954   file will have an arbitrary unique name. Return as *INSTALL_DATA a baton
955   for eiter installing or removing the file
956
957   Arrange that, on stream closure, *MD5_CHECKSUM and *SHA1_CHECKSUM will be
958   set to the MD-5 and SHA-1 checksums respectively of that file.
959   MD5_CHECKSUM and/or SHA1_CHECKSUM may be NULL if not wanted.
960
961   Allocate the new stream, path and checksums in RESULT_POOL.
962 */
963svn_error_t *
964svn_wc__db_pristine_prepare_install(svn_stream_t **stream,
965                                    svn_wc__db_install_data_t **install_data,
966                                    svn_checksum_t **sha1_checksum,
967                                    svn_checksum_t **md5_checksum,
968                                    svn_wc__db_t *db,
969                                    const char *wri_abspath,
970                                    apr_pool_t *result_pool,
971                                    apr_pool_t *scratch_pool);
972
973/* Install the file created via svn_wc__db_pristine_prepare_install() into
974   the pristine data store, to be identified by the SHA-1 checksum of its
975   contents, SHA1_CHECKSUM, and whose MD-5 checksum is MD5_CHECKSUM. */
976svn_error_t *
977svn_wc__db_pristine_install(svn_wc__db_install_data_t *install_data,
978                            const svn_checksum_t *sha1_checksum,
979                            const svn_checksum_t *md5_checksum,
980                            apr_pool_t *scratch_pool);
981
982/* Removes the temporary data created by svn_wc__db_pristine_prepare_install
983   when the pristine won't be installed. */
984svn_error_t *
985svn_wc__db_pristine_install_abort(svn_wc__db_install_data_t *install_data,
986                                  apr_pool_t *scratch_pool);
987
988
989/* Set *MD5_CHECKSUM to the MD-5 checksum of a pristine text
990   identified by its SHA-1 checksum SHA1_CHECKSUM. Return an error
991   if the pristine text does not exist or its MD5 checksum is not found.
992
993   Allocate *MD5_CHECKSUM in RESULT_POOL. */
994svn_error_t *
995svn_wc__db_pristine_get_md5(const svn_checksum_t **md5_checksum,
996                            svn_wc__db_t *db,
997                            const char *wri_abspath,
998                            const svn_checksum_t *sha1_checksum,
999                            apr_pool_t *result_pool,
1000                            apr_pool_t *scratch_pool);
1001
1002
1003/* Set *SHA1_CHECKSUM to the SHA-1 checksum of a pristine text
1004   identified by its MD-5 checksum MD5_CHECKSUM. Return an error
1005   if the pristine text does not exist or its SHA-1 checksum is not found.
1006
1007   Note: The MD-5 checksum is not strictly guaranteed to be unique in the
1008   database table, although duplicates are expected to be extremely rare.
1009   ### TODO: The behaviour is currently unspecified if the MD-5 checksum is
1010   not unique. Need to see whether this function is going to stay in use,
1011   and, if so, address this somehow.
1012
1013   Allocate *SHA1_CHECKSUM in RESULT_POOL. */
1014svn_error_t *
1015svn_wc__db_pristine_get_sha1(const svn_checksum_t **sha1_checksum,
1016                             svn_wc__db_t *db,
1017                             const char *wri_abspath,
1018                             const svn_checksum_t *md5_checksum,
1019                             apr_pool_t *result_pool,
1020                             apr_pool_t *scratch_pool);
1021
1022
1023/* If necessary transfers the PRISTINE files of the tree rooted at
1024   SRC_LOCAL_ABSPATH to the working copy identified by DST_WRI_ABSPATH. */
1025svn_error_t *
1026svn_wc__db_pristine_transfer(svn_wc__db_t *db,
1027                             const char *src_local_abspath,
1028                             const char *dst_wri_abspath,
1029                             svn_cancel_func_t cancel_func,
1030                             void *cancel_baton,
1031                             apr_pool_t *scratch_pool);
1032
1033/* Remove the pristine text with SHA-1 checksum SHA1_CHECKSUM from the
1034 * pristine store, iff it is not referenced by any of the (other) WC DB
1035 * tables. */
1036svn_error_t *
1037svn_wc__db_pristine_remove(svn_wc__db_t *db,
1038                           const char *wri_abspath,
1039                           const svn_checksum_t *sha1_checksum,
1040                           apr_pool_t *scratch_pool);
1041
1042
1043/* Remove all unreferenced pristines in the WC of WRI_ABSPATH in DB. */
1044svn_error_t *
1045svn_wc__db_pristine_cleanup(svn_wc__db_t *db,
1046                            const char *wri_abspath,
1047                            apr_pool_t *scratch_pool);
1048
1049
1050/* Set *PRESENT to true if the pristine store for WRI_ABSPATH in DB contains
1051   a pristine text with SHA-1 checksum SHA1_CHECKSUM, and to false otherwise.
1052*/
1053svn_error_t *
1054svn_wc__db_pristine_check(svn_boolean_t *present,
1055                          svn_wc__db_t *db,
1056                          const char *wri_abspath,
1057                          const svn_checksum_t *sha1_checksum,
1058                          apr_pool_t *scratch_pool);
1059
1060/* @defgroup svn_wc__db_external  External management
1061   @{ */
1062
1063/* Adds (or overwrites) a file external LOCAL_ABSPATH to the working copy
1064   identified by WRI_ABSPATH.
1065
1066   It updates both EXTERNALS and NODES in one atomic step.
1067 */
1068svn_error_t *
1069svn_wc__db_external_add_file(svn_wc__db_t *db,
1070                             const char *local_abspath,
1071                             const char *wri_abspath,
1072
1073                             const char *repos_relpath,
1074                             const char *repos_root_url,
1075                             const char *repos_uuid,
1076                             svn_revnum_t revision,
1077
1078                             const apr_hash_t *props,
1079                             apr_array_header_t *iprops,
1080
1081                             svn_revnum_t changed_rev,
1082                             apr_time_t changed_date,
1083                             const char *changed_author,
1084
1085                             const svn_checksum_t *checksum,
1086
1087                             const apr_hash_t *dav_cache,
1088
1089                             const char *record_ancestor_abspath,
1090                             const char *recorded_repos_relpath,
1091                             svn_revnum_t recorded_peg_revision,
1092                             svn_revnum_t recorded_revision,
1093
1094                             svn_boolean_t update_actual_props,
1095                             apr_hash_t *new_actual_props,
1096
1097                             svn_boolean_t keep_recorded_info,
1098                             const svn_skel_t *conflict,
1099                             const svn_skel_t *work_items,
1100                             apr_pool_t *scratch_pool);
1101
1102/* Adds (or overwrites) a symlink external LOCAL_ABSPATH to the working copy
1103   identified by WRI_ABSPATH.
1104 */
1105svn_error_t *
1106svn_wc__db_external_add_symlink(svn_wc__db_t *db,
1107                                const char *local_abspath,
1108                                const char *wri_abspath,
1109
1110                                const char *repos_relpath,
1111                                const char *repos_root_url,
1112                                const char *repos_uuid,
1113                                svn_revnum_t revision,
1114
1115                                const apr_hash_t *props,
1116
1117                                svn_revnum_t changed_rev,
1118                                apr_time_t changed_date,
1119                                const char *changed_author,
1120
1121                                const char *target,
1122
1123                                const apr_hash_t *dav_cache,
1124
1125                                const char *record_ancestor_abspath,
1126                                const char *recorded_repos_relpath,
1127                                svn_revnum_t recorded_peg_revision,
1128                                svn_revnum_t recorded_revision,
1129
1130                                svn_boolean_t update_actual_props,
1131                                apr_hash_t *new_actual_props,
1132
1133                                svn_boolean_t keep_recorded_info,
1134                                const svn_skel_t *work_items,
1135                                apr_pool_t *scratch_pool);
1136
1137/* Adds (or overwrites) a directory external LOCAL_ABSPATH to the working copy
1138   identified by WRI_ABSPATH.
1139
1140  Directory externals are stored in their own working copy, so one should use
1141  the normal svn_wc__db functions to access the normal working copy
1142  information.
1143 */
1144svn_error_t *
1145svn_wc__db_external_add_dir(svn_wc__db_t *db,
1146                            const char *local_abspath,
1147                            const char *wri_abspath,
1148
1149                            const char *repos_root_url,
1150                            const char *repos_uuid,
1151
1152                            const char *record_ancestor_abspath,
1153                            const char *recorded_repos_relpath,
1154                            svn_revnum_t recorded_peg_revision,
1155                            svn_revnum_t recorded_revision,
1156
1157                            const svn_skel_t *work_items,
1158                            apr_pool_t *scratch_pool);
1159
1160/* Remove a registered external LOCAL_ABSPATH from the working copy identified
1161   by WRI_ABSPATH.
1162 */
1163svn_error_t *
1164svn_wc__db_external_remove(svn_wc__db_t *db,
1165                           const char *local_abspath,
1166                           const char *wri_abspath,
1167
1168                           const svn_skel_t *work_items,
1169                           apr_pool_t *scratch_pool);
1170
1171
1172/* Reads information on the external LOCAL_ABSPATH as stored in the working
1173   copy identified with WRI_ABSPATH (If NULL the parent directory of
1174   LOCAL_ABSPATH is taken as WRI_ABSPATH).
1175
1176   Return SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not an external in
1177   this working copy.
1178
1179   When STATUS is requested it has one of these values
1180      svn_wc__db_status_normal           The external is available
1181      svn_wc__db_status_excluded         The external is user excluded
1182
1183   When KIND is requested then the value will be set to the kind of external.
1184
1185   If DEFINING_ABSPATH is requested, then the value will be set to the
1186   absolute path of the directory which originally defined the external.
1187   (The path with the svn:externals property)
1188
1189   If REPOS_ROOT_URL is requested, then the value will be set to the
1190   repository root of the external.
1191
1192   If REPOS_UUID is requested, then the value will be set to the
1193   repository uuid of the external.
1194
1195   If RECORDED_REPOS_RELPATH is requested, then the value will be set to the
1196   original repository relative path inside REPOS_ROOT_URL of the external.
1197
1198   If RECORDED_PEG_REVISION is requested, then the value will be set to the
1199   original recorded operational (peg) revision of the external.
1200
1201   If RECORDED_REVISION is requested, then the value will be set to the
1202   original recorded revision of the external.
1203
1204   Allocate the result in RESULT_POOL and perform temporary allocations in
1205   SCRATCH_POOL.
1206 */
1207svn_error_t *
1208svn_wc__db_external_read(svn_wc__db_status_t *status,
1209                         svn_node_kind_t *kind,
1210                         const char **defining_abspath,
1211
1212                         const char **repos_root_url,
1213                         const char **repos_uuid,
1214
1215                         const char **recorded_repos_relpath,
1216                         svn_revnum_t *recorded_peg_revision,
1217                         svn_revnum_t *recorded_revision,
1218
1219                         svn_wc__db_t *db,
1220                         const char *local_abspath,
1221                         const char *wri_abspath,
1222                         apr_pool_t *result_pool,
1223                         apr_pool_t *scratch_pool);
1224
1225/* Return in *EXTERNALS a list of svn_wc__committable_external_info_t *
1226 * containing info on externals defined to be checked out below LOCAL_ABSPATH,
1227 * returning only those externals that are not fixed to a specific revision.
1228 *
1229 * If IMMEDIATES_ONLY is TRUE, only those externals defined to be checked out
1230 * as immediate children of LOCAL_ABSPATH are returned (this is useful for
1231 * treating user requested depth < infinity).
1232 *
1233 * If there are no externals to be returned, set *EXTERNALS to NULL. Otherwise
1234 * set *EXTERNALS to an APR array newly cleated in RESULT_POOL.
1235 *
1236 * NOTE: This only returns the externals known by the immediate WC root for
1237 * LOCAL_ABSPATH; i.e.:
1238 * - If there is a further parent WC "above" the immediate WC root, and if
1239 *   that parent WC defines externals to live somewhere within this WC, these
1240 *   externals will appear to be foreign/unversioned and won't be picked up.
1241 * - Likewise, only the topmost level of externals nestings (externals
1242 *   defined within a checked out external dir) is picked up by this function.
1243 *   (For recursion, see svn_wc__committable_externals_below().)
1244 *
1245 * ###TODO: Add a WRI_ABSPATH (wc root indicator) separate from LOCAL_ABSPATH,
1246 * to allow searching any wc-root for externals under LOCAL_ABSPATH, not only
1247 * LOCAL_ABSPATH's most immediate wc-root. */
1248svn_error_t *
1249svn_wc__db_committable_externals_below(apr_array_header_t **externals,
1250                                       svn_wc__db_t *db,
1251                                       const char *local_abspath,
1252                                       svn_boolean_t immediates_only,
1253                                       apr_pool_t *result_pool,
1254                                       apr_pool_t *scratch_pool);
1255
1256/* Opaque struct for svn_wc__db_create_commit_queue, svn_wc__db_commit_queue_add,
1257   svn_wc__db_process_commit_queue */
1258typedef struct svn_wc__db_commit_queue_t svn_wc__db_commit_queue_t;
1259
1260/* Create a new svn_wc__db_commit_queue_t instance in RESULT_POOL for the
1261   working copy specified with WRI_ABSPATH */
1262svn_error_t *
1263svn_wc__db_create_commit_queue(svn_wc__db_commit_queue_t **queue,
1264                               svn_wc__db_t *db,
1265                               const char *wri_abspath,
1266                               apr_pool_t *result_pool,
1267                               apr_pool_t *scratch_pool);
1268
1269/* Adds the specified path to the commit queue with the related information.
1270
1271   See svn_wc_queue_committed4() for argument documentation.
1272
1273   Note that this function currently DOESN'T copy the passed values to
1274   RESULT_POOL, but expects them to be valid until processing. Otherwise the
1275   only users memory requirements would +- double.
1276  */
1277svn_error_t *
1278svn_wc__db_commit_queue_add(svn_wc__db_commit_queue_t *queue,
1279                            const char *local_abspath,
1280                            svn_boolean_t recurse,
1281                            svn_boolean_t is_commited,
1282                            svn_boolean_t remove_lock,
1283                            svn_boolean_t remove_changelist,
1284                            const svn_checksum_t *new_sha1_checksum,
1285                            apr_hash_t *new_dav_cache,
1286                            apr_pool_t *result_pool,
1287                            apr_pool_t *scratch_pool);
1288
1289/* Process the items in QUEUE in a single transaction. Commit workqueue items
1290   for items that need post processing.
1291
1292   Implementation detail of svn_wc_process_committed_queue2().
1293 */
1294svn_error_t *
1295svn_wc__db_process_commit_queue(svn_wc__db_t *db,
1296                                svn_wc__db_commit_queue_t *queue,
1297                                svn_revnum_t new_revnum,
1298                                apr_time_t new_date,
1299                                const char *new_author,
1300                                apr_pool_t *scratch_pool);
1301
1302
1303/* Gets a mapping from const char * local abspaths of externals to the const
1304   char * local abspath of where they are defined for all externals defined
1305   at or below LOCAL_ABSPATH.
1306
1307   ### Returns NULL in *EXTERNALS until we bumped to format 29.
1308
1309   Allocate the result in RESULT_POOL and perform temporary allocations in
1310   SCRATCH_POOL. */
1311svn_error_t *
1312svn_wc__db_externals_defined_below(apr_hash_t **externals,
1313                                   svn_wc__db_t *db,
1314                                   const char *local_abspath,
1315                                   apr_pool_t *result_pool,
1316                                   apr_pool_t *scratch_pool);
1317
1318/* Gather all svn:externals property values from the actual properties on
1319   directories below LOCAL_ABSPATH as a mapping of const char *local_abspath
1320   to const char * property values.
1321
1322   If DEPTHS is not NULL, set *depths to an apr_hash_t* mapping the same
1323   local_abspaths to the const char * ambient depth of the node.
1324
1325   Allocate the result in RESULT_POOL and perform temporary allocations in
1326   SCRATCH_POOL. */
1327svn_error_t *
1328svn_wc__db_externals_gather_definitions(apr_hash_t **externals,
1329                                        apr_hash_t **depths,
1330                                        svn_wc__db_t *db,
1331                                        const char *local_abspath,
1332                                        apr_pool_t *result_pool,
1333                                        apr_pool_t *scratch_pool);
1334
1335/* @} */
1336
1337/* @defgroup svn_wc__db_op  Operations on WORKING tree
1338   @{
1339*/
1340
1341/* Copy the node at SRC_ABSPATH (in NODES and ACTUAL_NODE tables) to
1342 * DST_ABSPATH, both in DB but not necessarily in the same WC.  The parent
1343 * of DST_ABSPATH must be a versioned directory.
1344 *
1345 * This copy is NOT recursive. It simply establishes this one node, plus
1346 * incomplete nodes for the children.
1347 *
1348 * If IS_MOVE is TRUE, mark this copy operation as the copy-half of
1349 * a move. The delete-half of the move needs to be created separately
1350 * with svn_wc__db_op_delete().
1351 *
1352 * Add WORK_ITEMS to the work queue. */
1353svn_error_t *
1354svn_wc__db_op_copy(svn_wc__db_t *db,
1355                   const char *src_abspath,
1356                   const char *dst_abspath,
1357                   const char *dst_op_root_abspath,
1358                   svn_boolean_t is_move,
1359                   const svn_skel_t *work_items,
1360                   apr_pool_t *scratch_pool);
1361
1362/* Checks if LOCAL_ABSPATH represents a move back to its original location,
1363 * and if it is reverts the move while keeping local changes after it has been
1364 * moved from MOVED_FROM_ABSPATH.
1365 *
1366 * If MOVED_BACK is not NULL, set *MOVED_BACK to TRUE when a move was reverted,
1367 * otherwise to FALSE.
1368 */
1369svn_error_t *
1370svn_wc__db_op_handle_move_back(svn_boolean_t *moved_back,
1371                               svn_wc__db_t *db,
1372                               const char *local_abspath,
1373                               const char *moved_from_abspath,
1374                               const svn_skel_t *work_items,
1375                               apr_pool_t *scratch_pool);
1376
1377
1378/* Copy the leaves of the op_depth layer directly shadowed by the operation
1379 * of SRC_ABSPATH (so SRC_ABSPATH must be an op_root) to dst_abspaths
1380 * parents layer.
1381 *
1382 * This operation is recursive. It copies all the descendants at the lower
1383 * layer and adds base-deleted nodes on dst_abspath layer to mark these nodes
1384 * properly deleted.
1385 *
1386 * Usually this operation is directly followed by a call to svn_wc__db_op_copy
1387 * which performs the real copy from src_abspath to dst_abspath.
1388 */
1389svn_error_t *
1390svn_wc__db_op_copy_shadowed_layer(svn_wc__db_t *db,
1391                                  const char *src_abspath,
1392                                  const char *dst_abspath,
1393                                  svn_boolean_t is_move,
1394                                  apr_pool_t *scratch_pool);
1395
1396
1397/* Record a copy at LOCAL_ABSPATH from a repository directory.
1398
1399   This copy is NOT recursive. It simply establishes this one node.
1400   CHILDREN must be provided, and incomplete nodes will be constructed
1401   for them.
1402
1403   ### arguments docco.  */
1404svn_error_t *
1405svn_wc__db_op_copy_dir(svn_wc__db_t *db,
1406                       const char *local_abspath,
1407                       const apr_hash_t *props,
1408                       svn_revnum_t changed_rev,
1409                       apr_time_t changed_date,
1410                       const char *changed_author,
1411                       const char *original_repos_relpath,
1412                       const char *original_root_url,
1413                       const char *original_uuid,
1414                       svn_revnum_t original_revision,
1415                       const apr_array_header_t *children,
1416                       svn_depth_t depth,
1417                       svn_boolean_t is_move,
1418                       const svn_skel_t *conflict,
1419                       const svn_skel_t *work_items,
1420                       apr_pool_t *scratch_pool);
1421
1422
1423/* Record a copy at LOCAL_ABSPATH from a repository file.
1424
1425   ### arguments docco.  */
1426svn_error_t *
1427svn_wc__db_op_copy_file(svn_wc__db_t *db,
1428                        const char *local_abspath,
1429                        const apr_hash_t *props,
1430                        svn_revnum_t changed_rev,
1431                        apr_time_t changed_date,
1432                        const char *changed_author,
1433                        const char *original_repos_relpath,
1434                        const char *original_root_url,
1435                        const char *original_uuid,
1436                        svn_revnum_t original_revision,
1437                        const svn_checksum_t *checksum,
1438                        svn_boolean_t update_actual_props,
1439                        const apr_hash_t *new_actual_props,
1440                        svn_boolean_t is_move,
1441                        const svn_skel_t *conflict,
1442                        const svn_skel_t *work_items,
1443                        apr_pool_t *scratch_pool);
1444
1445
1446svn_error_t *
1447svn_wc__db_op_copy_symlink(svn_wc__db_t *db,
1448                           const char *local_abspath,
1449                           const apr_hash_t *props,
1450                           svn_revnum_t changed_rev,
1451                           apr_time_t changed_date,
1452                           const char *changed_author,
1453                           const char *original_repos_relpath,
1454                           const char *original_root_url,
1455                           const char *original_uuid,
1456                           svn_revnum_t original_revision,
1457                           const char *target,
1458                           svn_boolean_t is_move,
1459                           const svn_skel_t *conflict,
1460                           const svn_skel_t *work_items,
1461                           apr_pool_t *scratch_pool);
1462
1463
1464/* ### do we need svn_wc__db_op_copy_server_excluded() ??  */
1465
1466
1467/* ### add a new versioned directory. a list of children is NOT passed
1468   ### since they are added in future, distinct calls to db_op_add_*.
1469   PROPS gives the properties; empty or NULL means none. */
1470/* ### do we need a CONFLICTS param?  */
1471svn_error_t *
1472svn_wc__db_op_add_directory(svn_wc__db_t *db,
1473                            const char *local_abspath,
1474                            const apr_hash_t *props,
1475                            const svn_skel_t *work_items,
1476                            apr_pool_t *scratch_pool);
1477
1478
1479/* Add a file.
1480   PROPS gives the properties; empty or NULL means none.
1481   ### this file has no "pristine"
1482   ### contents, so a checksum [reference] is not required.  */
1483/* ### do we need a CONFLICTS param?  */
1484svn_error_t *
1485svn_wc__db_op_add_file(svn_wc__db_t *db,
1486                       const char *local_abspath,
1487                       const apr_hash_t *props,
1488                       const svn_skel_t *work_items,
1489                       apr_pool_t *scratch_pool);
1490
1491
1492/* Add a symlink.
1493   PROPS gives the properties; empty or NULL means none. */
1494/* ### do we need a CONFLICTS param?  */
1495svn_error_t *
1496svn_wc__db_op_add_symlink(svn_wc__db_t *db,
1497                          const char *local_abspath,
1498                          const char *target,
1499                          const apr_hash_t *props,
1500                          const svn_skel_t *work_items,
1501                          apr_pool_t *scratch_pool);
1502
1503
1504/* Set the properties of the node LOCAL_ABSPATH in the ACTUAL tree to
1505   PROPS.
1506
1507   PROPS maps "const char *" names to "const svn_string_t *" values.
1508   To specify no properties, PROPS must be an empty hash, not NULL.
1509   If the node is not present, return an error.
1510
1511   If PROPS is NULL, set the properties to be the same as the pristine
1512   properties.
1513
1514   If CONFLICT is not NULL, it is used to register a conflict on this
1515   node at the same time the properties are changed.
1516
1517   WORK_ITEMS are inserted into the work queue, as additional things that
1518   need to be completed before the working copy is stable.
1519
1520
1521   If CLEAR_RECORDED_INFO is true, the recorded information for the node
1522   is cleared. (commonly used when updating svn:* magic properties).
1523
1524   NOTE: This will overwrite ALL working properties the node currently
1525   has. There is no db_op_set_prop() function. Callers must read all the
1526   properties, change one, and write all the properties.
1527   ### ugh. this has poor transaction semantics...
1528
1529
1530   NOTE: This will create an entry in the ACTUAL table for the node if it
1531   does not yet have one.
1532*/
1533svn_error_t *
1534svn_wc__db_op_set_props(svn_wc__db_t *db,
1535                        const char *local_abspath,
1536                        apr_hash_t *props,
1537                        svn_boolean_t clear_recorded_info,
1538                        const svn_skel_t *conflict,
1539                        const svn_skel_t *work_items,
1540                        apr_pool_t *scratch_pool);
1541
1542/* Mark LOCAL_ABSPATH, and all children, for deletion.
1543 *
1544 * This function removes the file externals (and if DELETE_DIR_EXTERNALS is
1545 * TRUE also the directory externals) registered below LOCAL_ABSPATH.
1546 * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes)
1547 *
1548 * If MOVED_TO_ABSPATH is not NULL, mark the deletion of LOCAL_ABSPATH
1549 * as the delete-half of a move from LOCAL_ABSPATH to MOVED_TO_ABSPATH.
1550 *
1551 * If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON)
1552 * for each node deleted. While this processing occurs, if CANCEL_FUNC is
1553 * not NULL, then it will be called (with CANCEL_BATON) to detect cancellation
1554 * during the processing.
1555 *
1556 * Note: the notification (and cancellation) occur outside of a SQLite
1557 * transaction.
1558 */
1559svn_error_t *
1560svn_wc__db_op_delete(svn_wc__db_t *db,
1561                     const char *local_abspath,
1562                     const char *moved_to_abspath,
1563                     svn_boolean_t delete_dir_externals,
1564                     svn_skel_t *conflict,
1565                     svn_skel_t *work_items,
1566                     svn_cancel_func_t cancel_func,
1567                     void *cancel_baton,
1568                     svn_wc_notify_func2_t notify_func,
1569                     void *notify_baton,
1570                     apr_pool_t *scratch_pool);
1571
1572
1573/* Mark all LOCAL_ABSPATH in the TARGETS array, and all of their children,
1574 * for deletion.
1575 *
1576 * This function is more efficient than svn_wc__db_op_delete() because
1577 * only one sqlite transaction is used for all targets.
1578 * It currently lacks support for moves (though this could be changed,
1579 * at which point svn_wc__db_op_delete() becomes redundant).
1580 *
1581 * This function removes the file externals (and if DELETE_DIR_EXTERNALS is
1582 * TRUE also the directory externals) registered below the targets.
1583 * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes)
1584 *
1585 * If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON)
1586 * for each node deleted. While this processing occurs, if CANCEL_FUNC is
1587 * not NULL, then it will be called (with CANCEL_BATON) to detect cancellation
1588 * during the processing.
1589 *
1590 * Note: the notification (and cancellation) occur outside of a SQLite
1591 * transaction.
1592 */
1593svn_error_t *
1594svn_wc__db_op_delete_many(svn_wc__db_t *db,
1595                          apr_array_header_t *targets,
1596                          svn_boolean_t delete_dir_externals,
1597                          const svn_skel_t *conflict,
1598                          svn_cancel_func_t cancel_func,
1599                          void *cancel_baton,
1600                          svn_wc_notify_func2_t notify_func,
1601                          void *notify_baton,
1602                          apr_pool_t *scratch_pool);
1603
1604
1605/* ### mark PATH as (possibly) modified. "svn edit" ... right API here? */
1606svn_error_t *
1607svn_wc__db_op_modified(svn_wc__db_t *db,
1608                       const char *local_abspath,
1609                       apr_pool_t *scratch_pool);
1610
1611
1612/* ### use NULL to remove from a changelist.
1613
1614   ### NOTE: only depth=svn_depth_empty is supported right now.
1615 */
1616svn_error_t *
1617svn_wc__db_op_set_changelist(svn_wc__db_t *db,
1618                             const char *local_abspath,
1619                             const char *new_changelist,
1620                             const apr_array_header_t *changelist_filter,
1621                             svn_depth_t depth,
1622                             /* ### flip to CANCEL, then NOTIFY. precedent.  */
1623                             svn_wc_notify_func2_t notify_func,
1624                             void *notify_baton,
1625                             svn_cancel_func_t cancel_func,
1626                             void *cancel_baton,
1627                             apr_pool_t *scratch_pool);
1628
1629/* Record CONFLICT on LOCAL_ABSPATH, potentially replacing other conflicts
1630   recorded on LOCAL_ABSPATH.
1631
1632   Users should in most cases pass CONFLICT to another WC_DB call instead of
1633   calling svn_wc__db_op_mark_conflict() directly outside a transaction, to
1634   allow recording atomically with the operation involved.
1635
1636   Any work items that are necessary as part of marking this node conflicted
1637   can be passed in WORK_ITEMS.
1638 */
1639svn_error_t *
1640svn_wc__db_op_mark_conflict(svn_wc__db_t *db,
1641                            const char *local_abspath,
1642                            const svn_skel_t *conflict,
1643                            const svn_skel_t *work_items,
1644                            apr_pool_t *scratch_pool);
1645
1646
1647/* Clear all or some of the conflicts stored on LOCAL_ABSPATH, if any.
1648
1649   Any work items that are necessary as part of resolving this node
1650   can be passed in WORK_ITEMS.
1651
1652### caller maintains ACTUAL, and how the resolution occurred. we're just
1653   ### recording state.
1654   ###
1655   ### I'm not sure that these three values are the best way to do this,
1656   ### but they're handy for now.  */
1657svn_error_t *
1658svn_wc__db_op_mark_resolved(svn_wc__db_t *db,
1659                            const char *local_abspath,
1660                            svn_boolean_t resolved_text,
1661                            svn_boolean_t resolved_props,
1662                            svn_boolean_t resolved_tree,
1663                            const svn_skel_t *work_items,
1664                            apr_pool_t *scratch_pool);
1665
1666
1667/* Revert all local changes which are being maintained in the database,
1668 * including conflict storage, properties and text modification status.
1669 *
1670 * Returns SVN_ERR_WC_INVALID_OPERATION_DEPTH if the revert is not
1671 * possible, e.g. copy/delete but not a root, or a copy root with
1672 * children.
1673 *
1674 * At present only depth=empty and depth=infinity are supported.
1675 *
1676 * If @a clear_changelists is FALSE then changelist information is kept,
1677 * otherwise it is cleared.
1678 *
1679 * This function populates the revert list that can be queried to
1680 * determine what was reverted.
1681 */
1682svn_error_t *
1683svn_wc__db_op_revert(svn_wc__db_t *db,
1684                     const char *local_abspath,
1685                     svn_depth_t depth,
1686                     svn_boolean_t clear_changelists,
1687                     apr_pool_t *result_pool,
1688                     apr_pool_t *scratch_pool);
1689
1690/* Query the revert list for LOCAL_ABSPATH and set *REVERTED if the
1691 * path was reverted.  Set *MARKER_FILES to a const char *list of
1692 * marker files if any were recorded on LOCAL_ABSPATH.
1693 *
1694 * Set *COPIED_HERE if the reverted node was copied here and is the
1695 * operation root of the copy.
1696 * Set *KIND to the node kind of the reverted node.
1697 *
1698 * Removes the row for LOCAL_ABSPATH from the revert list.
1699 */
1700svn_error_t *
1701svn_wc__db_revert_list_read(svn_boolean_t *reverted,
1702                            const apr_array_header_t **marker_files,
1703                            svn_boolean_t *copied_here,
1704                            svn_node_kind_t *kind,
1705                            svn_wc__db_t *db,
1706                            const char *local_abspath,
1707                            apr_pool_t *result_pool,
1708                            apr_pool_t *scratch_pool);
1709
1710/* The type of elements in the array returned by
1711 * svn_wc__db_revert_list_read_copied_children(). */
1712typedef struct svn_wc__db_revert_list_copied_child_info_t {
1713  const char *abspath;
1714  svn_node_kind_t kind;
1715} svn_wc__db_revert_list_copied_child_info_t ;
1716
1717/* Return in *CHILDREN a list of reverted copied nodes at or within
1718 * LOCAL_ABSPATH (which is a reverted file or a reverted directory).
1719 * Allocate *COPIED_CHILDREN and its elements in RESULT_POOL.
1720 * The elements are of type svn_wc__db_revert_list_copied_child_info_t. */
1721svn_error_t *
1722svn_wc__db_revert_list_read_copied_children(apr_array_header_t **children,
1723                                            svn_wc__db_t *db,
1724                                            const char *local_abspath,
1725                                            apr_pool_t *result_pool,
1726                                            apr_pool_t *scratch_pool);
1727
1728
1729/* Make revert notifications for all paths in the revert list that are
1730 * equal to LOCAL_ABSPATH or below LOCAL_ABSPATH.
1731 *
1732 * Removes all the corresponding rows from the revert list.
1733 *
1734 * ### Pass in cancel_func?
1735 */
1736svn_error_t *
1737svn_wc__db_revert_list_notify(svn_wc_notify_func2_t notify_func,
1738                              void *notify_baton,
1739                              svn_wc__db_t *db,
1740                              const char *local_abspath,
1741                              apr_pool_t *scratch_pool);
1742
1743/* Clean up after svn_wc__db_op_revert by removing the revert list.
1744 */
1745svn_error_t *
1746svn_wc__db_revert_list_done(svn_wc__db_t *db,
1747                            const char *local_abspath,
1748                            apr_pool_t *scratch_pool);
1749
1750/* ### status */
1751
1752
1753/* @} */
1754
1755/* @defgroup svn_wc__db_read  Read operations on the BASE/WORKING tree
1756   @{
1757
1758   These functions query information about nodes in ACTUAL, and returns
1759   the requested information from the appropriate ACTUAL, WORKING, or
1760   BASE tree.
1761
1762   For example, asking for the checksum of the pristine version will
1763   return the one recorded in WORKING, or if no WORKING node exists, then
1764   the checksum comes from BASE.
1765*/
1766
1767/* Retrieve information about a node.
1768
1769   For the node implied by LOCAL_ABSPATH from the local filesystem, return
1770   information in the provided OUT parameters. Each OUT parameter may be
1771   NULL, indicating that specific item is not requested.
1772
1773   The information returned comes from the BASE tree, as possibly modified
1774   by the WORKING and ACTUAL trees.
1775
1776   If there is no information about the node, then SVN_ERR_WC_PATH_NOT_FOUND
1777   will be returned.
1778
1779   The OUT parameters, and their "not available" values are:
1780     STATUS                  n/a (always available)
1781     KIND                    svn_node_unknown   (For ACTUAL only nodes)
1782     REVISION                SVN_INVALID_REVNUM
1783     REPOS_RELPATH           NULL
1784     REPOS_ROOT_URL          NULL
1785     REPOS_UUID              NULL
1786     CHANGED_REV             SVN_INVALID_REVNUM
1787     CHANGED_DATE            0
1788     CHANGED_AUTHOR          NULL
1789     DEPTH                   svn_depth_unknown
1790     CHECKSUM                NULL
1791     TARGET                  NULL
1792
1793     ORIGINAL_REPOS_RELPATH  NULL
1794     ORIGINAL_ROOT_URL       NULL
1795     ORIGINAL_UUID           NULL
1796     ORIGINAL_REVISION       SVN_INVALID_REVNUM
1797
1798     LOCK                    NULL
1799
1800     RECORDED_SIZE           SVN_INVALID_FILESIZE
1801     RECORDED_TIME       0
1802
1803     CHANGELIST              NULL
1804     CONFLICTED              FALSE
1805
1806     OP_ROOT                 FALSE
1807     HAD_PROPS               FALSE
1808     PROPS_MOD               FALSE
1809
1810     HAVE_BASE               FALSE
1811     HAVE_MORE_WORK          FALSE
1812     HAVE_WORK               FALSE
1813
1814   When STATUS is requested, then it will be one of these values:
1815
1816     svn_wc__db_status_normal
1817       A plain BASE node, with no local changes.
1818
1819     svn_wc__db_status_added
1820       A node has been added/copied/moved to here. See HAVE_BASE to see
1821       if this change overwrites a BASE node. Use scan_addition() to resolve
1822       whether this has been added, copied, or moved, and the details of the
1823       operation (this function only looks at LOCAL_ABSPATH, but resolving
1824       the details requires scanning one or more ancestor nodes).
1825
1826     svn_wc__db_status_deleted
1827       This node has been deleted or moved away. It may be a delete/move of
1828       a BASE node, or a child node of a subtree that was copied/moved to
1829       an ancestor location. Call scan_deletion() to determine the full
1830       details of the operations upon this node.
1831
1832     svn_wc__db_status_server_excluded
1833       The node is versioned/known by the server, but the server has
1834       decided not to provide further information about the node. This
1835       is a BASE node (since changes are not allowed to this node).
1836
1837     svn_wc__db_status_excluded
1838       The node has been excluded from the working copy tree. This may
1839       be an exclusion from the BASE tree, or an exclusion in the
1840       WORKING tree for a child node of a copied/moved parent.
1841
1842     svn_wc__db_status_not_present
1843       This is a node from the BASE tree, has been marked as "not-present"
1844       within this mixed-revision working copy. This node is at a revision
1845       that is not in the tree, contrary to its inclusion in the parent
1846       node's revision.
1847
1848     svn_wc__db_status_incomplete
1849       The BASE is incomplete due to an interrupted operation.  An
1850       incomplete WORKING node will be svn_wc__db_status_added.
1851
1852   If REVISION is requested, it will be set to the revision of the
1853   unmodified (BASE) node, or to SVN_INVALID_REVNUM if any structural
1854   changes have been made to that node (that is, if the node has a row in
1855   the WORKING table).
1856
1857   If DEPTH is requested, and the node is NOT a directory, then
1858   the value will be set to svn_depth_unknown.
1859
1860   If CHECKSUM is requested, and the node is NOT a file, then it will
1861   be set to NULL.
1862
1863   If TARGET is requested, and the node is NOT a symlink, then it will
1864   be set to NULL.
1865
1866   If TRANSLATED_SIZE is requested, and the node is NOT a file, then
1867   it will be set to SVN_INVALID_FILESIZE.
1868
1869   If HAVE_WORK is TRUE, the returned information is from the highest WORKING
1870   layer. In that case HAVE_MORE_WORK and HAVE_BASE provide information about
1871   what other layers exist for this node.
1872
1873   If HAVE_WORK is FALSE and HAVE_BASE is TRUE then the information is from
1874   the BASE tree.
1875
1876   If HAVE_WORK and HAVE_BASE are both FALSE and when retrieving CONFLICTED,
1877   then the node doesn't exist at all.
1878
1879   If OP_ROOT is requested and the node has a WORKING layer, OP_ROOT will be
1880   set to true if this node is the op_root for this layer.
1881
1882   If HAD_PROPS is requested and the node has pristine props, the value will
1883   be set to TRUE.
1884
1885   If PROPS_MOD is requested and the node has property modification the value
1886   will be set to TRUE.
1887
1888   ### add information about the need to scan upwards to get a complete
1889   ### picture of the state of this node.
1890
1891   ### add some documentation about OUT parameter values based on STATUS ??
1892
1893   ### the TEXT_MOD may become an enumerated value at some point to
1894   ### indicate different states of knowledge about text modifications.
1895   ### for example, an "svn edit" command in the future might set a
1896   ### flag indicating administratively-defined modification. and/or we
1897   ### might have a status indicating that we saw it was modified while
1898   ### performing a filesystem traversal.
1899
1900   All returned data will be allocated in RESULT_POOL. All temporary
1901   allocations will be made in SCRATCH_POOL.
1902*/
1903/* ### old docco. needs to be incorporated as appropriate. there is
1904   ### some pending, potential changes to the definition of this API,
1905   ### so not worrying about it just yet.
1906
1907   ### if the node has not been committed (after adding):
1908   ###   revision will be SVN_INVALID_REVNUM
1909   ###   repos_* will be NULL
1910   ###   changed_rev will be SVN_INVALID_REVNUM
1911   ###   changed_date will be 0
1912   ###   changed_author will be NULL
1913   ###   status will be svn_wc__db_status_added
1914   ###   text_mod will be TRUE
1915   ###   prop_mod will be TRUE if any props have been set
1916   ###   base_shadowed will be FALSE
1917
1918   ### if the node is not a copy, or a move destination:
1919   ###   original_repos_path will be NULL
1920   ###   original_root_url will be NULL
1921   ###   original_uuid will be NULL
1922   ###   original_revision will be SVN_INVALID_REVNUM
1923
1924   ### note that @a base_shadowed can be derived. if the status specifies
1925   ### an add/copy/move *and* there is a corresponding node in BASE, then
1926   ### the BASE has been deleted to open the way for this node.
1927*/
1928svn_error_t *
1929svn_wc__db_read_info(svn_wc__db_status_t *status,  /* ### derived */
1930                     svn_node_kind_t *kind,
1931                     svn_revnum_t *revision,
1932                     const char **repos_relpath,
1933                     const char **repos_root_url,
1934                     const char **repos_uuid,
1935                     svn_revnum_t *changed_rev,
1936                     apr_time_t *changed_date,
1937                     const char **changed_author,
1938                     svn_depth_t *depth,  /* dirs only */
1939                     const svn_checksum_t **checksum, /* files only */
1940                     const char **target, /* symlinks only */
1941
1942                     /* ### the following fields if copied/moved (history) */
1943                     const char **original_repos_relpath,
1944                     const char **original_root_url,
1945                     const char **original_uuid,
1946                     svn_revnum_t *original_revision,
1947
1948                     /* For BASE nodes */
1949                     svn_wc__db_lock_t **lock,
1950
1951                     /* Recorded for files present in the working copy */
1952                     svn_filesize_t *recorded_size,
1953                     apr_time_t *recorded_time,
1954
1955                     /* From ACTUAL */
1956                     const char **changelist,
1957                     svn_boolean_t *conflicted,
1958
1959                     /* ### the followed are derived fields */
1960                     svn_boolean_t *op_root,
1961
1962                     svn_boolean_t *had_props,
1963                     svn_boolean_t *props_mod,
1964
1965                     svn_boolean_t *have_base,
1966                     svn_boolean_t *have_more_work,
1967                     svn_boolean_t *have_work,
1968
1969                     svn_wc__db_t *db,
1970                     const char *local_abspath,
1971                     apr_pool_t *result_pool,
1972                     apr_pool_t *scratch_pool);
1973
1974/* Structure used as linked list in svn_wc__db_info_t to describe all nodes
1975   in this location that were moved to another location */
1976struct svn_wc__db_moved_to_info_t
1977{
1978  const char *moved_to_abspath;
1979  const char *shadow_op_root_abspath;
1980
1981  struct svn_wc__db_moved_to_info_t *next;
1982};
1983
1984/* Structure returned by svn_wc__db_read_children_info.  Only has the
1985   fields needed by status. */
1986struct svn_wc__db_info_t {
1987  svn_wc__db_status_t status;
1988  svn_node_kind_t kind;
1989  svn_revnum_t revnum;
1990  const char *repos_relpath;
1991  const char *repos_root_url;
1992  const char *repos_uuid;
1993  svn_revnum_t changed_rev;
1994  const char *changed_author;
1995  apr_time_t changed_date;
1996  svn_depth_t depth;
1997
1998  svn_filesize_t recorded_size;
1999  apr_time_t recorded_time;
2000
2001  const char *changelist;
2002  svn_boolean_t conflicted;
2003#ifdef HAVE_SYMLINK
2004  svn_boolean_t special;
2005#endif
2006  svn_boolean_t op_root;
2007
2008  svn_boolean_t has_checksum;
2009  svn_boolean_t copied;
2010  svn_boolean_t had_props;
2011  svn_boolean_t props_mod;
2012
2013  svn_boolean_t have_base;
2014  svn_boolean_t have_more_work;
2015
2016  svn_boolean_t locked;     /* WC directory lock */
2017  svn_wc__db_lock_t *lock;  /* Repository file lock */
2018  svn_boolean_t incomplete; /* TRUE if a working node is incomplete */
2019
2020  struct svn_wc__db_moved_to_info_t *moved_to; /* A linked list of locations
2021                                                 where nodes at this path
2022                                                 are moved to. Highest layers
2023                                                 first */
2024  svn_boolean_t moved_here;     /* Only on op-roots. */
2025
2026  svn_boolean_t file_external;
2027  svn_boolean_t has_descendants; /* Is dir, or has tc descendants */
2028};
2029
2030/* Return in *NODES a hash mapping name->struct svn_wc__db_info_t for
2031   the children of DIR_ABSPATH, and in *CONFLICTS a hash of names in
2032   conflict.
2033
2034   The results include any path that was a child of a deleted directory that
2035   existed at LOCAL_ABSPATH, even if that directory is now scheduled to be
2036   replaced by the working node at LOCAL_ABSPATH.
2037
2038   If BASE_TREE_ONLY is set, only information about the BASE tree
2039   is returned.
2040 */
2041svn_error_t *
2042svn_wc__db_read_children_info(apr_hash_t **nodes,
2043                              apr_hash_t **conflicts,
2044                              svn_wc__db_t *db,
2045                              const char *dir_abspath,
2046                              svn_boolean_t base_tree_only,
2047                              apr_pool_t *result_pool,
2048                              apr_pool_t *scratch_pool);
2049
2050/* Like svn_wc__db_read_children_info, but only gets an info node for the root
2051   element.
2052
2053   If BASE_TREE_ONLY is set, only information about the BASE tree
2054   is returned. */
2055svn_error_t *
2056svn_wc__db_read_single_info(const struct svn_wc__db_info_t **info,
2057                            svn_wc__db_t *db,
2058                            const char *local_abspath,
2059                            svn_boolean_t base_tree_only,
2060                            apr_pool_t *result_pool,
2061                            apr_pool_t *scratch_pool);
2062
2063/* Structure returned by svn_wc__db_read_walker_info.  Only has the
2064   fields needed by svn_wc__internal_walk_children(). */
2065struct svn_wc__db_walker_info_t {
2066  const char *name;
2067  svn_wc__db_status_t status;
2068  svn_node_kind_t kind;
2069};
2070
2071/* When a node is deleted in WORKING, some of its information is no longer
2072   available. But in some cases it might still be relevant to obtain this
2073   information even when the information isn't stored in the BASE tree.
2074
2075   This function allows access to that specific information.
2076
2077   When a node is not deleted, this node returns the same information
2078   as svn_wc__db_read_info().
2079
2080   All output arguments are optional and behave in the same way as when
2081   calling svn_wc__db_read_info().
2082
2083   (All other information (like original_*) can be obtained via other apis).
2084
2085   *PROPS maps "const char *" names to "const svn_string_t *" values.  If
2086   the pristine node is capable of having properties but has none, set
2087   *PROPS to an empty hash.  If its status is such that it cannot have
2088   properties, set *PROPS to NULL.
2089 */
2090svn_error_t *
2091svn_wc__db_read_pristine_info(svn_wc__db_status_t *status,
2092                              svn_node_kind_t *kind,
2093                              svn_revnum_t *changed_rev,
2094                              apr_time_t *changed_date,
2095                              const char **changed_author,
2096                              svn_depth_t *depth,  /* dirs only */
2097                              const svn_checksum_t **checksum, /* files only */
2098                              const char **target, /* symlinks only */
2099                              svn_boolean_t *had_props,
2100                              apr_hash_t **props,
2101                              svn_wc__db_t *db,
2102                              const char *local_abspath,
2103                              apr_pool_t *result_pool,
2104                              apr_pool_t *scratch_pool);
2105
2106/* Gets the information required to install a pristine file to the working copy
2107
2108   Set WCROOT_ABSPATH to the working copy root, SHA1_CHECKSUM to the
2109   checksum of the node (a valid reference into the pristine store)
2110   and PRISTINE_PROPS to the node's pristine properties (to use for
2111   installing the file).
2112
2113   If WRI_ABSPATH is not NULL, check for information in the working copy
2114   identified by WRI_ABSPATH.
2115   */
2116svn_error_t *
2117svn_wc__db_read_node_install_info(const char **wcroot_abspath,
2118                                  const svn_checksum_t **sha1_checksum,
2119                                  apr_hash_t **pristine_props,
2120                                  apr_time_t *changed_date,
2121                                  svn_wc__db_t *db,
2122                                  const char *local_abspath,
2123                                  const char *wri_abspath,
2124                                  apr_pool_t *result_pool,
2125                                  apr_pool_t *scratch_pool);
2126
2127/* Return in *ITEMS an array of struct svn_wc__db_walker_info_t* for
2128   the direct children of DIR_ABSPATH. */
2129svn_error_t *
2130svn_wc__db_read_children_walker_info(const apr_array_header_t **items,
2131                                     svn_wc__db_t *db,
2132                                     const char *dir_abspath,
2133                                     apr_pool_t *result_pool,
2134                                     apr_pool_t *scratch_pool);
2135
2136
2137/**
2138 * Set *revision, *repos_relpath, *repos_root_url, *repos_uuid to
2139 * the intended/commit location of LOCAL_ABSPATH. These arguments may be
2140 * NULL if they are not needed.
2141 *
2142 * If the node is deleted, return the url it would have in the repository
2143 * if it wouldn't be deleted. If the node is added return the url it will
2144 * have in the repository, once committed.
2145 *
2146 * If the node is not added and has an existing repository location, set
2147 * revision to its existing revision, otherwise to SVN_INVALID_REVNUM.
2148 */
2149svn_error_t *
2150svn_wc__db_read_repos_info(svn_revnum_t *revision,
2151                           const char **repos_relpath,
2152                           const char **repos_root_url,
2153                           const char **repos_uuid,
2154                           svn_wc__db_t *db,
2155                           const char *local_abspath,
2156                           apr_pool_t *result_pool,
2157                           apr_pool_t *scratch_pool);
2158
2159
2160/* Set *PROPS to the properties of the node LOCAL_ABSPATH in the ACTUAL
2161   tree (looking through to the WORKING or BASE tree as required).
2162
2163   ### *PROPS will be set to NULL in the following situations:
2164   ### ... tbd
2165
2166   PROPS maps "const char *" names to "const svn_string_t *" values.
2167   If the node has no properties, set *PROPS to an empty hash.
2168   If the node is not present, return an error.
2169   Allocate *PROPS and its keys and values in RESULT_POOL.
2170*/
2171svn_error_t *
2172svn_wc__db_read_props(apr_hash_t **props,
2173                      svn_wc__db_t *db,
2174                      const char *local_abspath,
2175                      apr_pool_t *result_pool,
2176                      apr_pool_t *scratch_pool);
2177
2178/* Call RECEIVER_FUNC, passing RECEIVER_BATON, an absolute path, and
2179 * a hash table mapping <tt>char *</tt> names onto svn_string_t *
2180 * values for any properties of child nodes of LOCAL_ABSPATH (up to DEPTH).
2181 *
2182 * If PRISTINE is FALSE, read the properties from the WORKING layer (highest
2183 * op_depth); if PRISTINE is FALSE, local modifications will be visible.
2184 */
2185svn_error_t *
2186svn_wc__db_read_props_streamily(svn_wc__db_t *db,
2187                                const char *local_abspath,
2188                                svn_depth_t depth,
2189                                svn_boolean_t pristine,
2190                                const apr_array_header_t *changelists,
2191                                svn_wc__proplist_receiver_t receiver_func,
2192                                void *receiver_baton,
2193                                svn_cancel_func_t cancel_func,
2194                                void *cancel_baton,
2195                                apr_pool_t *scratch_pool);
2196
2197
2198/* Set *PROPS to the base properties of the node at LOCAL_ABSPATH.
2199
2200   *PROPS maps "const char *" names to "const svn_string_t *" values.
2201   If the node has no properties, set *PROPS to an empty hash.
2202   If the base node is in a state that cannot have properties (such as
2203   not-present or locally added without copy-from), return an error.
2204
2205   Allocate *PROPS and its keys and values in RESULT_POOL.
2206
2207   See also svn_wc_get_pristine_props().
2208*/
2209svn_error_t *
2210svn_wc__db_read_pristine_props(apr_hash_t **props,
2211                               svn_wc__db_t *db,
2212                               const char *local_abspath,
2213                               apr_pool_t *result_pool,
2214                               apr_pool_t *scratch_pool);
2215
2216
2217/**
2218 * Set @a *iprops to a depth-first ordered array of
2219 * #svn_prop_inherited_item_t * structures representing the properties
2220 * inherited by @a local_abspath from the ACTUAL tree above
2221 * @a local_abspath (looking through to the WORKING or BASE tree as
2222 * required), up to and including the root of the working copy and
2223 * any cached inherited properties inherited by the root.
2224 *
2225 * The #svn_prop_inherited_item_t->path_or_url members of the
2226 * #svn_prop_inherited_item_t * structures in @a *iprops are
2227 * paths relative to the repository root URL for cached inherited
2228 * properties and absolute working copy paths otherwise.
2229 *
2230 * If ACTUAL_PROPS is not NULL, then set *ACTUAL_PROPS to ALL the actual
2231 * properties stored on LOCAL_ABSPATH.
2232 *
2233 * Allocate @a *iprops in @a result_pool.  Use @a scratch_pool
2234 * for temporary allocations.
2235 */
2236svn_error_t *
2237svn_wc__db_read_inherited_props(apr_array_header_t **iprops,
2238                                apr_hash_t **actual_props,
2239                                svn_wc__db_t *db,
2240                                const char *local_abspath,
2241                                const char *propname,
2242                                apr_pool_t *result_pool,
2243                                apr_pool_t *scratch_pool);
2244
2245/* Read a BASE node's inherited property information.
2246
2247   Set *IPROPS to to a depth-first ordered array of
2248   svn_prop_inherited_item_t * structures representing the cached
2249   inherited properties for the BASE node at LOCAL_ABSPATH.
2250
2251   If no cached properties are found, then set *IPROPS to NULL.
2252   If LOCAL_ABSPATH represents the root of the repository, then set
2253   *IPROPS to an empty array.
2254
2255   Allocate *IPROPS in RESULT_POOL, use SCRATCH_POOL for temporary
2256   allocations. */
2257svn_error_t *
2258svn_wc__db_read_cached_iprops(apr_array_header_t **iprops,
2259                              svn_wc__db_t *db,
2260                              const char *local_abspath,
2261                              apr_pool_t *result_pool,
2262                              apr_pool_t *scratch_pool);
2263
2264/* Find BASE nodes with cached inherited properties.
2265
2266   Set *IPROPS_PATHS to a hash mapping const char * absolute working copy
2267   paths to the repos_relpath of the path for each path in the working copy
2268   at or below LOCAL_ABSPATH, limited by DEPTH, that has cached inherited
2269   properties for the BASE node of the path.
2270
2271   Allocate *IPROP_PATHS in RESULT_POOL.
2272   Use SCRATCH_POOL for temporary allocations. */
2273svn_error_t *
2274svn_wc__db_get_children_with_cached_iprops(apr_hash_t **iprop_paths,
2275                                           svn_depth_t depth,
2276                                           const char *local_abspath,
2277                                           svn_wc__db_t *db,
2278                                           apr_pool_t *result_pool,
2279                                           apr_pool_t *scratch_pool);
2280
2281/** Obtain a mapping of const char * local_abspaths to const svn_string_t*
2282 * property values in *VALUES, of all PROPNAME properties on LOCAL_ABSPATH
2283 * and its descendants.
2284 *
2285 * Allocate the result in RESULT_POOL, and perform temporary allocations in
2286 * SCRATCH_POOL.
2287 */
2288svn_error_t *
2289svn_wc__db_prop_retrieve_recursive(apr_hash_t **values,
2290                                   svn_wc__db_t *db,
2291                                   const char *local_abspath,
2292                                   const char *propname,
2293                                   apr_pool_t *result_pool,
2294                                   apr_pool_t *scratch_pool);
2295
2296/* Set *CHILDREN to a new array of the (const char *) basenames of the
2297   immediate children of the working node at LOCAL_ABSPATH in DB.
2298
2299   Return every path that refers to a child of the working node at
2300   LOCAL_ABSPATH.  Do not include a path just because it was a child of a
2301   deleted directory that existed at LOCAL_ABSPATH if that directory is now
2302   scheduled to be replaced by the working node at LOCAL_ABSPATH.
2303
2304   Allocate *CHILDREN in RESULT_POOL and do temporary allocations in
2305   SCRATCH_POOL.
2306
2307   ### return some basic info for each child? e.g. kind.
2308   ### maybe the data in _read_get_info should be a structure, and this
2309   ### can return a struct for each one.
2310   ### however: _read_get_info can say "not interested", which isn't the
2311   ###   case with a struct. thus, a struct requires fetching and/or
2312   ###   computing all info.
2313*/
2314svn_error_t *
2315svn_wc__db_read_children_of_working_node(const apr_array_header_t **children,
2316                                         svn_wc__db_t *db,
2317                                         const char *local_abspath,
2318                                         apr_pool_t *result_pool,
2319                                         apr_pool_t *scratch_pool);
2320
2321svn_error_t *
2322svn_wc__db_base_read_not_present_children(
2323                                const apr_array_header_t **children,
2324                                svn_wc__db_t *db,
2325                                const char *local_abspath,
2326                                apr_pool_t *result_pool,
2327                                apr_pool_t *scratch_pool);
2328
2329/* Like svn_wc__db_read_children_of_working_node(), except also include any
2330   path that was a child of a deleted directory that existed at
2331   LOCAL_ABSPATH, even if that directory is now scheduled to be replaced by
2332   the working node at LOCAL_ABSPATH.
2333*/
2334svn_error_t *
2335svn_wc__db_read_children(const apr_array_header_t **children,
2336                         svn_wc__db_t *db,
2337                         const char *local_abspath,
2338                         apr_pool_t *result_pool,
2339                         apr_pool_t *scratch_pool);
2340
2341/* Read into *VICTIMS the basenames of the immediate children of
2342   LOCAL_ABSPATH in DB that are conflicted.
2343
2344   In case of tree conflicts a victim doesn't have to be in the
2345   working copy.
2346
2347   Allocate *VICTIMS in RESULT_POOL and do temporary allocations in
2348   SCRATCH_POOL */
2349/* ### This function will probably be removed. */
2350svn_error_t *
2351svn_wc__db_read_conflict_victims(const apr_array_header_t **victims,
2352                                 svn_wc__db_t *db,
2353                                 const char *local_abspath,
2354                                 apr_pool_t *result_pool,
2355                                 apr_pool_t *scratch_pool);
2356
2357/* Read into *MARKER_FILES the absolute paths of the marker files
2358   of conflicts stored on LOCAL_ABSPATH and its immediate children in DB.
2359   The on-disk files may have been deleted by the user.
2360
2361   Allocate *MARKER_FILES in RESULT_POOL and do temporary allocations
2362   in SCRATCH_POOL */
2363svn_error_t *
2364svn_wc__db_get_conflict_marker_files(apr_hash_t **markers,
2365                                     svn_wc__db_t *db,
2366                                     const char *local_abspath,
2367                                     apr_pool_t *result_pool,
2368                                     apr_pool_t *scratch_pool);
2369
2370/* Read the conflict information recorded on LOCAL_ABSPATH in *CONFLICT,
2371   an editable conflict skel. If kind is not NULL, also read the node kind
2372   in *KIND. (SHOW_HIDDEN: false, SHOW_DELETED: true). If props is not NULL
2373   read the actual properties in this value if they exist. (Set to NULL in case
2374   the node is deleted, etc.)
2375
2376   If the node exists, but does not have a conflict set *CONFLICT to NULL,
2377   otherwise return a SVN_ERR_WC_PATH_NOT_FOUND error.
2378
2379   Allocate *CONFLICTS in RESULT_POOL and do temporary allocations in
2380   SCRATCH_POOL */
2381svn_error_t *
2382svn_wc__db_read_conflict(svn_skel_t **conflict,
2383                         svn_node_kind_t *kind,
2384                         apr_hash_t **props,
2385                         svn_wc__db_t *db,
2386                         const char *local_abspath,
2387                         apr_pool_t *result_pool,
2388                         apr_pool_t *scratch_pool);
2389
2390
2391/* Return the kind of the node in DB at LOCAL_ABSPATH. The WORKING tree will
2392   be examined first, then the BASE tree. If the node is not present in either
2393   tree and ALLOW_MISSING is TRUE, then svn_node_unknown is returned.
2394   If the node is missing and ALLOW_MISSING is FALSE, then it will return
2395   SVN_ERR_WC_PATH_NOT_FOUND.
2396
2397   The SHOW_HIDDEN and SHOW_DELETED flags report certain states as kind none.
2398
2399   When nodes have certain statee they are only reported when:
2400      svn_wc__db_status_not_present         when show_hidden && show_deleted
2401
2402      svn_wc__db_status_excluded            when show_hidden
2403      svn_wc__db_status_server_excluded     when show_hidden
2404
2405      svn_wc__db_status_deleted             when show_deleted
2406
2407   In other cases these nodes are reported with *KIND as svn_node_none.
2408   (See also svn_wc_read_kind2()'s documentation)
2409
2410   Uses SCRATCH_POOL for temporary allocations.  */
2411svn_error_t *
2412svn_wc__db_read_kind(svn_node_kind_t *kind,
2413                     svn_wc__db_t *db,
2414                     const char *local_abspath,
2415                     svn_boolean_t allow_missing,
2416                     svn_boolean_t show_deleted,
2417                     svn_boolean_t show_hidden,
2418                     apr_pool_t *scratch_pool);
2419
2420/* Checks if a node replaces a node in a different layer. Also check if it
2421   replaces a BASE (op_depth 0) node or just a node in a higher layer (a copy).
2422   Finally check if this is the root of the replacement, or if the replacement
2423   is initiated by the parent node.
2424
2425   IS_REPLACE_ROOT (if not NULL) is set to TRUE if the node is the root of a
2426   replacement; otherwise to FALSE.
2427
2428   BASE_REPLACE (if not NULL) is set to TRUE if the node directly or indirectly
2429   replaces a node in the BASE tree; otherwise to FALSE.
2430
2431   IS_REPLACE (if not NULL) is set to TRUE if the node directly replaces a node
2432   in a lower layer; otherwise to FALSE.
2433 */
2434svn_error_t *
2435svn_wc__db_node_check_replace(svn_boolean_t *is_replace_root,
2436                              svn_boolean_t *base_replace,
2437                              svn_boolean_t *is_replace,
2438                              svn_wc__db_t *db,
2439                              const char *local_abspath,
2440                              apr_pool_t *scratch_pool);
2441
2442/* ### changelists. return an array, or an iterator interface? how big
2443   ### are these things? are we okay with an in-memory array? examine other
2444   ### changelist usage -- we may already assume the list fits in memory.
2445*/
2446
2447/* The DB-private version of svn_wc__is_wcroot(), which see.
2448 */
2449svn_error_t *
2450svn_wc__db_is_wcroot(svn_boolean_t *is_wcroot,
2451                     svn_wc__db_t *db,
2452                     const char *local_abspath,
2453                     apr_pool_t *scratch_pool);
2454
2455/* Check whether a node is a working copy root and/or switched.
2456
2457   If LOCAL_ABSPATH is the root of a working copy, set *IS_WC_ROOT to TRUE,
2458   otherwise to FALSE.
2459
2460   If LOCAL_ABSPATH is switched against its parent in the same working copy
2461   set *IS_SWITCHED to TRUE, otherwise to FALSE.
2462
2463   If KIND is not null, set *KIND to the node type of LOCAL_ABSPATH.
2464
2465   Any of the output arguments can be null to specify that the result is not
2466   interesting to the caller.
2467
2468   Use SCRATCH_POOL for temporary allocations.
2469 */
2470svn_error_t *
2471svn_wc__db_is_switched(svn_boolean_t *is_wcroot,
2472                       svn_boolean_t *is_switched,
2473                       svn_node_kind_t *kind,
2474                       svn_wc__db_t *db,
2475                       const char *local_abspath,
2476                       apr_pool_t *scratch_pool);
2477
2478
2479/* @} */
2480
2481
2482/* @defgroup svn_wc__db_global  Operations that alter multiple trees
2483   @{
2484*/
2485
2486/* Associate LOCAL_DIR_ABSPATH, and all its children with the repository at
2487   at REPOS_ROOT_URL.  The relative path to the repos root will not change,
2488   just the repository root.  The repos uuid will also remain the same.
2489   This also updates any locks which may exist for the node, as well as any
2490   copyfrom repository information.  Finally, the DAV cache (aka
2491   "wcprops") will be reset for affected entries.
2492
2493   Use SCRATCH_POOL for any temporary allocations.
2494
2495   ### local_dir_abspath "should be" the wcroot or a switch root. all URLs
2496   ### under this directory (depth=infinity) will be rewritten.
2497
2498   ### This API had a depth parameter, which was removed, should it be
2499   ### resurrected?  What's the purpose if we claim relocate is infinitely
2500   ### recursive?
2501
2502   ### Assuming the future ability to copy across repositories, should we
2503   ### refrain from resetting the copyfrom information in this operation?
2504*/
2505svn_error_t *
2506svn_wc__db_global_relocate(svn_wc__db_t *db,
2507                           const char *local_dir_abspath,
2508                           const char *repos_root_url,
2509                           apr_pool_t *scratch_pool);
2510
2511
2512/* ### docco
2513
2514   ### collapse the WORKING and ACTUAL tree changes down into BASE, called
2515       for each committed node.
2516
2517   NEW_REVISION must be the revision number of the revision created by
2518   the commit. It will become the BASE node's 'revnum' and 'changed_rev'
2519   values in the BASE_NODE table.
2520
2521   CHANGED_REVISION is the new 'last changed' revision. If the node is
2522   modified its value is equivalent to NEW_REVISION, but in case of a
2523   descendant of a copy/move it can be an older revision.
2524
2525   CHANGED_DATE is the (server-side) date of CHANGED_REVISION. It may be 0 if
2526   the revprop is missing on the revision.
2527
2528   CHANGED_AUTHOR is the (server-side) author of CHANGED_REVISION. It may be
2529   NULL if the revprop is missing on the revision.
2530
2531   WORK_ITEMS will be place into the work queue.
2532*/
2533svn_error_t *
2534svn_wc__db_global_commit(svn_wc__db_t *db,
2535                         const char *local_abspath,
2536                         svn_revnum_t new_revision,
2537                         svn_revnum_t changed_revision,
2538                         apr_time_t changed_date,
2539                         const char *changed_author,
2540                         const svn_checksum_t *new_checksum,
2541                         apr_hash_t *new_dav_cache,
2542                         svn_boolean_t keep_changelist,
2543                         svn_boolean_t no_unlock,
2544                         const svn_skel_t *work_items,
2545                         apr_pool_t *scratch_pool);
2546
2547
2548/* ### docco
2549
2550   Perform an "update" operation at this node. It will create/modify a BASE
2551   node, and possibly update the ACTUAL tree's node (e.g put the node into
2552   a conflicted state).
2553
2554   ### there may be cases where we need to tweak an existing WORKING node
2555
2556   ### this operations on a single node, but may affect children
2557
2558   ### the repository cannot be changed with this function, but a "switch"
2559   ### (aka changing repos_relpath) is possible
2560
2561   ### one of NEW_CHILDREN, NEW_CHECKSUM, or NEW_TARGET must be provided.
2562   ### the other two values must be NULL.
2563   ### should this be broken out into an update_(directory|file|symlink) ?
2564
2565   ### how does this differ from base_add_*? just the CONFLICT param.
2566   ### the WORK_ITEMS param is new here, but the base_add_* functions
2567   ### should probably grow that. should we instead just (re)use base_add
2568   ### rather than grow a new function?
2569
2570   ### this does not allow a change of depth
2571
2572   ### we do not update a file's TRANSLATED_SIZE here. at some future point,
2573   ### when the file is installed, then a TRANSLATED_SIZE will be set.
2574*/
2575svn_error_t *
2576svn_wc__db_global_update(svn_wc__db_t *db,
2577                         const char *local_abspath,
2578                         svn_node_kind_t new_kind,
2579                         const char *new_repos_relpath,
2580                         svn_revnum_t new_revision,
2581                         const apr_hash_t *new_props,
2582                         svn_revnum_t new_changed_rev,
2583                         apr_time_t new_changed_date,
2584                         const char *new_changed_author,
2585                         const apr_array_header_t *new_children,
2586                         const svn_checksum_t *new_checksum,
2587                         const char *new_target,
2588                         const apr_hash_t *new_dav_cache,
2589                         const svn_skel_t *conflict,
2590                         const svn_skel_t *work_items,
2591                         apr_pool_t *scratch_pool);
2592
2593
2594/* Modify the entry of working copy LOCAL_ABSPATH, presumably after an update
2595   of depth DEPTH completes.  If LOCAL_ABSPATH doesn't exist, this routine
2596   does nothing.
2597
2598   Set the node's repository relpath, repository root, repository uuid and
2599   revision to NEW_REPOS_RELPATH, NEW_REPOS_ROOT and NEW_REPOS_UUID.  If
2600   NEW_REPOS_RELPATH is null, the repository location is untouched; if
2601   NEW_REVISION in invalid, the working revision field is untouched.
2602   The modifications are mutually exclusive.  If NEW_REPOS_ROOT is non-NULL,
2603   set the repository root of the entry to NEW_REPOS_ROOT.
2604
2605   If LOCAL_ABSPATH is a directory, then, walk entries below LOCAL_ABSPATH
2606   according to DEPTH thusly:
2607
2608   If DEPTH is svn_depth_infinity, perform the following actions on
2609   every entry below PATH; if svn_depth_immediates, svn_depth_files,
2610   or svn_depth_empty, perform them only on LOCAL_ABSPATH.
2611
2612   If NEW_REVISION is valid, then tweak every entry to have this new
2613   working revision (excluding files that are scheduled for addition
2614   or replacement).  Likewise, if BASE_URL is non-null, then rewrite
2615   all urls to be "telescoping" children of the base_url.
2616
2617   EXCLUDE_RELPATHS is a hash containing const char *local_relpath.  Nodes
2618   for pathnames contained in EXCLUDE_RELPATHS are not touched by this
2619   function.  These pathnames should be paths relative to the wcroot.
2620
2621   If EMPTY_UPDATE is TRUE then no nodes at or below LOCAL_ABSPATH have been
2622   affected by the update/switch yet.
2623
2624   If WCROOT_IPROPS is not NULL it is a hash mapping const char * absolute
2625   working copy paths to depth-first ordered arrays of
2626   svn_prop_inherited_item_t * structures.  If LOCAL_ABSPATH exists in
2627   WCROOT_IPROPS, then set the hashed value as the node's inherited
2628   properties.
2629*/
2630svn_error_t *
2631svn_wc__db_op_bump_revisions_post_update(svn_wc__db_t *db,
2632                                         const char *local_abspath,
2633                                         svn_depth_t depth,
2634                                         const char *new_repos_relpath,
2635                                         const char *new_repos_root_url,
2636                                         const char *new_repos_uuid,
2637                                         svn_revnum_t new_revision,
2638                                         apr_hash_t *exclude_relpaths,
2639                                         apr_hash_t *wcroot_iprops,
2640                                         svn_boolean_t empty_update,
2641                                         svn_wc_notify_func2_t notify_func,
2642                                         void *notify_baton,
2643                                         apr_pool_t *scratch_pool);
2644
2645
2646/* Record the RECORDED_SIZE and RECORDED_TIME for a versioned node.
2647
2648   This function will record the information within the WORKING node,
2649   if present, or within the BASE tree. If neither node is present, then
2650   SVN_ERR_WC_PATH_NOT_FOUND will be returned.
2651
2652   RECORDED_SIZE may be SVN_INVALID_FILESIZE, which will be recorded
2653   as such, implying "unknown size".
2654
2655   RECORDED_TIME may be 0, which will be recorded as such, implying
2656   "unknown last mod time".
2657*/
2658svn_error_t *
2659svn_wc__db_global_record_fileinfo(svn_wc__db_t *db,
2660                                  const char *local_abspath,
2661                                  svn_filesize_t recorded_size,
2662                                  apr_time_t recorded_time,
2663                                  apr_pool_t *scratch_pool);
2664
2665
2666/* ### post-commit handling.
2667   ### maybe multiple phases?
2668   ### 1) mark a changelist as being-committed
2669   ### 2) collect ACTUAL content, store for future use as TEXTBASE
2670   ### 3) caller performs commit
2671   ### 4) post-commit, integrate changelist into BASE
2672*/
2673
2674
2675/* @} */
2676
2677
2678/* @defgroup svn_wc__db_lock  Function to manage the LOCKS table.
2679   @{
2680*/
2681
2682/* Add or replace LOCK for LOCAL_ABSPATH to DB.  */
2683svn_error_t *
2684svn_wc__db_lock_add(svn_wc__db_t *db,
2685                    const char *local_abspath,
2686                    const svn_wc__db_lock_t *lock,
2687                    apr_pool_t *scratch_pool);
2688
2689
2690/* Remove any lock for LOCAL_ABSPATH in DB and install WORK_ITEMS
2691   (if not NULL) in DB */
2692svn_error_t *
2693svn_wc__db_lock_remove(svn_wc__db_t *db,
2694                       const char *local_abspath,
2695                       svn_skel_t *work_items,
2696                       apr_pool_t *scratch_pool);
2697
2698
2699/* @} */
2700
2701
2702/* @defgroup svn_wc__db_scan  Functions to scan up a tree for further data.
2703   @{
2704*/
2705
2706/* Scan upwards for information about a known addition to the WORKING tree.
2707
2708   IFF a node's status as returned by svn_wc__db_read_info() is
2709   svn_wc__db_status_added (NOT obstructed_add!), then this function
2710   returns a refined status in *STATUS, which is one of:
2711
2712     svn_wc__db_status_added -- this NODE is a simple add without history.
2713       OP_ROOT_ABSPATH will be set to the topmost node in the added subtree
2714       (implying its parent will be an unshadowed BASE node). The REPOS_*
2715       values will be implied by that ancestor BASE node and this node's
2716       position in the added subtree. ORIGINAL_* will be set to their
2717       NULL values (and SVN_INVALID_REVNUM for ORIGINAL_REVISION).
2718
2719     svn_wc__db_status_copied -- this NODE is the root or child of a copy.
2720       The root of the copy will be stored in OP_ROOT_ABSPATH. Note that
2721       the parent of the operation root could be another WORKING node (from
2722       an add, copy, or move). The REPOS_* values will be implied by the
2723       ancestor unshadowed BASE node. ORIGINAL_* will indicate the source
2724       of the copy.
2725
2726     svn_wc__db_status_incomplete -- this NODE is copied but incomplete.
2727
2728     svn_wc__db_status_moved_here -- this NODE arrived as a result of a move.
2729       The root of the moved nodes will be stored in OP_ROOT_ABSPATH.
2730       Similar to the copied state, its parent may be a WORKING node or a
2731       BASE node. And again, the REPOS_* values are implied by this node's
2732       position in the subtree under the ancestor unshadowed BASE node.
2733       ORIGINAL_* will indicate the source of the move.
2734
2735   All OUT parameters may be NULL to indicate a lack of interest in
2736   that piece of information.
2737
2738   STATUS, OP_ROOT_ABSPATH, and REPOS_* will always be assigned a value
2739   if that information is requested (and assuming a successful return).
2740
2741   ORIGINAL_REPOS_RELPATH will refer to the *root* of the operation. It
2742   does *not* correspond to the node given by LOCAL_ABSPATH. The caller
2743   can use the suffix on LOCAL_ABSPATH (relative to OP_ROOT_ABSPATH) in
2744   order to compute the source node which corresponds to LOCAL_ABSPATH.
2745
2746   If the node given by LOCAL_ABSPATH does not have changes recorded in
2747   the WORKING tree, then SVN_ERR_WC_PATH_NOT_FOUND is returned. If it
2748   doesn't have an "added" status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS
2749   will be returned.
2750
2751   All returned data will be allocated in RESULT_POOL. All temporary
2752   allocations will be made in SCRATCH_POOL.
2753*/
2754svn_error_t *
2755svn_wc__db_scan_addition(svn_wc__db_status_t *status,
2756                         const char **op_root_abspath,
2757                         const char **repos_relpath,
2758                         const char **repos_root_url,
2759                         const char **repos_uuid,
2760                         const char **original_repos_relpath,
2761                         const char **original_root_url,
2762                         const char **original_uuid,
2763                         svn_revnum_t *original_revision,
2764                         svn_wc__db_t *db,
2765                         const char *local_abspath,
2766                         apr_pool_t *result_pool,
2767                         apr_pool_t *scratch_pool);
2768
2769/* Scan the working copy for move information of the node LOCAL_ABSPATH.
2770 * If LOCAL_ABSPATH is not moved here return an
2771 * SVN_ERR_WC_PATH_UNEXPECTED_STATUS error.
2772 *
2773 * If not NULL *MOVED_FROM_ABSPATH will be set to the previous location
2774 * of LOCAL_ABSPATH, before it or an ancestror was moved.
2775 *
2776 * If not NULL *OP_ROOT_ABSPATH will be set to the new location of the
2777 * path that was actually moved
2778 *
2779 * If not NULL *OP_ROOT_MOVED_FROM_ABSPATH will be set to the old location
2780 * of the path that was actually moved.
2781 *
2782 * If not NULL *MOVED_FROM_DELETE_ABSPATH will be set to the ancestor of the
2783 * moved from location that deletes the original location
2784 *
2785 * Given a working copy
2786 * A/B/C
2787 * svn mv A/B D
2788 * svn rm A
2789 *
2790 * You can call this function on D and D/C. When called on D/C all output
2791 *              MOVED_FROM_ABSPATH will be A/B/C
2792 *              OP_ROOT_ABSPATH will be D
2793 *              OP_ROOT_MOVED_FROM_ABSPATH will be A/B
2794 *              MOVED_FROM_DELETE_ABSPATH will be A
2795 */
2796svn_error_t *
2797svn_wc__db_scan_moved(const char **moved_from_abspath,
2798                      const char **op_root_abspath,
2799                      const char **op_root_moved_from_abspath,
2800                      const char **moved_from_delete_abspath,
2801                      svn_wc__db_t *db,
2802                      const char *local_abspath,
2803                      apr_pool_t *result_pool,
2804                      apr_pool_t *scratch_pool);
2805
2806/* Scan upwards for additional information about a deleted node.
2807
2808   When a deleted node is discovered in the WORKING tree, the situation
2809   may be quite complex. This function will provide the information to
2810   resolve the circumstances of the deletion.
2811
2812   For discussion purposes, we will start with the most complex example
2813   and then demonstrate simplified examples. Consider node B/W/D/N has been
2814   found as deleted. B is an unmodified directory (thus, only in BASE). W is
2815   "replacement" content that exists in WORKING, shadowing a similar B/W
2816   directory in BASE. D is a deleted subtree in the WORKING tree, and N is
2817   the deleted node.
2818
2819   In this example, BASE_DEL_ABSPATH will bet set to B/W. That is the root of
2820   the BASE tree (implicitly) deleted by the replacement. WORK_DEL_ABSPATH
2821   will be set to the subtree deleted within the replacement; in this case,
2822   B/W/D. No move-away took place, so MOVED_TO_ABSPATH is set to NULL.
2823
2824   In another scenario, B/W was moved-away before W was put into the WORKING
2825   tree through an add/copy/move-here. MOVED_TO_ABSPATH will indicate where
2826   B/W was moved to. Note that further operations may have been performed
2827   post-move, but that is not known or reported by this function.
2828
2829   If BASE does not have a B/W, then the WORKING B/W is not a replacement,
2830   but a simple add/copy/move-here. BASE_DEL_ABSPATH will be set to NULL.
2831
2832   If B/W/D does not exist in the WORKING tree (we're only talking about a
2833   deletion of nodes of the BASE tree), then deleting B/W/D would have marked
2834   the subtree for deletion. BASE_DEL_ABSPATH will refer to B/W/D,
2835   MOVED_TO_ABSPATH will be NULL, and WORK_DEL_ABSPATH will be NULL.
2836
2837   If the BASE node B/W/D was moved instead of deleted, then MOVED_TO_ABSPATH
2838   would indicate the target location (and other OUT values as above).
2839
2840   When the user deletes B/W/D from the WORKING tree, there are a few
2841   additional considerations. If B/W is a simple addition (not a copy or
2842   a move-here), then the deletion will simply remove the nodes from WORKING
2843   and possibly leave behind "base-delete" markers in the WORKING tree.
2844   If the source is a copy/moved-here, then the nodes are replaced with
2845   deletion markers.
2846
2847   If the user moves-away B/W/D from the WORKING tree, then behavior is
2848   again dependent upon the origination of B/W. For a plain add, the nodes
2849   simply move to the destination; this means that B/W/D ceases to be a
2850   node and so cannot be scanned. For a copy, a deletion is made at B/W/D,
2851   and a new copy (of a subtree of the original source) is made at the
2852   destination. For a move-here, a deletion is made, and a copy is made at
2853   the destination (we do not track multiple moves; the source is moved to
2854   B/W, then B/W/D is deleted; then a copy is made at the destination;
2855   however, note the double-move could have been performed by moving the
2856   subtree first, then moving the source to B/W).
2857
2858   There are three further considerations when resolving a deleted node:
2859
2860     If the BASE B/W/D was deleted explicitly *and* B/W is a replacement,
2861     then the explicit deletion is subsumed by the implicit deletion that
2862     occurred with the B/W replacement. Thus, BASE_DEL_ABSPATH will point
2863     to B/W as the root of the BASE deletion. IOW, we can detect the
2864     explicit move-away, but not an explicit deletion.
2865
2866     If B/W/D/N refers to a node present in the BASE tree, and B/W was
2867     replaced by a shallow subtree, then it is possible for N to be
2868     reported as deleted (from BASE) yet no deletions occurred in the
2869     WORKING tree above N. Thus, WORK_DEL_ABSPATH will be set to NULL.
2870
2871
2872   Summary of OUT parameters:
2873
2874   BASE_DEL_ABSPATH will specify the nearest ancestor of the explicit or
2875   implicit deletion (if any) that applies to the BASE tree.
2876
2877   WORK_DEL_ABSPATH will specify the root of a deleted subtree within
2878   the WORKING tree (note there is no concept of layered delete operations
2879   in WORKING, so there is only one deletion root in the ancestry).
2880
2881   MOVED_TO_ABSPATH will specify the path where this node was moved to
2882   if the node has moved-away.
2883
2884   If the node was moved-away, MOVED_TO_OP_ROOT_ABSPATH will specify the
2885   target path of the root of the move operation.  If LOCAL_ABSPATH itself
2886   is the source path of the root of the move operation, then
2887   MOVED_TO_OP_ROOT_ABSPATH equals MOVED_TO_ABSPATH.
2888
2889   All OUT parameters may be set to NULL to indicate a lack of interest in
2890   that piece of information.
2891
2892   If the node given by LOCAL_ABSPATH does not exist, then
2893   SVN_ERR_WC_PATH_NOT_FOUND is returned. If it doesn't have a "deleted"
2894   status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS will be returned.
2895
2896   All returned data will be allocated in RESULT_POOL. All temporary
2897   allocations will be made in SCRATCH_POOL.
2898*/
2899svn_error_t *
2900svn_wc__db_scan_deletion(const char **base_del_abspath,
2901                         const char **moved_to_abspath,
2902                         const char **work_del_abspath,
2903                         const char **moved_to_op_root_abspath,
2904                         svn_wc__db_t *db,
2905                         const char *local_abspath,
2906                         apr_pool_t *result_pool,
2907                         apr_pool_t *scratch_pool);
2908
2909
2910/* @} */
2911
2912
2913/* @defgroup svn_wc__db_upgrade  Functions for upgrading a working copy.
2914   @{
2915*/
2916
2917/* Installs or updates Sqlite schema statistics for the current (aka latest)
2918   working copy schema.
2919
2920   This function should be called once on initializing the database and after
2921   an schema update completes */
2922svn_error_t *
2923svn_wc__db_install_schema_statistics(svn_sqlite__db_t *sdb,
2924                                     apr_pool_t *scratch_pool);
2925
2926
2927/* Create a new wc.db file for LOCAL_DIR_ABSPATH, which is going to be a
2928   working copy for the repository REPOS_ROOT_URL with uuid REPOS_UUID.
2929   Return the raw sqlite handle, repository id and working copy id
2930   and store the database in WC_DB.
2931
2932   Perform temporary allocations in SCRATCH_POOL. */
2933svn_error_t *
2934svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb,
2935                         apr_int64_t *repos_id,
2936                         apr_int64_t *wc_id,
2937                         svn_wc__db_t *wc_db,
2938                         const char *local_dir_abspath,
2939                         const char *repos_root_url,
2940                         const char *repos_uuid,
2941                         apr_pool_t *scratch_pool);
2942
2943/* Simply insert (or replace) one row in the EXTERNALS table. */
2944svn_error_t *
2945svn_wc__db_upgrade_insert_external(svn_wc__db_t *db,
2946                                   const char *local_abspath,
2947                                   svn_node_kind_t kind,
2948                                   const char *parent_abspath,
2949                                   const char *def_local_abspath,
2950                                   const char *repos_relpath,
2951                                   const char *repos_root_url,
2952                                   const char *repos_uuid,
2953                                   svn_revnum_t def_peg_revision,
2954                                   svn_revnum_t def_revision,
2955                                   apr_pool_t *scratch_pool);
2956
2957/* Upgrade the metadata concerning the WC at WCROOT_ABSPATH, in DB,
2958 * to the SVN_WC__VERSION format.
2959 *
2960 * This function is used for upgrading wc-ng working copies to a newer
2961 * wc-ng format. If a pre-1.7 working copy is found, this function
2962 * returns SVN_ERR_WC_UPGRADE_REQUIRED.
2963 *
2964 * Upgrading subdirectories of a working copy is not supported.
2965 * If WCROOT_ABSPATH is not a working copy root SVN_ERR_WC_INVALID_OP_ON_CWD
2966 * is returned.
2967 *
2968 * If BUMPED_FORMAT is not NULL, set *BUMPED_FORMAT to TRUE if the format
2969 * was bumped or to FALSE if the wc was already at the resulting format.
2970 */
2971svn_error_t *
2972svn_wc__db_bump_format(int *result_format,
2973                       svn_boolean_t *bumped_format,
2974                       svn_wc__db_t *db,
2975                       const char *wcroot_abspath,
2976                       apr_pool_t *scratch_pool);
2977
2978/* @} */
2979
2980
2981/* @defgroup svn_wc__db_wq  Work queue manipulation. see workqueue.h
2982   @{
2983*/
2984
2985/* In the WCROOT associated with DB and WRI_ABSPATH, add WORK_ITEM to the
2986   wcroot's work queue. Use SCRATCH_POOL for all temporary allocations.  */
2987svn_error_t *
2988svn_wc__db_wq_add(svn_wc__db_t *db,
2989                  const char *wri_abspath,
2990                  const svn_skel_t *work_item,
2991                  apr_pool_t *scratch_pool);
2992
2993
2994/* In the WCROOT associated with DB and WRI_ABSPATH, fetch a work item that
2995   needs to be completed. Its identifier is returned in ID, and the data in
2996   WORK_ITEM.
2997
2998   Items are returned in the same order they were queued. This allows for
2999   (say) queueing work on a parent node to be handled before that of its
3000   children.
3001
3002   If there are no work items to be completed, then ID will be set to zero,
3003   and WORK_ITEM to NULL.
3004
3005   If COMPLETED_ID is not 0, the wq item COMPLETED_ID will be marked as
3006   completed before returning the next item.
3007
3008   RESULT_POOL will be used to allocate WORK_ITEM, and SCRATCH_POOL
3009   will be used for all temporary allocations.  */
3010svn_error_t *
3011svn_wc__db_wq_fetch_next(apr_uint64_t *id,
3012                         svn_skel_t **work_item,
3013                         svn_wc__db_t *db,
3014                         const char *wri_abspath,
3015                         apr_uint64_t completed_id,
3016                         apr_pool_t *result_pool,
3017                         apr_pool_t *scratch_pool);
3018
3019/* Special variant of svn_wc__db_wq_fetch_next(), which in the same transaction
3020   also records timestamps and sizes for one or more nodes */
3021svn_error_t *
3022svn_wc__db_wq_record_and_fetch_next(apr_uint64_t *id,
3023                                    svn_skel_t **work_item,
3024                                    svn_wc__db_t *db,
3025                                    const char *wri_abspath,
3026                                    apr_uint64_t completed_id,
3027                                    apr_hash_t *record_map,
3028                                    apr_pool_t *result_pool,
3029                                    apr_pool_t *scratch_pool);
3030
3031
3032/* @} */
3033
3034
3035/* Note: LEVELS_TO_LOCK is here strictly for backward compat.  The access
3036   batons still have the notion of 'levels to lock' and we need to ensure
3037   that they still function correctly, even in the new world.  'levels to
3038   lock' should not be exposed through the wc-ng APIs at all: users either
3039   get to lock the entire tree (rooted at some subdir, of course), or none.
3040
3041   An infinite depth lock is obtained with LEVELS_TO_LOCK set to -1, but until
3042   we move to a single DB only depth 0 is supported.
3043*/
3044svn_error_t *
3045svn_wc__db_wclock_obtain(svn_wc__db_t *db,
3046                         const char *local_abspath,
3047                         int levels_to_lock,
3048                         svn_boolean_t steal_lock,
3049                         apr_pool_t *scratch_pool);
3050
3051/* Set LOCK_ABSPATH to the path of the directory that owns the
3052   lock on LOCAL_ABSPATH, or NULL, if LOCAL_ABSPATH is not locked. */
3053svn_error_t*
3054svn_wc__db_wclock_find_root(const char **lock_abspath,
3055                            svn_wc__db_t *db,
3056                            const char *local_abspath,
3057                            apr_pool_t *result_pool,
3058                            apr_pool_t *scratch_pool);
3059
3060/* Check if somebody has a wclock on LOCAL_ABSPATH */
3061svn_error_t *
3062svn_wc__db_wclocked(svn_boolean_t *locked,
3063                    svn_wc__db_t *db,
3064                    const char *local_abspath,
3065                    apr_pool_t *scratch_pool);
3066
3067/* Release the previously obtained lock on LOCAL_ABSPATH */
3068svn_error_t *
3069svn_wc__db_wclock_release(svn_wc__db_t *db,
3070                          const char *local_abspath,
3071                          apr_pool_t *scratch_pool);
3072
3073/* Checks whether DB currently owns a lock to operate on LOCAL_ABSPATH.
3074   If EXACT is TRUE only lock roots are checked. */
3075svn_error_t *
3076svn_wc__db_wclock_owns_lock(svn_boolean_t *own_lock,
3077                            svn_wc__db_t *db,
3078                            const char *local_abspath,
3079                            svn_boolean_t exact,
3080                            apr_pool_t *scratch_pool);
3081
3082
3083
3084/* @defgroup svn_wc__db_temp Various temporary functions during transition
3085
3086  ### These functions SHOULD be completely removed before 1.7
3087
3088  @{
3089*/
3090
3091/* Removes all references to LOCAL_ABSPATH from DB, while optionally leaving
3092   a not present node.
3093
3094   This operation always recursively removes all nodes at and below
3095   LOCAL_ABSPATH from NODES and ACTUAL.
3096
3097   If DESTROY_WC is TRUE, this operation *installs* workqueue operations to
3098   update the local filesystem after the database operation. If DESTROY_CHANGES
3099   is FALSE, modified and unversioned files are left after running this
3100   operation (and the WQ). If DESTROY_CHANGES and DESTROY_WC are TRUE,
3101   LOCAL_ABSPATH and everything below it will be removed by the WQ.
3102
3103
3104   Note: Unlike many similar functions it is a valid scenario for this
3105   function to be called on a wcroot! In this case it will just leave the root
3106   record in BASE
3107 */
3108svn_error_t *
3109svn_wc__db_op_remove_node(svn_boolean_t *left_changes,
3110                          svn_wc__db_t *db,
3111                          const char *local_abspath,
3112                          svn_boolean_t destroy_wc,
3113                          svn_boolean_t destroy_changes,
3114                          const svn_skel_t *conflict,
3115                          const svn_skel_t *work_items,
3116                          svn_cancel_func_t cancel_func,
3117                          void *cancel_baton,
3118                          apr_pool_t *scratch_pool);
3119
3120/* Sets the depth of LOCAL_ABSPATH in its working copy to DEPTH using DB.
3121
3122   Returns SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not a BASE directory
3123 */
3124svn_error_t *
3125svn_wc__db_op_set_base_depth(svn_wc__db_t *db,
3126                             const char *local_abspath,
3127                             svn_depth_t depth,
3128                             apr_pool_t *scratch_pool);
3129
3130/* ### temp function. return the FORMAT for the directory LOCAL_ABSPATH.  */
3131svn_error_t *
3132svn_wc__db_temp_get_format(int *format,
3133                           svn_wc__db_t *db,
3134                           const char *local_dir_abspath,
3135                           apr_pool_t *scratch_pool);
3136
3137/* ### temp functions to manage/store access batons within the DB.  */
3138svn_wc_adm_access_t *
3139svn_wc__db_temp_get_access(svn_wc__db_t *db,
3140                           const char *local_dir_abspath,
3141                           apr_pool_t *scratch_pool);
3142void
3143svn_wc__db_temp_set_access(svn_wc__db_t *db,
3144                           const char *local_dir_abspath,
3145                           svn_wc_adm_access_t *adm_access,
3146                           apr_pool_t *scratch_pool);
3147svn_error_t *
3148svn_wc__db_temp_close_access(svn_wc__db_t *db,
3149                             const char *local_dir_abspath,
3150                             svn_wc_adm_access_t *adm_access,
3151                             apr_pool_t *scratch_pool);
3152void
3153svn_wc__db_temp_clear_access(svn_wc__db_t *db,
3154                             const char *local_dir_abspath,
3155                             apr_pool_t *scratch_pool);
3156
3157/* ### shallow hash: abspath -> svn_wc_adm_access_t *  */
3158apr_hash_t *
3159svn_wc__db_temp_get_all_access(svn_wc__db_t *db,
3160                               apr_pool_t *result_pool);
3161
3162/* ### temp function to open the sqlite database to the appropriate location,
3163   ### then borrow it for a bit.
3164   ### The *only* reason for this function is because entries.c still
3165   ### manually hacks the sqlite database.
3166
3167   ### No matter how tempted you may be DO NOT USE THIS FUNCTION!
3168   ### (if you do, gstein will hunt you down and burn your knee caps off
3169   ### in the middle of the night)
3170   ### "Bet on it." --gstein
3171*/
3172svn_error_t *
3173svn_wc__db_temp_borrow_sdb(svn_sqlite__db_t **sdb,
3174                           svn_wc__db_t *db,
3175                           const char *local_dir_abspath,
3176                           apr_pool_t *scratch_pool);
3177
3178
3179/* Return a directory in *TEMP_DIR_ABSPATH that is suitable for temporary
3180   files which may need to be moved (atomically and same-device) into the
3181   working copy indicated by WRI_ABSPATH.  */
3182svn_error_t *
3183svn_wc__db_temp_wcroot_tempdir(const char **temp_dir_abspath,
3184                               svn_wc__db_t *db,
3185                               const char *wri_abspath,
3186                               apr_pool_t *result_pool,
3187                               apr_pool_t *scratch_pool);
3188
3189/* Update the BASE_NODE of directory LOCAL_ABSPATH to be NEW_REPOS_RELPATH
3190   at revision NEW_REV with status incomplete. */
3191svn_error_t *
3192svn_wc__db_temp_op_start_directory_update(svn_wc__db_t *db,
3193                                          const char *local_abspath,
3194                                          const char *new_repos_relpath,
3195                                          svn_revnum_t new_rev,
3196                                          apr_pool_t *scratch_pool);
3197
3198/* Marks a directory update started with
3199   svn_wc__db_temp_op_start_directory_update as completed, by removing
3200   the incomplete status */
3201svn_error_t *
3202svn_wc__db_temp_op_end_directory_update(svn_wc__db_t *db,
3203                                        const char *local_dir_abspath,
3204                                        apr_pool_t *scratch_pool);
3205
3206
3207/* When local_abspath has no WORKING layer, copy the base tree at
3208   LOCAL_ABSPATH into the working tree as copy, leaving any subtree
3209   additions and copies as-is.  This may introduce multiple layers if
3210   the tree is mixed revision.
3211
3212   When local_abspath has a WORKING node, but is not an op-root, copy
3213   all descendants at the same op-depth to the op-depth of local_abspath,
3214   thereby turning this node in a copy of what was already there.
3215
3216   Fails with a SVN_ERR_WC_PATH_UNEXPECTED_STATUS error if LOCAL_RELPATH
3217   is already an op-root (as in that case it can't be copied as that
3218   would overwrite what is already there).
3219
3220   After this operation the copied layer (E.g. BASE) can be removed, without
3221   the WORKING nodes chaning. Typical usecase: tree conflict handling */
3222svn_error_t *
3223svn_wc__db_op_make_copy(svn_wc__db_t *db,
3224                        const char *local_abspath,
3225                        const svn_skel_t *conflicts,
3226                        const svn_skel_t *work_items,
3227                        apr_pool_t *scratch_pool);
3228
3229/* Close the wc root LOCAL_ABSPATH and remove any per-directory
3230   handles associated with it. */
3231svn_error_t *
3232svn_wc__db_drop_root(svn_wc__db_t *db,
3233                     const char *local_abspath,
3234                     apr_pool_t *scratch_pool);
3235
3236/* Return the OP_DEPTH for LOCAL_RELPATH. */
3237int
3238svn_wc__db_op_depth_for_upgrade(const char *local_relpath);
3239
3240/* Set *HAVE_WORK TRUE if there is a working layer below the top layer and
3241   *HAVE_BASE if there is a base layer. Set *STATUS to the status of the
3242   highest layer below WORKING */
3243svn_error_t *
3244svn_wc__db_info_below_working(svn_boolean_t *have_base,
3245                              svn_boolean_t *have_work,
3246                              svn_wc__db_status_t *status,
3247                              svn_wc__db_t *db,
3248                              const char *local_abspath,
3249                              apr_pool_t *scratch_pool);
3250
3251
3252/* Gets an array of const char *local_relpaths of descendants of LOCAL_ABSPATH,
3253 * which itself must be the op root of an addition, copy or move.
3254 * The descendants returned are at the same op_depth, but are to be deleted
3255 * by the commit processing because they are not present in the local copy.
3256 */
3257svn_error_t *
3258svn_wc__db_get_not_present_descendants(const apr_array_header_t **descendants,
3259                                       svn_wc__db_t *db,
3260                                       const char *local_abspath,
3261                                       apr_pool_t *result_pool,
3262                                       apr_pool_t *scratch_pool);
3263
3264/* Gather revision status information about a working copy using DB.
3265 *
3266 * Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision
3267 * numbers found within LOCAL_ABSPATH.
3268 * Only nodes with op_depth zero and presence 'normal' or 'incomplete'
3269 * are considered, so that added, deleted or excluded nodes do not affect
3270 * the result.  If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION
3271 * to the lowest and highest committed (i.e. "last changed") revision numbers,
3272 * respectively.
3273 *
3274 * Indicate in *IS_SPARSE_CHECKOUT whether any of the nodes within
3275 * LOCAL_ABSPATH is sparse.
3276 * Indicate in *IS_MODIFIED whether the working copy has local modifications
3277 * recorded for it in DB.
3278 *
3279 * Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH
3280 * is switched. If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH
3281 * itself is switched.  It should be any trailing portion of LOCAL_ABSPATH's
3282 * expected URL, long enough to include any parts that the caller considers
3283 * might be changed by a switch.  If it does not match the end of WC_PATH's
3284 * actual URL, then report a "switched" status.
3285 *
3286 * See also the functions below which provide a subset of this functionality.
3287 */
3288svn_error_t *
3289svn_wc__db_revision_status(svn_revnum_t *min_revision,
3290                           svn_revnum_t *max_revision,
3291                           svn_boolean_t *is_sparse_checkout,
3292                           svn_boolean_t *is_modified,
3293                           svn_boolean_t *is_switched,
3294                           svn_wc__db_t *db,
3295                           const char *local_abspath,
3296                           const char *trail_url,
3297                           svn_boolean_t committed,
3298                           apr_pool_t *scratch_pool);
3299
3300/* Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision
3301 * numbers found within LOCAL_ABSPATH in the working copy using DB.
3302 * Only nodes with op_depth zero and presence 'normal' or 'incomplete'
3303 * are considered, so that added, deleted or excluded nodes do not affect
3304 * the result.  If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION
3305 * to the lowest and highest committed (i.e. "last changed") revision numbers,
3306 * respectively. Use SCRATCH_POOL for temporary allocations.
3307 *
3308 * Either of MIN_REVISION and MAX_REVISION may be passed as NULL if
3309 * the caller doesn't care about that return value.
3310 *
3311 * This function provides a subset of the functionality of
3312 * svn_wc__db_revision_status() and is more efficient if the caller
3313 * doesn't need all information returned by svn_wc__db_revision_status(). */
3314svn_error_t *
3315svn_wc__db_min_max_revisions(svn_revnum_t *min_revision,
3316                             svn_revnum_t *max_revision,
3317                             svn_wc__db_t *db,
3318                             const char *local_abspath,
3319                             svn_boolean_t committed,
3320                             apr_pool_t *scratch_pool);
3321
3322/* Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH
3323 * is switched, using DB. Use SCRATCH_POOL for temporary allocations.
3324 *
3325 * If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH itself
3326 * is switched.  It should be any trailing portion of LOCAL_ABSPATH's
3327 * expected URL, long enough to include any parts that the caller considers
3328 * might be changed by a switch.  If it does not match the end of WC_PATH's
3329 * actual URL, then report a "switched" status.
3330 *
3331 * This function provides a subset of the functionality of
3332 * svn_wc__db_revision_status() and is more efficient if the caller
3333 * doesn't need all information returned by svn_wc__db_revision_status(). */
3334svn_error_t *
3335svn_wc__db_has_switched_subtrees(svn_boolean_t *is_switched,
3336                                 svn_wc__db_t *db,
3337                                 const char *local_abspath,
3338                                 const char *trail_url,
3339                                 apr_pool_t *scratch_pool);
3340
3341/* Set @a *excluded_subtrees to a hash mapping <tt>const char *</tt>
3342 * local absolute paths to <tt>const char *</tt> local absolute paths for
3343 * every path under @a local_abspath in @a db which are excluded by
3344 * the server (e.g. due to authz), or user.  If no such paths are found then
3345 * @a *server_excluded_subtrees is set to @c NULL.
3346 * Allocate the hash and all items therein from @a result_pool.
3347 */
3348svn_error_t *
3349svn_wc__db_get_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
3350                                 svn_wc__db_t *db,
3351                                 const char *local_abspath,
3352                                 apr_pool_t *result_pool,
3353                                 apr_pool_t *scratch_pool);
3354
3355/* Indicate in *IS_MODIFIED whether the working copy has local modifications,
3356 * using DB. Use SCRATCH_POOL for temporary allocations.
3357 *
3358 * This function does not check the working copy state, but is a lot more
3359 * efficient than a full status walk. */
3360svn_error_t *
3361svn_wc__db_has_db_mods(svn_boolean_t *is_modified,
3362                       svn_wc__db_t *db,
3363                       const char *local_abspath,
3364                       apr_pool_t *scratch_pool);
3365
3366
3367/* Verify the consistency of metadata concerning the WC that contains
3368 * WRI_ABSPATH, in DB.  Return an error if any problem is found. */
3369svn_error_t *
3370svn_wc__db_verify(svn_wc__db_t *db,
3371                  const char *wri_abspath,
3372                  apr_pool_t *scratch_pool);
3373
3374
3375/* Possibly need two structures, one with relpaths and with abspaths?
3376 * Only exposed for testing at present. */
3377struct svn_wc__db_moved_to_t {
3378  const char *local_relpath;  /* moved-to destination */
3379  int op_depth;       /* op-root of source */
3380};
3381
3382/* Set *FINAL_ABSPATH to an array of svn_wc__db_moved_to_t for
3383 * LOCAL_ABSPATH after following any and all nested moves.
3384 * Only exposed for testing at present. */
3385svn_error_t *
3386svn_wc__db_follow_moved_to(apr_array_header_t **moved_tos,
3387                           svn_wc__db_t *db,
3388                           const char *local_abspath,
3389                           apr_pool_t *result_pool,
3390                           apr_pool_t *scratch_pool);
3391
3392/* Update a moved-away tree conflict victim LOCAL_ABSPATH, deleted in
3393   DELETE_OP_ABSPATH with changes from the original location. */
3394svn_error_t *
3395svn_wc__db_update_moved_away_conflict_victim(svn_wc__db_t *db,
3396                                             const char *local_abspath,
3397                                             const char *delete_op_abspath,
3398                                             svn_wc_operation_t operation,
3399                                             svn_wc_conflict_action_t action,
3400                                             svn_wc_conflict_reason_t reason,
3401                                             svn_cancel_func_t cancel_func,
3402                                             void *cancel_baton,
3403                                             svn_wc_notify_func2_t notify_func,
3404                                             void *notify_baton,
3405                                             apr_pool_t *scratch_pool);
3406
3407/* Merge local changes from tree conflict victim at LOCAL_ABSPATH into the
3408   directory at DEST_ABSPATH. This function requires that LOCAL_ABSPATH is
3409   a directory and a tree-conflict victim. DST_ABSPATH must be a directory. */
3410svn_error_t *
3411svn_wc__db_update_incoming_move(svn_wc__db_t *db,
3412                                const char *local_abspath,
3413                                const char *dest_abspath,
3414                                svn_wc_operation_t operation,
3415                                svn_wc_conflict_action_t action,
3416                                svn_wc_conflict_reason_t reason,
3417                                svn_cancel_func_t cancel_func,
3418                                void *cancel_baton,
3419                                svn_wc_notify_func2_t notify_func,
3420                                void *notify_baton,
3421                                apr_pool_t *scratch_pool);
3422
3423/* Merge locally added dir tree conflict victim at LOCAL_ABSPATH with the
3424 * directory since added to the BASE layer by an update operation. */
3425svn_error_t *
3426svn_wc__db_update_local_add(svn_wc__db_t *db,
3427                            const char *local_abspath,
3428                            svn_cancel_func_t cancel_func,
3429                            void *cancel_baton,
3430                            svn_wc_notify_func2_t notify_func,
3431                            void *notify_baton,
3432                            apr_pool_t *scratch_pool);
3433
3434/* LOCAL_ABSPATH is moved to MOVE_DST_ABSPATH.  MOVE_SRC_ROOT_ABSPATH
3435 * is the root of the move to MOVE_DST_OP_ROOT_ABSPATH.
3436 * DELETE_ABSPATH is the op-root of the move; it's the same
3437 * as MOVE_SRC_ROOT_ABSPATH except for moves inside deletes when it is
3438 * the op-root of the delete. */
3439svn_error_t *
3440svn_wc__db_base_moved_to(const char **move_dst_abspath,
3441                         const char **move_dst_op_root_abspath,
3442                         const char **move_src_root_abspath,
3443                         const char **delete_abspath,
3444                         svn_wc__db_t *db,
3445                         const char *local_abspath,
3446                         apr_pool_t *result_pool,
3447                         apr_pool_t *scratch_pool);
3448
3449/* Recover space from the database file for LOCAL_ABSPATH by running
3450 * the "vacuum" command. */
3451svn_error_t *
3452svn_wc__db_vacuum(svn_wc__db_t *db,
3453                  const char *local_abspath,
3454                  apr_pool_t *scratch_pool);
3455
3456/* This raises move-edit tree-conflicts on any moves inside the
3457   delete-edit conflict on LOCAL_ABSPATH. This is experimental: see
3458   comment in resolve_conflict_on_node about combining with another
3459   function. */
3460svn_error_t *
3461svn_wc__db_op_raise_moved_away(svn_wc__db_t *db,
3462                               const char *local_abspath,
3463                               svn_wc_notify_func2_t notify_func,
3464                               void *notify_baton,
3465                               apr_pool_t *scratch_pool);
3466
3467/* Breaks all moves of nodes that exist at or below LOCAL_ABSPATH as
3468   shadowed (read: deleted) by the operation rooted at
3469   delete_op_root_abspath.
3470 */
3471svn_error_t *
3472svn_wc__db_op_break_moved_away(svn_wc__db_t *db,
3473                               const char *local_abspath,
3474                               const char *delete_op_root_abspath,
3475                               svn_boolean_t mark_tc_resolved,
3476                               svn_wc_notify_func2_t notify_func,
3477                               void *notify_baton,
3478                               apr_pool_t *scratch_pool);
3479
3480/* Set *REQUIRED_ABSPATH to the path that should be locked to ensure
3481 * that the lock covers all paths affected by resolving the conflicts
3482 * in the tree LOCAL_ABSPATH. */
3483svn_error_t *
3484svn_wc__required_lock_for_resolve(const char **required_abspath,
3485                                  svn_wc__db_t *db,
3486                                  const char *local_abspath,
3487                                  apr_pool_t *result_pool,
3488                                  apr_pool_t *scratch_pool);
3489
3490/* Return an array of const char * elements, which represent local absolute
3491 * paths for nodes, within the working copy indicated by WRI_ABSPATH, which
3492 * correspond to REPOS_RELPATH. If no such nodes exist, return an empty array.
3493 *
3494 * Note that this function returns each and every such node that is known
3495 * in the WC, including, for example, nodes that were children of a directory
3496 * which has been replaced.
3497 */
3498svn_error_t *
3499svn_wc__db_find_repos_node_in_wc(apr_array_header_t **local_abspath_list,
3500                                 svn_wc__db_t *db,
3501                                 const char *wri_abspath,
3502                                 const char *repos_relpath,
3503                                 apr_pool_t *result_pool,
3504                                 apr_pool_t *scratch_pool);
3505
3506/* Return an array of const char * elements, which represent local absolute
3507 * paths for nodes, within the working copy indicated by WRI_ABSPATH, which
3508 * have a basename matching BASENAME and have node kind KIND.
3509 * If no such nodes exist, return an empty array.
3510 *
3511 * This function returns only paths to nodes which are present in the highest
3512 * layer of the WC. In other words, paths to deleted and/or excluded nodes are
3513 * never returned.
3514 */
3515svn_error_t *
3516svn_wc__db_find_working_nodes_with_basename(apr_array_header_t **local_abspaths,
3517                                            svn_wc__db_t *db,
3518                                            const char *wri_abspath,
3519                                            const char *basename,
3520                                            svn_node_kind_t kind,
3521                                            apr_pool_t *result_pool,
3522                                            apr_pool_t *scratch_pool);
3523
3524/* Return an array of const char * elements, which represent local absolute
3525 * paths for nodes, within the working copy indicated by WRI_ABSPATH, which
3526 * are copies of REPOS_RELPATH and have node kind KIND.
3527 * If no such nodes exist, return an empty array.
3528 *
3529 * This function returns only paths to nodes which are present in the highest
3530 * layer of the WC. In other words, paths to deleted and/or excluded nodes are
3531 * never returned.
3532 */
3533svn_error_t *
3534svn_wc__db_find_copies_of_repos_path(apr_array_header_t **local_abspaths,
3535                                     svn_wc__db_t *db,
3536                                     const char *wri_abspath,
3537                                     const char *repos_relpath,
3538                                     svn_node_kind_t kind,
3539                                     apr_pool_t *result_pool,
3540                                     apr_pool_t *scratch_pool);
3541/* @} */
3542
3543typedef svn_error_t * (*svn_wc__db_verify_cb_t)(void *baton,
3544                                                const char *wc_abspath,
3545                                                const char *local_relpath,
3546                                                int op_depth,
3547                                                int id,
3548                                                const char *description,
3549                                                apr_pool_t *scratch_pool);
3550
3551/* Checks the database for FULL-correctness according to the spec.
3552
3553   Note that typical 1.7-1.9 databases WILL PRODUCE warnings.
3554
3555   This is mainly useful for WC-NG developers, as there will be
3556   warnings without the database being corrupt
3557*/
3558svn_error_t *
3559svn_wc__db_verify_db_full(svn_wc__db_t *db,
3560                          const char *wri_abspath,
3561                          svn_wc__db_verify_cb_t callback,
3562                          void *baton,
3563                          apr_pool_t *scratch_pool);
3564
3565
3566#ifdef __cplusplus
3567}
3568#endif /* __cplusplus */
3569
3570#endif /* SVN_WC_DB_H */
3571