1251881Speter/*
2251881Speter * wc.h :  shared stuff internal to the svn_wc library.
3251881Speter *
4251881Speter * ====================================================================
5251881Speter *    Licensed to the Apache Software Foundation (ASF) under one
6251881Speter *    or more contributor license agreements.  See the NOTICE file
7251881Speter *    distributed with this work for additional information
8251881Speter *    regarding copyright ownership.  The ASF licenses this file
9251881Speter *    to you under the Apache License, Version 2.0 (the
10251881Speter *    "License"); you may not use this file except in compliance
11251881Speter *    with the License.  You may obtain a copy of the License at
12251881Speter *
13251881Speter *      http://www.apache.org/licenses/LICENSE-2.0
14251881Speter *
15251881Speter *    Unless required by applicable law or agreed to in writing,
16251881Speter *    software distributed under the License is distributed on an
17251881Speter *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18251881Speter *    KIND, either express or implied.  See the License for the
19251881Speter *    specific language governing permissions and limitations
20251881Speter *    under the License.
21251881Speter * ====================================================================
22251881Speter */
23251881Speter
24251881Speter
25251881Speter#ifndef SVN_LIBSVN_WC_H
26251881Speter#define SVN_LIBSVN_WC_H
27251881Speter
28251881Speter#include <apr_pools.h>
29251881Speter#include <apr_hash.h>
30251881Speter
31251881Speter#include "svn_types.h"
32251881Speter#include "svn_error.h"
33251881Speter#include "svn_wc.h"
34251881Speter
35251881Speter#include "private/svn_sqlite.h"
36251881Speter#include "private/svn_wc_private.h"
37251881Speter#include "private/svn_skel.h"
38251881Speter
39251881Speter#include "wc_db.h"
40251881Speter
41251881Speter#ifdef __cplusplus
42251881Speterextern "C" {
43251881Speter#endif /* __cplusplus */
44251881Speter
45251881Speter
46251881Speter#define SVN_WC__PROP_REJ_EXT  ".prej"
47251881Speter
48251881Speter/* We can handle this format or anything lower, and we (should) error
49251881Speter * on anything higher.
50251881Speter *
51251881Speter * There is no format version 0; we started with 1.
52251881Speter *
53251881Speter * The bump to 2 introduced the ".svn-work" extension. For example,
54251881Speter *   ".svn/props/foo" became ".svn/props/foo.svn-work".
55251881Speter *
56251881Speter * The bump to 3 introduced the entry attribute
57251881Speter *   old-and-busted.c::ENTRIES_ATTR_ABSENT.
58251881Speter *
59251881Speter * The bump to 4 renamed the magic "svn:this_dir" entry name to "".
60251881Speter *
61251881Speter * == 1.0.x shipped with format 4
62251881Speter * == 1.1.x shipped with format 4
63251881Speter * == 1.2.x shipped with format 4
64251881Speter * == 1.3.x shipped with format 4
65251881Speter *
66251881Speter * The bump to 5 added support for replacing files with history (the
67251881Speter *   "revert base"). This was introduced in 1.4.0, but buggy until 1.4.6.
68251881Speter *
69251881Speter * The bump to 6 introduced caching of property modification state and
70251881Speter *   certain properties in the entries file.
71251881Speter *
72251881Speter * The bump to 7 changed the entries file format from XML to a custom
73251881Speter *   text-based format.
74251881Speter *
75251881Speter * The bump to 8 placed wcprops in one file per directory (named
76251881Speter *   upgrade.c::WCPROPS_ALL_DATA)
77251881Speter *
78251881Speter * == 1.4.x shipped with format 8
79251881Speter *
80251881Speter * The bump to 9 added changelists, keep-local, and sticky depth (for
81251881Speter *   selective/sparse checkouts) to each entry.
82251881Speter *
83251881Speter * == 1.5.x shipped with format 9
84251881Speter *
85251881Speter * The bump to 10 added tree-conflicts, file externals and a different
86251881Speter *   canonicalization of urls.
87251881Speter *
88251881Speter * == 1.6.x shipped with format 10
89251881Speter *
90251881Speter * The bump to 11 cleared the has_props, has_prop_mods, cachable_props,
91251881Speter *   and present_props values in the entries file. Older clients expect
92251881Speter *   proper values for these fields.
93251881Speter *
94251881Speter * The bump to 12 switched from 'entries' to the SQLite database 'wc.db'.
95251881Speter *
96251881Speter * The bump to 13 added the WORK_QUEUE table into 'wc.db', moved the
97251881Speter *   wcprops into the 'dav_cache' column in BASE_NODE, and stopped using
98251881Speter *   the 'incomplete_children' column of BASE_NODE.
99251881Speter *
100251881Speter * The bump to 14 added the WCLOCKS table (and migrated locks from the
101251881Speter *   filesystem into wc.db), and some columns to ACTUAL_NODE for future
102251881Speter *   use.
103251881Speter *
104251881Speter * The bump to 15 switched from depth='exclude' on directories to using
105251881Speter *   presence='exclude' within the BASE_NODE and WORKING_NODE tables.
106251881Speter *   This change also enabled exclude support on files and symlinks.
107251881Speter *
108251881Speter * The bump to 16 added 'locked_levels' to WC_LOCK, setting any existing
109251881Speter *   locks to a level of 0. The 'md5_checksum' column was added to PRISTINE
110251881Speter *   for future use.
111251881Speter *
112251881Speter * The bump to 17 added a '.svn/pristine' dir and moved the text bases into
113251881Speter *   the Pristine Store (the PRISTINE table and '.svn/pristine' dir), and
114251881Speter *   removed the '/.svn/text-base' dir.
115251881Speter *
116251881Speter * The bump to 18 moved the properties from separate files in the props and
117251881Speter *   prop-base directory (and .svn for the dir itself) into the wc.db file,
118251881Speter *   and then removed the props and prop-base dir.
119251881Speter *
120251881Speter * The bump to 19 introduced the 'single DB' per working copy. All metadata
121251881Speter *   is held in a single '.svn/wc.db' in the root directory of the working
122251881Speter *   copy. Bumped in r991236.
123251881Speter *
124251881Speter * The bump to 20 introduced NODES and drops BASE_NODE and WORKING_NODE,
125251881Speter *   op_depth is always 0 or 2. Bumped in r1005388.
126251881Speter *
127251881Speter * The bump to 21 moved tree conflict storage from the parent to the
128251881Speter *   conflicted node. Bumped in r1034436.
129251881Speter *
130251881Speter * The bump to 22 moved tree conflict storage from conflict_data column
131251881Speter *   to the tree_conflict_data column. Bumped in r1040255.
132251881Speter *
133251881Speter * The bump to 23 introduced multi-layer op_depth processing for NODES.
134251881Speter *   Bumped in r1044384.
135251881Speter *
136251881Speter * The bump to 24 started using the 'refcount' column of the PRISTINE table
137251881Speter *   correctly, instead of always setting it to '1'. Bumped in r1058523.
138251881Speter *
139251881Speter * The bump to 25 introduced the NODES_CURRENT view. Bumped in r1071283.
140251881Speter *
141251881Speter * The bump to 26 introduced the NODES_BASE view. Bumped in r1076617.
142251881Speter *
143251881Speter * The bump to 27 stored conflict files as relpaths rather than basenames.
144251881Speter *   Bumped in r1089593.
145251881Speter *
146251881Speter * The bump to 28 converted any remaining references to MD5 checksums
147251881Speter *   to SHA1 checksums. Bumped in r1095214.
148251881Speter *
149251881Speter * The bump to 29 renamed the pristine files from '<SHA1>' to '<SHA1>.svn-base'
150251881Speter * and introduced the EXTERNALS store. Bumped in r1129286.
151251881Speter *
152251881Speter * == 1.7.x shipped with format 29
153251881Speter *
154251881Speter * The bump to 30 switched the conflict storage to a skel inside conflict_data.
155251881Speter * Also clears some known invalid state. Bumped in r1387742.
156251881Speter *
157251881Speter * The bump to 31 added the inherited_props column in the NODES table.
158251881Speter * Bumped in r1395109.
159251881Speter *
160251881Speter * Please document any further format changes here.
161251881Speter */
162251881Speter
163251881Speter#define SVN_WC__VERSION 31
164251881Speter
165251881Speter
166251881Speter/* Formats <= this have no concept of "revert text-base/props".  */
167251881Speter#define SVN_WC__NO_REVERT_FILES 4
168251881Speter
169251881Speter/* A version <= this has wcprops stored in one file per entry. */
170251881Speter#define SVN_WC__WCPROPS_MANY_FILES_VERSION 7
171251881Speter
172251881Speter/* A version < this can have urls that aren't canonical according to the new
173251881Speter   rules. See issue #2475. */
174251881Speter#define SVN_WC__CHANGED_CANONICAL_URLS 10
175251881Speter
176251881Speter/* The format number written to wc-ng working copies so that old clients
177251881Speter   can recognize them as "newer Subversion"'s working copies. */
178251881Speter#define SVN_WC__NON_ENTRIES 12
179251881Speter#define SVN_WC__NON_ENTRIES_STRING "12\n"
180251881Speter
181251881Speter/* A version < this uses the old 'entries' file mechanism.  */
182251881Speter#define SVN_WC__WC_NG_VERSION 12
183251881Speter
184251881Speter/* In this version, the wcprops are "lost" between files and wc.db. We want
185251881Speter   to ignore them in upgrades.  */
186251881Speter#define SVN_WC__WCPROPS_LOST 12
187251881Speter
188251881Speter/* A version < this has no work queue (see workqueue.h).  */
189251881Speter#define SVN_WC__HAS_WORK_QUEUE 13
190251881Speter
191251881Speter/* Return a string indicating the released version (or versions) of
192251881Speter * Subversion that used WC format number WC_FORMAT, or some other
193251881Speter * suitable string if no released version used WC_FORMAT.
194251881Speter *
195251881Speter * ### It's not ideal to encode this sort of knowledge in this low-level
196251881Speter * library.  On the other hand, it doesn't need to be updated often and
197251881Speter * should be easily found when it does need to be updated.  */
198251881Speterconst char *
199251881Spetersvn_wc__version_string_from_format(int wc_format);
200251881Speter
201251881Speter/* Return true iff error E indicates an "is not a working copy" type
202251881Speter   of error, either because something wasn't a working copy at all, or
203251881Speter   because it's a working copy from a previous version (in need of
204251881Speter   upgrade). */
205251881Speter#define SVN_WC__ERR_IS_NOT_CURRENT_WC(e) \
206251881Speter            ((e->apr_err == SVN_ERR_WC_NOT_WORKING_COPY) || \
207251881Speter             (e->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED))
208251881Speter
209251881Speter
210251881Speter
211251881Speter/*** Context handling ***/
212251881Speterstruct svn_wc_context_t
213251881Speter{
214251881Speter  /* The wc_db handle for this working copy. */
215251881Speter  svn_wc__db_t *db;
216251881Speter
217251881Speter  /* Close the DB when we destroy this context?
218251881Speter     (This is used inside backward compat wrappers, and should only be
219251881Speter      modified by the proper create() functions. */
220251881Speter  svn_boolean_t close_db_on_destroy;
221251881Speter
222251881Speter  /* The state pool for this context. */
223251881Speter  apr_pool_t *state_pool;
224251881Speter};
225251881Speter
226251881Speter/**
227251881Speter * Just like svn_wc_context_create(), only use the provided DB to construct
228251881Speter * the context.
229251881Speter *
230251881Speter * Even though DB is not allocated from the same pool at *WC_CTX, it is
231251881Speter * expected to remain open throughout the life of *WC_CTX.
232251881Speter */
233251881Spetersvn_error_t *
234251881Spetersvn_wc__context_create_with_db(svn_wc_context_t **wc_ctx,
235251881Speter                               svn_config_t *config,
236251881Speter                               svn_wc__db_t *db,
237251881Speter                               apr_pool_t *result_pool);
238251881Speter
239251881Speter
240251881Speter/*** Committed Queue ***/
241251881Speter
242251881Speter/**
243251881Speter * Return the pool associated with QUEUE.  (This so we can keep some
244251881Speter * deprecated functions that need to peek inside the QUEUE struct in
245251881Speter * deprecated.c).
246251881Speter */
247251881Speterapr_pool_t *
248251881Spetersvn_wc__get_committed_queue_pool(const struct svn_wc_committed_queue_t *queue);
249251881Speter
250251881Speter
251251881Speter/** Internal helper for svn_wc_process_committed_queue2().
252251881Speter *
253251881Speter * ### If @a queue is NULL, then ...?
254251881Speter * ### else:
255251881Speter * Bump an item from @a queue (the one associated with @a
256251881Speter * local_abspath) to @a new_revnum after a commit succeeds, recursing
257251881Speter * if @a recurse is set.
258251881Speter *
259251881Speter * @a new_date is the (server-side) date of the new revision, or 0.
260251881Speter *
261251881Speter * @a rev_author is the (server-side) author of the new
262251881Speter * revision; it may be @c NULL.
263251881Speter *
264251881Speter * @a new_dav_cache is a hash of dav property changes to be made to
265251881Speter * the @a local_abspath.
266251881Speter *   ### [JAF]  Is it? See svn_wc_queue_committed3(). It ends up being
267251881Speter *   ### assigned as a whole to wc.db:BASE_NODE:dav_cache.
268251881Speter *
269251881Speter * If @a no_unlock is set, don't release any user locks on @a
270251881Speter * local_abspath; otherwise release them as part of this processing.
271251881Speter *
272251881Speter * If @a keep_changelist is set, don't remove any changeset assignments
273251881Speter * from @a local_abspath; otherwise, clear it of such assignments.
274251881Speter *
275251881Speter * If @a sha1_checksum is non-NULL, use it to identify the node's pristine
276251881Speter * text.
277251881Speter *
278251881Speter * Set TOP_OF_RECURSE to TRUE to show that this the top of a possibly
279251881Speter * recursive commit operation.
280251881Speter */
281251881Spetersvn_error_t *
282251881Spetersvn_wc__process_committed_internal(svn_wc__db_t *db,
283251881Speter                                   const char *local_abspath,
284251881Speter                                   svn_boolean_t recurse,
285251881Speter                                   svn_boolean_t top_of_recurse,
286251881Speter                                   svn_revnum_t new_revnum,
287251881Speter                                   apr_time_t new_date,
288251881Speter                                   const char *rev_author,
289251881Speter                                   apr_hash_t *new_dav_cache,
290251881Speter                                   svn_boolean_t no_unlock,
291251881Speter                                   svn_boolean_t keep_changelist,
292251881Speter                                   const svn_checksum_t *sha1_checksum,
293251881Speter                                   const svn_wc_committed_queue_t *queue,
294251881Speter                                   apr_pool_t *scratch_pool);
295251881Speter
296251881Speter
297251881Speter/*** Update traversals. ***/
298251881Speter
299251881Speterstruct svn_wc_traversal_info_t
300251881Speter{
301251881Speter  /* The pool in which this structure and everything inside it is
302251881Speter     allocated. */
303251881Speter  apr_pool_t *pool;
304251881Speter
305251881Speter  /* The before and after values of the SVN_PROP_EXTERNALS property,
306251881Speter   * for each directory on which that property changed.  These have
307251881Speter   * the same layout as those returned by svn_wc_edited_externals().
308251881Speter   *
309251881Speter   * The hashes, their keys, and their values are allocated in the
310251881Speter   * above pool.
311251881Speter   */
312251881Speter  apr_hash_t *externals_old;
313251881Speter  apr_hash_t *externals_new;
314251881Speter
315251881Speter  /* The ambient depths of the working copy directories.  The keys are
316251881Speter     working copy paths (as for svn_wc_edited_externals()), the values
317251881Speter     are the result of svn_depth_to_word(depth_of_each_dir). */
318251881Speter  apr_hash_t *depths;
319251881Speter};
320251881Speter
321251881Speter
322251881Speter/*** Names and file/dir operations in the administrative area. ***/
323251881Speter
324251881Speter/** The files within the administrative subdir. **/
325251881Speter#define SVN_WC__ADM_FORMAT              "format"
326251881Speter#define SVN_WC__ADM_ENTRIES             "entries"
327251881Speter#define SVN_WC__ADM_TMP                 "tmp"
328251881Speter#define SVN_WC__ADM_PRISTINE            "pristine"
329251881Speter#define SVN_WC__ADM_NONEXISTENT_PATH    "nonexistent-path"
330251881Speter
331251881Speter/* The basename of the ".prej" file, if a directory ever has property
332251881Speter   conflicts.  This .prej file will appear *within* the conflicted
333251881Speter   directory.  */
334251881Speter#define SVN_WC__THIS_DIR_PREJ           "dir_conflicts"
335251881Speter
336251881Speter
337251881Speter/* A few declarations for stuff in util.c.
338251881Speter * If this section gets big, move it all out into a new util.h file. */
339251881Speter
340251881Speter/* Ensure that DIR exists. */
341251881Spetersvn_error_t *svn_wc__ensure_directory(const char *path, apr_pool_t *pool);
342251881Speter
343251881Speter
344251881Speter/* Return a hash keyed by 'const char *' property names and with
345251881Speter   'svn_string_t *' values built from PROPS (which is an array of
346251881Speter   pointers to svn_prop_t's) or to NULL if PROPS is NULL or empty.
347251881Speter   PROPS items which lack a value will be ignored.  If PROPS contains
348251881Speter   multiple properties with the same name, each successive such item
349251881Speter   reached in a walk from the beginning to the end of the array will
350251881Speter   overwrite the previous in the returned hash.
351251881Speter
352251881Speter   NOTE: While the returned hash will be allocated in RESULT_POOL, the
353251881Speter   items it holds will share storage with those in PROPS.
354251881Speter
355251881Speter   ### This is rather the reverse of svn_prop_hash_to_array(), except
356251881Speter   ### that function's arrays contains svn_prop_t's, whereas this
357251881Speter   ### one's contains *pointers* to svn_prop_t's.  So much for
358251881Speter   ### consistency.  */
359251881Speterapr_hash_t *
360251881Spetersvn_wc__prop_array_to_hash(const apr_array_header_t *props,
361251881Speter                           apr_pool_t *result_pool);
362251881Speter
363251881Speter
364251881Speter/* Set *MODIFIED_P to non-zero if LOCAL_ABSPATH's text is modified with
365251881Speter * regard to the base revision, else set *MODIFIED_P to zero.
366251881Speter *
367251881Speter * If EXACT_COMPARISON is FALSE, translate LOCAL_ABSPATH's EOL
368251881Speter * style and keywords to repository-normal form according to its properties,
369251881Speter * and compare the result with the text base.
370251881Speter * Usually, EXACT_COMPARISON should be FALSE.
371251881Speter *
372251881Speter * If LOCAL_ABSPATH does not exist, consider it unmodified.  If it exists
373251881Speter * but is not under revision control (not even scheduled for
374251881Speter * addition), return the error SVN_WC_PATH_NOT_FOUND.
375251881Speter *
376251881Speter * If the text is unmodified and a write-lock is held this function
377251881Speter * will ensure that the last-known-unmodified timestamp and
378251881Speter * filesize of the file as recorded in DB matches the corresponding
379251881Speter * attributes of the actual file.  (This is often referred to as
380251881Speter * "timestamp repair", and serves to help future unforced is-modified
381251881Speter * checks return quickly if the file remains untouched.)
382251881Speter */
383251881Spetersvn_error_t *
384251881Spetersvn_wc__internal_file_modified_p(svn_boolean_t *modified_p,
385251881Speter                                 svn_wc__db_t *db,
386251881Speter                                 const char *local_abspath,
387251881Speter                                 svn_boolean_t exact_comparison,
388251881Speter                                 apr_pool_t *scratch_pool);
389251881Speter
390251881Speter
391251881Speter/* Prepare to merge a file content change into the working copy.
392251881Speter
393251881Speter   This does not merge properties; see svn_wc__merge_props() for that.
394251881Speter   This does not necessarily change the file TARGET_ABSPATH on disk; it
395251881Speter   may instead return work items that will replace the file on disk when
396251881Speter   they are run.  ### Can we be more consistent about this?
397251881Speter
398251881Speter   Merge the difference between LEFT_ABSPATH and RIGHT_ABSPATH into
399251881Speter   TARGET_ABSPATH.
400251881Speter
401251881Speter   Set *WORK_ITEMS to the appropriate work queue operations.
402251881Speter
403251881Speter   If there are any conflicts, append a conflict description to
404251881Speter   *CONFLICT_SKEL.  (First allocate *CONFLICT_SKEL from RESULT_POOL if
405251881Speter   it is initially NULL.  CONFLICT_SKEL itself must not be NULL.)
406251881Speter   Also, unless it is considered to be a 'binary' file, mark any
407251881Speter   conflicts in the text of the file TARGET_ABSPATH using LEFT_LABEL,
408251881Speter   RIGHT_LABEL and TARGET_LABEL.
409251881Speter
410251881Speter   Set *MERGE_OUTCOME to indicate the result.
411251881Speter
412251881Speter   When DRY_RUN is true, no actual changes are made to the working copy.
413251881Speter
414251881Speter   If DIFF3_CMD is specified, the given external diff3 tool will
415251881Speter   be used instead of our built in diff3 routines.
416251881Speter
417251881Speter   When MERGE_OPTIONS are specified, they are used by the internal
418251881Speter   diff3 routines, or passed to the external diff3 tool.
419251881Speter
420251881Speter   WRI_ABSPATH describes in which working copy information should be
421251881Speter   retrieved. (Interesting for merging file externals).
422251881Speter
423251881Speter   OLD_ACTUAL_PROPS is the set of actual properties before merging; used for
424251881Speter   detranslating the file before merging.  This is necessary because, in
425251881Speter   the case of updating, the update can have sent new properties, so we
426251881Speter   cannot simply fetch and use the current actual properties.
427251881Speter
428251881Speter     ### Is OLD_ACTUAL_PROPS still necessary, now that we first prepare the
429251881Speter         content change and property change and then apply them both to
430251881Speter         the WC together?
431251881Speter
432251881Speter   Property changes sent by the update are provided in PROP_DIFF.
433251881Speter
434251881Speter   For a complete description, see svn_wc_merge5() for which this is
435251881Speter   the (loggy) implementation.
436251881Speter
437251881Speter   *WORK_ITEMS will be allocated in RESULT_POOL. All temporary allocations
438251881Speter   will be performed in SCRATCH_POOL.
439251881Speter*/
440251881Spetersvn_error_t *
441251881Spetersvn_wc__internal_merge(svn_skel_t **work_items,
442251881Speter                       svn_skel_t **conflict_skel,
443251881Speter                       enum svn_wc_merge_outcome_t *merge_outcome,
444251881Speter                       svn_wc__db_t *db,
445251881Speter                       const char *left_abspath,
446251881Speter                       const char *right_abspath,
447251881Speter                       const char *target_abspath,
448251881Speter                       const char *wri_abspath,
449251881Speter                       const char *left_label,
450251881Speter                       const char *right_label,
451251881Speter                       const char *target_label,
452251881Speter                       apr_hash_t *old_actual_props,
453251881Speter                       svn_boolean_t dry_run,
454251881Speter                       const char *diff3_cmd,
455251881Speter                       const apr_array_header_t *merge_options,
456251881Speter                       const apr_array_header_t *prop_diff,
457251881Speter                       svn_cancel_func_t cancel_func,
458251881Speter                       void *cancel_baton,
459251881Speter                       apr_pool_t *result_pool,
460251881Speter                       apr_pool_t *scratch_pool);
461251881Speter
462251881Speter/* A default error handler for svn_wc_walk_entries3().  Returns ERR in
463251881Speter   all cases. */
464251881Spetersvn_error_t *
465251881Spetersvn_wc__walker_default_error_handler(const char *path,
466251881Speter                                     svn_error_t *err,
467251881Speter                                     void *walk_baton,
468251881Speter                                     apr_pool_t *pool);
469251881Speter
470251881Speter/* Set *EDITOR and *EDIT_BATON to an ambient-depth-based filtering
471251881Speter * editor that wraps WRAPPED_EDITOR and WRAPPED_BATON.  This is only
472251881Speter * required for operations where the requested depth is @c
473251881Speter * svn_depth_unknown and the server's editor driver doesn't understand
474251881Speter * depth.  It is safe for *EDITOR and *EDIT_BATON to start as
475251881Speter * WRAPPED_EDITOR and WRAPPED_BATON.
476251881Speter *
477251881Speter * ANCHOR, TARGET, and DB are as in svn_wc_get_update_editor3.
478251881Speter *
479251881Speter * @a requested_depth must be one of the following depth values:
480251881Speter * @c svn_depth_infinity, @c svn_depth_empty, @c svn_depth_files,
481251881Speter * @c svn_depth_immediates, or @c svn_depth_unknown.
482251881Speter *
483251881Speter * Allocations are done in POOL.
484251881Speter */
485251881Spetersvn_error_t *
486251881Spetersvn_wc__ambient_depth_filter_editor(const svn_delta_editor_t **editor,
487251881Speter                                    void **edit_baton,
488251881Speter                                    svn_wc__db_t *db,
489251881Speter                                    const char *anchor_abspath,
490251881Speter                                    const char *target,
491251881Speter                                    const svn_delta_editor_t *wrapped_editor,
492251881Speter                                    void *wrapped_edit_baton,
493251881Speter                                    apr_pool_t *result_pool);
494251881Speter
495251881Speter
496251881Speter/* Similar to svn_wc_conflicted_p3(), but with a wc_db parameter in place of
497251881Speter * a wc_context. */
498251881Spetersvn_error_t *
499251881Spetersvn_wc__internal_conflicted_p(svn_boolean_t *text_conflicted_p,
500251881Speter                              svn_boolean_t *prop_conflicted_p,
501251881Speter                              svn_boolean_t *tree_conflicted_p,
502251881Speter                              svn_wc__db_t *db,
503251881Speter                              const char *local_abspath,
504251881Speter                              apr_pool_t *scratch_pool);
505251881Speter
506251881Speter/* Similar to svn_wc__internal_conflicted_p(), but ignores
507251881Speter * moved-away-edit tree conflicts.  If CONFLICT_IGNORED_P is not NULL
508251881Speter * then sets *CONFLICT_IGNORED_P TRUE if a tree-conflict is ignored
509251881Speter * and FALSE otherwise. Also ignores text and property conflicts if
510251881Speter * TREE_ONLY is TRUE */
511251881Spetersvn_error_t *
512251881Spetersvn_wc__conflicted_for_update_p(svn_boolean_t *conflicted_p,
513251881Speter                                svn_boolean_t *conflict_ignored_p,
514251881Speter                                svn_wc__db_t *db,
515251881Speter                                const char *local_abspath,
516251881Speter                                svn_boolean_t tree_only,
517251881Speter                                apr_pool_t *scratch_pool);
518251881Speter
519251881Speter
520251881Speter/* Internal version of svn_wc_transmit_text_deltas3(). */
521251881Spetersvn_error_t *
522251881Spetersvn_wc__internal_transmit_text_deltas(const char **tempfile,
523251881Speter                                      const svn_checksum_t **new_text_base_md5_checksum,
524251881Speter                                      const svn_checksum_t **new_text_base_sha1_checksum,
525251881Speter                                      svn_wc__db_t *db,
526251881Speter                                      const char *local_abspath,
527251881Speter                                      svn_boolean_t fulltext,
528251881Speter                                      const svn_delta_editor_t *editor,
529251881Speter                                      void *file_baton,
530251881Speter                                      apr_pool_t *result_pool,
531251881Speter                                      apr_pool_t *scratch_pool);
532251881Speter
533251881Speter/* Internal version of svn_wc_transmit_prop_deltas2(). */
534251881Spetersvn_error_t *
535251881Spetersvn_wc__internal_transmit_prop_deltas(svn_wc__db_t *db,
536251881Speter                                     const char *local_abspath,
537251881Speter                                     const svn_delta_editor_t *editor,
538251881Speter                                     void *baton,
539251881Speter                                     apr_pool_t *scratch_pool);
540251881Speter
541251881Speter/* Library-internal version of svn_wc_ensure_adm4(). */
542251881Spetersvn_error_t *
543251881Spetersvn_wc__internal_ensure_adm(svn_wc__db_t *db,
544251881Speter                            const char *local_abspath,
545251881Speter                            const char *url,
546251881Speter                            const char *repos_root_url,
547251881Speter                            const char *repos_uuid,
548251881Speter                            svn_revnum_t revision,
549251881Speter                            svn_depth_t depth,
550251881Speter                            apr_pool_t *scratch_pool);
551251881Speter
552251881Speter
553251881Speter/* Library-internal version of svn_wc__changelist_match(). */
554251881Spetersvn_boolean_t
555251881Spetersvn_wc__internal_changelist_match(svn_wc__db_t *db,
556251881Speter                                  const char *local_abspath,
557251881Speter                                  const apr_hash_t *clhash,
558251881Speter                                  apr_pool_t *scratch_pool);
559251881Speter
560251881Speter/* Library-internal version of svn_wc_walk_status(), which see. */
561251881Spetersvn_error_t *
562251881Spetersvn_wc__internal_walk_status(svn_wc__db_t *db,
563251881Speter                             const char *local_abspath,
564251881Speter                             svn_depth_t depth,
565251881Speter                             svn_boolean_t get_all,
566251881Speter                             svn_boolean_t no_ignore,
567251881Speter                             svn_boolean_t ignore_text_mods,
568251881Speter                             const apr_array_header_t *ignore_patterns,
569251881Speter                             svn_wc_status_func4_t status_func,
570251881Speter                             void *status_baton,
571251881Speter                             svn_cancel_func_t cancel_func,
572251881Speter                             void *cancel_baton,
573251881Speter                             apr_pool_t *scratch_pool);
574251881Speter
575251881Speter/** A callback invoked by the generic node-walker function.  */
576251881Spetertypedef svn_error_t *(*svn_wc__node_found_func_t)(const char *local_abspath,
577251881Speter                                                  svn_node_kind_t kind,
578251881Speter                                                  void *walk_baton,
579251881Speter                                                  apr_pool_t *scratch_pool);
580251881Speter
581251881Speter/* Call @a walk_callback with @a walk_baton for @a local_abspath and all
582251881Speter   nodes underneath it, restricted by @a walk_depth, and possibly
583251881Speter   @a changelists.
584251881Speter
585251881Speter   If @a show_hidden is true, include hidden nodes, else ignore them.
586251881Speter   If CHANGELISTS is non-NULL and non-empty, filter thereon. */
587251881Spetersvn_error_t *
588251881Spetersvn_wc__internal_walk_children(svn_wc__db_t *db,
589251881Speter                               const char *local_abspath,
590251881Speter                               svn_boolean_t show_hidden,
591251881Speter                               const apr_array_header_t *changelists,
592251881Speter                               svn_wc__node_found_func_t walk_callback,
593251881Speter                               void *walk_baton,
594251881Speter                               svn_depth_t walk_depth,
595251881Speter                               svn_cancel_func_t cancel_func,
596251881Speter                               void *cancel_baton,
597251881Speter                               apr_pool_t *scratch_pool);
598251881Speter
599251881Speter/* Library-internal version of svn_wc_remove_from_revision_control2,
600251881Speter   which see.*/
601251881Spetersvn_error_t *
602251881Spetersvn_wc__internal_remove_from_revision_control(svn_wc__db_t *db,
603251881Speter                                              const char *local_abspath,
604251881Speter                                              svn_boolean_t destroy_wf,
605251881Speter                                              svn_cancel_func_t cancel_func,
606251881Speter                                              void *cancel_baton,
607251881Speter                                              apr_pool_t *scratch_pool);
608251881Speter
609251881Speter/* Library-internal version of svn_wc__node_get_schedule(). */
610251881Spetersvn_error_t *
611251881Spetersvn_wc__internal_node_get_schedule(svn_wc_schedule_t *schedule,
612251881Speter                                   svn_boolean_t *copied,
613251881Speter                                   svn_wc__db_t *db,
614251881Speter                                   const char *local_abspath,
615251881Speter                                   apr_pool_t *scratch_pool);
616251881Speter
617251881Speter/* Internal version of svn_wc__node_get_origin() */
618251881Spetersvn_error_t *
619251881Spetersvn_wc__internal_get_origin(svn_boolean_t *is_copy,
620251881Speter                            svn_revnum_t *revision,
621251881Speter                            const char **repos_relpath,
622251881Speter                            const char **repos_root_url,
623251881Speter                            const char **repos_uuid,
624251881Speter                            const char **copy_root_abspath,
625251881Speter                            svn_wc__db_t *db,
626251881Speter                            const char *local_abspath,
627251881Speter                            svn_boolean_t scan_deleted,
628251881Speter                            apr_pool_t *result_pool,
629251881Speter                            apr_pool_t *scratch_pool);
630251881Speter
631251881Speter/* Internal version of svn_wc__node_get_repos_info() */
632251881Spetersvn_error_t *
633251881Spetersvn_wc__internal_get_repos_info(svn_revnum_t *revision,
634251881Speter                                const char **repos_relpath,
635251881Speter                                const char **repos_root_url,
636251881Speter                                const char **repos_uuid,
637251881Speter                                svn_wc__db_t *db,
638251881Speter                                const char *local_abspath,
639251881Speter                                apr_pool_t *result_pool,
640251881Speter                                apr_pool_t *scratch_pool);
641251881Speter
642251881Speter/* Upgrade the wc sqlite database given in SDB for the wc located at
643251881Speter   WCROOT_ABSPATH. It's current/starting format is given by START_FORMAT.
644251881Speter   After the upgrade is complete (to as far as the automatic upgrade will
645251881Speter   perform), the resulting format is RESULT_FORMAT. All allocations are
646251881Speter   performed in SCRATCH_POOL.  */
647251881Spetersvn_error_t *
648251881Spetersvn_wc__upgrade_sdb(int *result_format,
649251881Speter                    const char *wcroot_abspath,
650251881Speter                    svn_sqlite__db_t *sdb,
651251881Speter                    int start_format,
652251881Speter                    apr_pool_t *scratch_pool);
653251881Speter
654251881Speter/* Create a conflict skel from the old separated data */
655251881Spetersvn_error_t *
656251881Spetersvn_wc__upgrade_conflict_skel_from_raw(svn_skel_t **conflicts,
657251881Speter                                       svn_wc__db_t *db,
658251881Speter                                       const char *wri_abspath,
659251881Speter                                       const char *local_relpath,
660251881Speter                                       const char *conflict_old,
661251881Speter                                       const char *conflict_wrk,
662251881Speter                                       const char *conflict_new,
663251881Speter                                       const char *prej_file,
664251881Speter                                       const char *tree_conflict_data,
665251881Speter                                       apr_size_t tree_conflict_len,
666251881Speter                                       apr_pool_t *result_pool,
667251881Speter                                       apr_pool_t *scratch_pool);
668251881Speter
669251881Spetersvn_error_t *
670251881Spetersvn_wc__wipe_postupgrade(const char *dir_abspath,
671251881Speter                         svn_boolean_t whole_admin,
672251881Speter                         svn_cancel_func_t cancel_func,
673251881Speter                         void *cancel_baton,
674251881Speter                         apr_pool_t *scratch_pool);
675251881Speter
676251881Speter/* Ensure LOCAL_ABSPATH is still locked in DB.  Returns the error
677251881Speter * SVN_ERR_WC_NOT_LOCKED if this is not the case.
678251881Speter */
679251881Spetersvn_error_t *
680251881Spetersvn_wc__write_check(svn_wc__db_t *db,
681251881Speter                    const char *local_abspath,
682251881Speter                    apr_pool_t *scratch_pool);
683251881Speter
684251881Speter/* Read into CONFLICTS svn_wc_conflict_description2_t* structs
685251881Speter * for all conflicts that have LOCAL_ABSPATH as victim.
686251881Speter *
687251881Speter * Victim must be versioned or be part of a tree conflict.
688251881Speter *
689251881Speter * If CREATE_TEMPFILES is TRUE, create temporary files for property conflicts.
690251881Speter *
691251881Speter * Allocate *CONFLICTS in RESULT_POOL and do temporary allocations in
692251881Speter * SCRATCH_POOL
693251881Speter */
694251881Spetersvn_error_t *
695251881Spetersvn_wc__read_conflicts(const apr_array_header_t **conflicts,
696251881Speter                       svn_wc__db_t *db,
697251881Speter                       const char *local_abspath,
698251881Speter                       svn_boolean_t create_tempfiles,
699251881Speter                       apr_pool_t *result_pool,
700251881Speter                       apr_pool_t *scratch_pool);
701251881Speter
702251881Speter
703251881Speter/* Perform the actual merge of file changes between an original file,
704251881Speter   identified by ORIGINAL_CHECKSUM (an empty file if NULL) to a new file
705251881Speter   identified by NEW_CHECKSUM in the working copy identified by WRI_ABSPATH.
706251881Speter
707251881Speter   Merge the result into LOCAL_ABSPATH, which is part of the working copy
708251881Speter   identified by WRI_ABSPATH. Use OLD_REVISION and TARGET_REVISION for naming
709251881Speter   the intermediate files.
710251881Speter
711251881Speter   Set *FOUND_TEXT_CONFLICT to TRUE when the merge encountered a conflict,
712251881Speter   otherwise to FALSE.
713251881Speter
714251881Speter   The rest of the arguments are passed to svn_wc__internal_merge.
715251881Speter */
716251881Spetersvn_error_t *
717251881Spetersvn_wc__perform_file_merge(svn_skel_t **work_items,
718251881Speter                           svn_skel_t **conflict_skel,
719251881Speter                           svn_boolean_t *found_conflict,
720251881Speter                           svn_wc__db_t *db,
721251881Speter                           const char *local_abspath,
722251881Speter                           const char *wri_abspath,
723251881Speter                           const svn_checksum_t *new_checksum,
724251881Speter                           const svn_checksum_t *original_checksum,
725251881Speter                           apr_hash_t *old_actual_props,
726251881Speter                           const apr_array_header_t *ext_patterns,
727251881Speter                           svn_revnum_t old_revision,
728251881Speter                           svn_revnum_t target_revision,
729251881Speter                           const apr_array_header_t *propchanges,
730251881Speter                           const char *diff3_cmd,
731251881Speter                           svn_cancel_func_t cancel_func,
732251881Speter                           void *cancel_baton,
733251881Speter                           apr_pool_t *result_pool,
734251881Speter                           apr_pool_t *scratch_pool);
735251881Speter
736251881Speter
737251881Speter/* Couple of random helpers for the Ev2 shims.
738251881Speter   ### These will eventually be obsoleted and removed. */
739251881Speterstruct svn_wc__shim_fetch_baton_t
740251881Speter{
741251881Speter  svn_wc__db_t *db;
742251881Speter  const char *base_abspath;
743251881Speter  svn_boolean_t fetch_base;
744251881Speter};
745251881Speter
746251881Speter/* Using a BATON of struct shim_fetch_baton, return KIND for PATH. */
747251881Spetersvn_error_t *
748251881Spetersvn_wc__fetch_kind_func(svn_node_kind_t *kind,
749251881Speter                        void *baton,
750251881Speter                        const char *path,
751251881Speter                        svn_revnum_t base_revision,
752251881Speter                        apr_pool_t *scratch_pool);
753251881Speter
754251881Speter/* Using a BATON of struct shim_fetch_baton, return PROPS for PATH. */
755251881Spetersvn_error_t *
756251881Spetersvn_wc__fetch_props_func(apr_hash_t **props,
757251881Speter                         void *baton,
758251881Speter                         const char *path,
759251881Speter                         svn_revnum_t base_revision,
760251881Speter                         apr_pool_t *result_pool,
761251881Speter                         apr_pool_t *scratch_pool);
762251881Speter
763251881Speter/* Using a BATON of struct shim_fetch_baton, return a delta base for PATH. */
764251881Spetersvn_error_t *
765251881Spetersvn_wc__fetch_base_func(const char **filename,
766251881Speter                        void *baton,
767251881Speter                        const char *path,
768251881Speter                        svn_revnum_t base_revision,
769251881Speter                        apr_pool_t *result_pool,
770251881Speter                        apr_pool_t *scratch_pool);
771251881Speter
772251881Speter/* Find duplicate targets in *EXTERNALS, a list of svn_wc_external_item2_t*
773251881Speter * elements, and store each target string in *DUPLICATE_TARGETS as const
774251881Speter * char * elements. *DUPLICATE_TARGETS will be NULL if no duplicates were
775251881Speter * found. */
776251881Spetersvn_error_t *
777251881Spetersvn_wc__externals_find_target_dups(apr_array_header_t **duplicate_targets,
778251881Speter                                   apr_array_header_t *externals,
779251881Speter                                   apr_pool_t *pool,
780251881Speter                                   apr_pool_t *scratch_pool);
781251881Speter
782251881Speter/* Revert tree LOCAL_ABSPATH to depth DEPTH and notify for all
783251881Speter   reverts. */
784251881Spetersvn_error_t *
785251881Spetersvn_wc__revert_internal(svn_wc__db_t *db,
786251881Speter                        const char *local_abspath,
787251881Speter                        svn_depth_t depth,
788251881Speter                        svn_boolean_t use_commit_times,
789251881Speter                        svn_cancel_func_t cancel_func,
790251881Speter                        void *cancel_baton,
791251881Speter                        svn_wc_notify_func2_t notify_func,
792251881Speter                        void *notify_baton,
793251881Speter                        apr_pool_t *scratch_pool);
794251881Speter
795251881Spetersvn_error_t *
796251881Spetersvn_wc__node_has_local_mods(svn_boolean_t *modified,
797251881Speter                            svn_boolean_t *all_edits_are_deletes,
798251881Speter                            svn_wc__db_t *db,
799251881Speter                            const char *local_abspath,
800251881Speter                            svn_cancel_func_t cancel_func,
801251881Speter                            void *cancel_baton,
802251881Speter                            apr_pool_t *scratch_pool);
803251881Speter
804251881Speter#ifdef __cplusplus
805251881Speter}
806251881Speter#endif /* __cplusplus */
807251881Speter
808251881Speter#endif /* SVN_LIBSVN_WC_H */
809