]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/subversion/subversion/include/private/svn_wc_private.h
Update Subversion to 1.14.0 LTS. See contrib/subversion/CHANGES for a
[FreeBSD/FreeBSD.git] / contrib / subversion / subversion / include / private / svn_wc_private.h
1 /**
2  * @copyright
3  * ====================================================================
4  *    Licensed to the Apache Software Foundation (ASF) under one
5  *    or more contributor license agreements.  See the NOTICE file
6  *    distributed with this work for additional information
7  *    regarding copyright ownership.  The ASF licenses this file
8  *    to you under the Apache License, Version 2.0 (the
9  *    "License"); you may not use this file except in compliance
10  *    with the License.  You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *    Unless required by applicable law or agreed to in writing,
15  *    software distributed under the License is distributed on an
16  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  *    KIND, either express or implied.  See the License for the
18  *    specific language governing permissions and limitations
19  *    under the License.
20  * ====================================================================
21  * @endcopyright
22  *
23  * @file svn_wc_private.h
24  * @brief The Subversion Working Copy Library - Internal routines
25  *
26  * Requires:
27  *            - A working copy
28  *
29  * Provides:
30  *            - Ability to manipulate working copy's versioned data.
31  *            - Ability to manipulate working copy's administrative files.
32  *
33  * Used By:
34  *            - Clients.
35  */
36
37 #ifndef SVN_WC_PRIVATE_H
38 #define SVN_WC_PRIVATE_H
39
40 #include "svn_types.h"
41 #include "svn_wc.h"
42 #include "private/svn_diff_tree.h"
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif /* __cplusplus */
47
48
49 /* Return TRUE iff CLHASH (a hash whose keys are const char *
50    changelist names) is NULL or if LOCAL_ABSPATH is part of a changelist in
51    CLHASH. */
52 svn_boolean_t
53 svn_wc__changelist_match(svn_wc_context_t *wc_ctx,
54                          const char *local_abspath,
55                          const apr_hash_t *clhash,
56                          apr_pool_t *scratch_pool);
57
58 /* Like svn_wc_get_update_editorX and svn_wc_get_status_editorX, but only
59    allows updating a file external LOCAL_ABSPATH.
60
61    Since this only deals with files, the WCROOT_IPROPS argument in
62    svn_wc_get_update_editorX and svn_wc_get_status_editorX (hashes mapping
63    const char * absolute working copy paths, which are working copy roots, to
64    depth-first ordered arrays of svn_prop_inherited_item_t * structures) is
65    simply IPROPS here, a depth-first ordered arrays of
66    svn_prop_inherited_item_t * structs. */
67 svn_error_t *
68 svn_wc__get_file_external_editor(const svn_delta_editor_t **editor,
69                                  void **edit_baton,
70                                  svn_revnum_t *target_revision,
71                                  svn_wc_context_t *wc_ctx,
72                                  const char *local_abspath,
73                                  const char *wri_abspath,
74                                  const char *url,
75                                  const char *repos_root_url,
76                                  const char *repos_uuid,
77                                  apr_array_header_t *iprops,
78                                  svn_boolean_t use_commit_times,
79                                  const char *diff3_cmd,
80                                  const apr_array_header_t *preserved_exts,
81                                  const char *record_ancestor_abspath,
82                                  const char *recorded_url,
83                                  const svn_opt_revision_t *recorded_peg_rev,
84                                  const svn_opt_revision_t *recorded_rev,
85                                  svn_wc_conflict_resolver_func2_t conflict_func,
86                                  void *conflict_baton,
87                                  svn_cancel_func_t cancel_func,
88                                  void *cancel_baton,
89                                  svn_wc_notify_func2_t notify_func,
90                                  void *notify_baton,
91                                  apr_pool_t *result_pool,
92                                  apr_pool_t *scratch_pool);
93
94 /* Like svn_wc_crawl_revisionsX, but only supports updating a file external
95    LOCAL_ABSPATH which may or may not exist yet. */
96 svn_error_t *
97 svn_wc__crawl_file_external(svn_wc_context_t *wc_ctx,
98                             const char *local_abspath,
99                             const svn_ra_reporter3_t *reporter,
100                             void *report_baton,
101                             svn_boolean_t restore_files,
102                             svn_boolean_t use_commit_times,
103                             svn_cancel_func_t cancel_func,
104                             void *cancel_baton,
105                             svn_wc_notify_func2_t notify_func,
106                             void *notify_baton,
107                             apr_pool_t *scratch_pool);
108
109 /* Check if LOCAL_ABSPATH is an external in the working copy identified
110    by WRI_ABSPATH. If not return SVN_ERR_WC_PATH_NOT_FOUND.
111
112    If it is an external return more information on this external.
113
114    If IGNORE_ENOENT, then set *external_kind to svn_node_none, when
115    LOCAL_ABSPATH is not an external instead of returning an error.
116
117    Here is an overview of how DEFINING_REVISION and
118    DEFINING_OPERATIONAL_REVISION would be set for which kinds of externals
119    definitions:
120
121      svn:externals line   DEFINING_REV.       DEFINING_OP._REV.
122
123          ^/foo@2 bar       2                   2
124      -r1 ^/foo@2 bar       1                   2
125      -r1 ^/foo   bar       1                  SVN_INVALID_REVNUM
126          ^/foo   bar      SVN_INVALID_REVNUM  SVN_INVALID_REVNUM
127          ^/foo@HEAD bar   SVN_INVALID_REVNUM  SVN_INVALID_REVNUM
128      -rHEAD ^/foo bar     -- not a valid externals definition --
129 */
130 svn_error_t *
131 svn_wc__read_external_info(svn_node_kind_t *external_kind,
132                            const char **defining_abspath,
133                            const char **defining_url,
134                            svn_revnum_t *defining_operational_revision,
135                            svn_revnum_t *defining_revision,
136                            svn_wc_context_t *wc_ctx,
137                            const char *wri_abspath,
138                            const char *local_abspath,
139                            svn_boolean_t ignore_enoent,
140                            apr_pool_t *result_pool,
141                            apr_pool_t *scratch_pool);
142
143 /** See svn_wc__committable_externals_below(). */
144 typedef struct svn_wc__committable_external_info_t {
145
146   /* The local absolute path where the external should be checked out. */
147   const char *local_abspath;
148
149   /* The relpath part of the source URL the external should be checked out
150    * from. */
151   const char *repos_relpath;
152
153   /* The root URL part of the source URL the external should be checked out
154    * from. */
155   const char *repos_root_url;
156
157   /* Set to either svn_node_file or svn_node_dir. */
158   svn_node_kind_t kind;
159
160 } svn_wc__committable_external_info_t;
161
162 /* Add svn_wc__committable_external_info_t* items to *EXTERNALS, describing
163  * 'committable' externals checked out below LOCAL_ABSPATH. Recursively find
164  * all nested externals (externals defined inside externals).
165  *
166  * In this context, a 'committable' external belongs to the same repository as
167  * LOCAL_ABSPATH, is not revision-pegged and is currently checked out in the
168  * WC. (Local modifications are not tested for.)
169  *
170  * *EXTERNALS must be initialized either to NULL or to a pointer created with
171  * apr_array_make(..., sizeof(svn_wc__committable_external_info_t *)). If
172  * *EXTERNALS is initialized to NULL, an array will be allocated from
173  * RESULT_POOL as necessary. If no committable externals are found,
174  * *EXTERNALS is left unchanged.
175  *
176  * DEPTH limits the recursion below LOCAL_ABSPATH.
177  *
178  * This function will not find externals defined in some parent WC above
179  * LOCAL_ABSPATH's WC-root.
180  *
181  * ###TODO: Add a WRI_ABSPATH (wc root indicator) separate from LOCAL_ABSPATH,
182  * to allow searching any wc-root for externals under LOCAL_ABSPATH, not only
183  * LOCAL_ABSPATH's most immediate wc-root. */
184 svn_error_t *
185 svn_wc__committable_externals_below(apr_array_header_t **externals,
186                                     svn_wc_context_t *wc_ctx,
187                                     const char *local_abspath,
188                                     svn_depth_t depth,
189                                     apr_pool_t *result_pool,
190                                     apr_pool_t *scratch_pool);
191
192 /* Gets a mapping from const char * local abspaths of externals to the const
193    char * local abspath of where they are defined for all externals defined
194    at or below LOCAL_ABSPATH.
195
196    ### Returns NULL in *EXTERNALS until we bumped to format 29.
197
198    Allocate the result in RESULT_POOL and perform temporary allocations in
199    SCRATCH_POOL. */
200 svn_error_t *
201 svn_wc__externals_defined_below(apr_hash_t **externals,
202                                 svn_wc_context_t *wc_ctx,
203                                 const char *local_abspath,
204                                 apr_pool_t *result_pool,
205                                 apr_pool_t *scratch_pool);
206
207
208 /* Registers a new external at LOCAL_ABSPATH in the working copy containing
209    DEFINING_ABSPATH.
210
211    The node is registered as defined on DEFINING_ABSPATH (must be an ancestor
212    of LOCAL_ABSPATH) of kind KIND.
213
214    The external is registered as from repository REPOS_ROOT_URL with uuid
215    REPOS_UUID and the defining relative path REPOS_RELPATH.
216
217    If the revision of the node is locked OPERATIONAL_REVISION and REVISION
218    are the peg and normal revision; otherwise their value is
219    SVN_INVALID_REVNUM.
220
221    ### Only KIND svn_node_dir is supported.
222
223    Perform temporary allocations in SCRATCH_POOL.
224  */
225 svn_error_t *
226 svn_wc__external_register(svn_wc_context_t *wc_ctx,
227                           const char *defining_abspath,
228                           const char *local_abspath,
229                           svn_node_kind_t kind,
230                           const char *repos_root_url,
231                           const char *repos_uuid,
232                           const char *repos_relpath,
233                           svn_revnum_t operational_revision,
234                           svn_revnum_t revision,
235                           apr_pool_t *scratch_pool);
236
237 /* Remove the external at LOCAL_ABSPATH from the working copy identified by
238    WRI_ABSPATH using WC_CTX.
239
240    If DECLARATION_ONLY is TRUE, only remove the registration and leave the
241    on-disk structure untouched.
242
243    If not NULL, call CANCEL_FUNC with CANCEL_BATON to allow canceling while
244    removing the working copy files.
245
246    ### This function wraps svn_wc_remove_from_revision_control2().
247  */
248 svn_error_t *
249 svn_wc__external_remove(svn_wc_context_t *wc_ctx,
250                         const char *wri_abspath,
251                         const char *local_abspath,
252                         svn_boolean_t declaration_only,
253                         svn_cancel_func_t cancel_func,
254                         void *cancel_baton,
255                         apr_pool_t *scratch_pool);
256
257 /* Gather all svn:externals property values from the actual properties on
258    directories below LOCAL_ABSPATH as a mapping of const char *local_abspath
259    to const char * values.
260
261    Use DEPTH as how it would be used to limit the externals property results
262    on update. (So any depth < infinity will only read svn:externals on
263    LOCAL_ABSPATH itself)
264
265    If DEPTHS is not NULL, set *depths to an apr_hash_t* mapping the same
266    local_abspaths to the const char * ambient depth of the node.
267
268    Allocate the result in RESULT_POOL and perform temporary allocations in
269    SCRATCH_POOL. */
270 svn_error_t *
271 svn_wc__externals_gather_definitions(apr_hash_t **externals,
272                                      apr_hash_t **ambient_depths,
273                                      svn_wc_context_t *wc_ctx,
274                                      const char *local_abspath,
275                                      svn_depth_t depth,
276                                      apr_pool_t *result_pool,
277                                      apr_pool_t *scratch_pool);
278
279 /* Close the DB for LOCAL_ABSPATH.  Perform temporary allocations in
280    SCRATCH_POOL.
281
282    Wraps svn_wc__db_drop_root(). */
283 svn_error_t *
284 svn_wc__close_db(const char *external_abspath,
285                  svn_wc_context_t *wc_ctx,
286                  apr_pool_t *scratch_pool);
287
288 /** Set @a *tree_conflict to a newly allocated @c
289  * svn_wc_conflict_description_t structure describing the tree
290  * conflict state of @a victim_abspath, or to @c NULL if @a victim_abspath
291  * is not in a state of tree conflict. @a wc_ctx is a working copy context
292  * used to access @a victim_path.  Allocate @a *tree_conflict in @a result_pool,
293  * use @a scratch_pool for temporary allocations.
294  */
295 svn_error_t *
296 svn_wc__get_tree_conflict(const svn_wc_conflict_description2_t **tree_conflict,
297                           svn_wc_context_t *wc_ctx,
298                           const char *victim_abspath,
299                           apr_pool_t *result_pool,
300                           apr_pool_t *scratch_pool);
301
302 /** Record the tree conflict described by @a conflict in the WC for
303  * @a conflict->local_abspath.  Use @a scratch_pool for all temporary
304  * allocations.
305  *
306  * Returns an SVN_ERR_WC_PATH_UNEXPECTED_STATUS error when
307  * CONFLICT->LOCAL_ABSPATH is already tree conflicted.
308  *
309  * ### This function can't set moved_away, moved_here conflicts for
310  *     any operation, except merges.
311  */
312 svn_error_t *
313 svn_wc__add_tree_conflict(svn_wc_context_t *wc_ctx,
314                           const svn_wc_conflict_description2_t *conflict,
315                           apr_pool_t *scratch_pool);
316
317 /* Remove any tree conflict on victim @a victim_abspath using @a wc_ctx.
318  * (If there is no such conflict recorded, do nothing and return success.)
319  *
320  * Do all temporary allocations in @a scratch_pool.
321  */
322 svn_error_t *
323 svn_wc__del_tree_conflict(svn_wc_context_t *wc_ctx,
324                           const char *victim_abspath,
325                           apr_pool_t *scratch_pool);
326
327 /** Check whether LOCAL_ABSPATH has a parent directory that knows about its
328  * existence. Set *IS_WCROOT to FALSE if a parent is found, and to TRUE
329  * if there is no such parent.
330  *
331  * Like svn_wc_is_wc_root2(), but doesn't consider switched subdirs or
332  * deleted entries as working copy roots.
333  */
334 svn_error_t *
335 svn_wc__is_wcroot(svn_boolean_t *is_wcroot,
336                   svn_wc_context_t *wc_ctx,
337                   const char *local_abspath,
338                   apr_pool_t *scratch_pool);
339
340
341 /** Set @a *wcroot_abspath to the local abspath of the root of the
342  * working copy in which @a local_abspath resides.
343  */
344 svn_error_t *
345 svn_wc__get_wcroot(const char **wcroot_abspath,
346                    svn_wc_context_t *wc_ctx,
347                    const char *local_abspath,
348                    apr_pool_t *result_pool,
349                    apr_pool_t *scratch_pool);
350
351 /** Set @a *dir to the abspath of the directory in which administrative
352  * data for experimental features may be stored. This directory is inside
353  * the WC's administrative directory. Ensure the directory exists.
354  *
355  * @a local_abspath is any path in the WC, and is used to find the WC root.
356  *
357  * @warning EXPERIMENTAL.
358  */
359 SVN_EXPERIMENTAL
360 svn_error_t *
361 svn_wc__get_experimental_dir(char **dir,
362                              svn_wc_context_t *wc_ctx,
363                              const char *local_abspath,
364                              apr_pool_t *result_pool,
365                              apr_pool_t *scratch_pool);
366
367 /**
368  * The following are temporary APIs to aid in the transition from wc-1 to
369  * wc-ng.  Use them for new development now, but they may be disappearing
370  * before the 1.7 release.
371  */
372
373 /*
374  * Convert from svn_wc_conflict_description2_t to
375  * svn_wc_conflict_description_t. This is needed by some backwards-compat
376  * code in libsvn_client/ctx.c
377  *
378  * Allocate the result in RESULT_POOL.
379  */
380 svn_wc_conflict_description_t *
381 svn_wc__cd2_to_cd(const svn_wc_conflict_description2_t *conflict,
382                   apr_pool_t *result_pool);
383
384
385 /*
386  * Convert from svn_wc_status3_t to svn_wc_status2_t.
387  * Allocate the result in RESULT_POOL.
388  *
389  * Deprecated because svn_wc_status2_t is deprecated and the only
390  * calls are from other deprecated functions.
391  */
392 SVN_DEPRECATED
393 svn_error_t *
394 svn_wc__status2_from_3(svn_wc_status2_t **status,
395                        const svn_wc_status3_t *old_status,
396                        svn_wc_context_t *wc_ctx,
397                        const char *local_abspath,
398                        apr_pool_t *result_pool,
399                        apr_pool_t *scratch_pool);
400
401 /**
402  * Set @a *children to a new array of the immediate children of the working
403  * node at @a dir_abspath.  The elements of @a *children are (const char *)
404  * absolute paths.
405  *
406  * Include children that are scheduled for deletion, but not those that
407  * are excluded, server-excluded or not-present.
408  *
409  * Return every path that refers to a child of the working node at
410  * @a dir_abspath.  Do not include a path just because it was a child of a
411  * deleted directory that existed at @a dir_abspath if that directory is now
412  * sheduled to be replaced by the working node at @a dir_abspath.
413  *
414  * Allocate @a *children in @a result_pool.  Use @a wc_ctx to access the
415  * working copy, and @a scratch_pool for all temporary allocations.
416  */
417 svn_error_t *
418 svn_wc__node_get_children_of_working_node(const apr_array_header_t **children,
419                                           svn_wc_context_t *wc_ctx,
420                                           const char *dir_abspath,
421                                           apr_pool_t *result_pool,
422                                           apr_pool_t *scratch_pool);
423
424 /**
425  * Gets the immediate 'not-present' children of a node.
426  *
427  * #### Needed during 'svn cp WC URL' to handle mixed revision cases
428  */
429 svn_error_t *
430 svn_wc__node_get_not_present_children(const apr_array_header_t **children,
431                                       svn_wc_context_t *wc_ctx,
432                                       const char *dir_abspath,
433                                       apr_pool_t *result_pool,
434                                       apr_pool_t *scratch_pool);
435
436 /**
437  * Fetch the repository information for the working version
438  * of the node at @a local_abspath into @a *revision, @a *repos_relpath,
439  * @a *repos_root_url and @a *repos_uuid. Use @a wc_ctx to access the working
440  * copy. Allocate results in @a result_pool.
441  *
442  * @a *revision will be set to SVN_INVALID_REVNUM for any shadowed node (including
443  * added and deleted nodes). All other output values will be set to the current
444  * values or those they would have after a commit.
445  *
446  * All output argument may be NULL, indicating no interest.
447  */
448 svn_error_t *
449 svn_wc__node_get_repos_info(svn_revnum_t *revision,
450                             const char **repos_relpath,
451                             const char **repos_root_url,
452                             const char **repos_uuid,
453                             svn_wc_context_t *wc_ctx,
454                             const char *local_abspath,
455                             apr_pool_t *result_pool,
456                             apr_pool_t *scratch_pool);
457
458 /**
459  * Get the changed revision, date and author for @a local_abspath using @a
460  * wc_ctx.  Allocate the return values in @a result_pool; use @a scratch_pool
461  * for temporary allocations.  Any of the return pointers may be @c NULL, in
462  * which case they are not set.
463  *
464  * If @a local_abspath is not in the working copy, return
465  * @c SVN_ERR_WC_PATH_NOT_FOUND.
466  */
467 svn_error_t *
468 svn_wc__node_get_changed_info(svn_revnum_t *changed_rev,
469                               apr_time_t *changed_date,
470                               const char **changed_author,
471                               svn_wc_context_t *wc_ctx,
472                               const char *local_abspath,
473                               apr_pool_t *result_pool,
474                               apr_pool_t *scratch_pool);
475
476
477 /**
478  * Set @a *url to the corresponding url for @a local_abspath, using @a wc_ctx.
479  * If the node is added, return the url it will have in the repository.
480  *
481  * If @a local_abspath is not in the working copy, return
482  * @c SVN_ERR_WC_PATH_NOT_FOUND.
483  */
484 svn_error_t *
485 svn_wc__node_get_url(const char **url,
486                      svn_wc_context_t *wc_ctx,
487                      const char *local_abspath,
488                      apr_pool_t *result_pool,
489                      apr_pool_t *scratch_pool);
490
491 /**
492  * Retrieves the origin of the node as it is known in the repository. For
493  * a copied node this retrieves where the node is copied from, for an added
494  * node this returns NULL/INVALID outputs, and for any other node this
495  * retrieves the repository location.
496  *
497  * All output arguments may be NULL.
498  *
499  * If @a is_copy is not NULL, sets @a *is_copy to TRUE if the origin is a copy
500  * of the original node.
501  *
502  * If not NULL, sets @a revision, @a repos_relpath, @a repos_root_url and
503  * @a repos_uuid to the original (if a copy) or their current values.
504  *
505  * If not NULL, set @a depth, to the recorded depth on @a local_abspath.
506  *
507  * If @a copy_root_abspath is not NULL, and @a *is_copy indicates that the
508  * node was copied, set @a *copy_root_abspath to the local absolute path of
509  * the root of the copied subtree containing the node. If the copied node is
510  * a root by itself, @a *copy_root_abspath will match @a local_abspath (but
511  * won't necessarily point to the same string in memory).
512  *
513  * If @a scan_deleted is TRUE, determine the origin of the deleted node. If
514  * @a scan_deleted is FALSE, return NULL, SVN_INVALID_REVNUM or FALSE for
515  * deleted nodes.
516  *
517  * Allocate the result in @a result_pool. Perform temporary allocations in
518  * @a scratch_pool */
519 svn_error_t *
520 svn_wc__node_get_origin(svn_boolean_t *is_copy,
521                         svn_revnum_t *revision,
522                         const char **repos_relpath,
523                         const char **repos_root_url,
524                         const char **repos_uuid,
525                         svn_depth_t *depth,
526                         const char **copy_root_abspath,
527                         svn_wc_context_t *wc_ctx,
528                         const char *local_abspath,
529                         svn_boolean_t scan_deleted,
530                         apr_pool_t *result_pool,
531                         apr_pool_t *scratch_pool);
532
533 /**
534  * Set @a *not_present to TRUE when @a local_abspath has status
535  * svn_wc__db_status_not_present. Set @a *user_excluded to TRUE when
536  * @a local_abspath has status svn_wc__db_status_excluded. Set
537  * @a *server_excluded to TRUE when @a local_abspath has status
538  * svn_wc__db_status_server_excluded. Otherwise set these values to FALSE.
539  * If @a base_only is TRUE then only the base node will be examined,
540  * otherwise the current base or working node will be examined.
541  *
542  * If a value is not interesting you can pass NULL.
543  *
544  * If @a local_abspath is not in the working copy, return
545  * @c SVN_ERR_WC_PATH_NOT_FOUND.  Use @a scratch_pool for all temporary
546  * allocations.
547  */
548 svn_error_t *
549 svn_wc__node_is_not_present(svn_boolean_t *not_present,
550                             svn_boolean_t *user_excluded,
551                             svn_boolean_t *server_excluded,
552                             svn_wc_context_t *wc_ctx,
553                             const char *local_abspath,
554                             svn_boolean_t base_only,
555                             apr_pool_t *scratch_pool);
556
557 /**
558  * Set @a *is_added to whether @a local_abspath is added, using
559  * @a wc_ctx.  If @a local_abspath is not in the working copy, return
560  * @c SVN_ERR_WC_PATH_NOT_FOUND.  Use @a scratch_pool for all temporary
561  * allocations.
562  *
563  * NOTE: "added" in this sense, means it was added, copied-here, or
564  *   moved-here. This function provides NO information on whether this
565  *   addition has replaced another node.
566  *
567  *   To be clear, this does NOT correspond to svn_wc_schedule_add.
568  */
569 svn_error_t *
570 svn_wc__node_is_added(svn_boolean_t *is_added,
571                       svn_wc_context_t *wc_ctx,
572                       const char *local_abspath,
573                       apr_pool_t *scratch_pool);
574
575 /**
576  * Set @a *has_working to whether @a local_abspath has a working node (which
577  * might shadow BASE nodes)
578  *
579  * This is a check similar to status = added or status = deleted.
580  */
581 svn_error_t *
582 svn_wc__node_has_working(svn_boolean_t *has_working,
583                          svn_wc_context_t *wc_ctx,
584                          const char *local_abspath,
585                          apr_pool_t *scratch_pool);
586
587
588 /**
589  * Get the repository location of the base node at @a local_abspath.
590  *
591  * Set *REVISION, *REPOS_RELPATH, *REPOS_ROOT_URL *REPOS_UUID and *LOCK_TOKEN
592  * to the location that this node was checked out at or last updated/switched
593  * to, regardless of any uncommitted changes (delete, replace and/or copy-here/
594  * move-here).
595  *
596  * If there is no BASE node at @a local_abspath or if @a show_hidden is FALSE,
597  * no status 'normal' or 'incomplete' BASE node report
598  * SVN_ERR_WC_PATH_NOT_FOUND, or if @a ignore_enoent is TRUE, @a kind
599  * svn_node_unknown, @a revision SVN_INVALID_REVNUM and all other values NULL.
600  *
601  * All output arguments may be NULL.
602  *
603  * Allocate the results in @a result_pool. Perform temporary allocations in
604  * @a scratch_pool.
605  */
606 svn_error_t *
607 svn_wc__node_get_base(svn_node_kind_t *kind,
608                       svn_revnum_t *revision,
609                       const char **repos_relpath,
610                       const char **repos_root_url,
611                       const char **repos_uuid,
612                       const char **lock_token,
613                       svn_wc_context_t *wc_ctx,
614                       const char *local_abspath,
615                       svn_boolean_t ignore_enoent,
616                       apr_pool_t *result_pool,
617                       apr_pool_t *scratch_pool);
618
619
620 /* Return an array of const char * elements, which represent local absolute
621  * paths for nodes, within the working copy indicated by WRI_ABSPATH, which
622  * have a basename matching BASENAME and have node kind KIND.
623  * If no such nodes exist, return an empty array.
624  *
625  * This function returns only paths to nodes which are present in the highest
626  * layer of the WC. In other words, paths to deleted and/or excluded nodes are
627  * never returned.
628  */
629 svn_error_t *
630 svn_wc__find_working_nodes_with_basename(apr_array_header_t **abspaths,
631                                          const char *wri_abspath,
632                                          const char *basename,
633                                          svn_node_kind_t kind,
634                                          svn_wc_context_t *wc_ctx,
635                                          apr_pool_t *result_pool,
636                                          apr_pool_t *scratch_pool);
637
638 /* Return an array of const char * elements, which represent local absolute
639  * paths for nodes, within the working copy indicated by WRI_ABSPATH, which
640  * are copies of REPOS_RELPATH and have node kind KIND.
641  * If no such nodes exist, return an empty array.
642  *
643  * This function returns only paths to nodes which are present in the highest
644  * layer of the WC. In other words, paths to deleted and/or excluded nodes are
645  * never returned.
646  */
647 svn_error_t *
648 svn_wc__find_copies_of_repos_path(apr_array_header_t **abspaths,
649                                   const char *wri_abspath,
650                                   const char *repos_relpath,
651                                   svn_node_kind_t kind,
652                                   svn_wc_context_t *wc_ctx,
653                                   apr_pool_t *result_pool,
654                                   apr_pool_t *scratch_pool);
655
656 /* Get the working revision of @a local_abspath using @a wc_ctx. If @a
657  * local_abspath is not in the working copy, return @c
658  * SVN_ERR_WC_PATH_NOT_FOUND.
659  *
660  * This function is meant as a temporary solution for using the old-style
661  * semantics of entries. It will handle any uncommitted changes (delete,
662  * replace and/or copy-here/move-here).
663  *
664  * For a delete the @a revision is the BASE node of the operation root, e.g
665  * the path that was deleted. But if the delete is  below an add, the
666  * revision is set to SVN_INVALID_REVNUM. For an add, copy or move we return
667  * SVN_INVALID_REVNUM. In case of a replacement, we return the BASE
668  * revision.
669  *
670  * The @a changed_rev is set to the latest committed change to @a
671  * local_abspath before or equal to @a revision, unless the node is
672  * copied-here or moved-here. Then it is the revision of the latest committed
673  * change before or equal to the copyfrom_rev.  NOTE, that we use
674  * SVN_INVALID_REVNUM for a scheduled copy or move.
675  *
676  * The @a changed_date and @a changed_author are the ones associated with @a
677  * changed_rev.
678  */
679 svn_error_t *
680 svn_wc__node_get_pre_ng_status_data(svn_revnum_t *revision,
681                                     svn_revnum_t *changed_rev,
682                                     apr_time_t *changed_date,
683                                     const char **changed_author,
684                                     svn_wc_context_t *wc_ctx,
685                                     const char *local_abspath,
686                                     apr_pool_t *result_pool,
687                                     apr_pool_t *scratch_pool);
688
689 /**
690  * Acquire a recursive write lock for @a local_abspath.  If @a lock_anchor
691  * is true, determine if @a local_abspath has an anchor that should be locked
692  * instead; otherwise, @a local_abspath must be a versioned directory.
693  * Store the obtained lock in @a wc_ctx.
694  *
695  * If @a lock_root_abspath is not NULL, store the root of the lock in
696  * @a *lock_root_abspath. If @a lock_root_abspath is NULL, then @a
697  * lock_anchor must be FALSE.
698  *
699  * Returns @c SVN_ERR_WC_LOCKED if an existing lock is encountered, in
700  * which case any locks acquired will have been released.
701  *
702  * If @a lock_anchor is TRUE and @a lock_root_abspath is not NULL, @a
703  * lock_root_abspath will be set even when SVN_ERR_WC_LOCKED is returned.
704  */
705 svn_error_t *
706 svn_wc__acquire_write_lock(const char **lock_root_abspath,
707                            svn_wc_context_t *wc_ctx,
708                            const char *local_abspath,
709                            svn_boolean_t lock_anchor,
710                            apr_pool_t *result_pool,
711                            apr_pool_t *scratch_pool);
712
713
714 /**
715  * Recursively release write locks for @a local_abspath, using @a wc_ctx
716  * for working copy access.  Only locks held by @a wc_ctx are released.
717  * Locks are not removed if work queue items are present.
718  *
719  * If @a local_abspath is not the root of an owned SVN_ERR_WC_NOT_LOCKED
720  * is returned.
721  */
722 svn_error_t *
723 svn_wc__release_write_lock(svn_wc_context_t *wc_ctx,
724                            const char *local_abspath,
725                            apr_pool_t *scratch_pool);
726
727 /** A callback invoked by the svn_wc__call_with_write_lock() function.  */
728 typedef svn_error_t *(*svn_wc__with_write_lock_func_t)(void *baton,
729                                                        apr_pool_t *result_pool,
730                                                        apr_pool_t *scratch_pool);
731
732
733 /** Call function @a func while holding a write lock on
734  * @a local_abspath. The @a baton, and @a result_pool and
735  * @a scratch_pool, is passed @a func.
736  *
737  * If @a lock_anchor is TRUE, determine if @a local_abspath has an anchor
738  * that should be locked instead.
739  *
740  * Use @a wc_ctx for working copy access.
741  * The lock is guaranteed to be released after @a func returns.
742  */
743 svn_error_t *
744 svn_wc__call_with_write_lock(svn_wc__with_write_lock_func_t func,
745                              void *baton,
746                              svn_wc_context_t *wc_ctx,
747                              const char *local_abspath,
748                              svn_boolean_t lock_anchor,
749                              apr_pool_t *result_pool,
750                              apr_pool_t *scratch_pool);
751
752 /** Evaluate the expression @a expr while holding a write lock on
753  * @a local_abspath.
754  *
755  * @a expr must yield an (svn_error_t *) error code.  If the error code
756  * is not #SVN_NO_ERROR, cause the function using this macro to return
757  * the error to its caller.
758  *
759  * If @a lock_anchor is TRUE, determine if @a local_abspath has an anchor
760  * that should be locked instead.
761  *
762  * Use @a wc_ctx for working copy access.
763  *
764  * The lock is guaranteed to be released after evaluating @a expr.
765  */
766 #define SVN_WC__CALL_WITH_WRITE_LOCK(expr, wc_ctx, local_abspath,             \
767                                      lock_anchor, scratch_pool)               \
768   do {                                                                        \
769     svn_error_t *svn_wc__err1, *svn_wc__err2;                                 \
770     const char *svn_wc__lock_root_abspath;                                    \
771     SVN_ERR(svn_wc__acquire_write_lock(&svn_wc__lock_root_abspath, wc_ctx,    \
772                                        local_abspath, lock_anchor,            \
773                                        scratch_pool, scratch_pool));          \
774     svn_wc__err1 = (expr);                                                    \
775     svn_wc__err2 = svn_wc__release_write_lock(                                \
776                      wc_ctx, svn_wc__lock_root_abspath, scratch_pool);        \
777     SVN_ERR(svn_error_compose_create(svn_wc__err1, svn_wc__err2));            \
778   } while (0)
779
780
781 /** A callback invoked by svn_wc__prop_list_recursive().
782  * It is equivalent to svn_proplist_receiver_t declared in svn_client.h,
783  * but kept private within the svn_wc__ namespace because it is used within
784  * the bowels of libsvn_wc which don't include svn_client.h.
785  *
786  * @since New in 1.7. */
787 typedef svn_error_t *(*svn_wc__proplist_receiver_t)(void *baton,
788                                                     const char *local_abspath,
789                                                     apr_hash_t *props,
790                                                     apr_pool_t *scratch_pool);
791
792 /** Call @a receiver_func, passing @a receiver_baton, an absolute path, and
793  * a hash table mapping <tt>const char *</tt> names onto <tt>const
794  * svn_string_t *</tt> values for all the regular properties of the node
795  * at @a local_abspath and any node beneath @a local_abspath within the
796  * specified @a depth. @a receiver_fun must not be NULL.
797  *
798  * If @a propname is not NULL, the passed hash table will only contain
799  * the property @a propname.
800  *
801  * If @a pristine is not @c TRUE, and @a base_props is FALSE show local
802  * modifications to the properties.
803  *
804  * If a node has no properties, @a receiver_func is not called for the node.
805  *
806  * If @a changelists are non-NULL and non-empty, filter by them.
807  *
808  * Use @a wc_ctx to access the working copy, and @a scratch_pool for
809  * temporary allocations.
810  *
811  * If the node at @a local_abspath does not exist,
812  * #SVN_ERR_WC_PATH_NOT_FOUND is returned.
813  *
814  * @since New in 1.7.
815  */
816 svn_error_t *
817 svn_wc__prop_list_recursive(svn_wc_context_t *wc_ctx,
818                             const char *local_abspath,
819                             const char *propname,
820                             svn_depth_t depth,
821                             svn_boolean_t pristine,
822                             const apr_array_header_t *changelists,
823                             svn_wc__proplist_receiver_t receiver_func,
824                             void *receiver_baton,
825                             svn_cancel_func_t cancel_func,
826                             void *cancel_baton,
827                             apr_pool_t *scratch_pool);
828
829 /**
830  * Set @a *inherited_props to a depth-first ordered array of
831  * #svn_prop_inherited_item_t * structures representing the properties
832  * inherited by @a local_abspath from the ACTUAL tree above
833  * @a local_abspath (looking through to the WORKING or BASE tree as
834  * required), up to and including the root of the working copy and
835  * any cached inherited properties inherited by the root.
836  *
837  * The #svn_prop_inherited_item_t->path_or_url members of the
838  * #svn_prop_inherited_item_t * structures in @a *inherited_props are
839  * paths relative to the repository root URL for cached inherited
840  * properties and absolute working copy paths otherwise.
841  *
842  * Allocate @a *inherited_props in @a result_pool.  Use @a scratch_pool
843  * for temporary allocations.
844  */
845 svn_error_t *
846 svn_wc__get_iprops(apr_array_header_t **inherited_props,
847                    svn_wc_context_t *wc_ctx,
848                    const char *local_abspath,
849                    const char *propname,
850                    apr_pool_t *result_pool,
851                    apr_pool_t *scratch_pool);
852
853 /** Obtain a mapping of const char * local_abspaths to const svn_string_t*
854  * property values in *VALUES, of all PROPNAME properties on LOCAL_ABSPATH
855  * and its descendants.
856  *
857  * Allocate the result in RESULT_POOL, and perform temporary allocations in
858  * SCRATCH_POOL.
859  */
860 svn_error_t *
861 svn_wc__prop_retrieve_recursive(apr_hash_t **values,
862                                 svn_wc_context_t *wc_ctx,
863                                 const char *local_abspath,
864                                 const char *propname,
865                                 apr_pool_t *result_pool,
866                                 apr_pool_t *scratch_pool);
867
868 /**
869  * Set @a *iprops_paths to a hash mapping const char * absolute working
870  * copy paths to the nodes repository root relative path for each path
871  * in the working copy at or below @a local_abspath, limited by @a depth,
872  * that has cached inherited properties for the base node of the path.
873  *
874  * Allocate @a *iprop_paths
875  * in @a result_pool.  Use @a scratch_pool for temporary allocations.
876  */
877 svn_error_t *
878 svn_wc__get_cached_iprop_children(apr_hash_t **iprop_paths,
879                                   svn_depth_t depth,
880                                   svn_wc_context_t *wc_ctx,
881                                   const char *local_abspath,
882                                   apr_pool_t *result_pool,
883                                   apr_pool_t *scratch_pool);
884
885
886 /**
887  * For use by entries.c and entries-dump.c to read old-format working copies.
888  */
889 svn_error_t *
890 svn_wc__read_entries_old(apr_hash_t **entries,
891                          const char *dir_abspath,
892                          apr_pool_t *result_pool,
893                          apr_pool_t *scratch_pool);
894
895 /**
896  * Recursively clear the dav cache (wcprops) in @a wc_ctx for the tree
897  * rooted at @a local_abspath.
898  */
899 svn_error_t *
900 svn_wc__node_clear_dav_cache_recursive(svn_wc_context_t *wc_ctx,
901                                        const char *local_abspath,
902                                        apr_pool_t *scratch_pool);
903
904 /**
905  * Set @a lock_tokens to a hash mapping <tt>const char *</tt> URL
906  * to <tt>const char *</tt> lock tokens for every path at or under
907  * @a local_abspath in @a wc_ctx which has such a lock token set on it.
908  * Allocate the hash and all items therein from @a result_pool.
909  */
910 svn_error_t *
911 svn_wc__node_get_lock_tokens_recursive(apr_hash_t **lock_tokens,
912                                        svn_wc_context_t *wc_ctx,
913                                        const char *local_abspath,
914                                        apr_pool_t *result_pool,
915                                        apr_pool_t *scratch_pool);
916
917 /* Set @a *min_revision and @a *max_revision to the lowest and highest revision
918  * numbers found within @a local_abspath, using context @a wc_ctx.
919  * If @a committed is TRUE, set @a *min_revision and @a *max_revision
920  * to the lowest and highest comitted (i.e. "last changed") revision numbers,
921  * respectively. Use @a scratch_pool for temporary allocations.
922  *
923  * Either of MIN_REVISION and MAX_REVISION may be passed as NULL if
924  * the caller doesn't care about that return value.
925  *
926  * This function provides a subset of the functionality of
927  * svn_wc_revision_status2() and is more efficient if the caller
928  * doesn't need all information returned by svn_wc_revision_status2(). */
929 svn_error_t *
930 svn_wc__min_max_revisions(svn_revnum_t *min_revision,
931                           svn_revnum_t *max_revision,
932                           svn_wc_context_t *wc_ctx,
933                           const char *local_abspath,
934                           svn_boolean_t committed,
935                           apr_pool_t *scratch_pool);
936
937 /* Indicate in @a is_switched whether any node beneath @a local_abspath
938  * is switched, using context @a wc_ctx.
939  * Use @a scratch_pool for temporary allocations.
940  *
941  * If @a trail_url is non-NULL, use it to determine if @a local_abspath itself
942  * is switched.  It should be any trailing portion of @a local_abspath's
943  * expected URL, long enough to include any parts that the caller considers
944  * might be changed by a switch.  If it does not match the end of
945  * @a local_abspath's actual URL, then report a "switched" status.
946  *
947  * This function provides a subset of the functionality of
948  * svn_wc_revision_status2() and is more efficient if the caller
949  * doesn't need all information returned by svn_wc_revision_status2(). */
950 svn_error_t *
951 svn_wc__has_switched_subtrees(svn_boolean_t *is_switched,
952                               svn_wc_context_t *wc_ctx,
953                               const char *local_abspath,
954                               const char *trail_url,
955                               apr_pool_t *scratch_pool);
956
957 /* Set @a *excluded_subtrees to a hash mapping <tt>const char *</tt>
958  * local * absolute paths to <tt>const char *</tt> local absolute paths for
959  * every path under @a local_abspath in @a wc_ctx which are excluded
960  * by the server (e.g. because of authz) or the users.
961  * If no excluded paths are found then @a *server_excluded_subtrees
962  * is set to @c NULL.
963  * Allocate the hash and all items therein from @a result_pool.
964  */
965 svn_error_t *
966 svn_wc__get_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
967                               svn_wc_context_t *wc_ctx,
968                               const char *local_abspath,
969                               apr_pool_t *result_pool,
970                               apr_pool_t *scratch_pool);
971
972 /* Indicate in @a *is_modified whether the working copy has local
973  * modifications, using context @a wc_ctx.
974  *
975  * If IGNORE_UNVERSIONED, unversioned paths inside the tree rooted by
976  * LOCAL_ABSPATH are not seen as a change, otherwise they are.
977  * (svn:ignored paths are always ignored)
978  *
979  * Use @a scratch_pool for temporary allocations. */
980 svn_error_t *
981 svn_wc__has_local_mods(svn_boolean_t *is_modified,
982                        svn_wc_context_t *wc_ctx,
983                        const char *local_abspath,
984                        svn_boolean_t ignore_unversioned,
985                        svn_cancel_func_t cancel_func,
986                        void *cancel_baton,
987                        apr_pool_t *scratch_pool);
988
989 /* Renames a working copy from @a from_abspath to @a dst_abspath and makes sure
990    open handles are closed to allow this on all platforms.
991
992    Summary: This avoids a file lock problem on wc.db on Windows, that is
993             triggered by libsvn_client'ss copy to working copy code. */
994 svn_error_t *
995 svn_wc__rename_wc(svn_wc_context_t *wc_ctx,
996                   const char *from_abspath,
997                   const char *dst_abspath,
998                   apr_pool_t *scratch_pool);
999
1000 /* Set *TMPDIR_ABSPATH to a directory that is suitable for temporary
1001    files which may need to be moved (atomically and same-device) into
1002    the working copy indicated by WRI_ABSPATH.  */
1003 svn_error_t *
1004 svn_wc__get_tmpdir(const char **tmpdir_abspath,
1005                    svn_wc_context_t *wc_ctx,
1006                    const char *wri_abspath,
1007                    apr_pool_t *result_pool,
1008                    apr_pool_t *scratch_pool);
1009
1010 /* Gets information needed by the commit harvester.
1011  *
1012  * ### Currently this API is work in progress and is designed for just this
1013  * ### caller. It is certainly possible (and likely) that this function and
1014  * ### it's caller will eventually move into a wc and maybe wc_db api.
1015  */
1016 svn_error_t *
1017 svn_wc__node_get_commit_status(svn_boolean_t *added,
1018                                svn_boolean_t *deleted,
1019                                svn_boolean_t *is_replace_root,
1020                                svn_boolean_t *is_op_root,
1021                                svn_revnum_t *revision,
1022                                svn_revnum_t *original_revision,
1023                                const char **original_repos_relpath,
1024                                svn_wc_context_t *wc_ctx,
1025                                const char *local_abspath,
1026                                apr_pool_t *result_pool,
1027                                apr_pool_t *scratch_pool);
1028
1029 /* Gets the md5 checksum for the pristine file identified by a sha1_checksum in the
1030    working copy identified by wri_abspath.
1031
1032    Wraps svn_wc__db_pristine_get_md5().
1033  */
1034 svn_error_t *
1035 svn_wc__node_get_md5_from_sha1(const svn_checksum_t **md5_checksum,
1036                                svn_wc_context_t *wc_ctx,
1037                                const char *wri_abspath,
1038                                const svn_checksum_t *sha1_checksum,
1039                                apr_pool_t *result_pool,
1040                                apr_pool_t *scratch_pool);
1041
1042 /* Like svn_wc_get_pristine_contents2(), but keyed on the CHECKSUM
1043    rather than on the local absolute path of the working file.
1044    WRI_ABSPATH is any versioned path of the working copy in whose
1045    pristine database we'll be looking for these contents.  */
1046 svn_error_t *
1047 svn_wc__get_pristine_contents_by_checksum(svn_stream_t **contents,
1048                                           svn_wc_context_t *wc_ctx,
1049                                           const char *wri_abspath,
1050                                           const svn_checksum_t *checksum,
1051                                           apr_pool_t *result_pool,
1052                                           apr_pool_t *scratch_pool);
1053
1054 /* Gets an array of const char *repos_relpaths of descendants of LOCAL_ABSPATH,
1055  * which must be the op root of an addition, copy or move. The descendants
1056  * returned are at the same op_depth, but are to be deleted by the commit
1057  * processing because they are not present in the local copy.
1058  */
1059 svn_error_t *
1060 svn_wc__get_not_present_descendants(const apr_array_header_t **descendants,
1061                                     svn_wc_context_t *wc_ctx,
1062                                     const char *local_abspath,
1063                                     apr_pool_t *result_pool,
1064                                     apr_pool_t *scratch_pool);
1065
1066
1067 /* Checks a node LOCAL_ABSPATH in WC_CTX for several kinds of obstructions
1068  * for tasks like merge processing.
1069  *
1070  * If a node is not obstructed it sets *OBSTRUCTION_STATE to
1071  * svn_wc_notify_state_inapplicable. If a node is obstructed or when its
1072  * direct parent does not exist or is deleted return _state_obstructed. When
1073  * a node doesn't exist but should exist return svn_wc_notify_state_missing.
1074  *
1075  * A node is also obstructed if it is marked excluded or server-excluded or when
1076  * an unversioned file or directory exists. And if NO_WCROOT_CHECK is FALSE,
1077  * the root of a working copy is also obstructed; this to allow detecting
1078  * obstructing working copies.
1079  *
1080  * If KIND is not NULL, set *KIND to the kind of node registered in the working
1081  * copy, or SVN_NODE_NONE if the node doesn't
1082  *
1083  * If DELETED is not NULL, set *DELETED to TRUE if the node is marked as
1084  * deleted in the working copy.
1085  *
1086  * If EXCLUDED is not NULL, set *EXCLUDED to TRUE if the node is marked as
1087  * user or server excluded.
1088  *
1089  * If PARENT_DEPTH is not NULL, set *PARENT_DEPTH to the depth stored on the
1090  * parent. (Set to svn_depth_unknown if LOCAL_ABSPATH itself exists as node)
1091  *
1092  * All output arguments except OBSTRUCTION_STATE can be NULL to ommit the
1093  * result.
1094  *
1095  * This function performs temporary allocations in SCRATCH_POOL.
1096  */
1097 svn_error_t *
1098 svn_wc__check_for_obstructions(svn_wc_notify_state_t *obstruction_state,
1099                                svn_node_kind_t *kind,
1100                                svn_boolean_t *deleted,
1101                                svn_boolean_t *excluded,
1102                                svn_depth_t *parent_depth,
1103                                svn_wc_context_t *wc_ctx,
1104                                const char *local_abspath,
1105                                svn_boolean_t no_wcroot_check,
1106                                apr_pool_t *scratch_pool);
1107
1108
1109 /**
1110  * A structure which describes various system-generated metadata about
1111  * a working-copy path or URL.
1112  *
1113  * @note Fields may be added to the end of this structure in future
1114  * versions.  Therefore, users shouldn't allocate structures of this
1115  * type, to preserve binary compatibility.
1116  *
1117  * @since New in 1.7.
1118  */
1119 typedef struct svn_wc__info2_t
1120 {
1121   /** Where the item lives in the repository. */
1122   const char *URL;
1123
1124   /** The root URL of the repository. */
1125   const char *repos_root_URL;
1126
1127   /** The repository's UUID. */
1128   const char *repos_UUID;
1129
1130   /** The revision of the object.  If the target is a working-copy
1131    * path, then this is its current working revision number.  If the target
1132    * is a URL, then this is the repository revision that it lives in. */
1133   svn_revnum_t rev;
1134
1135   /** The node's kind. */
1136   svn_node_kind_t kind;
1137
1138   /** The size of the file in the repository (untranslated,
1139    * e.g. without adjustment of line endings and keyword
1140    * expansion). Only applicable for file -- not directory -- URLs.
1141    * For working copy paths, @a size will be #SVN_INVALID_FILESIZE. */
1142   svn_filesize_t size;
1143
1144   /** The last revision in which this object changed. */
1145   svn_revnum_t last_changed_rev;
1146
1147   /** The date of the last_changed_rev. */
1148   apr_time_t last_changed_date;
1149
1150   /** The author of the last_changed_rev. */
1151   const char *last_changed_author;
1152
1153   /** An exclusive lock, if present.  Could be either local or remote. */
1154   svn_lock_t *lock;
1155
1156   /* Possible information about the working copy, NULL if not valid. */
1157   struct svn_wc_info_t *wc_info;
1158
1159 } svn_wc__info2_t;
1160
1161 /** The callback invoked by info retrievers.  Each invocation
1162  * describes @a local_abspath with the information present in @a info.
1163  * Use @a scratch_pool for all temporary allocation.
1164  *
1165  * @since New in 1.7.
1166  */
1167 typedef svn_error_t *(*svn_wc__info_receiver2_t)(void *baton,
1168                                                  const char *local_abspath,
1169                                                  const svn_wc__info2_t *info,
1170                                                  apr_pool_t *scratch_pool);
1171
1172 /* Walk the children of LOCAL_ABSPATH and push svn_wc__info2_t's through
1173    RECEIVER/RECEIVER_BATON.  Honor DEPTH while crawling children, and
1174    filter the pushed items against CHANGELISTS.
1175
1176    If FETCH_EXCLUDED is TRUE, also fetch excluded nodes.
1177    If FETCH_ACTUAL_ONLY is TRUE, also fetch actual-only nodes. */
1178 svn_error_t *
1179 svn_wc__get_info(svn_wc_context_t *wc_ctx,
1180                  const char *local_abspath,
1181                  svn_depth_t depth,
1182                  svn_boolean_t fetch_excluded,
1183                  svn_boolean_t fetch_actual_only,
1184                  const apr_array_header_t *changelists,
1185                  svn_wc__info_receiver2_t receiver,
1186                  void *receiver_baton,
1187                  svn_cancel_func_t cancel_func,
1188                  void *cancel_baton,
1189                  apr_pool_t *scratch_pool);
1190
1191 /* Alternative version of svn_wc_delete4().
1192  * It can delete multiple TARGETS more efficiently (within a single sqlite
1193  * transaction per working copy), but lacks support for moves.
1194  *
1195  * ### Inconsistency: if DELETE_UNVERSIONED_TARGET is FALSE and a target is
1196  *     unversioned, svn_wc__delete_many() will continue whereas
1197  *     svn_wc_delete4() will throw an error.
1198  */
1199 svn_error_t *
1200 svn_wc__delete_many(svn_wc_context_t *wc_ctx,
1201                     const apr_array_header_t *targets,
1202                     svn_boolean_t keep_local,
1203                     svn_boolean_t delete_unversioned_target,
1204                     svn_cancel_func_t cancel_func,
1205                     void *cancel_baton,
1206                     svn_wc_notify_func2_t notify_func,
1207                     void *notify_baton,
1208                     apr_pool_t *scratch_pool);
1209
1210
1211 /* If the node at LOCAL_ABSPATH was moved away set *MOVED_TO_ABSPATH to
1212  * the absolute path of the copied move-target node, and *COPY_OP_ROOT_ABSPATH
1213  * to the absolute path of the root node of the copy operation.
1214  *
1215  * If the node was not moved, set *MOVED_TO_ABSPATH and *COPY_OP_ROOT_ABSPATH
1216  * to NULL.
1217  *
1218  * Either MOVED_TO_ABSPATH or OP_ROOT_ABSPATH may be NULL to indicate
1219  * that the caller is not interested in the result.
1220  */
1221 svn_error_t *
1222 svn_wc__node_was_moved_away(const char **moved_to_abspath,
1223                             const char **copy_op_root_abspath,
1224                             svn_wc_context_t *wc_ctx,
1225                             const char *local_abspath,
1226                             apr_pool_t *result_pool,
1227                             apr_pool_t *scratch_pool);
1228
1229 /* If the node at LOCAL_ABSPATH was moved here set *MOVED_FROM_ABSPATH to
1230  * the absolute path of the deleted move-source node, and set
1231  * *DELETE_OP_ROOT_ABSPATH to the absolute path of the root node of the
1232  * delete operation.
1233  *
1234  * If the node was not moved, set *MOVED_FROM_ABSPATH and
1235  * *DELETE_OP_ROOT_ABSPATH to NULL.
1236  *
1237  * Either MOVED_FROM_ABSPATH or OP_ROOT_ABSPATH may be NULL to indicate
1238  * that the caller is not interested in the result.
1239  */
1240 svn_error_t *
1241 svn_wc__node_was_moved_here(const char **moved_from_abspath,
1242                             const char **delete_op_root_abspath,
1243                             svn_wc_context_t *wc_ctx,
1244                             const char *local_abspath,
1245                             apr_pool_t *result_pool,
1246                             apr_pool_t *scratch_pool);
1247
1248 /* During an upgrade to wc-ng, supply known details about an existing
1249  * external.  The working copy will suck in and store the information supplied
1250  * about the existing external at @a local_abspath. */
1251 svn_error_t *
1252 svn_wc__upgrade_add_external_info(svn_wc_context_t *wc_ctx,
1253                                   const char *local_abspath,
1254                                   svn_node_kind_t kind,
1255                                   const char *def_local_abspath,
1256                                   const char *repos_relpath,
1257                                   const char *repos_root_url,
1258                                   const char *repos_uuid,
1259                                   svn_revnum_t def_peg_revision,
1260                                   svn_revnum_t def_revision,
1261                                   apr_pool_t *scratch_pool);
1262
1263 /* If the URL for @a item is relative, then using the repository root
1264    URL @a repos_root_url and the parent directory URL @parent_dir_url,
1265    resolve it into an absolute URL and save it in @a *resolved_url.
1266
1267    Regardless if the URL is absolute or not, if there are no errors,
1268    the URL returned in @a *resolved_url will be canonicalized.
1269
1270    The following relative URL formats are supported:
1271
1272      ../    relative to the parent directory of the external
1273      ^/     relative to the repository root
1274      //     relative to the scheme
1275      /      relative to the server's hostname
1276
1277    The ../ and ^/ relative URLs may use .. to remove path elements up
1278    to the server root.
1279
1280    The external URL should not be canonicalized before calling this function,
1281    as otherwise the scheme relative URL '//host/some/path' would have been
1282    canonicalized to '/host/some/path' and we would not be able to match on
1283    the leading '//'. */
1284 svn_error_t *
1285 svn_wc__resolve_relative_external_url(const char **resolved_url,
1286                                       const svn_wc_external_item2_t *item,
1287                                       const char *repos_root_url,
1288                                       const char *parent_dir_url,
1289                                       apr_pool_t *result_pool,
1290                                       apr_pool_t *scratch_pool);
1291
1292 typedef enum svn_wc__external_description_format_t
1293 {
1294   /* LOCALPATH [-r PEG] URL */
1295   svn_wc__external_description_format_1 = 0,
1296
1297   /* [-r REV] URL[@PEG] LOCALPATH, introduced in Subversion 1.5 */
1298   svn_wc__external_description_format_2
1299 } svn_wc__external_description_format_t;
1300
1301 /* Additional information about what the external's parser has parsed. */
1302 typedef struct svn_wc__externals_parser_info_t
1303 {
1304   /* The syntax format used by the external description. */
1305   svn_wc__external_description_format_t format;
1306
1307   /* The string used for defining the operative revision, i.e.
1308      "-rN", "-rHEAD", or "-r{DATE}".
1309      NULL if revision was not given. */
1310   const char *rev_str;
1311
1312   /* The string used for defining the peg revision (equals rev_str in
1313      format 1, is "@N", or "@HEAD" or "@{DATE}" in format 2).
1314      NULL if peg revision was not given. */
1315   const char *peg_rev_str;
1316
1317 } svn_wc__externals_parser_info_t;
1318
1319 /* Like svn_wc_parse_externals_description3() but returns an additional array
1320  * with elements of type svn_wc__externals_parser_info_t in @a *parser_infos_p.
1321  * @a parser_infos_p may be NULL if not required by the caller.
1322  */
1323 svn_error_t *
1324 svn_wc__parse_externals_description(apr_array_header_t **externals_p,
1325                                     apr_array_header_t **parser_infos_p,
1326                                     const char *defining_directory,
1327                                     const char *desc,
1328                                     svn_boolean_t canonicalize_url,
1329                                     apr_pool_t *pool);
1330
1331 /**
1332  * Set @a *editor and @a *edit_baton to an editor that generates
1333  * #svn_wc_status3_t structures and sends them through @a status_func /
1334  * @a status_baton.  @a anchor_abspath is a working copy directory
1335  * directory which will be used as the root of our editor.  If @a
1336  * target_basename is not "", it represents a node in the @a anchor_abspath
1337  * which is the subject of the editor drive (otherwise, the @a
1338  * anchor_abspath is the subject).
1339  *
1340  * If @a set_locks_baton is non-@c NULL, it will be set to a baton that can
1341  * be used in a call to the svn_wc_status_set_repos_locks() function.
1342  *
1343  * Callers drive this editor to describe working copy out-of-dateness
1344  * with respect to the repository.  If this information is not
1345  * available or not desired, callers should simply call the
1346  * close_edit() function of the @a editor vtable.
1347  *
1348  * If the editor driver calls @a editor's set_target_revision() vtable
1349  * function, then when the edit drive is completed, @a *edit_revision
1350  * will contain the revision delivered via that interface.
1351  *
1352  * Assuming the target is a directory, then:
1353  *
1354  *   - If @a get_all is @c FALSE, then only locally-modified entries will be
1355  *     returned.  If @c TRUE, then all entries will be returned.
1356  *
1357  *   - If @a depth is #svn_depth_empty, a status structure will
1358  *     be returned for the target only; if #svn_depth_files, for the
1359  *     target and its immediate file children; if
1360  *     #svn_depth_immediates, for the target and its immediate
1361  *     children; if #svn_depth_infinity, for the target and
1362  *     everything underneath it, fully recursively.
1363  *
1364  *     If @a depth is #svn_depth_unknown, take depths from the
1365  *     working copy and behave as above in each directory's case.
1366  *
1367  *     If the given @a depth is incompatible with the depth found in a
1368  *     working copy directory, the found depth always governs.
1369  *
1370  * If @a check_working_copy is not set, do not scan the working copy
1371  * for local modifications, taking only the BASE tree into account.
1372  *
1373  * If @a no_ignore is set, statuses that would typically be ignored
1374  * will instead be reported.
1375  *
1376  * @a ignore_patterns is an array of file patterns matching
1377  * unversioned files to ignore for the purposes of status reporting,
1378  * or @c NULL if the default set of ignorable file patterns should be used.
1379  *
1380  * If @a cancel_func is non-NULL, call it with @a cancel_baton while building
1381  * the @a statushash to determine if the client has canceled the operation.
1382  *
1383  * If @a depth_as_sticky is set handle @a depth like when depth_is_sticky is
1384  * passed for updating. This will show excluded nodes show up as added in the
1385  * repository.
1386  *
1387  * If @a server_performs_filtering is TRUE, assume that the server handles
1388  * the ambient depth filtering, so this doesn't have to be handled in the
1389  * editor.
1390  *
1391  * Allocate the editor itself in @a result_pool, and use @a scratch_pool
1392  * for temporary allocations. The editor will do its temporary allocations
1393  * in a subpool of @a result_pool.
1394  *
1395  * @since New in 1.8.
1396  */
1397 svn_error_t *
1398 svn_wc__get_status_editor(const svn_delta_editor_t **editor,
1399                           void **edit_baton,
1400                           void **set_locks_baton,
1401                           svn_revnum_t *edit_revision,
1402                           svn_wc_context_t *wc_ctx,
1403                           const char *anchor_abspath,
1404                           const char *target_basename,
1405                           svn_depth_t depth,
1406                           svn_boolean_t get_all,
1407                           svn_boolean_t check_working_copy,
1408                           svn_boolean_t no_ignore,
1409                           svn_boolean_t depth_as_sticky,
1410                           svn_boolean_t server_performs_filtering,
1411                           const apr_array_header_t *ignore_patterns,
1412                           svn_wc_status_func4_t status_func,
1413                           void *status_baton,
1414                           svn_cancel_func_t cancel_func,
1415                           void *cancel_baton,
1416                           apr_pool_t *result_pool,
1417                           apr_pool_t *scratch_pool);
1418
1419
1420 /**
1421  * Set @a *editor and @a *edit_baton to an editor and baton for updating a
1422  * working copy.
1423  *
1424  * @a anchor_abspath is a local working copy directory, with a fully recursive
1425  * write lock in @a wc_ctx, which will be used as the root of our editor.
1426  *
1427  * @a target_basename is the entry in @a anchor_abspath that will actually be
1428  * updated, or the empty string if all of @a anchor_abspath should be updated.
1429  *
1430  * The editor invokes @a notify_func with @a notify_baton as the update
1431  * progresses, if @a notify_func is non-NULL.
1432  *
1433  * If @a cancel_func is non-NULL, the editor will invoke @a cancel_func with
1434  * @a cancel_baton as the update progresses to see if it should continue.
1435  *
1436  * If @a conflict_func is non-NULL, then invoke it with @a
1437  * conflict_baton whenever a conflict is encountered, giving the
1438  * callback a chance to resolve the conflict before the editor takes
1439  * more drastic measures (such as marking a file conflicted, or
1440  * bailing out of the update).
1441  *
1442  * If @a external_func is non-NULL, then invoke it with @a external_baton
1443  * whenever external changes are encountered, giving the callback a chance
1444  * to store the external information for processing.
1445  *
1446  * If @a diff3_cmd is non-NULL, then use it as the diff3 command for
1447  * any merging; otherwise, use the built-in merge code.
1448  *
1449  * @a preserved_exts is an array of filename patterns which, when
1450  * matched against the extensions of versioned files, determine for
1451  * which such files any related generated conflict files will preserve
1452  * the original file's extension as their own.  If a file's extension
1453  * does not match any of the patterns in @a preserved_exts (which is
1454  * certainly the case if @a preserved_exts is @c NULL or empty),
1455  * generated conflict files will carry Subversion's custom extensions.
1456  *
1457  * @a target_revision is a pointer to a revision location which, after
1458  * successful completion of the drive of this editor, will be
1459  * populated with the revision to which the working copy was updated.
1460  *
1461  * @a wcroot_iprops is a hash mapping const char * absolute working copy
1462  * paths which are working copy roots (at or under the target within the
1463  * constraints dictated by @a depth) to depth-first ordered arrays of
1464  * svn_prop_inherited_item_t * structures which represent the inherited
1465  * properties for the base of those paths at @a target_revision.  After a
1466  * successful drive of this editor, the base nodes for these paths will
1467  * have their inherited properties cache updated with the values from
1468  * @a wcroot_iprops.
1469  *
1470  * If @a use_commit_times is TRUE, then all edited/added files will
1471  * have their working timestamp set to the last-committed-time.  If
1472  * FALSE, the working files will be touched with the 'now' time.
1473  *
1474  * If @a allow_unver_obstructions is TRUE, then allow unversioned
1475  * obstructions when adding a path.
1476  *
1477  * If @a adds_as_modification is TRUE, a local addition at the same path
1478  * as an incoming addition of the same node kind results in a normal node
1479  * with a possible local modification, instead of a tree conflict.
1480  *
1481  * If @a depth is #svn_depth_infinity, update fully recursively.
1482  * Else if it is #svn_depth_immediates, update the uppermost
1483  * directory, its file entries, and the presence or absence of
1484  * subdirectories (but do not descend into the subdirectories).
1485  * Else if it is #svn_depth_files, update the uppermost directory
1486  * and its immediate file entries, but not subdirectories.
1487  * Else if it is #svn_depth_empty, update exactly the uppermost
1488  * target, and don't touch its entries.
1489  *
1490  * If @a depth_is_sticky is set and @a depth is not
1491  * #svn_depth_unknown, then in addition to updating PATHS, also set
1492  * their sticky ambient depth value to @a depth.
1493  *
1494  * If @a server_performs_filtering is TRUE, assume that the server handles
1495  * the ambient depth filtering, so this doesn't have to be handled in the
1496  * editor.
1497  *
1498  * If @a clean_checkout is TRUE, assume that we are checking out into an
1499  * empty directory, and so bypass a number of conflict checks that are
1500  * unnecessary in this case.
1501  *
1502  * If @a fetch_dirents_func is not NULL, the update editor may call this
1503  * callback, when asked to perform a depth restricted update. It will do this
1504  * before returning the editor to allow using the primary ra session for this.
1505  *
1506  * @since New in 1.8.
1507  */
1508 svn_error_t *
1509 svn_wc__get_update_editor(const svn_delta_editor_t **editor,
1510                           void **edit_baton,
1511                           svn_revnum_t *target_revision,
1512                           svn_wc_context_t *wc_ctx,
1513                           const char *anchor_abspath,
1514                           const char *target_basename,
1515                           apr_hash_t *wcroot_iprops,
1516                           svn_boolean_t use_commit_times,
1517                           svn_depth_t depth,
1518                           svn_boolean_t depth_is_sticky,
1519                           svn_boolean_t allow_unver_obstructions,
1520                           svn_boolean_t adds_as_modification,
1521                           svn_boolean_t server_performs_filtering,
1522                           svn_boolean_t clean_checkout,
1523                           const char *diff3_cmd,
1524                           const apr_array_header_t *preserved_exts,
1525                           svn_wc_dirents_func_t fetch_dirents_func,
1526                           void *fetch_dirents_baton,
1527                           svn_wc_conflict_resolver_func2_t conflict_func,
1528                           void *conflict_baton,
1529                           svn_wc_external_update_t external_func,
1530                           void *external_baton,
1531                           svn_cancel_func_t cancel_func,
1532                           void *cancel_baton,
1533                           svn_wc_notify_func2_t notify_func,
1534                           void *notify_baton,
1535                           apr_pool_t *result_pool,
1536                           apr_pool_t *scratch_pool);
1537
1538
1539 /**
1540  * A variant of svn_wc__get_update_editor().
1541  *
1542  * Set @a *editor and @a *edit_baton to an editor and baton for "switching"
1543  * a working copy to a new @a switch_url.  (Right now, this URL must be
1544  * within the same repository that the working copy already comes
1545  * from.)  @a switch_url must not be @c NULL.
1546  *
1547  * All other parameters behave as for svn_wc__get_update_editor().
1548  *
1549  * @since New in 1.8.
1550  */
1551 svn_error_t *
1552 svn_wc__get_switch_editor(const svn_delta_editor_t **editor,
1553                           void **edit_baton,
1554                           svn_revnum_t *target_revision,
1555                           svn_wc_context_t *wc_ctx,
1556                           const char *anchor_abspath,
1557                           const char *target_basename,
1558                           const char *switch_url,
1559                           apr_hash_t *wcroot_iprops,
1560                           svn_boolean_t use_commit_times,
1561                           svn_depth_t depth,
1562                           svn_boolean_t depth_is_sticky,
1563                           svn_boolean_t allow_unver_obstructions,
1564                           svn_boolean_t server_performs_filtering,
1565                           const char *diff3_cmd,
1566                           const apr_array_header_t *preserved_exts,
1567                           svn_wc_dirents_func_t fetch_dirents_func,
1568                           void *fetch_dirents_baton,
1569                           svn_wc_conflict_resolver_func2_t conflict_func,
1570                           void *conflict_baton,
1571                           svn_wc_external_update_t external_func,
1572                           void *external_baton,
1573                           svn_cancel_func_t cancel_func,
1574                           void *cancel_baton,
1575                           svn_wc_notify_func2_t notify_func,
1576                           void *notify_baton,
1577                           apr_pool_t *result_pool,
1578                           apr_pool_t *scratch_pool);
1579
1580
1581
1582 /**
1583  * Return an @a editor/@a edit_baton for diffing a working copy against the
1584  * repository. The editor is allocated in @a result_pool; temporary
1585  * calculations are performed in @a scratch_pool.
1586  *
1587  * This editor supports diffing either the actual files and properties in the
1588  * working copy (when @a use_text_base is #FALSE), or the current pristine
1589  * information (when @a use_text_base is #TRUE) against the editor driver.
1590  *
1591  * @a anchor_abspath/@a target represent the base of the hierarchy to be
1592  * compared. The diff callback paths will be relative to this path.
1593  *
1594  * Diffs will be reported as valid relpaths, with @a anchor_abspath being
1595  * the root ("").
1596  *
1597  * @a diff_processor will retrieve the diff report.
1598  *
1599  * If @a depth is #svn_depth_empty, just diff exactly @a target or
1600  * @a anchor_path if @a target is empty.  If #svn_depth_files then do the same
1601  * and for top-level file entries as well (if any).  If
1602  * #svn_depth_immediates, do the same as #svn_depth_files but also diff
1603  * top-level subdirectories at #svn_depth_empty.  If #svn_depth_infinity,
1604  * then diff fully recursively. If @a depth is #svn_depth_unknown, then...
1605  *
1606  *   ### ... then the @a server_performs_filtering option is meaningful.
1607  *   ### But what does this depth mean exactly? Something about 'ambient'
1608  *   ### depth? How does it compare with depth 'infinity'?
1609  *
1610  * @a ignore_ancestry determines whether paths that have discontinuous node
1611  * ancestry are treated as delete/add or as simple modifications.  If
1612  * @a ignore_ancestry is @c FALSE, then any discontinuous node ancestry will
1613  * result in the diff given as a full delete followed by an add.
1614  *
1615  * @a show_copies_as_adds determines whether paths added with history will
1616  * appear as a diff against their copy source, or whether such paths will
1617  * appear as if they were newly added in their entirety.
1618  *
1619  * If @a use_git_diff_format is TRUE, copied paths will be treated as added
1620  * if they weren't modified after being copied. This allows the callbacks
1621  * to generate appropriate --git diff headers for such files.
1622  *
1623  * Normally, the difference from repository->working_copy is shown. If
1624  * @a reverse_order is TRUE, then we want to show working_copy->repository
1625  * diffs. Most of the reversal is done by the caller; here we just swap the
1626  * order of reporting a replacement so that the local addition is reported
1627  * before the remote delete. (The caller's diff processor can then transform
1628  * adds into deletes and deletes into adds, but it can't reorder the output.)
1629  *
1630  * If @a cancel_func is non-NULL, it will be used along with @a cancel_baton
1631  * to periodically check if the client has canceled the operation.
1632  *
1633  * @a changelist_filter is an array of <tt>const char *</tt> changelist
1634  * names, used as a restrictive filter on items whose differences are
1635  * reported; that is, don't generate diffs about any item unless
1636  * it's a member of one of those changelists.  If @a changelist_filter is
1637  * empty (or altogether @c NULL), no changelist filtering occurs.
1638  *
1639  * If @a server_performs_filtering is TRUE, assume that the server handles
1640  * the ambient depth filtering, so this doesn't have to be handled in the
1641  * editor.
1642  *
1643  *
1644  * A diagram illustrating how this function is used.
1645  *
1646  *   Steps 1 and 2 create the chain; step 3 drives it.
1647  *
1648  *   1.                    svn_wc__get_diff_editor(diff_cbs)
1649  *                                       |           ^
1650  *   2.         svn_ra_do_diff3(editor)  |           |
1651  *                    |           ^      |           |
1652  *                    v           |      v           |
1653  *           +----------+       +----------+       +----------+
1654  *           |          |       |          |       |          |
1655  *      +--> | reporter | ----> |  editor  | ----> | diff_cbs | ----> text
1656  *      |    |          |       |          |       |          |       out
1657  *      |    +----------+       +----------+       +----------+
1658  *      |
1659  *   3. svn_wc_crawl_revisions5(WC,reporter)
1660  *
1661  *
1662  * @since New in 1.8.
1663  */
1664 svn_error_t *
1665 svn_wc__get_diff_editor(const svn_delta_editor_t **editor,
1666                         void **edit_baton,
1667                         svn_wc_context_t *wc_ctx,
1668                         const char *anchor_abspath,
1669                         const char *target,
1670                         svn_depth_t depth,
1671                         svn_boolean_t ignore_ancestry,
1672                         svn_boolean_t use_text_base,
1673                         svn_boolean_t reverse_order,
1674                         svn_boolean_t server_performs_filtering,
1675                         const apr_array_header_t *changelist_filter,
1676                         const svn_diff_tree_processor_t *diff_processor,
1677                         svn_cancel_func_t cancel_func,
1678                         void *cancel_baton,
1679                         apr_pool_t *result_pool,
1680                         apr_pool_t *scratch_pool);
1681
1682 /** Callback for the svn_diff_tree_processor_t wrapper, to allow handling
1683  *  notifications like how the repos diff in libsvn_client does.
1684  *
1685  * Probably only necessary while transitioning to svn_diff_tree_processor_t
1686  */
1687 typedef svn_error_t *
1688         (*svn_wc__diff_state_handle_t)(svn_boolean_t tree_conflicted,
1689                                        svn_wc_notify_state_t *state,
1690                                        svn_wc_notify_state_t *prop_state,
1691                                        const char *relpath,
1692                                        svn_node_kind_t kind,
1693                                        svn_boolean_t before_op,
1694                                        svn_boolean_t for_add,
1695                                        svn_boolean_t for_delete,
1696                                        void *state_baton,
1697                                        apr_pool_t *scratch_pool);
1698
1699 /** Callback for the svn_diff_tree_processor_t wrapper, to allow handling
1700  *  notifications like how the repos diff in libsvn_client does.
1701  *
1702  * Probably only necessary while transitioning to svn_diff_tree_processor_t
1703  */
1704 typedef svn_error_t *
1705         (*svn_wc__diff_state_close_t)(const char *relpath,
1706                                       svn_node_kind_t kind,
1707                                       void *state_baton,
1708                                       apr_pool_t *scratch_pool);
1709
1710 /** Callback for the svn_diff_tree_processor_t wrapper, to allow handling
1711  *  absent nodes.
1712  *
1713  * Probably only necessary while transitioning to svn_diff_tree_processor_t
1714  */
1715 typedef svn_error_t *
1716         (*svn_wc__diff_state_absent_t)(const char *relpath,
1717                                        void *state_baton,
1718                                        apr_pool_t *scratch_pool);
1719
1720 /** Obtains a diff processor that will drive the diff callbacks when it
1721  * is invoked.
1722  */
1723 svn_error_t *
1724 svn_wc__wrap_diff_callbacks(const svn_diff_tree_processor_t **diff_processor,
1725                             const svn_wc_diff_callbacks4_t *callbacks,
1726                             void *callback_baton,
1727                             svn_boolean_t walk_deleted_dirs,
1728                             apr_pool_t *result_pool,
1729                             apr_pool_t *scratch_pool);
1730
1731
1732 /**
1733  * Assuming @a local_abspath itself or any of its children are under version
1734  * control or a tree conflict victim and in a state of conflict, take these
1735  * nodes out of this state.
1736  *
1737  * If @a resolve_text is TRUE then any text conflict is resolved,
1738  * if @a resolve_tree is TRUE then any tree conflicts are resolved.
1739  * If @a resolve_prop is set to "" all property conflicts are resolved,
1740  * if it is set to any other string value, conflicts on that specific
1741  * property are resolved and when resolve_prop is NULL, no property
1742  * conflicts are resolved.
1743  *
1744  * If @a depth is #svn_depth_empty, act only on @a local_abspath; if
1745  * #svn_depth_files, resolve @a local_abspath and its conflicted file
1746  * children (if any); if #svn_depth_immediates, resolve @a local_abspath
1747  * and all its immediate conflicted children (both files and directories,
1748  * if any); if #svn_depth_infinity, resolve @a local_abspath and every
1749  * conflicted file or directory anywhere beneath it.
1750  *
1751  * If @a conflict_choice is #svn_wc_conflict_choose_base, resolve the
1752  * conflict with the old file contents; if
1753  * #svn_wc_conflict_choose_mine_full, use the original working contents;
1754  * if #svn_wc_conflict_choose_theirs_full, the new contents; and if
1755  * #svn_wc_conflict_choose_merged, don't change the contents at all,
1756  * just remove the conflict status, which is the pre-1.5 behavior.
1757  *
1758  * If @a conflict_choice is #svn_wc_conflict_choose_unspecified, invoke the
1759  * @a conflict_func with the @a conflict_baton argument to obtain a
1760  * resolution decision for each conflict.
1761  *
1762  * #svn_wc_conflict_choose_theirs_conflict and
1763  * #svn_wc_conflict_choose_mine_conflict are not legal for binary
1764  * files or properties.
1765  *
1766  * @a wc_ctx is a working copy context, with a write lock, for @a
1767  * local_abspath.
1768  *
1769  * The implementation details are opaque, as our "conflicted" criteria
1770  * might change over time.  (At the moment, this routine removes the
1771  * three fulltext 'backup' files and any .prej file created in a conflict,
1772  * and modifies @a local_abspath's entry.)
1773  *
1774  * If @a local_abspath is not under version control and not a tree
1775  * conflict, return #SVN_ERR_ENTRY_NOT_FOUND. If @a path isn't in a
1776  * state of conflict to begin with, do nothing, and return #SVN_NO_ERROR.
1777  *
1778  * If @c local_abspath was successfully taken out of a state of conflict,
1779  * report this information to @c notify_func (if non-@c NULL.)  If only
1780  * text, only property, or only tree conflict resolution was requested,
1781  * and it was successful, then success gets reported.
1782  *
1783  * Temporary allocations will be performed in @a scratch_pool.
1784  *
1785  * @since New in 1.8.
1786  */
1787 svn_error_t *
1788 svn_wc__resolve_conflicts(svn_wc_context_t *wc_ctx,
1789                           const char *local_abspath,
1790                           svn_depth_t depth,
1791                           svn_boolean_t resolve_text,
1792                           const char *resolve_prop,
1793                           svn_boolean_t resolve_tree,
1794                           svn_wc_conflict_choice_t conflict_choice,
1795                           svn_wc_conflict_resolver_func2_t conflict_func,
1796                           void *conflict_baton,
1797                           svn_cancel_func_t cancel_func,
1798                           void *cancel_baton,
1799                           svn_wc_notify_func2_t notify_func,
1800                           void *notify_baton,
1801                           apr_pool_t *scratch_pool);
1802
1803 /**
1804  * Resolve the text conflict at LOCAL_ABSPATH as per CHOICE, and then
1805  * mark the conflict resolved.
1806  * The working copy must already be locked for resolving, e.g. by calling
1807  * svn_wc__acquire_write_lock_for_resolve() first.
1808  * @since New in 1.10.
1809  */
1810 svn_error_t *
1811 svn_wc__conflict_text_mark_resolved(svn_wc_context_t *wc_ctx,
1812                                     const char *local_abspath,
1813                                     svn_wc_conflict_choice_t choice,
1814                                     svn_cancel_func_t cancel_func,
1815                                     void *cancel_baton,
1816                                     svn_wc_notify_func2_t notify_func,
1817                                     void *notify_baton,
1818                                     apr_pool_t *scratch_pool);
1819
1820 /**
1821  * Resolve the conflicted property PROPNAME at LOCAL_ABSPATH as per CHOICE,
1822  * and then mark the conflict resolved.  If MERGED_VALUE is not NULL, this is
1823  * the new merged property, used when choosing #svn_wc_conflict_choose_merged.
1824  *
1825  * The working copy must already be locked for resolving, e.g. by calling
1826  * svn_wc__acquire_write_lock_for_resolve() first.
1827  * @since New in 1.10.
1828  */
1829 svn_error_t *
1830 svn_wc__conflict_prop_mark_resolved(svn_wc_context_t *wc_ctx,
1831                                     const char *local_abspath,
1832                                     const char *propname,
1833                                     svn_wc_conflict_choice_t choice,
1834                                     const svn_string_t *merged_value,
1835                                     svn_wc_notify_func2_t notify_func,
1836                                     void *notify_baton,
1837                                     apr_pool_t *scratch_pool);
1838
1839 /* Resolve a tree conflict where the victim at LOCAL_ABSPATH is a directory
1840  * which was locally deleted, replaced or moved away, and which received an
1841  * arbitrary incoming change during an update or switch operation.
1842  *
1843  * The conflict is resolved by accepting the current working copy state and
1844  * breaking the 'moved-here' link for any files or directories which were
1845  * moved out of the victim directory before the update operation.
1846  * As a result, any such files or directories become copies (rather than moves)
1847  * of content which the victim directory contained before it was updated.
1848  *
1849  * The tree conflict at LOCAL_ABSPATH must have the following properties or
1850  * SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE will be returned:
1851  *
1852  * operation: svn_wc_operation_update or svn_wc_operation_switch
1853  * local change: svn_wc_conflict_reason_deleted or
1854  *               svn_wc_conflict_reason_replaced or
1855  *               svn_wc_conflict_reason_moved_away
1856  * incoming change: any
1857  *
1858  * The working copy must already be locked for resolving, e.g. by calling
1859  * svn_wc__acquire_write_lock_for_resolve() first.
1860  *
1861  * @since New in 1.10.
1862  */
1863 svn_error_t *
1864 svn_wc__conflict_tree_update_break_moved_away(svn_wc_context_t *wc_ctx,
1865                                               const char *local_abspath,
1866                                               svn_cancel_func_t cancel_func,
1867                                               void *cancel_baton,
1868                                               svn_wc_notify_func2_t notify_func,
1869                                               void *notify_baton,
1870                                               apr_pool_t *scratch_pool);
1871
1872
1873 /* Resolve a tree conflict where the victim at LOCAL_ABSPATH is a directory
1874  * which was locally deleted or replaced, and which received an edit (some
1875  * change inside the directory, or a change to the direcotory's properties)
1876  * during an update or switch operation.
1877  *
1878  * The conflict is resolved by keeping the victim deleted, and propagating
1879  * its tree conflict to any children which were moved out of the directory
1880  * before the update operation.
1881  * As a result, any such files or directories become victims of the tree
1882  * conflict as well and must be resolved independently.
1883  * Additionally, LOCAL_ABSPATH itself may become the victim of a different
1884  * tree conflict as a result of resolving the existing tree conflict.
1885  *
1886  * The tree conflict at LOCAL_ABSPATH must have the following properties or
1887  * SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE will be returned:
1888  *
1889  * operation: svn_wc_operation_update or svn_wc_operation_switch
1890  * local change: svn_wc_conflict_reason_deleted or
1891  *               svn_wc_conflict_reason_replaced
1892  * incoming change: svn_wc_conflict_action_edit
1893  *
1894  * If this conflict cannot be resolved because the conflict cannot be
1895  * propagated to moved-away children, this function returns
1896  * SVN_ERR_WC_OBSTRUCTED_UPDATE or SVN_ERR_WC_FOUND_CONFLICT.
1897  * The caller should continue by resolving other conflicts and attempt to
1898  * resolve this conflict again later.
1899  *
1900  * The working copy must already be locked for resolving, e.g. by calling
1901  * svn_wc__acquire_write_lock_for_resolve() first.
1902  *
1903  * @since New in 1.10.
1904  */
1905 svn_error_t *
1906 svn_wc__conflict_tree_update_raise_moved_away(svn_wc_context_t *wc_ctx,
1907                                               const char *local_abspath,
1908                                               svn_cancel_func_t cancel_func,
1909                                               void *cancel_baton,
1910                                               svn_wc_notify_func2_t notify_func,
1911                                               void *notify_baton,
1912                                               apr_pool_t *scratch_pool);
1913
1914 /* Resolve a tree conflict where the victim at LOCAL_ABSPATH is a file or
1915  * directory which was locally moved away, and which received an edit (some
1916  * change inside the directory or file, or a change to properties) during an
1917  * update or switch operation.
1918  *
1919  * The conflict is resolved by keeping the victim moved-away, and propagating
1920  * the incoming edits to the victim's moved-to location.
1921  *
1922  * The tree conflict at LOCAL_ABSPATH must have the following properties or
1923  * SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE will be returned:
1924  *
1925  * operation: svn_wc_operation_update or svn_wc_operation_switch
1926  * local change: svn_wc_conflict_reason_moved_away
1927  * incoming change: svn_wc_conflict_action_edit
1928  *
1929  * If this conflict cannot be resolved this function returns
1930  * SVN_ERR_WC_OBSTRUCTED_UPDATE or SVN_ERR_WC_FOUND_CONFLICT.
1931  * The caller should continue by resolving other conflicts and attempt to
1932  * resolve this conflict again later.
1933  *
1934  * The working copy must already be locked for resolving, e.g. by calling
1935  * svn_wc__acquire_write_lock_for_resolve() first.
1936  *
1937  * @since New in 1.10.
1938  */
1939 svn_error_t *
1940 svn_wc__conflict_tree_update_moved_away_node(svn_wc_context_t *wc_ctx,
1941                                              const char *local_abspath,
1942                                              svn_cancel_func_t cancel_func,
1943                                              void *cancel_baton,
1944                                              svn_wc_notify_func2_t notify_func,
1945                                              void *notify_baton,
1946                                              apr_pool_t *scratch_pool);
1947
1948 /* Merge local changes from a tree conflict victim of an incoming deletion
1949  * to the specified DEST_ABSPATH added during an update. Both LOCAL_ABSPATH
1950  * and DEST_ABSPATH must be directories.
1951  *
1952  * Assuming DEST_ABSPATH is the correct move destination, this function
1953  * allows local changes to "follow" incoming moves during updates.
1954  *
1955  * @since New in 1.10. */
1956 svn_error_t *
1957 svn_wc__conflict_tree_update_incoming_move(svn_wc_context_t *wc_ctx,
1958                                            const char *local_abspath,
1959                                            const char *dest_abspath,
1960                                            svn_cancel_func_t cancel_func,
1961                                            void *cancel_baton,
1962                                            svn_wc_notify_func2_t notify_func,
1963                                            void *notify_baton,
1964                                            apr_pool_t *scratch_pool);
1965
1966 /* Resolve a 'local dir add vs incoming dir add' tree conflict upon update
1967  * by merging the locally added directory with the incoming added directory.
1968  *
1969  * @since New in 1.10. */
1970 svn_error_t *
1971 svn_wc__conflict_tree_update_local_add(svn_wc_context_t *wc_ctx,
1972                                        const char *local_abspath,
1973                                        svn_cancel_func_t cancel_func,
1974                                        void *cancel_baton,
1975                                        svn_wc_notify_func2_t notify_func,
1976                                        void *notify_baton,
1977                                        apr_pool_t *scratch_pool);
1978
1979 /* Find nodes in the working copy which corresponds to the new location
1980  * MOVED_TO_REPOS_RELPATH of the tree conflict victim at VICTIM_ABSPATH.
1981  * The nodes must be of the same node kind as VICTIM_NODE_KIND.
1982  * If no such node can be found, set *POSSIBLE_TARGETS to an empty array.
1983  *
1984  * The nodes should be useful for conflict resolution, e.g. it should be
1985  * possible to merge changes into these nodes to resolve an incoming-move
1986  * tree conflict. But the exact criteria for selecting a node are left
1987  * to the implementation of this function.
1988  * Note that this function may not necessarily return a node which was
1989  * actually moved. The only hard guarantee is that the node corresponds to
1990  * the repository relpath MOVED_TO_REPOS_RELPATH specified by the caller.
1991  * Users should perform a sanity check on the results returned from this
1992  * function, e.g. establish whether the MOVED_TO_REPOS_RELPATH at its
1993  * current checked-out revision shares ancestry with the conflict victim.
1994  */
1995 svn_error_t *
1996 svn_wc__guess_incoming_move_target_nodes(apr_array_header_t **possible_targets,
1997                                          svn_wc_context_t *wc_ctx,
1998                                          const char *victim_abspath,
1999                                          svn_node_kind_t victim_node_kind,
2000                                          const char *moved_to_repos_relpath,
2001                                          apr_pool_t *result_pool,
2002                                          apr_pool_t *scratch_pool);
2003
2004 /**
2005  * Move @a src_abspath to @a dst_abspath, by scheduling @a dst_abspath
2006  * for addition to the repository, remembering the history. Mark @a src_abspath
2007  * as deleted after moving.@a wc_ctx is used for accessing the working copy and
2008  * must contain a write lock for the parent directory of @a src_abspath and
2009  * @a dst_abspath.
2010  *
2011  * If @a metadata_only is TRUE then this is a database-only operation and
2012  * the working directories and files are not changed.
2013  *
2014  * @a src_abspath must be a file or directory under version control;
2015  * the parent of @a dst_abspath must be a directory under version control
2016  * in the same working copy; @a dst_abspath will be the name of the copied
2017  * item, and it must not exist already if @a metadata_only is FALSE.  Note that
2018  * when @a src points to a versioned file, the working file doesn't
2019  * necessarily exist in which case its text-base is used instead.
2020  *
2021  * If @a allow_mixed_revisions is @c FALSE, #SVN_ERR_WC_MIXED_REVISIONS
2022  * will be raised if the move source is a mixed-revision subtree.
2023  * If @a allow_mixed_revisions is TRUE, a mixed-revision move source is
2024  * allowed but the move will degrade to a copy and a delete without local
2025  * move tracking. This parameter should be set to FALSE except where backwards
2026  * compatibility to svn_wc_move() is required.
2027  *
2028  * If @a cancel_func is non-NULL, call it with @a cancel_baton at
2029  * various points during the operation.  If it returns an error
2030  * (typically #SVN_ERR_CANCELLED), return that error immediately.
2031  *
2032  * If @a notify_func is non-NULL, call it with @a notify_baton and the path
2033  * of the root node (only) of the destination.
2034  *
2035  * Use @a scratch_pool for temporary allocations.
2036  *
2037  * @since New in 1.8.
2038  */
2039 svn_error_t *
2040 svn_wc__move2(svn_wc_context_t *wc_ctx,
2041               const char *src_abspath,
2042               const char *dst_abspath,
2043               svn_boolean_t metadata_only,
2044               svn_boolean_t allow_mixed_revisions,
2045               svn_cancel_func_t cancel_func,
2046               void *cancel_baton,
2047               svn_wc_notify_func2_t notify_func,
2048               void *notify_baton,
2049               apr_pool_t *scratch_pool);
2050
2051
2052 /* During merge when we encounter added directories, we add them using
2053    svn_wc_add4(), recording its original location, etc. But at that time
2054    we don't have its original properties. This function allows updating the
2055    BASE properties of such a special added node, but only before it receives
2056    other changes.
2057
2058    NEW_ORIGINAL_PROPS is a new set of properties, including entry props that
2059    will be applied to LOCAL_ABSPATH as pristine properties.
2060
2061    The copyfrom_* arguments are used to verify (some of) the assumptions of
2062    this function */
2063 svn_error_t *
2064 svn_wc__complete_directory_add(svn_wc_context_t *wc_ctx,
2065                                const char *local_abspath,
2066                                apr_hash_t *new_original_props,
2067                                const char *copyfrom_url,
2068                                svn_revnum_t copyfrom_rev,
2069                                apr_pool_t *scratch_pool);
2070
2071
2072 /* Acquire a write lock on LOCAL_ABSPATH or an ancestor that covers
2073    all possible paths affected by resolving the conflicts in the tree
2074    LOCAL_ABSPATH.  Set *LOCK_ROOT_ABSPATH to the path of the lock
2075    obtained. */
2076 svn_error_t *
2077 svn_wc__acquire_write_lock_for_resolve(const char **lock_root_abspath,
2078                                        svn_wc_context_t *wc_ctx,
2079                                        const char *local_abspath,
2080                                        apr_pool_t *result_pool,
2081                                        apr_pool_t *scratch_pool);
2082
2083 /* The implemementation of svn_wc_diff6(), but reporting to a diff processor
2084  *
2085  * New mode, when ANCHOR_AT_GIVEN_PATHS is true:
2086  *
2087  *   Anchor the DIFF_PROCESSOR at LOCAL_ABSPATH.
2088  *
2089  * Backward compatibility mode for svn_wc_diff6(),
2090  * when ANCHOR_AT_GIVEN_PATHS is false:
2091  *
2092  *   Send diff processor relpaths relative to LOCAL_ABSPATH if it is a
2093  *   directory; otherwise, relative to the parent of LOCAL_ABSPATH.
2094  *   This matches the "anchor and target" semantics of svn_wc_diff6().
2095  */
2096 svn_error_t *
2097 svn_wc__diff7(svn_boolean_t anchor_at_given_paths,
2098               svn_wc_context_t *wc_ctx,
2099               const char *local_abspath,
2100               svn_depth_t depth,
2101               svn_boolean_t ignore_ancestry,
2102               const apr_array_header_t *changelist_filter,
2103               const svn_diff_tree_processor_t *diff_processor,
2104               svn_cancel_func_t cancel_func,
2105               void *cancel_baton,
2106               apr_pool_t *result_pool,
2107               apr_pool_t *scratch_pool);
2108
2109 /**
2110  * Read all conflicts at LOCAL_ABSPATH into an array containing pointers to
2111  * svn_wc_conflict_description2_t data structures alloated in RESULT_POOL.
2112  */
2113 svn_error_t *
2114 svn_wc__read_conflict_descriptions2_t(const apr_array_header_t **conflicts,
2115                                       svn_wc_context_t *wc_ctx,
2116                                       const char *local_abspath,
2117                                       apr_pool_t *result_pool,
2118                                       apr_pool_t *scratch_pool);
2119
2120 /* Internal version of svn_wc_translated_stream(), accepting a working
2121    copy context. */
2122 svn_error_t *
2123 svn_wc__translated_stream(svn_stream_t **stream,
2124                           svn_wc_context_t *wc_ctx,
2125                           const char *local_abspath,
2126                           const char *versioned_abspath,
2127                           apr_uint32_t flags,
2128                           apr_pool_t *result_pool,
2129                           apr_pool_t *scratch_pool);
2130
2131 #ifdef __cplusplus
2132 }
2133 #endif /* __cplusplus */
2134
2135 #endif /* SVN_WC_PRIVATE_H */