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