]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/libsvn_wc/wc.h
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / contrib / subversion / subversion / libsvn_wc / wc.h
1 /*
2  * wc.h :  shared stuff internal to the svn_wc library.
3  *
4  * ====================================================================
5  *    Licensed to the Apache Software Foundation (ASF) under one
6  *    or more contributor license agreements.  See the NOTICE file
7  *    distributed with this work for additional information
8  *    regarding copyright ownership.  The ASF licenses this file
9  *    to you under the Apache License, Version 2.0 (the
10  *    "License"); you may not use this file except in compliance
11  *    with the License.  You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  *    Unless required by applicable law or agreed to in writing,
16  *    software distributed under the License is distributed on an
17  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  *    KIND, either express or implied.  See the License for the
19  *    specific language governing permissions and limitations
20  *    under the License.
21  * ====================================================================
22  */
23
24 \f
25 #ifndef SVN_LIBSVN_WC_H
26 #define SVN_LIBSVN_WC_H
27
28 #include <apr_pools.h>
29 #include <apr_hash.h>
30
31 #include "svn_types.h"
32 #include "svn_error.h"
33 #include "svn_wc.h"
34
35 #include "private/svn_sqlite.h"
36 #include "private/svn_wc_private.h"
37 #include "private/svn_skel.h"
38
39 #include "wc_db.h"
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif /* __cplusplus */
44
45
46 #define SVN_WC__PROP_REJ_EXT  ".prej"
47 \f
48 /* We can handle this format or anything lower, and we (should) error
49  * on anything higher.
50  *
51  * There is no format version 0; we started with 1.
52  *
53  * The bump to 2 introduced the ".svn-work" extension. For example,
54  *   ".svn/props/foo" became ".svn/props/foo.svn-work".
55  *
56  * The bump to 3 introduced the entry attribute
57  *   old-and-busted.c::ENTRIES_ATTR_ABSENT.
58  *
59  * The bump to 4 renamed the magic "svn:this_dir" entry name to "".
60  *
61  * == 1.0.x shipped with format 4
62  * == 1.1.x shipped with format 4
63  * == 1.2.x shipped with format 4
64  * == 1.3.x shipped with format 4
65  *
66  * The bump to 5 added support for replacing files with history (the
67  *   "revert base"). This was introduced in 1.4.0, but buggy until 1.4.6.
68  *
69  * The bump to 6 introduced caching of property modification state and
70  *   certain properties in the entries file.
71  *
72  * The bump to 7 changed the entries file format from XML to a custom
73  *   text-based format.
74  *
75  * The bump to 8 placed wcprops in one file per directory (named
76  *   upgrade.c::WCPROPS_ALL_DATA)
77  *
78  * == 1.4.x shipped with format 8
79  *
80  * The bump to 9 added changelists, keep-local, and sticky depth (for
81  *   selective/sparse checkouts) to each entry.
82  *
83  * == 1.5.x shipped with format 9
84  *
85  * The bump to 10 added tree-conflicts, file externals and a different
86  *   canonicalization of urls.
87  *
88  * == 1.6.x shipped with format 10
89  *
90  * The bump to 11 cleared the has_props, has_prop_mods, cachable_props,
91  *   and present_props values in the entries file. Older clients expect
92  *   proper values for these fields.
93  *
94  * The bump to 12 switched from 'entries' to the SQLite database 'wc.db'.
95  *
96  * The bump to 13 added the WORK_QUEUE table into 'wc.db', moved the
97  *   wcprops into the 'dav_cache' column in BASE_NODE, and stopped using
98  *   the 'incomplete_children' column of BASE_NODE.
99  *
100  * The bump to 14 added the WCLOCKS table (and migrated locks from the
101  *   filesystem into wc.db), and some columns to ACTUAL_NODE for future
102  *   use.
103  *
104  * The bump to 15 switched from depth='exclude' on directories to using
105  *   presence='exclude' within the BASE_NODE and WORKING_NODE tables.
106  *   This change also enabled exclude support on files and symlinks.
107  *
108  * The bump to 16 added 'locked_levels' to WC_LOCK, setting any existing
109  *   locks to a level of 0. The 'md5_checksum' column was added to PRISTINE
110  *   for future use.
111  *
112  * The bump to 17 added a '.svn/pristine' dir and moved the text bases into
113  *   the Pristine Store (the PRISTINE table and '.svn/pristine' dir), and
114  *   removed the '/.svn/text-base' dir.
115  *
116  * The bump to 18 moved the properties from separate files in the props and
117  *   prop-base directory (and .svn for the dir itself) into the wc.db file,
118  *   and then removed the props and prop-base dir.
119  *
120  * The bump to 19 introduced the 'single DB' per working copy. All metadata
121  *   is held in a single '.svn/wc.db' in the root directory of the working
122  *   copy. Bumped in r991236.
123  *
124  * The bump to 20 introduced NODES and drops BASE_NODE and WORKING_NODE,
125  *   op_depth is always 0 or 2. Bumped in r1005388.
126  *
127  * The bump to 21 moved tree conflict storage from the parent to the
128  *   conflicted node. Bumped in r1034436.
129  *
130  * The bump to 22 moved tree conflict storage from conflict_data column
131  *   to the tree_conflict_data column. Bumped in r1040255.
132  *
133  * The bump to 23 introduced multi-layer op_depth processing for NODES.
134  *   Bumped in r1044384.
135  *
136  * The bump to 24 started using the 'refcount' column of the PRISTINE table
137  *   correctly, instead of always setting it to '1'. Bumped in r1058523.
138  *
139  * The bump to 25 introduced the NODES_CURRENT view. Bumped in r1071283.
140  *
141  * The bump to 26 introduced the NODES_BASE view. Bumped in r1076617.
142  *
143  * The bump to 27 stored conflict files as relpaths rather than basenames.
144  *   Bumped in r1089593.
145  *
146  * The bump to 28 converted any remaining references to MD5 checksums
147  *   to SHA1 checksums. Bumped in r1095214.
148  *
149  * The bump to 29 renamed the pristine files from '<SHA1>' to '<SHA1>.svn-base'
150  * and introduced the EXTERNALS store. Bumped in r1129286.
151  *
152  * == 1.7.x shipped with format 29
153  *
154  * The bump to 30 switched the conflict storage to a skel inside conflict_data.
155  * Also clears some known invalid state. Bumped in r1387742.
156  *
157  * The bump to 31 added the inherited_props column in the NODES table.
158  * Bumped in r1395109.
159  *
160  * Please document any further format changes here.
161  */
162
163 #define SVN_WC__VERSION 31
164
165
166 /* Formats <= this have no concept of "revert text-base/props".  */
167 #define SVN_WC__NO_REVERT_FILES 4
168
169 /* A version <= this has wcprops stored in one file per entry. */
170 #define SVN_WC__WCPROPS_MANY_FILES_VERSION 7
171
172 /* A version < this can have urls that aren't canonical according to the new
173    rules. See issue #2475. */
174 #define SVN_WC__CHANGED_CANONICAL_URLS 10
175
176 /* The format number written to wc-ng working copies so that old clients
177    can recognize them as "newer Subversion"'s working copies. */
178 #define SVN_WC__NON_ENTRIES 12
179 #define SVN_WC__NON_ENTRIES_STRING "12\n"
180
181 /* A version < this uses the old 'entries' file mechanism.  */
182 #define SVN_WC__WC_NG_VERSION 12
183
184 /* In this version, the wcprops are "lost" between files and wc.db. We want
185    to ignore them in upgrades.  */
186 #define SVN_WC__WCPROPS_LOST 12
187
188 /* A version < this has no work queue (see workqueue.h).  */
189 #define SVN_WC__HAS_WORK_QUEUE 13
190
191 /* Return a string indicating the released version (or versions) of
192  * Subversion that used WC format number WC_FORMAT, or some other
193  * suitable string if no released version used WC_FORMAT.
194  *
195  * ### It's not ideal to encode this sort of knowledge in this low-level
196  * library.  On the other hand, it doesn't need to be updated often and
197  * should be easily found when it does need to be updated.  */
198 const char *
199 svn_wc__version_string_from_format(int wc_format);
200
201 /* Return true iff error E indicates an "is not a working copy" type
202    of error, either because something wasn't a working copy at all, or
203    because it's a working copy from a previous version (in need of
204    upgrade). */
205 #define SVN_WC__ERR_IS_NOT_CURRENT_WC(e) \
206             ((e->apr_err == SVN_ERR_WC_NOT_WORKING_COPY) || \
207              (e->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED))
208
209
210 \f
211 /*** Context handling ***/
212 struct svn_wc_context_t
213 {
214   /* The wc_db handle for this working copy. */
215   svn_wc__db_t *db;
216
217   /* Close the DB when we destroy this context?
218      (This is used inside backward compat wrappers, and should only be
219       modified by the proper create() functions. */
220   svn_boolean_t close_db_on_destroy;
221
222   /* The state pool for this context. */
223   apr_pool_t *state_pool;
224 };
225
226 /**
227  * Just like svn_wc_context_create(), only use the provided DB to construct
228  * the context.
229  *
230  * Even though DB is not allocated from the same pool at *WC_CTX, it is
231  * expected to remain open throughout the life of *WC_CTX.
232  */
233 svn_error_t *
234 svn_wc__context_create_with_db(svn_wc_context_t **wc_ctx,
235                                svn_config_t *config,
236                                svn_wc__db_t *db,
237                                apr_pool_t *result_pool);
238
239 \f
240 /*** Committed Queue ***/
241
242 /**
243  * Return the pool associated with QUEUE.  (This so we can keep some
244  * deprecated functions that need to peek inside the QUEUE struct in
245  * deprecated.c).
246  */
247 apr_pool_t *
248 svn_wc__get_committed_queue_pool(const struct svn_wc_committed_queue_t *queue);
249
250
251 /** Internal helper for svn_wc_process_committed_queue2().
252  *
253  * ### If @a queue is NULL, then ...?
254  * ### else:
255  * Bump an item from @a queue (the one associated with @a
256  * local_abspath) to @a new_revnum after a commit succeeds, recursing
257  * if @a recurse is set.
258  *
259  * @a new_date is the (server-side) date of the new revision, or 0.
260  *
261  * @a rev_author is the (server-side) author of the new
262  * revision; it may be @c NULL.
263  *
264  * @a new_dav_cache is a hash of dav property changes to be made to
265  * the @a local_abspath.
266  *   ### [JAF]  Is it? See svn_wc_queue_committed3(). It ends up being
267  *   ### assigned as a whole to wc.db:BASE_NODE:dav_cache.
268  *
269  * If @a no_unlock is set, don't release any user locks on @a
270  * local_abspath; otherwise release them as part of this processing.
271  *
272  * If @a keep_changelist is set, don't remove any changeset assignments
273  * from @a local_abspath; otherwise, clear it of such assignments.
274  *
275  * If @a sha1_checksum is non-NULL, use it to identify the node's pristine
276  * text.
277  *
278  * Set TOP_OF_RECURSE to TRUE to show that this the top of a possibly
279  * recursive commit operation.
280  */
281 svn_error_t *
282 svn_wc__process_committed_internal(svn_wc__db_t *db,
283                                    const char *local_abspath,
284                                    svn_boolean_t recurse,
285                                    svn_boolean_t top_of_recurse,
286                                    svn_revnum_t new_revnum,
287                                    apr_time_t new_date,
288                                    const char *rev_author,
289                                    apr_hash_t *new_dav_cache,
290                                    svn_boolean_t no_unlock,
291                                    svn_boolean_t keep_changelist,
292                                    const svn_checksum_t *sha1_checksum,
293                                    const svn_wc_committed_queue_t *queue,
294                                    apr_pool_t *scratch_pool);
295
296 \f
297 /*** Update traversals. ***/
298
299 struct svn_wc_traversal_info_t
300 {
301   /* The pool in which this structure and everything inside it is
302      allocated. */
303   apr_pool_t *pool;
304
305   /* The before and after values of the SVN_PROP_EXTERNALS property,
306    * for each directory on which that property changed.  These have
307    * the same layout as those returned by svn_wc_edited_externals().
308    *
309    * The hashes, their keys, and their values are allocated in the
310    * above pool.
311    */
312   apr_hash_t *externals_old;
313   apr_hash_t *externals_new;
314
315   /* The ambient depths of the working copy directories.  The keys are
316      working copy paths (as for svn_wc_edited_externals()), the values
317      are the result of svn_depth_to_word(depth_of_each_dir). */
318   apr_hash_t *depths;
319 };
320
321
322 /*** Names and file/dir operations in the administrative area. ***/
323
324 /** The files within the administrative subdir. **/
325 #define SVN_WC__ADM_FORMAT              "format"
326 #define SVN_WC__ADM_ENTRIES             "entries"
327 #define SVN_WC__ADM_TMP                 "tmp"
328 #define SVN_WC__ADM_PRISTINE            "pristine"
329 #define SVN_WC__ADM_NONEXISTENT_PATH    "nonexistent-path"
330
331 /* The basename of the ".prej" file, if a directory ever has property
332    conflicts.  This .prej file will appear *within* the conflicted
333    directory.  */
334 #define SVN_WC__THIS_DIR_PREJ           "dir_conflicts"
335
336 \f
337 /* A few declarations for stuff in util.c.
338  * If this section gets big, move it all out into a new util.h file. */
339
340 /* Ensure that DIR exists. */
341 svn_error_t *svn_wc__ensure_directory(const char *path, apr_pool_t *pool);
342
343
344 /* Return a hash keyed by 'const char *' property names and with
345    'svn_string_t *' values built from PROPS (which is an array of
346    pointers to svn_prop_t's) or to NULL if PROPS is NULL or empty.
347    PROPS items which lack a value will be ignored.  If PROPS contains
348    multiple properties with the same name, each successive such item
349    reached in a walk from the beginning to the end of the array will
350    overwrite the previous in the returned hash.
351
352    NOTE: While the returned hash will be allocated in RESULT_POOL, the
353    items it holds will share storage with those in PROPS.
354
355    ### This is rather the reverse of svn_prop_hash_to_array(), except
356    ### that function's arrays contains svn_prop_t's, whereas this
357    ### one's contains *pointers* to svn_prop_t's.  So much for
358    ### consistency.  */
359 apr_hash_t *
360 svn_wc__prop_array_to_hash(const apr_array_header_t *props,
361                            apr_pool_t *result_pool);
362
363 \f
364 /* Set *MODIFIED_P to non-zero if LOCAL_ABSPATH's text is modified with
365  * regard to the base revision, else set *MODIFIED_P to zero.
366  *
367  * If EXACT_COMPARISON is FALSE, translate LOCAL_ABSPATH's EOL
368  * style and keywords to repository-normal form according to its properties,
369  * and compare the result with the text base.
370  * Usually, EXACT_COMPARISON should be FALSE.
371  *
372  * If LOCAL_ABSPATH does not exist, consider it unmodified.  If it exists
373  * but is not under revision control (not even scheduled for
374  * addition), return the error SVN_WC_PATH_NOT_FOUND.
375  *
376  * If the text is unmodified and a write-lock is held this function
377  * will ensure that the last-known-unmodified timestamp and
378  * filesize of the file as recorded in DB matches the corresponding
379  * attributes of the actual file.  (This is often referred to as
380  * "timestamp repair", and serves to help future unforced is-modified
381  * checks return quickly if the file remains untouched.)
382  */
383 svn_error_t *
384 svn_wc__internal_file_modified_p(svn_boolean_t *modified_p,
385                                  svn_wc__db_t *db,
386                                  const char *local_abspath,
387                                  svn_boolean_t exact_comparison,
388                                  apr_pool_t *scratch_pool);
389
390
391 /* Prepare to merge a file content change into the working copy.
392
393    This does not merge properties; see svn_wc__merge_props() for that.
394    This does not necessarily change the file TARGET_ABSPATH on disk; it
395    may instead return work items that will replace the file on disk when
396    they are run.  ### Can we be more consistent about this?
397
398    Merge the difference between LEFT_ABSPATH and RIGHT_ABSPATH into
399    TARGET_ABSPATH.
400
401    Set *WORK_ITEMS to the appropriate work queue operations.
402
403    If there are any conflicts, append a conflict description to
404    *CONFLICT_SKEL.  (First allocate *CONFLICT_SKEL from RESULT_POOL if
405    it is initially NULL.  CONFLICT_SKEL itself must not be NULL.)
406    Also, unless it is considered to be a 'binary' file, mark any
407    conflicts in the text of the file TARGET_ABSPATH using LEFT_LABEL,
408    RIGHT_LABEL and TARGET_LABEL.
409
410    Set *MERGE_OUTCOME to indicate the result.
411
412    When DRY_RUN is true, no actual changes are made to the working copy.
413
414    If DIFF3_CMD is specified, the given external diff3 tool will
415    be used instead of our built in diff3 routines.
416
417    When MERGE_OPTIONS are specified, they are used by the internal
418    diff3 routines, or passed to the external diff3 tool.
419
420    WRI_ABSPATH describes in which working copy information should be
421    retrieved. (Interesting for merging file externals).
422
423    OLD_ACTUAL_PROPS is the set of actual properties before merging; used for
424    detranslating the file before merging.  This is necessary because, in
425    the case of updating, the update can have sent new properties, so we
426    cannot simply fetch and use the current actual properties.
427
428      ### Is OLD_ACTUAL_PROPS still necessary, now that we first prepare the
429          content change and property change and then apply them both to
430          the WC together?
431
432    Property changes sent by the update are provided in PROP_DIFF.
433
434    For a complete description, see svn_wc_merge5() for which this is
435    the (loggy) implementation.
436
437    *WORK_ITEMS will be allocated in RESULT_POOL. All temporary allocations
438    will be performed in SCRATCH_POOL.
439 */
440 svn_error_t *
441 svn_wc__internal_merge(svn_skel_t **work_items,
442                        svn_skel_t **conflict_skel,
443                        enum svn_wc_merge_outcome_t *merge_outcome,
444                        svn_wc__db_t *db,
445                        const char *left_abspath,
446                        const char *right_abspath,
447                        const char *target_abspath,
448                        const char *wri_abspath,
449                        const char *left_label,
450                        const char *right_label,
451                        const char *target_label,
452                        apr_hash_t *old_actual_props,
453                        svn_boolean_t dry_run,
454                        const char *diff3_cmd,
455                        const apr_array_header_t *merge_options,
456                        const apr_array_header_t *prop_diff,
457                        svn_cancel_func_t cancel_func,
458                        void *cancel_baton,
459                        apr_pool_t *result_pool,
460                        apr_pool_t *scratch_pool);
461
462 /* A default error handler for svn_wc_walk_entries3().  Returns ERR in
463    all cases. */
464 svn_error_t *
465 svn_wc__walker_default_error_handler(const char *path,
466                                      svn_error_t *err,
467                                      void *walk_baton,
468                                      apr_pool_t *pool);
469
470 /* Set *EDITOR and *EDIT_BATON to an ambient-depth-based filtering
471  * editor that wraps WRAPPED_EDITOR and WRAPPED_BATON.  This is only
472  * required for operations where the requested depth is @c
473  * svn_depth_unknown and the server's editor driver doesn't understand
474  * depth.  It is safe for *EDITOR and *EDIT_BATON to start as
475  * WRAPPED_EDITOR and WRAPPED_BATON.
476  *
477  * ANCHOR, TARGET, and DB are as in svn_wc_get_update_editor3.
478  *
479  * @a requested_depth must be one of the following depth values:
480  * @c svn_depth_infinity, @c svn_depth_empty, @c svn_depth_files,
481  * @c svn_depth_immediates, or @c svn_depth_unknown.
482  *
483  * Allocations are done in POOL.
484  */
485 svn_error_t *
486 svn_wc__ambient_depth_filter_editor(const svn_delta_editor_t **editor,
487                                     void **edit_baton,
488                                     svn_wc__db_t *db,
489                                     const char *anchor_abspath,
490                                     const char *target,
491                                     const svn_delta_editor_t *wrapped_editor,
492                                     void *wrapped_edit_baton,
493                                     apr_pool_t *result_pool);
494
495
496 /* Similar to svn_wc_conflicted_p3(), but with a wc_db parameter in place of
497  * a wc_context. */
498 svn_error_t *
499 svn_wc__internal_conflicted_p(svn_boolean_t *text_conflicted_p,
500                               svn_boolean_t *prop_conflicted_p,
501                               svn_boolean_t *tree_conflicted_p,
502                               svn_wc__db_t *db,
503                               const char *local_abspath,
504                               apr_pool_t *scratch_pool);
505
506 /* Similar to svn_wc__internal_conflicted_p(), but ignores
507  * moved-away-edit tree conflicts.  If CONFLICT_IGNORED_P is not NULL
508  * then sets *CONFLICT_IGNORED_P TRUE if a tree-conflict is ignored
509  * and FALSE otherwise. Also ignores text and property conflicts if
510  * TREE_ONLY is TRUE */
511 svn_error_t *
512 svn_wc__conflicted_for_update_p(svn_boolean_t *conflicted_p,
513                                 svn_boolean_t *conflict_ignored_p,
514                                 svn_wc__db_t *db,
515                                 const char *local_abspath,
516                                 svn_boolean_t tree_only,
517                                 apr_pool_t *scratch_pool);
518
519
520 /* Internal version of svn_wc_transmit_text_deltas3(). */
521 svn_error_t *
522 svn_wc__internal_transmit_text_deltas(const char **tempfile,
523                                       const svn_checksum_t **new_text_base_md5_checksum,
524                                       const svn_checksum_t **new_text_base_sha1_checksum,
525                                       svn_wc__db_t *db,
526                                       const char *local_abspath,
527                                       svn_boolean_t fulltext,
528                                       const svn_delta_editor_t *editor,
529                                       void *file_baton,
530                                       apr_pool_t *result_pool,
531                                       apr_pool_t *scratch_pool);
532
533 /* Internal version of svn_wc_transmit_prop_deltas2(). */
534 svn_error_t *
535 svn_wc__internal_transmit_prop_deltas(svn_wc__db_t *db,
536                                      const char *local_abspath,
537                                      const svn_delta_editor_t *editor,
538                                      void *baton,
539                                      apr_pool_t *scratch_pool);
540
541 /* Library-internal version of svn_wc_ensure_adm4(). */
542 svn_error_t *
543 svn_wc__internal_ensure_adm(svn_wc__db_t *db,
544                             const char *local_abspath,
545                             const char *url,
546                             const char *repos_root_url,
547                             const char *repos_uuid,
548                             svn_revnum_t revision,
549                             svn_depth_t depth,
550                             apr_pool_t *scratch_pool);
551
552
553 /* Library-internal version of svn_wc__changelist_match(). */
554 svn_boolean_t
555 svn_wc__internal_changelist_match(svn_wc__db_t *db,
556                                   const char *local_abspath,
557                                   const apr_hash_t *clhash,
558                                   apr_pool_t *scratch_pool);
559
560 /* Library-internal version of svn_wc_walk_status(), which see. */
561 svn_error_t *
562 svn_wc__internal_walk_status(svn_wc__db_t *db,
563                              const char *local_abspath,
564                              svn_depth_t depth,
565                              svn_boolean_t get_all,
566                              svn_boolean_t no_ignore,
567                              svn_boolean_t ignore_text_mods,
568                              const apr_array_header_t *ignore_patterns,
569                              svn_wc_status_func4_t status_func,
570                              void *status_baton,
571                              svn_cancel_func_t cancel_func,
572                              void *cancel_baton,
573                              apr_pool_t *scratch_pool);
574
575 /** A callback invoked by the generic node-walker function.  */
576 typedef svn_error_t *(*svn_wc__node_found_func_t)(const char *local_abspath,
577                                                   svn_node_kind_t kind,
578                                                   void *walk_baton,
579                                                   apr_pool_t *scratch_pool);
580
581 /* Call @a walk_callback with @a walk_baton for @a local_abspath and all
582    nodes underneath it, restricted by @a walk_depth, and possibly
583    @a changelists.
584
585    If @a show_hidden is true, include hidden nodes, else ignore them.
586    If CHANGELISTS is non-NULL and non-empty, filter thereon. */
587 svn_error_t *
588 svn_wc__internal_walk_children(svn_wc__db_t *db,
589                                const char *local_abspath,
590                                svn_boolean_t show_hidden,
591                                const apr_array_header_t *changelists,
592                                svn_wc__node_found_func_t walk_callback,
593                                void *walk_baton,
594                                svn_depth_t walk_depth,
595                                svn_cancel_func_t cancel_func,
596                                void *cancel_baton,
597                                apr_pool_t *scratch_pool);
598
599 /* Library-internal version of svn_wc_remove_from_revision_control2,
600    which see.*/
601 svn_error_t *
602 svn_wc__internal_remove_from_revision_control(svn_wc__db_t *db,
603                                               const char *local_abspath,
604                                               svn_boolean_t destroy_wf,
605                                               svn_cancel_func_t cancel_func,
606                                               void *cancel_baton,
607                                               apr_pool_t *scratch_pool);
608
609 /* Library-internal version of svn_wc__node_get_schedule(). */
610 svn_error_t *
611 svn_wc__internal_node_get_schedule(svn_wc_schedule_t *schedule,
612                                    svn_boolean_t *copied,
613                                    svn_wc__db_t *db,
614                                    const char *local_abspath,
615                                    apr_pool_t *scratch_pool);
616
617 /* Internal version of svn_wc__node_get_origin() */
618 svn_error_t *
619 svn_wc__internal_get_origin(svn_boolean_t *is_copy,
620                             svn_revnum_t *revision,
621                             const char **repos_relpath,
622                             const char **repos_root_url,
623                             const char **repos_uuid,
624                             const char **copy_root_abspath,
625                             svn_wc__db_t *db,
626                             const char *local_abspath,
627                             svn_boolean_t scan_deleted,
628                             apr_pool_t *result_pool,
629                             apr_pool_t *scratch_pool);
630
631 /* Internal version of svn_wc__node_get_repos_info() */
632 svn_error_t *
633 svn_wc__internal_get_repos_info(svn_revnum_t *revision,
634                                 const char **repos_relpath,
635                                 const char **repos_root_url,
636                                 const char **repos_uuid,
637                                 svn_wc__db_t *db,
638                                 const char *local_abspath,
639                                 apr_pool_t *result_pool,
640                                 apr_pool_t *scratch_pool);
641
642 /* Upgrade the wc sqlite database given in SDB for the wc located at
643    WCROOT_ABSPATH. It's current/starting format is given by START_FORMAT.
644    After the upgrade is complete (to as far as the automatic upgrade will
645    perform), the resulting format is RESULT_FORMAT. All allocations are
646    performed in SCRATCH_POOL.  */
647 svn_error_t *
648 svn_wc__upgrade_sdb(int *result_format,
649                     const char *wcroot_abspath,
650                     svn_sqlite__db_t *sdb,
651                     int start_format,
652                     apr_pool_t *scratch_pool);
653
654 /* Create a conflict skel from the old separated data */
655 svn_error_t *
656 svn_wc__upgrade_conflict_skel_from_raw(svn_skel_t **conflicts,
657                                        svn_wc__db_t *db,
658                                        const char *wri_abspath,
659                                        const char *local_relpath,
660                                        const char *conflict_old,
661                                        const char *conflict_wrk,
662                                        const char *conflict_new,
663                                        const char *prej_file,
664                                        const char *tree_conflict_data,
665                                        apr_size_t tree_conflict_len,
666                                        apr_pool_t *result_pool,
667                                        apr_pool_t *scratch_pool);
668
669 svn_error_t *
670 svn_wc__wipe_postupgrade(const char *dir_abspath,
671                          svn_boolean_t whole_admin,
672                          svn_cancel_func_t cancel_func,
673                          void *cancel_baton,
674                          apr_pool_t *scratch_pool);
675
676 /* Ensure LOCAL_ABSPATH is still locked in DB.  Returns the error
677  * SVN_ERR_WC_NOT_LOCKED if this is not the case.
678  */
679 svn_error_t *
680 svn_wc__write_check(svn_wc__db_t *db,
681                     const char *local_abspath,
682                     apr_pool_t *scratch_pool);
683
684 /* Read into CONFLICTS svn_wc_conflict_description2_t* structs
685  * for all conflicts that have LOCAL_ABSPATH as victim.
686  *
687  * Victim must be versioned or be part of a tree conflict.
688  *
689  * If CREATE_TEMPFILES is TRUE, create temporary files for property conflicts.
690  *
691  * Allocate *CONFLICTS in RESULT_POOL and do temporary allocations in
692  * SCRATCH_POOL
693  */
694 svn_error_t *
695 svn_wc__read_conflicts(const apr_array_header_t **conflicts,
696                        svn_wc__db_t *db,
697                        const char *local_abspath,
698                        svn_boolean_t create_tempfiles,
699                        apr_pool_t *result_pool,
700                        apr_pool_t *scratch_pool);
701
702
703 /* Perform the actual merge of file changes between an original file,
704    identified by ORIGINAL_CHECKSUM (an empty file if NULL) to a new file
705    identified by NEW_CHECKSUM in the working copy identified by WRI_ABSPATH.
706
707    Merge the result into LOCAL_ABSPATH, which is part of the working copy
708    identified by WRI_ABSPATH. Use OLD_REVISION and TARGET_REVISION for naming
709    the intermediate files.
710
711    Set *FOUND_TEXT_CONFLICT to TRUE when the merge encountered a conflict,
712    otherwise to FALSE.
713
714    The rest of the arguments are passed to svn_wc__internal_merge.
715  */
716 svn_error_t *
717 svn_wc__perform_file_merge(svn_skel_t **work_items,
718                            svn_skel_t **conflict_skel,
719                            svn_boolean_t *found_conflict,
720                            svn_wc__db_t *db,
721                            const char *local_abspath,
722                            const char *wri_abspath,
723                            const svn_checksum_t *new_checksum,
724                            const svn_checksum_t *original_checksum,
725                            apr_hash_t *old_actual_props,
726                            const apr_array_header_t *ext_patterns,
727                            svn_revnum_t old_revision,
728                            svn_revnum_t target_revision,
729                            const apr_array_header_t *propchanges,
730                            const char *diff3_cmd,
731                            svn_cancel_func_t cancel_func,
732                            void *cancel_baton,
733                            apr_pool_t *result_pool,
734                            apr_pool_t *scratch_pool);
735
736
737 /* Couple of random helpers for the Ev2 shims.
738    ### These will eventually be obsoleted and removed. */
739 struct svn_wc__shim_fetch_baton_t
740 {
741   svn_wc__db_t *db;
742   const char *base_abspath;
743   svn_boolean_t fetch_base;
744 };
745
746 /* Using a BATON of struct shim_fetch_baton, return KIND for PATH. */
747 svn_error_t *
748 svn_wc__fetch_kind_func(svn_node_kind_t *kind,
749                         void *baton,
750                         const char *path,
751                         svn_revnum_t base_revision,
752                         apr_pool_t *scratch_pool);
753
754 /* Using a BATON of struct shim_fetch_baton, return PROPS for PATH. */
755 svn_error_t *
756 svn_wc__fetch_props_func(apr_hash_t **props,
757                          void *baton,
758                          const char *path,
759                          svn_revnum_t base_revision,
760                          apr_pool_t *result_pool,
761                          apr_pool_t *scratch_pool);
762
763 /* Using a BATON of struct shim_fetch_baton, return a delta base for PATH. */
764 svn_error_t *
765 svn_wc__fetch_base_func(const char **filename,
766                         void *baton,
767                         const char *path,
768                         svn_revnum_t base_revision,
769                         apr_pool_t *result_pool,
770                         apr_pool_t *scratch_pool);
771
772 /* Find duplicate targets in *EXTERNALS, a list of svn_wc_external_item2_t*
773  * elements, and store each target string in *DUPLICATE_TARGETS as const
774  * char * elements. *DUPLICATE_TARGETS will be NULL if no duplicates were
775  * found. */
776 svn_error_t *
777 svn_wc__externals_find_target_dups(apr_array_header_t **duplicate_targets,
778                                    apr_array_header_t *externals,
779                                    apr_pool_t *pool,
780                                    apr_pool_t *scratch_pool);
781
782 /* Revert tree LOCAL_ABSPATH to depth DEPTH and notify for all
783    reverts. */
784 svn_error_t *
785 svn_wc__revert_internal(svn_wc__db_t *db,
786                         const char *local_abspath,
787                         svn_depth_t depth,
788                         svn_boolean_t use_commit_times,
789                         svn_cancel_func_t cancel_func,
790                         void *cancel_baton,
791                         svn_wc_notify_func2_t notify_func,
792                         void *notify_baton,
793                         apr_pool_t *scratch_pool);
794
795 svn_error_t *
796 svn_wc__node_has_local_mods(svn_boolean_t *modified,
797                             svn_boolean_t *all_edits_are_deletes,
798                             svn_wc__db_t *db,
799                             const char *local_abspath,
800                             svn_cancel_func_t cancel_func,
801                             void *cancel_baton,
802                             apr_pool_t *scratch_pool);
803
804 #ifdef __cplusplus
805 }
806 #endif /* __cplusplus */
807
808 #endif /* SVN_LIBSVN_WC_H */