Change the format of the revprops block sent in svnserve for
[svn.git] / subversion / include / svn_wc.h
blob94a1b135819e355350dfc671f00a81370f2bff5f
1 /**
2 * @copyright
3 * ====================================================================
4 * Copyright (c) 2000-2007 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
16 * @endcopyright
18 * @file svn_wc.h
19 * @brief Subversion's working copy library
21 * Requires:
22 * - A working copy
24 * Provides:
25 * - Ability to manipulate working copy's versioned data.
26 * - Ability to manipulate working copy's administrative files.
28 * Used By:
29 * - Clients.
32 #ifndef SVN_WC_H
33 #define SVN_WC_H
36 #include <apr.h>
37 #include <apr_pools.h>
38 #include <apr_tables.h>
39 #include <apr_hash.h>
41 #include "svn_types.h"
42 #include "svn_string.h"
43 #include "svn_delta.h"
44 #include "svn_error.h"
45 #include "svn_opt.h"
46 #include "svn_ra.h" /* for svn_ra_reporter_t type */
48 #ifdef __cplusplus
49 extern "C" {
50 #endif /* __cplusplus */
53 /**
54 * Get libsvn_wc version information.
56 * @since New in 1.1.
58 const svn_version_t *svn_wc_version(void);
60 /**
61 * @defgroup svn_wc Working copy management
62 * @{
65 /** Flags for use with svn_wc_translated_file2
67 * @defgroup translate_flags Translation flags
69 * @{
72 /** Translate from Normal Form.
74 * The working copy text bases and repository files are stored
75 * in normal form. Some files' contents - or ever representation -
76 * differs between the working copy and the normal form. This flag
77 * specifies to take the latter form as input and transform it
78 * to the former.
80 * Either this flag or @c SVN_WC_TRANSLATE_TO_NF should be specified,
81 * but not both.
83 #define SVN_WC_TRANSLATE_FROM_NF 0x00000000
85 /** Translate to Normal Form.
87 * Either this flag or @c SVN_WC_TRANSLATE_FROM_NF should be specified,
88 * but not both.
90 #define SVN_WC_TRANSLATE_TO_NF 0x00000001
92 /** Force repair of eol styles, making sure the output file consistently
93 * contains the one eol style as specified by the svn:eol-style
94 * property and the required translation direction.
97 #define SVN_WC_TRANSLATE_FORCE_EOL_REPAIR 0x00000002
99 /** Don't register a pool cleanup to delete the output file */
100 #define SVN_WC_TRANSLATE_NO_OUTPUT_CLEANUP 0x00000004
102 /** Guarantee a new file is created on successful return.
103 * The default shortcuts translation by returning the path
104 * of the untranslated file when no translation is required.
106 #define SVN_WC_TRANSLATE_FORCE_COPY 0x00000008
108 /** Use a non-wc-local tmp directory for creating output files,
109 * instead of in the working copy admin tmp area which is the default.
111 * @since New in 1.4.
113 #define SVN_WC_TRANSLATE_USE_GLOBAL_TMP 0x00000010
115 /** @} */
118 /* Locking/Opening/Closing */
120 /** Baton for access to a working copy administrative area.
122 * One day all such access will require a baton, we're not there yet.
124 * Access batons can be grouped into sets, by passing an existing open
125 * baton when opening a new baton. Given one baton in a set, other batons
126 * may be retrieved. This allows an entire hierarchy to be locked, and
127 * then the set of batons can be passed around by passing a single baton.
129 typedef struct svn_wc_adm_access_t svn_wc_adm_access_t;
133 * Return, in @a *adm_access, a pointer to a new access baton for the working
134 * copy administrative area associated with the directory @a path. If
135 * @a write_lock is TRUE the baton will include a write lock, otherwise the
136 * baton can only be used for read access. If @a path refers to a directory
137 * that is already write locked then the error @c SVN_ERR_WC_LOCKED will be
138 * returned. The error @c SVN_ERR_WC_NOT_DIRECTORY will be returned if
139 * @a path is not a versioned directory.
141 * If @a associated is an open access baton then @a adm_access will be added
142 * to the set containing @a associated. @a associated can be @c NULL, in
143 * which case @a adm_access is the start of a new set.
145 * @a levels_to_lock specifies how far to lock. Zero means just the specified
146 * directory. Any negative value means to lock the entire working copy
147 * directory hierarchy under @a path. A positive value indicates the number of
148 * levels of directories to lock -- 1 means just immediate subdirectories, 2
149 * means immediate subdirectories and their subdirectories, etc. All the
150 * access batons will become part of the set containing @a adm_access. This
151 * is an all-or-nothing option, if it is not possible to lock all the
152 * requested directories then an error will be returned and @a adm_access will
153 * be invalid, with the exception that subdirectories of @a path that are
154 * missing from the physical filesystem will not be locked and will not cause
155 * an error. The error @c SVN_ERR_WC_LOCKED will be returned if a
156 * subdirectory of @a path is already write locked.
158 * If @a cancel_func is non-NULL, call it with @a cancel_baton to determine
159 * if the client has cancelled the operation.
161 * @a pool will be used to allocate memory for the baton and any subsequently
162 * cached items. If @a adm_access has not been closed when the pool is
163 * cleared, it will be closed automatically at that point, and removed from
164 * its set. A baton closed in this way will not remove physical locks from
165 * the working copy if cleanup is required.
167 * The first baton in a set, with @a associated passed as @c NULL, must have
168 * the longest lifetime of all the batons in the set. This implies it must be
169 * the root of the hierarchy.
171 * @since New in 1.2.
173 svn_error_t *
174 svn_wc_adm_open3(svn_wc_adm_access_t **adm_access,
175 svn_wc_adm_access_t *associated,
176 const char *path,
177 svn_boolean_t write_lock,
178 int levels_to_lock,
179 svn_cancel_func_t cancel_func,
180 void *cancel_baton,
181 apr_pool_t *pool);
184 * Similar to svn_wc_adm_open3(), but without cancellation support.
186 * @deprecated Provided for backward compatibility with the 1.1 API.
188 svn_error_t *
189 svn_wc_adm_open2(svn_wc_adm_access_t **adm_access,
190 svn_wc_adm_access_t *associated,
191 const char *path,
192 svn_boolean_t write_lock,
193 int levels_to_lock,
194 apr_pool_t *pool);
197 * Similar to svn_wc_adm_open2(), but with @a tree_lock instead of
198 * @a levels_to_lock. @a levels_to_lock is set to -1 if @a tree_lock
199 * is @c TRUE, else 0.
201 * @deprecated Provided for backward compatibility with the 1.0 API.
203 svn_error_t *
204 svn_wc_adm_open(svn_wc_adm_access_t **adm_access,
205 svn_wc_adm_access_t *associated,
206 const char *path,
207 svn_boolean_t write_lock,
208 svn_boolean_t tree_lock,
209 apr_pool_t *pool);
212 * Checks the working copy to determine the node type of @a path. If
213 * @a path is a versioned directory then the behaviour is like that of
214 * svn_wc_adm_open3(), otherwise, if @a path is a file or does not
215 * exist, then the behaviour is like that of svn_wc_adm_open3() with
216 * @a path replaced by the parent directory of @a path. If @a path is
217 * an unversioned directory, the behaviour is also like that of
218 * svn_wc_adm_open3() on the parent, except that if the open fails,
219 * then the returned SVN_ERR_WC_NOT_DIRECTORY error refers to @a path,
220 * not to @a path's parent.
222 * @since New in 1.2.
224 svn_error_t *
225 svn_wc_adm_probe_open3(svn_wc_adm_access_t **adm_access,
226 svn_wc_adm_access_t *associated,
227 const char *path,
228 svn_boolean_t write_lock,
229 int levels_to_lock,
230 svn_cancel_func_t cancel_func,
231 void *cancel_baton,
232 apr_pool_t *pool);
235 * Similar to svn_wc_adm_probe_open3() without the cancel
236 * functionality.
238 * @deprecated Provided for backward compatibility with the 1.1 API.
240 svn_error_t *
241 svn_wc_adm_probe_open2(svn_wc_adm_access_t **adm_access,
242 svn_wc_adm_access_t *associated,
243 const char *path,
244 svn_boolean_t write_lock,
245 int levels_to_lock,
246 apr_pool_t *pool);
249 * Similar to svn_wc_adm_probe_open2(), but with @a tree_lock instead of
250 * @a levels_to_lock. @a levels_to_lock is set to -1 if @a tree_lock
251 * is @c TRUE, else 0.
253 * @deprecated Provided for backward compatibility with the 1.0 API.
255 svn_error_t *
256 svn_wc_adm_probe_open(svn_wc_adm_access_t **adm_access,
257 svn_wc_adm_access_t *associated,
258 const char *path,
259 svn_boolean_t write_lock,
260 svn_boolean_t tree_lock,
261 apr_pool_t *pool);
264 * Open access batons for @a path and return in @a *anchor_access and
265 * @a *target the anchor and target required to drive an editor. Return
266 * in @a *target_access the access baton for the target, which may be the
267 * same as @a *anchor_access. All the access batons will be in the
268 * @a *anchor_access set.
270 * @a levels_to_lock determines the levels_to_lock used when opening
271 * @a path if @a path is a versioned directory, @a levels_to_lock is
272 * ignored otherwise. If @a write_lock is @c TRUE the access batons
273 * will hold write locks.
275 * If @a cancel_func is non-NULL, call it with @a cancel_baton to determine
276 * if the client has cancelled the operation.
278 * This function is essentially a combination of svn_wc_adm_open3() and
279 * svn_wc_get_actual_target(), with the emphasis on reducing physical IO.
281 * @since New in 1.2.
283 svn_error_t *
284 svn_wc_adm_open_anchor(svn_wc_adm_access_t **anchor_access,
285 svn_wc_adm_access_t **target_access,
286 const char **target,
287 const char *path,
288 svn_boolean_t write_lock,
289 int levels_to_lock,
290 svn_cancel_func_t cancel_func,
291 void *cancel_baton,
292 apr_pool_t *pool);
294 /** Return, in @a *adm_access, a pointer to an existing access baton associated
295 * with @a path. @a path must be a directory that is locked as part of the
296 * set containing the @a associated access baton.
298 * If the requested access baton is marked as missing in, or is simply
299 * absent from, @a associated, return SVN_ERR_WC_NOT_LOCKED.
301 * @a pool is used only for local processing, it is not used for the batons.
303 svn_error_t *
304 svn_wc_adm_retrieve(svn_wc_adm_access_t **adm_access,
305 svn_wc_adm_access_t *associated,
306 const char *path,
307 apr_pool_t *pool);
309 /** Check the working copy to determine the node type of @a path. If
310 * @a path is a versioned directory then the behaviour is like that of
311 * svn_wc_adm_retrieve(), otherwise, if @a path is a file, an unversioned
312 * directory, or does not exist, then the behaviour is like that of
313 * svn_wc_adm_retrieve() with @a path replaced by the parent directory of
314 * @a path.
316 svn_error_t *
317 svn_wc_adm_probe_retrieve(svn_wc_adm_access_t **adm_access,
318 svn_wc_adm_access_t *associated,
319 const char *path,
320 apr_pool_t *pool);
323 * Try various ways to obtain an access baton for @a path.
325 * First, try to obtain @a *adm_access via svn_wc_adm_probe_retrieve(),
326 * but if this fails because @a associated can't give a baton for
327 * @a path or @a path's parent, then try svn_wc_adm_probe_open3(),
328 * this time passing @a write_lock and @a levels_to_lock. If there is
329 * still no access because @a path is not a versioned directory, then
330 * just set @a *adm_access to NULL and return success. But if it is
331 * because @a path is locked, then return the error @c SVN_ERR_WC_LOCKED,
332 * and the effect on @a *adm_access is undefined. (Or if the attempt
333 * fails for any other reason, return the corresponding error, and the
334 * effect on @a *adm_access is also undefined.)
336 * If svn_wc_adm_probe_open3() succeeds, then add @a *adm_access to
337 * @a associated.
339 * If @a cancel_func is non-NULL, call it with @a cancel_baton to determine
340 * if the client has cancelled the operation.
342 * Use @a pool only for local processing, not to allocate @a *adm_access.
344 * @since New in 1.2.
346 svn_error_t *
347 svn_wc_adm_probe_try3(svn_wc_adm_access_t **adm_access,
348 svn_wc_adm_access_t *associated,
349 const char *path,
350 svn_boolean_t write_lock,
351 int levels_to_lock,
352 svn_cancel_func_t cancel_func,
353 void *cancel_baton,
354 apr_pool_t *pool);
357 * Similar to svn_wc_adm_probe_try3() without the cancel
358 * functionality.
360 * @deprecated Provided for backward compatibility with the 1.1 API.
362 svn_error_t *
363 svn_wc_adm_probe_try2(svn_wc_adm_access_t **adm_access,
364 svn_wc_adm_access_t *associated,
365 const char *path,
366 svn_boolean_t write_lock,
367 int levels_to_lock,
368 apr_pool_t *pool);
371 * Similar to svn_wc_adm_probe_try2(), but with @a tree_lock instead of
372 * @a levels_to_lock. @a levels_to_lock is set to -1 if @a tree_lock
373 * is @c TRUE, else 0.
375 * @deprecated Provided for backward compatibility with the 1.0 API.
377 svn_error_t *
378 svn_wc_adm_probe_try(svn_wc_adm_access_t **adm_access,
379 svn_wc_adm_access_t *associated,
380 const char *path,
381 svn_boolean_t write_lock,
382 svn_boolean_t tree_lock,
383 apr_pool_t *pool);
386 /** Give up the access baton @a adm_access, and its lock if any. This will
387 * recursively close any batons in the same set that are direct
388 * subdirectories of @a adm_access. Any physical locks will be removed from
389 * the working copy. Lock removal is unconditional, there is no check to
390 * determine if cleanup is required.
392 svn_error_t *svn_wc_adm_close(svn_wc_adm_access_t *adm_access);
394 /** Return the path used to open the access baton @a adm_access */
395 const char *svn_wc_adm_access_path(svn_wc_adm_access_t *adm_access);
397 /** Return the pool used by access baton @a adm_access */
398 apr_pool_t *svn_wc_adm_access_pool(svn_wc_adm_access_t *adm_access);
400 /** Return @c TRUE is the access baton @a adm_access has a write lock,
401 * @c FALSE otherwise. Compared to svn_wc_locked() this is a cheap, fast
402 * function that doesn't access the filesystem.
404 svn_boolean_t svn_wc_adm_locked(svn_wc_adm_access_t *adm_access);
406 /** Set @a *locked to non-zero if @a path is locked, else set it to zero. */
407 svn_error_t *
408 svn_wc_locked(svn_boolean_t *locked,
409 const char *path,
410 apr_pool_t *pool);
414 * Return @c TRUE if @a name is the name of the WC administrative
415 * directory. Use @a pool for any temporary allocations. Only works
416 * with base directory names, not paths or URIs.
418 * For compatibility, the default name (.svn) will always be treated
419 * as an admin dir name, even if the working copy is actually using an
420 * alternative name.
422 * @since New in 1.3.
424 svn_boolean_t svn_wc_is_adm_dir(const char *name, apr_pool_t *pool);
428 * Return the name of the administrative directory.
429 * Use @a pool for any temporary allocations.
431 * The returned pointer will refer to either a statically allocated
432 * string, or to a string allocated in @a pool.
434 * @since New in 1.3.
436 const char *svn_wc_get_adm_dir(apr_pool_t *pool);
440 * Use @a name for the administrative directory in the working copy.
441 * Use @a pool for any temporary allocations.
443 * The list of valid names is limited. Currently only ".svn" (the
444 * default) and "_svn" are allowed.
446 * @note This function changes global (per-process) state and must be
447 * called in a single-threaded context during the initialization of a
448 * Subversion client.
450 * @since New in 1.3.
452 svn_error_t *svn_wc_set_adm_dir(const char *name, apr_pool_t *pool);
456 /** Traversal information is information gathered by a working copy
457 * crawl or update. For example, the before and after values of the
458 * svn:externals property are important after an update, and since
459 * we're traversing the working tree anyway (a complete traversal
460 * during the initial crawl, and a traversal of changed paths during
461 * the checkout/update/switch), it makes sense to gather the
462 * property's values then instead of making a second pass.
464 typedef struct svn_wc_traversal_info_t svn_wc_traversal_info_t;
467 /** Return a new, empty traversal info object, allocated in @a pool. */
468 svn_wc_traversal_info_t *svn_wc_init_traversal_info(apr_pool_t *pool);
471 /** Set @a *externals_old and @a *externals_new to hash tables representing
472 * changes to values of the svn:externals property on directories
473 * traversed by @a traversal_info.
475 * @a traversal_info is obtained from svn_wc_init_traversal_info(), but is
476 * only useful after it has been passed through another function, such
477 * as svn_wc_crawl_revisions(), svn_wc_get_update_editor(),
478 * svn_wc_get_switch_editor(), etc.
480 * Each hash maps <tt>const char *</tt> directory names onto
481 * <tt>const char *</tt> values of the externals property for that directory.
482 * The dir names are full paths -- that is, anchor plus target, not target
483 * alone. The values are not parsed, they are simply copied raw, and are
484 * never NULL: directories that acquired or lost the property are
485 * simply omitted from the appropriate table. Directories whose value
486 * of the property did not change show the same value in each hash.
488 * The hashes, keys, and values have the same lifetime as @a traversal_info.
490 void
491 svn_wc_edited_externals(apr_hash_t **externals_old,
492 apr_hash_t **externals_new,
493 svn_wc_traversal_info_t *traversal_info);
496 /** Set @a *depths to a hash table mapping <tt>const char *</tt>
497 * directory names (directories traversed by @a traversal_info) to
498 * <tt>const char *</tt> values (the depths of those directories, as
499 * converted by svn_depth_to_word()).
501 * @a traversal_info is obtained from svn_wc_init_traversal_info(), but is
502 * only useful after it has been passed through another function, such
503 * as svn_wc_crawl_revisions(), svn_wc_get_update_editor(),
504 * svn_wc_get_switch_editor(), etc.
506 * The dir names are full paths -- that is, anchor plus target, not target
507 * alone. The values are not allocated, they are static constant strings.
508 * Although the values are never NULL, not all directories traversed
509 * are necessarily listed. For example, directories which did not
510 * have an svn:externals property set or modified are not included.
512 * The hashes and keys have the same lifetime as @a traversal_info.
514 * @since New in 1.5.
516 void
517 svn_wc_traversed_depths(apr_hash_t **depths,
518 svn_wc_traversal_info_t *traversal_info);
521 /** One external item. This usually represents one line from an
522 * svn:externals description but with the path and URL
523 * canonicalized.
525 * In order to avoid backwards compatibility problems clients should use
526 * svn_wc_external_item_create() to allocate and intialize this structure
527 * instead of doing so themselves.
529 * @since New in 1.5.
531 typedef struct svn_wc_external_item2_t
533 /** The name of the subdirectory into which this external should be
534 checked out. This is relative to the parent directory that
535 holds this external item. (Note that these structs are often
536 stored in hash tables with the target dirs as keys, so this
537 field will often be redundant.) */
538 const char *target_dir;
540 /** Where to check out from. */
541 const char *url;
543 /** What revision to check out. The only valid kinds for this are
544 svn_opt_revision_number, svn_opt_revision_date, and
545 svn_opt_revision_head. */
546 svn_opt_revision_t revision;
548 /** The peg revision to use when checking out. The only valid kinds are
549 svn_opt_revision_number, svn_opt_revision_date, and
550 svn_opt_revision_head. */
551 svn_opt_revision_t peg_revision;
553 } svn_wc_external_item2_t;
556 * Initialize an external item.
557 * Set @a *item to an external item object, allocated in @a pool.
559 * In order to avoid backwards compatibility problems, this function
560 * is used to intialize and allocate the @c svn_wc_external_item2_t
561 * structure rather than doing so explicitly, as the size of this
562 * structure may change in the future.
564 * The current implementation never returns error, but callers should
565 * still check for error, for compatibility with future versions.
567 * @since New in 1.5.
569 svn_error_t *
570 svn_wc_external_item_create(const svn_wc_external_item2_t **item,
571 apr_pool_t *pool);
574 * Return a duplicate of @a item, allocated in @a pool. No part of the new
575 * item will be shared with @a item.
577 * @since New in 1.5.
579 svn_wc_external_item2_t *
580 svn_wc_external_item2_dup(const svn_wc_external_item2_t *item,
581 apr_pool_t *pool);
584 * One external item. Similar to svn_wc_external_item2_t, except
585 * @a revision is interpreted as both the operational revision and the
586 * peg revision.
588 * @deprecated Provided for backward compatibility with the 1.4 API.
590 typedef struct svn_wc_external_item_t
592 /** Same as @c svn_wc_external_item2_t.target_dir */
593 const char *target_dir;
595 /** Same as @c svn_wc_external_item2_t.url */
596 const char *url;
598 /** Same as @c svn_wc_external_item2_t.revision */
599 svn_opt_revision_t revision;
601 } svn_wc_external_item_t;
604 * Return a duplicate of @a item, allocated in @a pool. No part of the new
605 * item will be shared with @a item.
607 * @since New in 1.3.
609 * @deprecated Provided for backward compatibility with the 1.4 API.
611 svn_wc_external_item_t *
612 svn_wc_external_item_dup(const svn_wc_external_item_t *item,
613 apr_pool_t *pool);
616 * If @a externals_p is non-NULL, set @a *externals_p to an array of
617 * @c svn_wc_external_item2_t * objects based on @a desc. The @a url
618 * member of the objects will be canonicalized if @a canonicalize_url
619 * is @c TRUE.
621 * If the format of @a desc is invalid, don't touch @a *externals_p and
622 * return @c SVN_ERR_CLIENT_INVALID_EXTERNALS_DESCRIPTION. Thus, if
623 * you just want to check the validity of an externals description,
624 * and don't care about the parsed result, pass NULL for @a externals_p.
626 * The format of @a desc is the same as for values of the directory
627 * property @c SVN_PROP_EXTERNALS, which see.
629 * Allocate the table, keys, and values in @a pool.
631 * Use @a parent_directory only in constructing error strings.
633 * @since New in 1.5.
635 svn_error_t *
636 svn_wc_parse_externals_description3(apr_array_header_t **externals_p,
637 const char *parent_directory,
638 const char *desc,
639 svn_boolean_t canonicalize_url,
640 apr_pool_t *pool);
643 * Similar to svn_wc_parse_externals_description3() with @a
644 * canonicalize_url set to @c TRUE, but returns an array of @c
645 * svn_wc_external_item_t * objects instead of @c
646 * svn_wc_external_item2_t * objects
648 * @since New in 1.1.
650 * @deprecated Provided for backward compatibility with the 1.4 API.
652 svn_error_t *
653 svn_wc_parse_externals_description2(apr_array_header_t **externals_p,
654 const char *parent_directory,
655 const char *desc,
656 apr_pool_t *pool);
659 * Similar to svn_wc_parse_externals_description2(), but returns the
660 * parsed externals in a hash instead of an array. This function
661 * should not be used, as storing the externals in a hash causes their
662 * order of evaluation to be not easily identifiable.
664 * @deprecated Provided for backward compatibility with the 1.0 API.
666 svn_error_t *
667 svn_wc_parse_externals_description(apr_hash_t **externals_p,
668 const char *parent_directory,
669 const char *desc,
670 apr_pool_t *pool);
674 /* Notification/callback handling. */
677 * @defgroup svn_wc_notifications Notification callback handling
678 * @{
680 * In many cases, the WC library will scan a working copy and make
681 * changes. The caller usually wants to know when each of these changes
682 * has been made, so that it can display some kind of notification to
683 * the user.
685 * These notifications have a standard callback function type, which
686 * takes the path of the file that was affected, and a caller-
687 * supplied baton.
689 * Note that the callback is a 'void' return -- this is a simple
690 * reporting mechanism, rather than an opportunity for the caller to
691 * alter the operation of the WC library.
693 * Note also that some of the actions are used across several
694 * different Subversion commands. For example, the update actions are
695 * also used for checkouts, switches, and merges.
698 /** The type of action occurring. */
699 typedef enum svn_wc_notify_action_t
701 /** Adding a path to revision control. */
702 svn_wc_notify_add = 0,
704 /** Copying a versioned path. */
705 svn_wc_notify_copy,
707 /** Deleting a versioned path. */
708 svn_wc_notify_delete,
710 /** Restoring a missing path from the pristine text-base. */
711 svn_wc_notify_restore,
713 /** Reverting a modified path. */
714 svn_wc_notify_revert,
716 /** A revert operation has failed. */
717 svn_wc_notify_failed_revert,
719 /** Resolving a conflict. */
720 svn_wc_notify_resolved,
722 /** Skipping a path. */
723 svn_wc_notify_skip,
725 /** Got a delete in an update. */
726 svn_wc_notify_update_delete,
728 /** Got an add in an update. */
729 svn_wc_notify_update_add,
731 /** Got any other action in an update. */
732 svn_wc_notify_update_update,
734 /** The last notification in an update (including updates of externals). */
735 svn_wc_notify_update_completed,
737 /** Updating an external module. */
738 svn_wc_notify_update_external,
740 /** The last notification in a status (including status on externals). */
741 svn_wc_notify_status_completed,
743 /** Running status on an external module. */
744 svn_wc_notify_status_external,
746 /** Committing a modification. */
747 svn_wc_notify_commit_modified,
749 /** Committing an addition. */
750 svn_wc_notify_commit_added,
752 /** Committing a deletion. */
753 svn_wc_notify_commit_deleted,
755 /** Committing a replacement. */
756 svn_wc_notify_commit_replaced,
758 /** Transmitting post-fix text-delta data for a file. */
759 svn_wc_notify_commit_postfix_txdelta,
761 /** Processed a single revision's blame. */
762 svn_wc_notify_blame_revision,
764 /** Locking a path. @since New in 1.2. */
765 svn_wc_notify_locked,
767 /** Unlocking a path. @since New in 1.2. */
768 svn_wc_notify_unlocked,
770 /** Failed to lock a path. @since New in 1.2. */
771 svn_wc_notify_failed_lock,
773 /** Failed to unlock a path. @since New in 1.2. */
774 svn_wc_notify_failed_unlock,
776 /** Tried adding a path that already exists. @since New in 1.5. */
777 svn_wc_notify_exists,
779 /** Changelist name set. @since New in 1.5. */
780 svn_wc_notify_changelist_set,
782 /** Changelist name cleared. @since New in 1.5. */
783 svn_wc_notify_changelist_clear,
785 /** Failed to update a path's changelist association. @since New in 1.5. */
786 svn_wc_notify_changelist_failed,
788 /** Warn user that a path has moved from one changelist to another.
789 @since New in 1.5. */
790 svn_wc_notify_changelist_moved,
792 /** A merge operation (to path) has begun. See @c merge_range in
793 @c svn_wc_notify_t. @since New in 1.5 */
794 svn_wc_notify_merge_begin,
796 /** Replace notification. */
797 svn_wc_notify_update_replace
799 } svn_wc_notify_action_t;
802 /** The type of notification that is occurring. */
803 typedef enum svn_wc_notify_state_t
805 svn_wc_notify_state_inapplicable = 0,
807 /** Notifier doesn't know or isn't saying. */
808 svn_wc_notify_state_unknown,
810 /** The state did not change. */
811 svn_wc_notify_state_unchanged,
813 /** The item wasn't present. */
814 svn_wc_notify_state_missing,
816 /** An unversioned item obstructed work. */
817 svn_wc_notify_state_obstructed,
819 /** Pristine state was modified. */
820 svn_wc_notify_state_changed,
822 /** Modified state had mods merged in. */
823 svn_wc_notify_state_merged,
825 /** Modified state got conflicting mods. */
826 svn_wc_notify_state_conflicted
828 } svn_wc_notify_state_t;
831 * What happened to a lock during an operation.
833 * @since New in 1.2.
835 typedef enum svn_wc_notify_lock_state_t {
836 svn_wc_notify_lock_state_inapplicable = 0,
837 svn_wc_notify_lock_state_unknown,
838 /** The lock wasn't changed. */
839 svn_wc_notify_lock_state_unchanged,
840 /** The item was locked. */
841 svn_wc_notify_lock_state_locked,
842 /** The item was unlocked. */
843 svn_wc_notify_lock_state_unlocked
844 } svn_wc_notify_lock_state_t;
847 * Structure used in the @c svn_wc_notify_func2_t function.
849 * @c kind, @c content_state, @c prop_state and @c lock_state are from
850 * after @c action, not before.
852 * @note If @c action is @c svn_wc_notify_update, then @c path has
853 * already been installed, so it is legitimate for an implementation of
854 * @c svn_wc_notify_func2_t to examine @c path in the working copy.
856 * @note The purpose of the @c kind, @c mime_type, @c content_state, and
857 * @c prop_state fields is to provide "for free" information that an
858 * implementation is likely to want, and which it would otherwise be
859 * forced to deduce via expensive operations such as reading entries
860 * and properties. However, if the caller does not have this
861 * information, it will simply pass the corresponding `*_unknown'
862 * values, and it is up to the implementation how to handle that
863 * (i.e., whether to attempt deduction, or just to punt and
864 * give a less informative notification).
866 * @note Callers of notification functions should use svn_wc_create_notify()
867 * to create structures of this type to allow for extensibility.
869 * @since New in 1.2.
871 typedef struct svn_wc_notify_t {
872 /** Path, either absolute or relative to the current working directory
873 * (i.e., not relative to an anchor). */
874 const char *path;
875 /** Action that describes what happened to @c path. */
876 svn_wc_notify_action_t action;
877 /** Node kind of @c path. */
878 svn_node_kind_t kind;
879 /** If non-NULL, indicates the mime-type of @c path.
880 * It is always @c NULL for directories. */
881 const char *mime_type;
882 /** Points to the lock structure received from the repository when
883 * @c action is @c svn_wc_notify_locked. For other actions, it is
884 * @c NULL. */
885 const svn_lock_t *lock;
886 /** Points to an error describing the reason for the failure when @c
887 * action is @c svn_wc_notify_failed_lock or @c svn_wc_notify_failed_unlock.
888 * Is @c NULL otherwise. */
889 svn_error_t *err;
890 /** The type of notification that is occurring about node content. */
891 svn_wc_notify_state_t content_state;
892 /** The type of notification that is occurring about node properties. */
893 svn_wc_notify_state_t prop_state;
894 /** Reflects the addition or removal of a lock token in the working copy. */
895 svn_wc_notify_lock_state_t lock_state;
896 /** When @c action is @c svn_wc_notify_update_completed, target revision
897 * of the update, or @c SVN_INVALID_REVNUM if not available; when @c
898 * action is @c svn_wc_notify_blame_revision, processed revision.
899 * In all other cases, it is @c SVN_INVALID_REVNUM. */
900 svn_revnum_t revision;
901 /** When @c action is @c svn_wc_notify_changelist_add or name. In all other
902 * cases, it is @c NULL. */
903 const char *changelist_name;
904 /** When @c action is @c svn_wc_notify_merge_begin, and both the
905 left and right sides of the merge are from the same URL. In all
906 other cases, it is @c NULL. */
907 svn_merge_range_t *merge_range;
908 /* NOTE: Add new fields at the end to preserve binary compatibility.
909 Also, if you add fields here, you have to update svn_wc_create_notify
910 and svn_wc_dup_notify. */
911 } svn_wc_notify_t;
914 * Allocate an @c svn_wc_notify_t structure in @a pool, initialize and return
915 * it.
917 * Set the @c path field of the created struct to @a path, and @c action to
918 * @a action. Set all other fields to their @c _unknown, @c NULL or
919 * invalid value, respectively.
921 * @since New in 1.2.
923 svn_wc_notify_t *
924 svn_wc_create_notify(const char *path,
925 svn_wc_notify_action_t action,
926 apr_pool_t *pool);
929 * Return a deep copy of @a notify, allocated in @a pool.
931 * @since New in 1.2.
933 svn_wc_notify_t *
934 svn_wc_dup_notify(const svn_wc_notify_t *notify,
935 apr_pool_t *pool);
938 * Notify the world that @a notify->action has happened to @a notify->path.
940 * Recommendation: callers of @c svn_wc_notify_func2_t should avoid
941 * invoking it multiple times on the same path within a given
942 * operation, and implementations should not bother checking for such
943 * duplicate calls. For example, in an update, the caller should not
944 * invoke the notify func on receiving a prop change and then again
945 * on receiving a text change. Instead, wait until all changes have
946 * been received, and then invoke the notify func once (from within
947 * an @c svn_delta_editor_t's close_file(), for example), passing
948 * the appropriate @a notify->content_state and @a notify->prop_state flags.
950 * @since New in 1.2.
952 typedef void (*svn_wc_notify_func2_t)(void *baton,
953 const svn_wc_notify_t *notify,
954 apr_pool_t *pool);
957 * Similar to @c svn_wc_notify_func2_t, but takes the information as arguments
958 * instead of struct fields.
960 * @deprecated Provided for backward compatibility with the 1.1 API.
962 typedef void (*svn_wc_notify_func_t)(void *baton,
963 const char *path,
964 svn_wc_notify_action_t action,
965 svn_node_kind_t kind,
966 const char *mime_type,
967 svn_wc_notify_state_t content_state,
968 svn_wc_notify_state_t prop_state,
969 svn_revnum_t revision);
971 /** @} */
975 * A simple callback type to wrap svn_ra_get_file(); see that
976 * docstring for more information.
978 * This technique allows libsvn_client to 'wrap' svn_ra_get_file() and
979 * pass it down into libsvn_wc functions, thus allowing the WC layer
980 * to legally call the RA function via (blind) callback.
982 * @since New in 1.5
984 typedef svn_error_t *(*svn_wc_get_file_t)(void *baton,
985 const char *path,
986 svn_revnum_t revision,
987 svn_stream_t *stream,
988 svn_revnum_t *fetched_rev,
989 apr_hash_t **props,
990 apr_pool_t *pool);
994 * Interactive conflict handling
996 * @defgroup svn_wc_conflict Conflict callback functionality
998 * @{
1000 * This API gives a Subversion client application the opportunity to
1001 * define a callback that allows the user to resolve conflicts
1002 * interactively during updates and merges.
1004 * If a conflict is discovered, libsvn_wc invokes the callback with an
1005 * @c svn_wc_conflict_description_t. This structure describes the
1006 * path in conflict, whether it's a text or property conflict, and may
1007 * also present up to three files that can be used to resolve the
1008 * conflict (perhaps by launching an editor or 3rd-party merging
1009 * tool). The structure also provides a possible fourth file (@c
1010 * merged_file) which, if not NULL, represents libsvn_wc's attempt to
1011 * contextually merge the first three files. (Note that libsvn_wc
1012 * will not attempt to merge a file that it believes is binary, and it
1013 * will only attempt to merge property values it believes to be a
1014 * series of multi-line text.)
1016 * When the callback is finished interacting with the user, it
1017 * responds by returning a @c svn_wc_conflict_result_t. This
1018 * structure indicates whether the user wants to postpone the conflict
1019 * for later (allowing libsvn_wc to mark the path "conflicted" as
1020 * usual), or whether the user wants libsvn_wc to use one of the four
1021 * files as the "final" state for resolving the conflict immediately.
1023 * Note that the callback is at liberty (and encouraged) to merge the
1024 * three files itself. If it does so, it signals this to libsvn_wc by
1025 * returning a choice of @c svn_wc_conflict_choose_merged. To return
1026 * the 'final' merged file to libsvn_wc, the callback has the option of
1027 * either:
1029 * - editing the original @c merged_file in-place
1031 * or, if libsvn_wc never supplied a merged_file in the
1032 * description structure (i.e. passed NULL for that field),
1034 * - return the merged file in the @c svn_wc_conflict_result_t.
1038 /** The type of action being attempted on an object.
1040 * @since New in 1.5.
1042 typedef enum svn_wc_conflict_action_t
1044 svn_wc_conflict_action_edit, /* attempting to change text or props */
1045 svn_wc_conflict_action_add, /* attempting to add object */
1046 svn_wc_conflict_action_delete /* attempting to delete object */
1048 } svn_wc_conflict_action_t;
1051 /** The pre-existing condition which is causing a state of conflict.
1053 * @since New in 1.5.
1055 typedef enum svn_wc_conflict_reason_t
1057 svn_wc_conflict_reason_edited, /* local edits are already present */
1058 svn_wc_conflict_reason_obstructed, /* another object is in the way */
1059 svn_wc_conflict_reason_deleted, /* object is already schedule-delete */
1060 svn_wc_conflict_reason_missing, /* object is unknown or missing */
1061 svn_wc_conflict_reason_unversioned /* object is unversioned */
1063 } svn_wc_conflict_reason_t;
1066 /** The type of conflict being described by an @c
1067 * svn_wc_conflict_description_t (see below).
1069 * @since New in 1.5.
1071 typedef enum svn_wc_conflict_kind_t
1073 svn_wc_conflict_kind_text, /* textual conflict (on a file) */
1074 svn_wc_conflict_kind_property /* property conflict (on a file or dir) */
1076 /* ### Add future kinds here that represent "tree" conflicts. */
1078 } svn_wc_conflict_kind_t;
1081 /** A struct that describes a conflict that has occurred in the
1082 * working copy. Passed to @c svn_wc_conflict_resolver_func_t.
1084 * @note Fields may be added to the end of this structure in future
1085 * versions. Therefore, to preserve binary compatibility, users
1086 * should not directly allocate structures of this type.
1088 * @since New in 1.5.
1090 typedef struct svn_wc_conflict_description_t
1092 /** The path that is being operated on */
1093 const char *path;
1095 /** The node type of the path being operated on */
1096 svn_node_kind_t node_kind;
1098 /** What sort of conflict are we describing? */
1099 svn_wc_conflict_kind_t kind;
1101 /** Only set if this is a property conflict. */
1102 const char *property_name;
1104 /** The following only apply to file objects:
1105 * - Whether svn thinks the object is a binary file.
1106 * - If available (non-NULL), the svn:mime-type property of the path */
1107 svn_boolean_t is_binary;
1109 /** mime-type of the object */
1110 const char *mime_type;
1112 /** If not NULL, an open working copy access baton to either the
1113 * path itself (if @c path is a directory), or to the parent
1114 * directory (if @c path is a file.) */
1115 svn_wc_adm_access_t *access;
1117 /** The action being attempted on @c path. */
1118 svn_wc_conflict_action_t action;
1120 /** The reason for the conflict. */
1121 svn_wc_conflict_reason_t reason;
1123 /** If this is text-conflict and involves the merging of two files
1124 * descended from a common ancestor, here are the paths of up to
1125 * four fulltext files that can be used to interactively resolve the
1126 * conflict. All four files will be in repository-normal form -- LF
1127 * line endings and contracted keywords. (If any of these files are
1128 * not available, they default to NULL.)
1130 * On the other hand, if this is a property-conflict, then these
1131 * paths represent temporary files that contain the three different
1132 * property-values in conflict. The fourth path (@c merged_file)
1133 * may or may not be NULL; if set, it represents libsvn_wc's
1134 * attempt to merge the property values together. (Remember that
1135 * property values are technically binary values, and thus can't
1136 * always be merged.)
1138 const char *base_file; /* common ancestor of the two files being merged */
1140 /** their version of the file */
1141 const char *their_file;
1143 /** my locally-edited version of the file */
1144 const char *my_file;
1146 /** merged version; may contain conflict markers */
1147 const char *merged_file;
1149 } svn_wc_conflict_description_t;
1152 /** The way in which the conflict callback chooses a course of action.
1154 * @since New in 1.5.
1156 typedef enum svn_wc_conflict_choice_t
1158 /* Don't resolve the conflict now. Let libsvn_wc mark the path
1159 'conflicted', so user can run 'svn resolved' later. */
1160 svn_wc_conflict_choose_postpone,
1162 /* If their were files to choose from, select one as a way of
1163 resolving the conflict here and now. libsvn_wc will then do the
1164 work of "installing" the chosen file.
1166 svn_wc_conflict_choose_base, /* original version */
1167 svn_wc_conflict_choose_theirs_full, /* incoming version */
1168 svn_wc_conflict_choose_mine_full, /* own version */
1169 svn_wc_conflict_choose_theirs, /* incoming (for conflicted hunks) */
1170 svn_wc_conflict_choose_mine, /* own (for conflicted hunks) */
1171 svn_wc_conflict_choose_merged /* merged version */
1173 } svn_wc_conflict_choice_t;
1176 /** The final result returned by @a svn_wc_conflict_resolver_func_t.
1178 * @note Fields may be added to the end of this structure in future
1179 * versions. Therefore, to preserve binary compatibility, users
1180 * should not directly allocate structures of this type. Instead,
1181 * construct this structure using @c svn_wc_create_conflict_result()
1182 * below.
1184 * @since New in 1.5.
1186 typedef struct svn_wc_conflict_result_t
1188 /** A choice to either delay the conflict resolution or select a
1189 particular file to resolve the conflict. */
1190 svn_wc_conflict_choice_t choice;
1192 /** If not NULL, this is a path to a file which contains the client's
1193 (or more likely, the user's) merging of the three values in
1194 conflict. libsvn_wc accepts this file if (and only if) @c choice
1195 is set to @c svn_wc_conflict_choose_merged.*/
1196 const char *merged_file;
1198 } svn_wc_conflict_result_t;
1202 * Allocate an @c svn_wc_conflict_result_t structure in @a pool,
1203 * initialize and return it.
1205 * Set the @c choice field of the structure to @a choice, and @c
1206 * merged_file to @a merged_file. Set all other fields to their @c
1207 * _unknown, @c NULL or invalid value, respectively.
1209 * @since New in 1.5.
1211 svn_wc_conflict_result_t *
1212 svn_wc_create_conflict_result(svn_wc_conflict_choice_t choice,
1213 const char *merged_file,
1214 apr_pool_t *pool);
1217 /** A callback used in svn_client_merge3(), svn_client_update3(), and
1218 * svn_client_switch2() for resolving conflicts during the application
1219 * of a tree delta to a working copy.
1221 * @a description describes the exact nature of the conflict, and
1222 * provides information to help resolve it. @a baton is a closure
1223 * object; it should be provided by the implementation, and passed by
1224 * the caller. All allocations should be performed in @a pool. When
1225 * finished, the callback signals its resolution by returning a
1226 * structure in @a *result. (See @c svn_wc_conflict_result_t.)
1228 * Implementations of this callback are free to present the conflict
1229 * using any user interface. This may include simple contextual
1230 * conflicts in a file's text or properties, or more complex
1231 * 'tree'-based conflcts related to obstructed additions, deletions,
1232 * and edits. The callback implementation is free to decide which
1233 * sorts of conflicts to handle; it's also free to decide which types
1234 * of conflicts are automatically resolvable and which require user
1235 * interaction.
1237 * @since New in 1.5.
1239 typedef svn_error_t *(*svn_wc_conflict_resolver_func_t)
1240 (svn_wc_conflict_result_t **result,
1241 const svn_wc_conflict_description_t *description,
1242 void *baton,
1243 apr_pool_t *pool);
1245 /** @} */
1250 * A callback vtable invoked by our diff-editors, as they receive
1251 * diffs from the server. 'svn diff' and 'svn merge' both implement
1252 * their own versions of this table.
1254 * @since New in 1.2.
1256 typedef struct svn_wc_diff_callbacks2_t
1258 /** A file @a path has changed. If @a tmpfile2 is non-NULL, the
1259 * contents have changed and those changes can be seen by comparing
1260 * @a tmpfile1 and @a tmpfile2, which represent @a rev1 and @a rev2 of
1261 * the file, respectively.
1263 * If known, the @c svn:mime-type value of each file is passed into
1264 * @a mimetype1 and @a mimetype2; either or both of the values can
1265 * be NULL. The implementor can use this information to decide if
1266 * (or how) to generate differences.
1268 * @a propchanges is an array of (@c svn_prop_t) structures. If it has
1269 * any elements, the original list of properties is provided in
1270 * @a originalprops, which is a hash of @c svn_string_t values, keyed on the
1271 * property name.
1273 * @a adm_access will be an access baton for the directory containing
1274 * @a path, or @c NULL if the diff editor is not using access batons.
1276 * If @a contentstate is non-NULL, set @a *contentstate to the state of
1277 * the file contents after the operation has been performed. The same
1278 * applies for @a propstate regarding the property changes. (In
1279 * practice, this is only useful with merge, not diff; diff callbacks
1280 * will probably set @a *contentstate and @a *propstate to
1281 * @c svn_wc_notify_state_unknown, since they do not change the state and
1282 * therefore do not bother to know the state after the operation.)
1284 svn_error_t *(*file_changed)(svn_wc_adm_access_t *adm_access,
1285 svn_wc_notify_state_t *contentstate,
1286 svn_wc_notify_state_t *propstate,
1287 const char *path,
1288 const char *tmpfile1,
1289 const char *tmpfile2,
1290 svn_revnum_t rev1,
1291 svn_revnum_t rev2,
1292 const char *mimetype1,
1293 const char *mimetype2,
1294 const apr_array_header_t *propchanges,
1295 apr_hash_t *originalprops,
1296 void *diff_baton);
1298 /** A file @a path was added. The contents can be seen by comparing
1299 * @a tmpfile1 and @a tmpfile2, which represent @a rev1 and @a rev2
1300 * of the file, respectively. (If either file is empty, the rev
1301 * will be 0.)
1303 * If known, the @c svn:mime-type value of each file is passed into
1304 * @a mimetype1 and @a mimetype2; either or both of the values can
1305 * be NULL. The implementor can use this information to decide if
1306 * (or how) to generate differences.
1308 * @a propchanges is an array of (@c svn_prop_t) structures. If it contains
1309 * any elements, the original list of properties is provided in
1310 * @a originalprops, which is a hash of @c svn_string_t values, keyed on the
1311 * property name.
1313 * @a adm_access will be an access baton for the directory containing
1314 * @a path, or @c NULL if the diff editor is not using access batons.
1316 * If @a contentstate is non-NULL, set @a *contentstate to the state of the
1317 * file contents after the operation has been performed. The same
1318 * applies for @a propstate regarding the property changes. (In practice,
1319 * this is only useful with merge, not diff; diff callbacks will
1320 * probably set @a *contentstate and *propstate to
1321 * @c svn_wc_notify_state_unknown, since they do not change the state
1322 * and therefore do not bother to know the state after the operation.)
1325 svn_error_t *(*file_added)(svn_wc_adm_access_t *adm_access,
1326 svn_wc_notify_state_t *contentstate,
1327 svn_wc_notify_state_t *propstate,
1328 const char *path,
1329 const char *tmpfile1,
1330 const char *tmpfile2,
1331 svn_revnum_t rev1,
1332 svn_revnum_t rev2,
1333 const char *mimetype1,
1334 const char *mimetype2,
1335 const apr_array_header_t *propchanges,
1336 apr_hash_t *originalprops,
1337 void *diff_baton);
1339 /** A file @a path was deleted. The [loss of] contents can be seen by
1340 * comparing @a tmpfile1 and @a tmpfile2. @a originalprops provides
1341 * the properties of the file.
1343 * If known, the @c svn:mime-type value of each file is passed into
1344 * @a mimetype1 and @a mimetype2; either or both of the values can
1345 * be NULL. The implementor can use this information to decide if
1346 * (or how) to generate differences.
1348 * @a adm_access will be an access baton for the directory containing
1349 * @a path, or @c NULL if the diff editor is not using access batons.
1351 * If @a state is non-NULL, set @a *state to the state of the item
1352 * after the delete operation has been performed. (In practice,
1353 * this is only useful with merge, not diff; diff callbacks will
1354 * probably set @a *state to @c svn_wc_notify_state_unknown, since
1355 * they do not change the state and therefore do not bother to know
1356 * the state after the operation.)
1358 svn_error_t *(*file_deleted)(svn_wc_adm_access_t *adm_access,
1359 svn_wc_notify_state_t *state,
1360 const char *path,
1361 const char *tmpfile1,
1362 const char *tmpfile2,
1363 const char *mimetype1,
1364 const char *mimetype2,
1365 apr_hash_t *originalprops,
1366 void *diff_baton);
1368 /** A directory @a path was added. @a rev is the revision that the
1369 * directory came from.
1371 * @a adm_access will be an access baton for the directory containing
1372 * @a path, or @c NULL if the diff editor is not using access batons.
1374 svn_error_t *(*dir_added)(svn_wc_adm_access_t *adm_access,
1375 svn_wc_notify_state_t *state,
1376 const char *path,
1377 svn_revnum_t rev,
1378 void *diff_baton);
1380 /** A directory @a path was deleted.
1382 * @a adm_access will be an access baton for the directory containing
1383 * @a path, or @c NULL if the diff editor is not using access batons.
1385 * If @a state is non-NULL, set @a *state to the state of the item
1386 * after the delete operation has been performed. (In practice,
1387 * this is only useful with merge, not diff; diff callbacks will
1388 * probably set @a *state to @c svn_wc_notify_state_unknown, since
1389 * they do not change the state and therefore do not bother to know
1390 * the state after the operation.)
1392 svn_error_t *(*dir_deleted)(svn_wc_adm_access_t *adm_access,
1393 svn_wc_notify_state_t *state,
1394 const char *path,
1395 void *diff_baton);
1397 /** A list of property changes (@a propchanges) was applied to the
1398 * directory @a path.
1400 * The array is a list of (@c svn_prop_t) structures.
1402 * The original list of properties is provided in @a original_props,
1403 * which is a hash of @c svn_string_t values, keyed on the property
1404 * name.
1406 * @a adm_access will be an access baton for the directory containing
1407 * @a path, or @c NULL if the diff editor is not using access batons.
1409 * If @a state is non-NULL, set @a *state to the state of the properties
1410 * after the operation has been performed. (In practice, this is only
1411 * useful with merge, not diff; diff callbacks will probably set @a *state
1412 * to @c svn_wc_notify_state_unknown, since they do not change the state
1413 * and therefore do not bother to know the state after the operation.)
1415 svn_error_t *(*dir_props_changed)(svn_wc_adm_access_t *adm_access,
1416 svn_wc_notify_state_t *state,
1417 const char *path,
1418 const apr_array_header_t *propchanges,
1419 apr_hash_t *original_props,
1420 void *diff_baton);
1422 } svn_wc_diff_callbacks2_t;
1425 * Similar to @c svn_wc_diff_callbacks2_t, but with file additions/content
1426 * changes and property changes split into different functions.
1428 * @deprecated Provided for backward compatibility with the 1.1 API.
1430 typedef struct svn_wc_diff_callbacks_t
1432 /** Similar to @c file_changed in @c svn_wc_diff_callbacks2_t, but without
1433 * property change information. @a tmpfile2 is never NULL. @a state applies
1434 * to the file contents. */
1435 svn_error_t *(*file_changed)(svn_wc_adm_access_t *adm_access,
1436 svn_wc_notify_state_t *state,
1437 const char *path,
1438 const char *tmpfile1,
1439 const char *tmpfile2,
1440 svn_revnum_t rev1,
1441 svn_revnum_t rev2,
1442 const char *mimetype1,
1443 const char *mimetype2,
1444 void *diff_baton);
1446 /** Similar to @c file_added in @c svn_wc_diff_callbacks2_t, but without
1447 * property change information. @a *state applies to the file contents. */
1448 svn_error_t *(*file_added)(svn_wc_adm_access_t *adm_access,
1449 svn_wc_notify_state_t *state,
1450 const char *path,
1451 const char *tmpfile1,
1452 const char *tmpfile2,
1453 svn_revnum_t rev1,
1454 svn_revnum_t rev2,
1455 const char *mimetype1,
1456 const char *mimetype2,
1457 void *diff_baton);
1459 /** Similar to @c file_deleted in @c svn_wc_diff_callbacks2_t, but without
1460 * the properties. */
1461 svn_error_t *(*file_deleted)(svn_wc_adm_access_t *adm_access,
1462 svn_wc_notify_state_t *state,
1463 const char *path,
1464 const char *tmpfile1,
1465 const char *tmpfile2,
1466 const char *mimetype1,
1467 const char *mimetype2,
1468 void *diff_baton);
1470 /** The same as @c dir_added in @c svn_wc_diff_callbacks2_t. */
1471 svn_error_t *(*dir_added)(svn_wc_adm_access_t *adm_access,
1472 svn_wc_notify_state_t *state,
1473 const char *path,
1474 svn_revnum_t rev,
1475 void *diff_baton);
1477 /** The same as @c dir_deleted in @c svn_wc_diff_callbacks2_t. */
1478 svn_error_t *(*dir_deleted)(svn_wc_adm_access_t *adm_access,
1479 svn_wc_notify_state_t *state,
1480 const char *path,
1481 void *diff_baton);
1483 /** Similar to @c dir_props_changed in @c svn_wc_diff_callbacks2_t, but this
1484 * function is called for files as well as directories. */
1485 svn_error_t *(*props_changed)(svn_wc_adm_access_t *adm_access,
1486 svn_wc_notify_state_t *state,
1487 const char *path,
1488 const apr_array_header_t *propchanges,
1489 apr_hash_t *original_props,
1490 void *diff_baton);
1492 } svn_wc_diff_callbacks_t;
1495 /* Asking questions about a working copy. */
1497 /** Set @a *wc_format to @a path's working copy format version number if
1498 * @a path is a valid working copy directory, else set it to 0.
1499 * Return error @c APR_ENOENT if @a path does not exist at all.
1501 svn_error_t *
1502 svn_wc_check_wc(const char *path,
1503 int *wc_format,
1504 apr_pool_t *pool);
1507 /** Set @a *has_binary_prop to @c TRUE iff @a path has been marked
1508 * with a property indicating that it is non-text (in other words, binary).
1509 * @a adm_access is an access baton set that contains @a path.
1511 svn_error_t *
1512 svn_wc_has_binary_prop(svn_boolean_t *has_binary_prop,
1513 const char *path,
1514 svn_wc_adm_access_t *adm_access,
1515 apr_pool_t *pool);
1518 /* Detecting modification. */
1520 /** Set @a *modified_p to non-zero if @a filename's text is modified
1521 * with regard to the base revision, else set @a *modified_p to zero.
1522 * @a filename is a path to the file, not just a basename. @a adm_access
1523 * must be an access baton for @a filename.
1525 * If @a force_comparison is @c TRUE, this function will not allow
1526 * early return mechanisms that avoid actual content comparison.
1527 * Instead, if there is a text base, a full byte-by-byte comparison
1528 * will be done, and the entry checksum verified as well. (This means
1529 * that if the text base is much longer than the working file, every
1530 * byte of the text base will still be examined.)
1532 * If @a filename does not exist, consider it unmodified. If it exists
1533 * but is not under revision control (not even scheduled for
1534 * addition), return the error @c SVN_ERR_ENTRY_NOT_FOUND.
1536 * If @a filename is unmodified but has a timestamp variation then this
1537 * function may "repair" @a filename's text-time by setting it to
1538 * @a filename's last modification time.
1540 svn_error_t *
1541 svn_wc_text_modified_p(svn_boolean_t *modified_p,
1542 const char *filename,
1543 svn_boolean_t force_comparison,
1544 svn_wc_adm_access_t *adm_access,
1545 apr_pool_t *pool);
1548 /** Set @a *modified_p to non-zero if @a path's properties are modified
1549 * with regard to the base revision, else set @a modified_p to zero.
1550 * @a adm_access must be an access baton for @a path.
1552 svn_error_t *
1553 svn_wc_props_modified_p(svn_boolean_t *modified_p,
1554 const char *path,
1555 svn_wc_adm_access_t *adm_access,
1556 apr_pool_t *pool);
1561 /** Administrative subdir.
1563 * Ideally, this would be completely private to wc internals (in fact,
1564 * it used to be that adm_subdir() in adm_files.c was the only function
1565 * who knew the adm subdir's name). However, import wants to protect
1566 * against importing administrative subdirs, so now the name is a
1567 * matter of public record.
1569 * @deprecated Provided for backward compatibility with the 1.2 API.
1571 #define SVN_WC_ADM_DIR_NAME ".svn"
1575 /* Entries and status. */
1577 /** The schedule states an entry can be in. */
1578 typedef enum svn_wc_schedule_t
1580 /** Nothing special here */
1581 svn_wc_schedule_normal,
1583 /** Slated for addition */
1584 svn_wc_schedule_add,
1586 /** Slated for deletion */
1587 svn_wc_schedule_delete,
1589 /** Slated for replacement (delete + add) */
1590 svn_wc_schedule_replace
1592 } svn_wc_schedule_t;
1596 * Values for the working_size field in svn_wc_entry_t
1597 * when it isn't set to the actual size value of the unchanged
1598 * working file.
1600 * @defgroup svn_wc_entry_working_size_constants Working size constants
1602 * @{
1605 /** The value of the working size is unknown (hasn't been
1606 * calculated and stored in the past for whatever reason).
1608 * @since New in 1.5
1610 #define SVN_WC_ENTRY_WORKING_SIZE_UNKNOWN -1
1612 /** @} */
1614 /** A working copy entry -- that is, revision control information about
1615 * one versioned entity.
1617 typedef struct svn_wc_entry_t
1619 /* IMPORTANT: If you extend this structure, add new fields to the end. */
1621 /* General Attributes */
1623 /** entry's name */
1624 const char *name;
1626 /** base revision */
1627 svn_revnum_t revision;
1629 /** url in repository */
1630 const char *url;
1632 /** canonical repository URL or NULL if not known */
1633 const char *repos;
1635 /** repository uuid */
1636 const char *uuid;
1638 /** node kind (file, dir, ...) */
1639 svn_node_kind_t kind;
1641 /* State information */
1643 /** scheduling (add, delete, replace ...) */
1644 svn_wc_schedule_t schedule;
1646 /** in a copied state (possibly because the entry is a child of a
1647 path that is @c svn_wc_schedule_add or @c svn_wc_schedule_replace,
1648 when the entry itself is @c svn_wc_schedule_normal) */
1649 svn_boolean_t copied;
1651 /** deleted, but parent rev lags behind */
1652 svn_boolean_t deleted;
1654 /** absent -- we know an entry of this name exists, but that's all
1655 (usually this happens because of authz restrictions) */
1656 svn_boolean_t absent;
1658 /** for THIS_DIR entry, implies whole entries file is incomplete */
1659 svn_boolean_t incomplete;
1661 /** copyfrom location */
1662 const char *copyfrom_url;
1664 /** copyfrom revision */
1665 svn_revnum_t copyfrom_rev;
1667 /** old version of conflicted file */
1668 const char *conflict_old;
1670 /** new version of conflicted file */
1671 const char *conflict_new;
1673 /** working version of conflicted file */
1674 const char *conflict_wrk;
1676 /** property reject file */
1677 const char *prejfile;
1679 /** last up-to-date time for text contents (0 means no information available)
1681 apr_time_t text_time;
1683 /** last up-to-date time for properties (0 means no information available) */
1684 apr_time_t prop_time;
1686 /** Hex MD5 checksum for the untranslated text base file,
1687 * can be @c NULL for backwards compatibility.
1689 const char *checksum;
1691 /* "Entry props" */
1693 /** last revision this was changed */
1694 svn_revnum_t cmt_rev;
1696 /** last date this was changed */
1697 apr_time_t cmt_date;
1699 /** last commit author of this item */
1700 const char *cmt_author;
1702 /** lock token or NULL if path not locked in this WC
1703 * @since New in 1.2.
1705 const char *lock_token;
1706 /** lock owner, or NULL if not locked in this WC
1707 * @since New in 1.2.
1709 const char *lock_owner;
1710 /** lock comment or NULL if not locked in this WC or no comment
1711 * @since New in 1.2.
1713 const char *lock_comment;
1714 /** Lock creation date or 0 if not locked in this WC
1715 * @since New in 1.2.
1717 apr_time_t lock_creation_date;
1719 /** Whether this entry has any working properties.
1720 * False if this information is not stored in the entry.
1722 * @since New in 1.4. */
1723 svn_boolean_t has_props;
1725 /** Whether this entry has property modifications.
1727 * @note For working copies in older formats, this flag is not valid.
1729 * @see svn_wc_props_modified_p().
1731 * @since New in 1.4. */
1732 svn_boolean_t has_prop_mods;
1734 /** A space-separated list of all properties whose presence/absence is cached
1735 * in this entry.
1737 * @see @c present_props.
1739 * @since New in 1.4. */
1740 const char *cachable_props;
1742 /** Cached property existence for this entry.
1743 * This is a space-separated list of property names. If a name exists in
1744 * @c cachable_props but not in this list, this entry does not have that
1745 * property. If a name exists in both lists, the property is present on this
1746 * entry.
1748 * @since New in 1.4. */
1749 const char *present_props;
1751 /** which changelist this item is part of, or NULL if not part of any.
1752 * @since New in 1.5.
1754 const char *changelist;
1756 /** Size of the file after being translated into local
1757 * representation, or @c SVN_WC_ENTRY_WORKING_SIZE_UNKNOWN if
1758 * unknown.
1760 * @since New in 1.5.
1762 apr_off_t working_size;
1764 /** Whether a local copy of this entry should be kept in the working copy
1765 * after a deletion has been committed, Only valid for the this-dir entry
1766 * when it is scheduled for deletion.
1768 * @since New in 1.5. */
1769 svn_boolean_t keep_local;
1771 /** The depth of this entry.
1773 * ### It's a bit annoying that we only use this on this_dir
1774 * ### entries, yet it will exist (with value svn_depth_infinity) on
1775 * ### all entries. Maybe some future extensibility would make this
1776 * ### field meaningful on entries besides this_dir.
1778 * @since New in 1.5. */
1779 svn_depth_t depth;
1781 /* IMPORTANT: If you extend this structure, check the following functions in
1782 * subversion/libsvn_wc/entries.c, to see if you need to extend them as well.
1784 * svn_wc__atts_to_entry()
1785 * svn_wc_entry_dup()
1786 * alloc_entry()
1787 * read_entry()
1788 * write_entry()
1789 * fold_entry()
1792 } svn_wc_entry_t;
1795 /** How an entries file's owner dir is named in the entries file. */
1796 #define SVN_WC_ENTRY_THIS_DIR ""
1799 /** Set @a *entry to an entry for @a path, allocated in the access baton
1800 * pool. If @a show_hidden is TRUE, return the entry even if it's in
1801 * 'deleted' or 'absent' state. If @a path is not under revision
1802 * control, or if entry is hidden, not scheduled for re-addition,
1803 * and @a show_hidden is @c FALSE, then set @a *entry to @c NULL.
1805 * @a *entry should not be modified, since doing so modifies the entries
1806 * cache in @a adm_access without changing the entries file on disk.
1808 * If @a path is not a directory then @a adm_access must be an access baton
1809 * for the parent directory of @a path. To avoid needing to know whether
1810 * @a path is a directory or not, if @a path is a directory @a adm_access
1811 * can still be an access baton for the parent of @a path so long as the
1812 * access baton for @a path itself is in the same access baton set.
1814 * @a path can be relative or absolute but must share the same base used
1815 * to open @a adm_access.
1817 * Note that it is possible for @a path to be absent from disk but still
1818 * under revision control; and conversely, it is possible for @a path to
1819 * be present, but not under revision control.
1821 * Use @a pool only for local processing.
1823 svn_error_t *
1824 svn_wc_entry(const svn_wc_entry_t **entry,
1825 const char *path,
1826 svn_wc_adm_access_t *adm_access,
1827 svn_boolean_t show_hidden,
1828 apr_pool_t *pool);
1831 /** Parse the `entries' file for @a adm_access and return a hash @a entries,
1832 * whose keys are (<tt>const char *</tt>) entry names and values are
1833 * (<tt>svn_wc_entry_t *</tt>). The hash @a entries, and its keys and
1834 * values, are allocated from the pool used to open the @a adm_access
1835 * baton (that's how the entries caching works). @a pool is used for
1836 * transient allocations.
1838 * Entries that are in a 'deleted' or 'absent' state (and not
1839 * scheduled for re-addition) are not returned in the hash, unless
1840 * @a show_hidden is TRUE.
1842 * @par Important:
1843 * The @a entries hash is the entries cache in @a adm_access
1844 * and so usually the hash itself, the keys and the values should be treated
1845 * as read-only. If any of these are modified then it is the caller's
1846 * responsibility to ensure that the entries file on disk is updated. Treat
1847 * the hash values as type (<tt>const svn_wc_entry_t *</tt>) if you wish to
1848 * avoid accidental modification. Modifying the schedule member is a
1849 * particularly bad idea, as the entries writing process relies on having
1850 * access to the original schedule. Use a duplicate entry to modify the
1851 * schedule.
1853 * @par Important:
1854 * Only the entry structures representing files and
1855 * @c SVN_WC_ENTRY_THIS_DIR contain complete information. The entry
1856 * structures representing subdirs have only the `kind' and `state'
1857 * fields filled in. If you want info on a subdir, you must use this
1858 * routine to open its @a path and read the @c SVN_WC_ENTRY_THIS_DIR
1859 * structure, or call svn_wc_entry() on its @a path.
1861 svn_error_t *
1862 svn_wc_entries_read(apr_hash_t **entries,
1863 svn_wc_adm_access_t *adm_access,
1864 svn_boolean_t show_hidden,
1865 apr_pool_t *pool);
1868 /** Return a duplicate of @a entry, allocated in @a pool. No part of the new
1869 * entry will be shared with @a entry.
1871 svn_wc_entry_t *
1872 svn_wc_entry_dup(const svn_wc_entry_t *entry,
1873 apr_pool_t *pool);
1876 /** Given a @a dir_path under version control, decide if one of its
1877 * entries (@a entry) is in state of conflict; return the answers in
1878 * @a text_conflicted_p and @a prop_conflicted_p.
1880 * (If the entry mentions that a .rej or .prej exist, but they are
1881 * both removed, assume the conflict has been resolved by the user.)
1883 svn_error_t *
1884 svn_wc_conflicted_p(svn_boolean_t *text_conflicted_p,
1885 svn_boolean_t *prop_conflicted_p,
1886 const char *dir_path,
1887 const svn_wc_entry_t *entry,
1888 apr_pool_t *pool);
1890 /** Set @a *url and @a *rev to the ancestor URL and revision for @a path,
1891 * allocating in @a pool. @a adm_access must be an access baton for @a path.
1893 * If @a url or @a rev is NULL, then ignore it (just don't return the
1894 * corresponding information).
1896 svn_error_t *
1897 svn_wc_get_ancestry(char **url,
1898 svn_revnum_t *rev,
1899 const char *path,
1900 svn_wc_adm_access_t *adm_access,
1901 apr_pool_t *pool);
1904 /** A callback vtable invoked by the generic entry-walker function.
1905 * @since New in 1.5.
1907 typedef struct svn_wc_entry_callbacks2_t
1909 /** An @a entry was found at @a path. */
1910 svn_error_t *(*found_entry)(const char *path,
1911 const svn_wc_entry_t *entry,
1912 void *walk_baton,
1913 apr_pool_t *pool);
1915 /** Handle the error @a err encountered while processing @a path.
1916 * Wrap or squelch @a err as desired, and return an @c svn_error_t
1917 * *, or @c SVN_NO_ERROR.
1919 svn_error_t *(*handle_error)(const char *path,
1920 svn_error_t *err,
1921 void *walk_baton,
1922 apr_pool_t *pool);
1924 } svn_wc_entry_callbacks2_t;
1926 /** @deprecated Provided for backward compatibility with the 1.4 API. */
1927 typedef struct svn_wc_entry_callbacks_t
1929 /** An @a entry was found at @a path. */
1930 svn_error_t *(*found_entry)(const char *path,
1931 const svn_wc_entry_t *entry,
1932 void *walk_baton,
1933 apr_pool_t *pool);
1935 } svn_wc_entry_callbacks_t;
1938 * A generic entry-walker.
1940 * Do a potentially recursive depth-first entry-walk beginning on
1941 * @a path, which can be a file or dir. Call callbacks in
1942 * @a walk_callbacks, passing @a walk_baton to each. Use @a pool for
1943 * looping, recursion, and to allocate all entries returned.
1944 * @a adm_access must be an access baton for @a path.
1946 * If @a depth is @c svn_depth_empty, invoke the callbacks on @a path
1947 * and return without recursing further. If @c svn_depth_files, do
1948 * the same and invoke the callbacks on file children (if any) of
1949 * @a path, then return. If @c svn_depth_immediates, do the preceding
1950 * but also invoke callbacks on immediate subdirectories, then return.
1951 * If @c svn_depth_infinity, recurse fully starting from @a path.
1953 * If @a cancel_func is non-NULL, call it with @a cancel_baton to determine
1954 * if the client has cancelled the operation.
1956 * Like our other entries interfaces, entries that are in a 'deleted'
1957 * or 'absent' state (and not scheduled for re-addition) are not
1958 * discovered, unless @a show_hidden is TRUE.
1960 * When a new directory is entered, @c SVN_WC_ENTRY_THIS_DIR will always
1961 * be returned first.
1963 * @note Callers should be aware that each directory will be
1964 * returned *twice*: first as an entry within its parent, and
1965 * subsequently as the '.' entry within itself. The two calls can be
1966 * distinguished by looking for @c SVN_WC_ENTRY_THIS_DIR in the 'name'
1967 * field of the entry.
1969 * @since New in 1.5.
1971 svn_error_t *
1972 svn_wc_walk_entries3(const char *path,
1973 svn_wc_adm_access_t *adm_access,
1974 const svn_wc_entry_callbacks2_t
1975 *walk_callbacks,
1976 void *walk_baton,
1977 svn_depth_t depth,
1978 svn_boolean_t show_hidden,
1979 svn_cancel_func_t cancel_func,
1980 void *cancel_baton,
1981 apr_pool_t *pool);
1984 * Similar to svn_wc_walk_entries3(), but without cancellation support
1985 * or error handling from @a walk_callbacks, and with @a depth always
1986 * set to @c svn_depth_infinity.
1988 * @deprecated Provided for backward compatibility with the 1.4 API.
1990 svn_error_t *
1991 svn_wc_walk_entries2(const char *path,
1992 svn_wc_adm_access_t *adm_access,
1993 const svn_wc_entry_callbacks_t
1994 *walk_callbacks,
1995 void *walk_baton,
1996 svn_boolean_t show_hidden,
1997 svn_cancel_func_t cancel_func,
1998 void *cancel_baton,
1999 apr_pool_t *pool);
2002 * Similar to svn_wc_walk_entries2(), but without cancellation support.
2004 * @deprecated Provided for backward compatibility with the 1.0 API.
2006 svn_error_t *
2007 svn_wc_walk_entries(const char *path,
2008 svn_wc_adm_access_t *adm_access,
2009 const svn_wc_entry_callbacks_t
2010 *walk_callbacks,
2011 void *walk_baton,
2012 svn_boolean_t show_hidden,
2013 apr_pool_t *pool);
2016 /** Mark missing @a path as 'deleted' in its @a parent's list of entries.
2018 * Return @c SVN_ERR_WC_PATH_FOUND if @a path isn't actually missing.
2020 svn_error_t *
2021 svn_wc_mark_missing_deleted(const char *path,
2022 svn_wc_adm_access_t *parent,
2023 apr_pool_t *pool);
2026 /** Ensure that an administrative area exists for @a path, so that @a
2027 * path is a working copy subdir based on @a url at @a revision, with
2028 * depth @a depth, and with repository UUID @a uuid and repository
2029 * root URL @a repos.
2031 * @a depth must be a definite depth, it cannot be @c svn_depth_unknown.
2032 * @a uuid and @a repos may be @c NULL. If non-@c NULL, @a repos must
2033 * be a prefix of @a url.
2035 * If the administrative area does not exist, then create it and
2036 * initialize it to an unlocked state.
2038 * If the administrative area already exists then the given @a url
2039 * must match the URL in the administrative area and the given
2040 * @a revision must match the BASE of the working copy dir unless
2041 * the admin directory is scheduled for deletion or the
2042 * SVN_ERR_WC_OBSTRUCTED_UPDATE error will be returned.
2044 * Do not ensure existence of @a path itself; if @a path does not
2045 * exist, return error.
2047 * @since New in 1.5.
2049 svn_error_t *
2050 svn_wc_ensure_adm3(const char *path,
2051 const char *uuid,
2052 const char *url,
2053 const char *repos,
2054 svn_revnum_t revision,
2055 svn_depth_t depth,
2056 apr_pool_t *pool);
2060 * Similar to svn_wc_ensure_adm3(), but with @a depth set to
2061 * @c svn_depth_infinity.
2063 * @deprecated Provided for backwards compatibility with the 1.4 API.
2065 * @since New in 1.3.
2067 svn_error_t *
2068 svn_wc_ensure_adm2(const char *path,
2069 const char *uuid,
2070 const char *url,
2071 const char *repos,
2072 svn_revnum_t revision,
2073 apr_pool_t *pool);
2077 * Similar to svn_wc_ensure_adm2(), but with @a repos set to @c NULL.
2079 * @deprecated Provided for backwards compatibility with the 1.2 API.
2081 svn_error_t *
2082 svn_wc_ensure_adm(const char *path,
2083 const char *uuid,
2084 const char *url,
2085 svn_revnum_t revision,
2086 apr_pool_t *pool);
2089 /** Set the repository root URL of @a path to @a repos, if possible.
2091 * @a adm_access must contain @a path and be write-locked, if @a path
2092 * is versioned. Return no error if path is missing or unversioned.
2093 * Use @a pool for temporary allocations.
2095 * @note In some circumstances, the repository root can't be set
2096 * without making the working copy corrupt. In such cases, this
2097 * function just returns no error, without modifying the @a path entry.
2099 * @note This function exists to make it possible to try to set the repository
2100 * root in old working copies; new working copies normally get this set at
2101 * creation time.
2103 * @since New in 1.3.
2105 svn_error_t *
2106 svn_wc_maybe_set_repos_root(svn_wc_adm_access_t *adm_access,
2107 const char *path,
2108 const char *repos,
2109 apr_pool_t *pool);
2113 * @defgroup svn_wc_status Working copy status.
2114 * @{
2116 * We have two functions for getting working copy status: one function
2117 * for getting the status of exactly one thing, and another for
2118 * getting the statuses of (potentially) multiple things.
2120 * The concept of depth, as explained in the documentation for
2121 * svn_depth_t, may be useful in understanding this. Suppose we're
2122 * getting the status of directory D:
2124 * To offer all three levels, we could have one unified function,
2125 * taking a `depth' parameter. Unfortunately, because this function
2126 * would have to handle multiple return values as well as the single
2127 * return value case, getting the status of just one entity would
2128 * become cumbersome: you'd have to roll through a hash to find one
2129 * lone status.
2131 * So we have svn_wc_status() for depth-empty (just D itself), and
2132 * svn_wc_get_status_editor() for depth-immediates and depth-infinity,
2133 * since the latter two involve multiple return values.
2135 * @note The status structures may contain a @c NULL ->entry field.
2136 * This indicates an item that is not versioned in the working copy.
2139 /** The type of status for the working copy. */
2140 enum svn_wc_status_kind
2142 /** does not exist */
2143 svn_wc_status_none = 1,
2145 /** is not a versioned thing in this wc */
2146 svn_wc_status_unversioned,
2148 /** exists, but uninteresting */
2149 svn_wc_status_normal,
2151 /** is scheduled for addition */
2152 svn_wc_status_added,
2154 /** under v.c., but is missing */
2155 svn_wc_status_missing,
2157 /** scheduled for deletion */
2158 svn_wc_status_deleted,
2160 /** was deleted and then re-added */
2161 svn_wc_status_replaced,
2163 /** text or props have been modified */
2164 svn_wc_status_modified,
2166 /** local mods received repos mods */
2167 svn_wc_status_merged,
2169 /** local mods received conflicting repos mods */
2170 svn_wc_status_conflicted,
2172 /** is unversioned but configured to be ignored */
2173 svn_wc_status_ignored,
2175 /** an unversioned resource is in the way of the versioned resource */
2176 svn_wc_status_obstructed,
2178 /** an unversioned path populated by an svn:externals property */
2179 svn_wc_status_external,
2181 /** a directory doesn't contain a complete entries list */
2182 svn_wc_status_incomplete
2186 * Structure for holding the "status" of a working copy item.
2188 * The item's entry data is in @a entry, augmented and possibly shadowed
2189 * by the other fields. @a entry is @c NULL if this item is not under
2190 * version control.
2192 * @note Fields may be added to the end of this structure in future
2193 * versions. Therefore, to preserve binary compatibility, users
2194 * should not directly allocate structures of this type.
2196 * @since New in 1.2.
2198 typedef struct svn_wc_status2_t
2200 /** Can be @c NULL if not under version control. */
2201 svn_wc_entry_t *entry;
2203 /** The status of the entries text. */
2204 enum svn_wc_status_kind text_status;
2206 /** The status of the entries properties. */
2207 enum svn_wc_status_kind prop_status;
2209 /** a directory can be 'locked' if a working copy update was interrupted. */
2210 svn_boolean_t locked;
2212 /** a file or directory can be 'copied' if it's scheduled for
2213 * addition-with-history (or part of a subtree that is scheduled as such.).
2215 svn_boolean_t copied;
2217 /** a file or directory can be 'switched' if the switch command has been
2218 * used.
2220 svn_boolean_t switched;
2222 /** The entry's text status in the repository. */
2223 enum svn_wc_status_kind repos_text_status;
2225 /** The entry's property status in the repository. */
2226 enum svn_wc_status_kind repos_prop_status;
2228 /** The entry's lock in the repository, if any. */
2229 svn_lock_t *repos_lock;
2231 /** Set to the URI (actual or expected) of the item.
2232 * @since New in 1.3
2234 const char *url;
2237 * @defgroup svn_wc_status_ood WC out-of-date info from the repository
2238 * @{
2240 * When the working copy item is out-of-date compared to the
2241 * repository, the following fields represent the state of the
2242 * youngest revision of the item in the repository. If the working
2243 * copy is not out of date, the fields are initialized as described
2244 * below.
2247 /** Set to the youngest committed revision, or @c SVN_INVALID_REVNUM
2248 * if not out of date.
2249 * @since New in 1.3
2251 svn_revnum_t ood_last_cmt_rev;
2253 /** Set to the most recent commit date, or @c 0 if not out of date.
2254 * @since New in 1.3
2256 apr_time_t ood_last_cmt_date;
2258 /** Set to the node kind of the youngest commit, or @c svn_node_none
2259 * if not out of date.
2260 * @since New in 1.3
2262 svn_node_kind_t ood_kind;
2264 /** Set to the user name of the youngest commit, or @c NULL if not
2265 * out of date or non-existent. Because a non-existent @c
2266 * svn:author property has the same behavior as an out-of-date
2267 * working copy, examine @c ood_last_cmt_rev to determine whether
2268 * the working copy is out of date.
2269 * @since New in 1.3
2271 const char *ood_last_cmt_author;
2273 /** @} */
2275 /* NOTE! Please update svn_wc_dup_status2() when adding new fields here. */
2276 } svn_wc_status2_t;
2281 * Same as @c svn_wc_status2_t, but without the svn_lock_t 'repos_lock' field.
2283 * @deprecated Provided for backward compatibility with the 1.1 API.
2285 typedef struct svn_wc_status_t
2287 /** Can be @c NULL if not under version control. */
2288 svn_wc_entry_t *entry;
2290 /** The status of the entries text. */
2291 enum svn_wc_status_kind text_status;
2293 /** The status of the entries properties. */
2294 enum svn_wc_status_kind prop_status;
2296 /** a directory can be 'locked' if a working copy update was interrupted. */
2297 svn_boolean_t locked;
2299 /** a file or directory can be 'copied' if it's scheduled for
2300 * addition-with-history (or part of a subtree that is scheduled as such.).
2302 svn_boolean_t copied;
2304 /** a file or directory can be 'switched' if the switch command has been
2305 * used.
2307 svn_boolean_t switched;
2309 /** The entry's text status in the repository. */
2310 enum svn_wc_status_kind repos_text_status;
2312 /** The entry's property status in the repository. */
2313 enum svn_wc_status_kind repos_prop_status;
2315 } svn_wc_status_t;
2320 * Return a deep copy of the @a orig_stat status structure, allocated
2321 * in @a pool.
2323 * @since New in 1.2.
2325 svn_wc_status2_t *
2326 svn_wc_dup_status2(svn_wc_status2_t *orig_stat,
2327 apr_pool_t *pool);
2331 * Same as svn_wc_dup_status2(), but for older svn_wc_status_t structures.
2333 * @deprecated Provided for backward compatibility with the 1.1 API.
2335 svn_wc_status_t *
2336 svn_wc_dup_status(svn_wc_status_t *orig_stat,
2337 apr_pool_t *pool);
2341 * Fill @a *status for @a path, allocating in @a pool.
2342 * @a adm_access must be an access baton for @a path.
2344 * Here are some things to note about the returned structure. A quick
2345 * examination of the @c status->text_status after a successful return of
2346 * this function can reveal the following things:
2348 * - @c svn_wc_status_none : @a path is not versioned, and is either not
2349 * present on disk, or is ignored by svn's
2350 * default ignore regular expressions or the
2351 * svn:ignore property setting for @a path's
2352 * parent directory.
2354 * - @c svn_wc_status_missing : @a path is versioned, but is missing from
2355 * the working copy.
2357 * - @c svn_wc_status_unversioned : @a path is not versioned, but is
2358 * present on disk and not being
2359 * ignored (see above).
2361 * The other available results for the @c text_status field are more
2362 * straightforward in their meanings. See the comments on the
2363 * @c svn_wc_status_kind structure for some hints.
2365 * @since New in 1.2.
2367 svn_error_t *
2368 svn_wc_status2(svn_wc_status2_t **status,
2369 const char *path,
2370 svn_wc_adm_access_t *adm_access,
2371 apr_pool_t *pool);
2375 * Same as svn_wc_status2(), but for older svn_wc_status_t structures.
2377 * @deprecated Provided for backward compatibility with the 1.1 API.
2379 svn_error_t *
2380 svn_wc_status(svn_wc_status_t **status,
2381 const char *path,
2382 svn_wc_adm_access_t *adm_access,
2383 apr_pool_t *pool);
2389 * A callback for reporting a @a status about @a path.
2391 * @a baton is a closure object; it should be provided by the
2392 * implementation, and passed by the caller.
2394 * @since New in 1.2.
2396 typedef void (*svn_wc_status_func2_t)(void *baton,
2397 const char *path,
2398 svn_wc_status2_t *status);
2401 * Same as svn_wc_status_func2_t(), but for older svn_wc_status_t structures.
2403 * @deprecated Provided for backward compatibility with the 1.1 API.
2405 typedef void (*svn_wc_status_func_t)(void *baton,
2406 const char *path,
2407 svn_wc_status_t *status);
2411 * Set @a *editor and @a *edit_baton to an editor that generates @c
2412 * svn_wc_status2_t structures and sends them through @a status_func /
2413 * @a status_baton. @a anchor is an access baton, with a tree lock,
2414 * for the local path to the working copy which will be used as the
2415 * root of our editor. If @a target is not empty, it represents an
2416 * entry in the @a anchor path which is the subject of the editor
2417 * drive (otherwise, the @a anchor is the subject).
2419 * If @a set_locks_baton is non-@c NULL, it will be set to a baton that can
2420 * be used in a call to the svn_wc_status_set_repos_locks() function.
2422 * Callers drive this editor to describe working copy out-of-dateness
2423 * with respect to the repository. If this information is not
2424 * available or not desired, callers should simply call the
2425 * close_edit() function of the @a editor vtable.
2427 * If the editor driver calls @a editor's set_target_revision() vtable
2428 * function, then when the edit drive is completed, @a *edit_revision
2429 * will contain the revision delivered via that interface.
2431 * Assuming the target is a directory, then:
2433 * - If @a get_all is FALSE, then only locally-modified entries will be
2434 * returned. If TRUE, then all entries will be returned.
2436 * - If @a depth is @c svn_depth_empty, a status structure will
2437 * be returned for the target only; if @c svn_depth_files, for the
2438 * target and its immediate file children; if
2439 * @c svn_depth_immediates, for the target and its immediate
2440 * children; if @c svn_depth_infinity, for the target and
2441 * everything underneath it, fully recursively.
2443 * If @a depth is @c svn_depth_unknown, take depths from the
2444 * working copy and behave as above in each directory's case.
2446 * If the given @a depth is incompatible with the depth found in a
2447 * working copy directory, the found depth always governs.
2449 * If @a no_ignore is set, statuses that would typically be ignored
2450 * will instead be reported.
2452 * @a ignore_patterns is an array of file patterns matching
2453 * unversioned files to ignore for the purposes of status reporting,
2454 * or @c NULL if the default set of ignorable file patterns should be used.
2456 * If @a cancel_func is non-NULL, call it with @a cancel_baton while building
2457 * the @a statushash to determine if the client has cancelled the operation.
2459 * If @a traversal_info is non-NULL, then record pre-update traversal
2460 * state in it. (Caller should obtain @a traversal_info from
2461 * svn_wc_init_traversal_info().)
2463 * Allocate the editor itself in @a pool, but the editor does temporary
2464 * allocations in a subpool of @a pool.
2466 * @since New in 1.5.
2468 svn_error_t *
2469 svn_wc_get_status_editor3(const svn_delta_editor_t **editor,
2470 void **edit_baton,
2471 void **set_locks_baton,
2472 svn_revnum_t *edit_revision,
2473 svn_wc_adm_access_t *anchor,
2474 const char *target,
2475 svn_depth_t depth,
2476 svn_boolean_t get_all,
2477 svn_boolean_t no_ignore,
2478 apr_array_header_t *ignore_patterns,
2479 svn_wc_status_func2_t status_func,
2480 void *status_baton,
2481 svn_cancel_func_t cancel_func,
2482 void *cancel_baton,
2483 svn_wc_traversal_info_t *traversal_info,
2484 apr_pool_t *pool);
2487 * Like svn_wc_get_status_editor3(), but with @a ignore_patterns
2488 * provided from the corresponding value in @a config, and @a recurse
2489 * instead of @a depth. If @a recurse is TRUE, behave as if for @c
2490 * svn_depth_infinity; else if @a recurse is FALSE, behave as if for
2491 * @c svn_depth_immediates.
2493 * @since New in 1.2.
2494 * @deprecated Provided for backward compatibility with the 1.4 API.
2496 svn_error_t *
2497 svn_wc_get_status_editor2(const svn_delta_editor_t **editor,
2498 void **edit_baton,
2499 void **set_locks_baton,
2500 svn_revnum_t *edit_revision,
2501 svn_wc_adm_access_t *anchor,
2502 const char *target,
2503 apr_hash_t *config,
2504 svn_boolean_t recurse,
2505 svn_boolean_t get_all,
2506 svn_boolean_t no_ignore,
2507 svn_wc_status_func2_t status_func,
2508 void *status_baton,
2509 svn_cancel_func_t cancel_func,
2510 void *cancel_baton,
2511 svn_wc_traversal_info_t *traversal_info,
2512 apr_pool_t *pool);
2515 * Same as svn_wc_get_status_editor2(), but with @a set_locks_baton set
2516 * to @c NULL, and taking a deprecated svn_wc_status_func_t argument.
2518 * @deprecated Provided for backward compatibility with the 1.1 API.
2520 svn_error_t *
2521 svn_wc_get_status_editor(const svn_delta_editor_t **editor,
2522 void **edit_baton,
2523 svn_revnum_t *edit_revision,
2524 svn_wc_adm_access_t *anchor,
2525 const char *target,
2526 apr_hash_t *config,
2527 svn_boolean_t recurse,
2528 svn_boolean_t get_all,
2529 svn_boolean_t no_ignore,
2530 svn_wc_status_func_t status_func,
2531 void *status_baton,
2532 svn_cancel_func_t cancel_func,
2533 void *cancel_baton,
2534 svn_wc_traversal_info_t *traversal_info,
2535 apr_pool_t *pool);
2539 * Associate @a locks, a hash table mapping <tt>const char*</tt>
2540 * absolute repository paths to <tt>svn_lock_t</tt> objects, with a
2541 * @a set_locks_baton returned by an earlier call to
2542 * svn_wc_get_status_editor3(). @a repos_root is the repository root URL.
2543 * Perform all allocations in @a pool.
2545 * @note @a locks will not be copied, so it must be valid throughout the
2546 * edit. @a pool must also not be destroyed or cleared before the edit is
2547 * finished.
2549 * @since New in 1.2.
2551 svn_error_t *
2552 svn_wc_status_set_repos_locks(void *set_locks_baton,
2553 apr_hash_t *locks,
2554 const char *repos_root,
2555 apr_pool_t *pool);
2557 /** @} */
2561 * Copy @a src to @a dst_basename in @a dst_parent, and schedule
2562 * @a dst_basename for addition to the repository, remembering the copy
2563 * history.
2565 * @a src must be a file or directory under version control; @a dst_parent
2566 * must be a directory under version control in the same working copy;
2567 * @a dst_basename will be the name of the copied item, and it must not
2568 * exist already.
2570 * If @a cancel_func is non-NULL, call it with @a cancel_baton at
2571 * various points during the operation. If it returns an error
2572 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
2574 * For each file or directory copied, @a notify_func will be called
2575 * with its path and the @a notify_baton. @a notify_func may be @c NULL
2576 * if you are not interested in this information.
2578 * @par Important:
2579 * This is a variant of svn_wc_add(). No changes will happen
2580 * to the repository until a commit occurs. This scheduling can be
2581 * removed with svn_client_revert2().
2583 * @since New in 1.2.
2585 svn_error_t *
2586 svn_wc_copy2(const char *src,
2587 svn_wc_adm_access_t *dst_parent,
2588 const char *dst_basename,
2589 svn_cancel_func_t cancel_func,
2590 void *cancel_baton,
2591 svn_wc_notify_func2_t notify_func,
2592 void *notify_baton,
2593 apr_pool_t *pool);
2596 * Similar to svn_wc_copy2(), but takes an @c svn_wc_notify_func_t instead.
2598 * @deprecated Provided for backward compatibility with the 1.1 API.
2600 svn_error_t *
2601 svn_wc_copy(const char *src,
2602 svn_wc_adm_access_t *dst_parent,
2603 const char *dst_basename,
2604 svn_cancel_func_t cancel_func,
2605 void *cancel_baton,
2606 svn_wc_notify_func_t notify_func,
2607 void *notify_baton,
2608 apr_pool_t *pool);
2611 * Schedule @a path for deletion, it will be deleted from the repository on
2612 * the next commit. If @a path refers to a directory, then a recursive
2613 * deletion will occur. @a adm_access must hold a write lock for the parent
2614 * of @a path.
2616 * If @a keep_local is FALSE, this function immediately deletes all files,
2617 * modified and unmodified, versioned and unversioned from the working copy.
2618 * It also immediately deletes unversioned directories and directories that
2619 * are scheduled to be added. Only versioned directories will remain in the
2620 * working copy, these get deleted by the update following the commit.
2622 * If @a keep_local is TRUE, all files and directories will be kept in the
2623 * working copy (and will become unversioned on the next commit).
2625 * If @a cancel_func is non-NULL, call it with @a cancel_baton at
2626 * various points during the operation. If it returns an error
2627 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
2629 * For each path marked for deletion, @a notify_func will be called with
2630 * the @a notify_baton and that path. The @a notify_func callback may be
2631 * @c NULL if notification is not needed.
2633 * @since New in 1.5.
2635 svn_error_t *
2636 svn_wc_delete3(const char *path,
2637 svn_wc_adm_access_t *adm_access,
2638 svn_cancel_func_t cancel_func,
2639 void *cancel_baton,
2640 svn_wc_notify_func2_t notify_func,
2641 void *notify_baton,
2642 svn_boolean_t keep_local,
2643 apr_pool_t *pool);
2646 * Similar to svn_wc_delete3(), but with @a keep_local always set to FALSE.
2648 * @deprecated Provided for backward compatibility with the 1.4 API.
2650 svn_error_t *
2651 svn_wc_delete2(const char *path,
2652 svn_wc_adm_access_t *adm_access,
2653 svn_cancel_func_t cancel_func,
2654 void *cancel_baton,
2655 svn_wc_notify_func2_t notify_func,
2656 void *notify_baton,
2657 apr_pool_t *pool);
2660 * Similar to svn_wc_delete2(), but takes an @c svn_wc_notify_func_t instead.
2662 * @deprecated Provided for backward compatibility with the 1.1 API.
2664 svn_error_t *
2665 svn_wc_delete(const char *path,
2666 svn_wc_adm_access_t *adm_access,
2667 svn_cancel_func_t cancel_func,
2668 void *cancel_baton,
2669 svn_wc_notify_func_t notify_func,
2670 void *notify_baton,
2671 apr_pool_t *pool);
2675 * Put @a path under version control by adding an entry in its parent,
2676 * and, if @a path is a directory, adding an administrative area. The
2677 * new entry and anything under it is scheduled for addition to the
2678 * repository. @a parent_access should hold a write lock for the parent
2679 * directory of @a path. If @a path is a directory then an access baton
2680 * for @a path will be added to the set containing @a parent_access.
2682 * If @a path does not exist, return @c SVN_ERR_WC_PATH_NOT_FOUND.
2684 * If @a copyfrom_url is non-NULL, it and @a copyfrom_rev are used as
2685 * `copyfrom' args. This is for copy operations, where one wants
2686 * to schedule @a path for addition with a particular history.
2688 * If @a cancel_func is non-NULL, call it with @a cancel_baton at
2689 * various points during the operation. If it returns an error
2690 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
2692 * When the @a path has been added, then @a notify_func will be called
2693 * (if it is not @c NULL) with the @a notify_baton and the path.
2695 * Return @c SVN_ERR_WC_NODE_KIND_CHANGE if @a path is both an unversioned
2696 * directory and a file that is scheduled for deletion or in state deleted.
2698 *<pre> ### This function currently does double duty -- it is also
2699 * ### responsible for "switching" a working copy directory over to a
2700 * ### new copyfrom ancestry and scheduling it for addition. Here is
2701 * ### the old doc string from Ben, lightly edited to bring it
2702 * ### up-to-date, explaining the TRUE, secret life of this function:</pre>
2704 * Given a @a path within a working copy of type KIND, follow this algorithm:
2706 * - if @a path is not under version control:
2707 * - Place it under version control and schedule for addition;
2708 * if @a copyfrom_url is non-NULL, use it and @a copyfrom_rev as
2709 * 'copyfrom' history
2711 * - if @a path is already under version control:
2712 * (This can only happen when a directory is copied, in which
2713 * case ancestry must have been supplied as well.)
2715 * - Schedule the directory itself for addition with copyfrom history.
2716 * - Mark all its children with a 'copied' flag
2717 * - Rewrite all the URLs to what they will be after a commit.
2718 * - ### @todo Remove old wcprops too, see the '###' below.
2720 *<pre> ### I think possibly the "switchover" functionality should be
2721 * ### broken out into a separate function, but its all intertwined in
2722 * ### the code right now. Ben, thoughts? Hard? Easy? Mauve?</pre>
2724 * ### Update: see "###" comment in svn_wc_add_repos_file()'s doc
2725 * string about this.
2727 * @since New in 1.2.
2729 svn_error_t *
2730 svn_wc_add2(const char *path,
2731 svn_wc_adm_access_t *parent_access,
2732 const char *copyfrom_url,
2733 svn_revnum_t copyfrom_rev,
2734 svn_cancel_func_t cancel_func,
2735 void *cancel_baton,
2736 svn_wc_notify_func2_t notify_func,
2737 void *notify_baton,
2738 apr_pool_t *pool);
2741 * Similar to svn_wc_add2(), but takes an @c svn_wc_notify_func_t instead.
2743 * @deprecated Provided for backward compatibility with the 1.1 API.
2745 svn_error_t *
2746 svn_wc_add(const char *path,
2747 svn_wc_adm_access_t *parent_access,
2748 const char *copyfrom_url,
2749 svn_revnum_t copyfrom_rev,
2750 svn_cancel_func_t cancel_func,
2751 void *cancel_baton,
2752 svn_wc_notify_func_t notify_func,
2753 void *notify_baton,
2754 apr_pool_t *pool);
2756 /** Add a file to a working copy at @a dst_path, obtaining the text-base's
2757 * contents from @a new_text_base_path, the wc file's content from
2758 * @a new_text_path, its base properties from @a new_base_props and
2759 * wc properties from @a new_props.
2760 * The base text and props normally come from the repository file
2761 * represented by the copyfrom args, see below. The new file will
2762 * be scheduled for addition with history.
2764 * Automatically remove @a new_text_base_path and @a new_text_path
2765 * upon successful completion.
2767 * @a new_text_path and @a new_props may be NULL, in which case
2768 * the working copy text and props are taken from the base files with
2769 * appropriate translation of the file's content.
2771 * @a adm_access, or an access baton in its associated set, must
2772 * contain a write lock for the parent of @a dst_path.
2774 * If @a copyfrom_url is non-NULL, then @a copyfrom_rev must be a
2775 * valid revision number, and together they are the copyfrom history
2776 * for the new file.
2778 * Use @a pool for temporary allocations.
2780 * ### This function is very redundant with svn_wc_add(). Ideally,
2781 * we'd merge them, so that svn_wc_add() would just take optional
2782 * new_props and optional copyfrom information. That way it could be
2783 * used for both 'svn add somefilesittingonmydisk' and for adding
2784 * files from repositories, with or without copyfrom history.
2786 * The problem with this Ideal Plan is that svn_wc_add() also takes
2787 * care of recursive URL-rewriting. There's a whole comment in its
2788 * doc string about how that's really weird, outside its core mission,
2789 * etc, etc. So another part of the Ideal Plan is that that
2790 * functionality of svn_wc_add() would move into a separate function.
2792 * @since New in 1.4
2794 svn_error_t *
2795 svn_wc_add_repos_file2(const char *dst_path,
2796 svn_wc_adm_access_t *adm_access,
2797 const char *new_text_base_path,
2798 const char *new_text_path,
2799 apr_hash_t *new_base_props,
2800 apr_hash_t *new_props,
2801 const char *copyfrom_url,
2802 svn_revnum_t copyfrom_rev,
2803 apr_pool_t *pool);
2805 /** Same as svn_wc_add_repos_file2(), except that it doesn't have the
2806 * new_text_base_path and new_base_props arguments.
2808 * @deprecated Provided for compatibility with the 1.3 API
2812 svn_error_t *
2813 svn_wc_add_repos_file(const char *dst_path,
2814 svn_wc_adm_access_t *adm_access,
2815 const char *new_text_path,
2816 apr_hash_t *new_props,
2817 const char *copyfrom_url,
2818 svn_revnum_t copyfrom_rev,
2819 apr_pool_t *pool);
2822 /** Remove entry @a name in @a adm_access from revision control. @a name
2823 * must be either a file or @c SVN_WC_ENTRY_THIS_DIR. @a adm_access must
2824 * hold a write lock.
2826 * If @a name is a file, all its info will be removed from @a adm_access's
2827 * administrative directory. If @a name is @c SVN_WC_ENTRY_THIS_DIR, then
2828 * @a adm_access's entire administrative area will be deleted, along with
2829 * *all* the administrative areas anywhere in the tree below @a adm_access.
2831 * Normally, only administrative data is removed. However, if
2832 * @a destroy_wf is TRUE, then all working file(s) and dirs are deleted
2833 * from disk as well. When called with @a destroy_wf, any locally
2834 * modified files will *not* be deleted, and the special error
2835 * @c SVN_ERR_WC_LEFT_LOCAL_MOD might be returned. (Callers only need to
2836 * check for this special return value if @a destroy_wf is TRUE.)
2838 * If @a instant_error is TRUE, then return @c
2839 * SVN_ERR_WC_LEFT_LOCAL_MOD the instant a locally modified file is
2840 * encountered. Otherwise, leave locally modified files in place and
2841 * return the error only after all the recursion is complete.
2843 * If @a cancel_func is non-NULL, call it with @a cancel_baton at
2844 * various points during the removal. If it returns an error
2845 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
2847 * WARNING: This routine is exported for careful, measured use by
2848 * libsvn_client. Do *not* call this routine unless you really
2849 * understand what the heck you're doing.
2851 svn_error_t *
2852 svn_wc_remove_from_revision_control(svn_wc_adm_access_t *adm_access,
2853 const char *name,
2854 svn_boolean_t destroy_wf,
2855 svn_boolean_t instant_error,
2856 svn_cancel_func_t cancel_func,
2857 void *cancel_baton,
2858 apr_pool_t *pool);
2862 * Assuming @a path is under version control and in a state of conflict,
2863 * then take @a path *out* of this state. If @a resolve_text is TRUE then
2864 * any text conflict is resolved, if @a resolve_props is TRUE then any
2865 * property conflicts are resolved.
2867 * If @a depth is @c svn_depth_empty, act only on @a path; if
2868 * @c svn_depth_files, resolve @a path and its conflicted file
2869 * children (if any); if @c svn_depth_immediates, resolve @a path and
2870 * all its immediate conflicted children (both files and directories,
2871 * if any); if @c svn_depth_infinity, resolve @a path and every
2872 * conflicted file or directory anywhere beneath it.
2874 * If @a conflict_choice is @c svn_wc_conflict_choose_base, resolve the
2875 * conflict with the old file contents; if
2876 * @c svn_wc_conflict_choose_mine_full, use the original working contents;
2877 * if @c svn_wc_conflict_choose_theirs_full, the new contents; and if
2878 * @c svn_wc_conflict_choose_merged, don't change the contents at all,
2879 * just remove the conflict status, which is the pre-1.5 behavior.
2881 * (@c svn_wc_conflict_choose_theirs and @c svn_wc_conflict_choose_mine
2882 * are not yet implemented; the effect of passing one of those values
2883 * as @a conflict_choice is currently undefined, which may or may not
2884 * be an underhanded way of allowing real behaviors to be added for
2885 * them later without revving this interface.)
2887 * @a adm_access is an access baton, with a write lock, for @a path.
2889 * Needless to say, this function doesn't touch conflict markers or
2890 * anything of that sort -- only a human can semantically resolve a
2891 * conflict. Instead, this function simply marks a file as "having
2892 * been resolved", clearing the way for a commit.
2894 * The implementation details are opaque, as our "conflicted" criteria
2895 * might change over time. (At the moment, this routine removes the
2896 * three fulltext 'backup' files and any .prej file created in a conflict,
2897 * and modifies @a path's entry.)
2899 * If @a path is not under version control, return @c SVN_ERR_ENTRY_NOT_FOUND.
2900 * If @a path isn't in a state of conflict to begin with, do nothing, and
2901 * return @c SVN_NO_ERROR.
2903 * If @c path was successfully taken out of a state of conflict, report this
2904 * information to @c notify_func (if non-@c NULL.) If only text or only
2905 * property conflict resolution was requested, and it was successful, then
2906 * success gets reported.
2908 * @since New in 1.5.
2910 svn_error_t *
2911 svn_wc_resolved_conflict3(const char *path,
2912 svn_wc_adm_access_t *adm_access,
2913 svn_boolean_t resolve_text,
2914 svn_boolean_t resolve_props,
2915 svn_depth_t depth,
2916 svn_wc_conflict_choice_t conflict_choice,
2917 svn_wc_notify_func2_t notify_func,
2918 void *notify_baton,
2919 svn_cancel_func_t cancel_func,
2920 void *cancel_baton,
2921 apr_pool_t *pool);
2925 * Similar to svn_wc_resolved_conflict3(), but without automatic conflict
2926 * resolution support, and with @a depth set according to @a recurse:
2927 * if @a recurse is TRUE, @a depth is @c svn_depth_infinity, else it is
2928 * @c svn_depth_files.
2930 * @deprecated Provided for backward compatibility with the 1.4 API.
2932 svn_error_t *
2933 svn_wc_resolved_conflict2(const char *path,
2934 svn_wc_adm_access_t *adm_access,
2935 svn_boolean_t resolve_text,
2936 svn_boolean_t resolve_props,
2937 svn_boolean_t recurse,
2938 svn_wc_notify_func2_t notify_func,
2939 void *notify_baton,
2940 svn_cancel_func_t cancel_func,
2941 void *cancel_baton,
2942 apr_pool_t *pool);
2945 * Similar to svn_wc_resolved_conflict2(), but takes an
2946 * svn_wc_notify_func_t and doesn't have cancellation support.
2948 * @deprecated Provided for backward compatibility with the 1.0 API.
2950 svn_error_t *
2951 svn_wc_resolved_conflict(const char *path,
2952 svn_wc_adm_access_t *adm_access,
2953 svn_boolean_t resolve_text,
2954 svn_boolean_t resolve_props,
2955 svn_boolean_t recurse,
2956 svn_wc_notify_func_t notify_func,
2957 void *notify_baton,
2958 apr_pool_t *pool);
2961 /* Commits. */
2965 * Storage type for queued post-commit data.
2967 * @since New in 1.5.
2969 typedef struct svn_wc_committed_queue_t svn_wc_committed_queue_t;
2973 * Create a queue for use with svn_wc_queue_committed() and
2974 * svn_wc_process_committed_queue().
2976 * The returned queue and all further
2977 * allocations required for queueing new items will also be done
2978 * from @a pool.
2980 * @since New in 1.5.
2982 svn_wc_committed_queue_t *
2983 svn_wc_committed_queue_create(apr_pool_t *pool);
2988 * Queue committed items to be processed later by
2989 * svn_wc_process_committed_queue().
2991 * The first time this function is called, @a *queue should
2992 * be @c NULL to signal that initialization is required.
2994 * All pointer data passed to this function
2995 * (@a path, @a adm_access, @a wcprop_changes
2996 * and @a digest) should remain valid until the queue has been
2997 * processed by svn_wc_process_committed_queue().
2999 * The parameters have the same meaning as those
3000 * for svn_wc_process_committed4().
3002 * @since New in 1.5.
3004 svn_error_t *
3005 svn_wc_queue_committed(svn_wc_committed_queue_t **queue,
3006 const char *path,
3007 svn_wc_adm_access_t *adm_access,
3008 svn_boolean_t recurse,
3009 apr_array_header_t *wcprop_changes,
3010 svn_boolean_t remove_lock,
3011 svn_boolean_t remove_changelist,
3012 const unsigned char *digest,
3013 apr_pool_t *pool);
3017 * Like svn_wc_process_committed4(), but batch processes
3018 * items queued with svn_wc_queue_committed().
3020 * @since New in 1.5.
3022 svn_error_t *
3023 svn_wc_process_committed_queue(svn_wc_committed_queue_t *queue,
3024 svn_wc_adm_access_t *adm_access,
3025 svn_revnum_t new_revnum,
3026 const char *rev_date,
3027 const char *rev_author,
3028 apr_pool_t *pool);
3032 * Bump a successfully committed absolute @a path to @a new_revnum after a
3033 * commit succeeds. @a rev_date and @a rev_author are the (server-side)
3034 * date and author of the new revision; one or both may be @c NULL.
3035 * @a adm_access must hold a write lock appropriate for @a path.
3037 * If non-NULL, @a wcprop_changes is an array of <tt>svn_prop_t *</tt>
3038 * changes to wc properties; if an @c svn_prop_t->value is NULL, then
3039 * that property is deleted.
3041 * If @a remove_lock is @c TRUE, any entryprops related to a repository
3042 * lock will be removed.
3044 * If @a remove_changelist is @c TRUE, any association with a
3045 * changelist will be removed.
3047 * If @a path is a member of a changelist, remove that association.
3049 * If @a path is a file and @a digest is non-NULL, use @a digest as
3050 * the checksum for the new text base. Else, calculate the checksum
3051 * if needed.
3053 * If @a recurse is TRUE and @a path is a directory, then bump every
3054 * versioned object at or under @a path. This is usually done for
3055 * copied trees.
3057 * @since New in 1.5.
3059 svn_error_t *
3060 svn_wc_process_committed4(const char *path,
3061 svn_wc_adm_access_t *adm_access,
3062 svn_boolean_t recurse,
3063 svn_revnum_t new_revnum,
3064 const char *rev_date,
3065 const char *rev_author,
3066 apr_array_header_t *wcprop_changes,
3067 svn_boolean_t remove_lock,
3068 svn_boolean_t remove_changelist,
3069 const unsigned char *digest,
3070 apr_pool_t *pool);
3072 /** Similar to svn_wc_process_committed4(), but with @a
3073 * remove_changelist set to FALSE.
3075 * @since New in 1.4.
3077 * @deprecated Provided for backwards compatibility with the 1.4 API.
3079 svn_error_t *
3080 svn_wc_process_committed3(const char *path,
3081 svn_wc_adm_access_t *adm_access,
3082 svn_boolean_t recurse,
3083 svn_revnum_t new_revnum,
3084 const char *rev_date,
3085 const char *rev_author,
3086 apr_array_header_t *wcprop_changes,
3087 svn_boolean_t remove_lock,
3088 const unsigned char *digest,
3089 apr_pool_t *pool);
3091 /** Similar to svn_wc_process_committed3(), but with @a digest set to
3092 * NULL.
3094 * @since New in 1.2.
3096 * @deprecated Provided for backwards compatibility with the 1.3 API.
3098 svn_error_t *
3099 svn_wc_process_committed2(const char *path,
3100 svn_wc_adm_access_t *adm_access,
3101 svn_boolean_t recurse,
3102 svn_revnum_t new_revnum,
3103 const char *rev_date,
3104 const char *rev_author,
3105 apr_array_header_t *wcprop_changes,
3106 svn_boolean_t remove_lock,
3107 apr_pool_t *pool);
3110 * Similar to svn_wc_process_committed2(), but with @a remove_lock set to
3111 * @c FALSE.
3113 * @deprecated Provided for backward compatibility with the 1.1 API.
3115 svn_error_t *
3116 svn_wc_process_committed(const char *path,
3117 svn_wc_adm_access_t *adm_access,
3118 svn_boolean_t recurse,
3119 svn_revnum_t new_revnum,
3120 const char *rev_date,
3121 const char *rev_author,
3122 apr_array_header_t *wcprop_changes,
3123 apr_pool_t *pool);
3130 * Do a depth-first crawl in a working copy, beginning at @a path.
3132 * Communicate the `state' of the working copy's revisions and depths
3133 * to @a reporter/@a report_baton. Obviously, if @a path is a file
3134 * instead of a directory, this depth-first crawl will be a short one.
3136 * No locks are or logs are created, nor are any animals harmed in the
3137 * process. No cleanup is necessary. @a adm_access must be an access
3138 * baton for the @a path hierarchy, it does not require a write lock.
3140 * After all revisions are reported, @a reporter->finish_report() is
3141 * called, which immediately causes the RA layer to update the working
3142 * copy. Thus the return value may very well reflect the result of
3143 * the update!
3145 * If @a depth is @c svn_depth_empty, then report state only for
3146 * @a path itself. If @c svn_depth_files, do the same and include
3147 * immediate file children of @a path. If @c svn_depth_immediates,
3148 * then behave as if for @c svn_depth_files but also report the
3149 * property states of immediate subdirectories. If @a depth is
3150 * @c svn_depth_infinity, then report state fully recursively. All
3151 * descents are only as deep as @a path's own depth permits, of
3152 * course. If @a depth is @c svn_depth_unknown, then just use
3153 * @c svn_depth_infinity, which in practice means depth of @a path.
3155 * Iff @a depth_compatibility_trick is TRUE, then set the @c start_empty
3156 * flag on @a reporter->set_path() and @a reporter->link_path() calls
3157 * as necessary to trick a pre-1.5 (i.e., depth-unaware) server into
3158 * sending back all the items the client might need to upgrade a
3159 * working copy from a shallower depth to a deeper one.
3161 * If @a restore_files is TRUE, then unexpectedly missing working files
3162 * will be restored from the administrative directory's cache. For each
3163 * file restored, the @a notify_func function will be called with the
3164 * @a notify_baton and the path of the restored file. @a notify_func may
3165 * be @c NULL if this notification is not required. If @a
3166 * use_commit_times is TRUE, then set restored files' timestamps to
3167 * their last-commit-times.
3169 * If @a traversal_info is non-NULL, then record pre-update traversal
3170 * state in it. (Caller should obtain @a traversal_info from
3171 * svn_wc_init_traversal_info().)
3173 * @since New in 1.5.
3175 svn_error_t *
3176 svn_wc_crawl_revisions3(const char *path,
3177 svn_wc_adm_access_t *adm_access,
3178 const svn_ra_reporter3_t *reporter,
3179 void *report_baton,
3180 svn_boolean_t restore_files,
3181 svn_depth_t depth,
3182 svn_boolean_t depth_compatibility_trick,
3183 svn_boolean_t use_commit_times,
3184 svn_wc_notify_func2_t notify_func,
3185 void *notify_baton,
3186 svn_wc_traversal_info_t *traversal_info,
3187 apr_pool_t *pool);
3190 * Similar to svn_wc_crawl_revisions3, but taking svn_ra_reporter2_t
3191 * instead of svn_ra_reporter3_t, and therefore only able to report @c
3192 * svn_depth_infinity for depths; and taking @a recurse instead of @a
3193 * depth; and with @a depth_compatibility_trick always false.
3195 * @deprecated Provided for compatibility with the 1.4 API.
3197 svn_error_t *
3198 svn_wc_crawl_revisions2(const char *path,
3199 svn_wc_adm_access_t *adm_access,
3200 const svn_ra_reporter2_t *reporter,
3201 void *report_baton,
3202 svn_boolean_t restore_files,
3203 svn_boolean_t recurse,
3204 svn_boolean_t use_commit_times,
3205 svn_wc_notify_func2_t notify_func,
3206 void *notify_baton,
3207 svn_wc_traversal_info_t *traversal_info,
3208 apr_pool_t *pool);
3211 * Similar to svn_wc_crawl_revisions2(), but takes an svn_wc_notify_func_t
3212 * and a @c svn_reporter_t instead.
3214 * @deprecated Provided for backward compatibility with the 1.1 API.
3216 svn_error_t *
3217 svn_wc_crawl_revisions(const char *path,
3218 svn_wc_adm_access_t *adm_access,
3219 const svn_ra_reporter_t *reporter,
3220 void *report_baton,
3221 svn_boolean_t restore_files,
3222 svn_boolean_t recurse,
3223 svn_boolean_t use_commit_times,
3224 svn_wc_notify_func_t notify_func,
3225 void *notify_baton,
3226 svn_wc_traversal_info_t *traversal_info,
3227 apr_pool_t *pool);
3230 /* Updates. */
3232 /** Set @a *wc_root to @c TRUE if @a path represents a "working copy root",
3233 * @c FALSE otherwise. Use @a pool for any intermediate allocations.
3235 * If @a path is not found, return the error @c SVN_ERR_ENTRY_NOT_FOUND.
3237 * @note Due to the way in which "WC-root-ness" is calculated, passing
3238 * a @a path of `.' to this function will always return @c TRUE.
3240 svn_error_t *
3241 svn_wc_is_wc_root(svn_boolean_t *wc_root,
3242 const char *path,
3243 svn_wc_adm_access_t *adm_access,
3244 apr_pool_t *pool);
3247 /** Conditionally split @a path into an @a anchor and @a target for the
3248 * purpose of updating and committing.
3250 * @a anchor is the directory at which the update or commit editor
3251 * should be rooted.
3253 * @a target is the actual subject (relative to the @a anchor) of the
3254 * update/commit, or "" if the @a anchor itself is the subject.
3256 * Allocate @a anchor and @a target in @a pool.
3258 svn_error_t *
3259 svn_wc_get_actual_target(const char *path,
3260 const char **anchor,
3261 const char **target,
3262 apr_pool_t *pool);
3266 /* Update and update-like functionality. */
3269 * Set @a *editor and @a *edit_baton to an editor and baton for updating a
3270 * working copy.
3272 * If @a ti is non-NULL, record traversal info in @a ti, for use by
3273 * post-traversal accessors such as svn_wc_edited_externals().
3275 * @a anchor is an access baton, with a write lock, for the local path to the
3276 * working copy which will be used as the root of our editor. Further
3277 * locks will be acquired if the update creates new directories. All
3278 * locks, both those in @a anchor and newly acquired ones, will be released
3279 * when the editor driver calls @c close_edit.
3281 * @a target is the entry in @a anchor that will actually be updated, or
3282 * empty if all of @a anchor should be updated.
3284 * The editor invokes @a notify_func with @a notify_baton as the update
3285 * progresses, if @a notify_func is non-NULL.
3287 * If @a cancel_func is non-NULL, the editor will invoke @a cancel_func with
3288 * @a cancel_baton as the update progresses to see if it should continue.
3290 * If @a conflict_func is non-NULL, then invoke it with @a
3291 * conflict_baton whenever a conflict is encountered, giving the
3292 * callback a chance to resolve the conflict before the editor takes
3293 * more drastic measures (such as marking a file conflicted, or
3294 * bailing out of the update).
3296 * If @a fetch_func is non-NULL, then use it (with @a fetch_baton) as
3297 * a fallback for retrieving repository files whenever 'copyfrom' args
3298 * are sent into editor->add_file().
3300 * If @a diff3_cmd is non-NULL, then use it as the diff3 command for
3301 * any merging; otherwise, use the built-in merge code.
3303 * @a preserved_exts is an array of filename patterns which, when
3304 * matched against the extensions of versioned files, determine for
3305 * which such files any related generated conflict files will preserve
3306 * the original file's extension as their own. If a file's extension
3307 * does not match any of the patterns in @a preserved_exts (which is
3308 * certainly the case if @a preserved_exts is @c NULL or empty),
3309 * generated conflict files will carry Subversion's custom extensions.
3311 * @a target_revision is a pointer to a revision location which, after
3312 * successful completion of the drive of this editor, will be
3313 * populated with the revision to which the working copy was updated.
3315 * If @a use_commit_times is TRUE, then all edited/added files will
3316 * have their working timestamp set to the last-committed-time. If
3317 * FALSE, the working files will be touched with the 'now' time.
3319 * If @a allow_unver_obstructions is TRUE, then allow unversioned
3320 * obstructions when adding a path.
3322 * If @a depth is @c svn_depth_infinity, update fully recursively.
3323 * Else if it is @c svn_depth_immediates, update the uppermost
3324 * directory, its file entries, and the presence or absence of
3325 * subdirectories (but do not descend into the subdirectories).
3326 * Else if it is @c svn_depth_files, update the uppermost directory
3327 * and its immediate file entries, but not subdirectories.
3328 * Else if it is @c svn_depth_empty, update exactly the uppermost
3329 * target, and don't touch its entries.
3331 * If @a depth_is_sticky is set and @a depth is not @c
3332 * svn_depth_unknown, then in addition to updating PATHS, also set
3333 * their sticky ambient depth value to @a depth.
3335 * @since New in 1.5.
3337 svn_error_t *
3338 svn_wc_get_update_editor3(svn_revnum_t *target_revision,
3339 svn_wc_adm_access_t *anchor,
3340 const char *target,
3341 svn_boolean_t use_commit_times,
3342 svn_depth_t depth,
3343 svn_boolean_t depth_is_sticky,
3344 svn_boolean_t allow_unver_obstructions,
3345 svn_wc_notify_func2_t notify_func,
3346 void *notify_baton,
3347 svn_cancel_func_t cancel_func,
3348 void *cancel_baton,
3349 svn_wc_conflict_resolver_func_t conflict_func,
3350 void *conflict_baton,
3351 svn_wc_get_file_t fetch_func,
3352 void *fetch_baton,
3353 const char *diff3_cmd,
3354 apr_array_header_t *preserved_exts,
3355 const svn_delta_editor_t **editor,
3356 void **edit_baton,
3357 svn_wc_traversal_info_t *ti,
3358 apr_pool_t *pool);
3362 * Similar to svn_wc_get_update_editor3() but with the @a
3363 * allow_unver_obstructions parameter always set to FALSE, @a
3364 * conflict_func and baton set to NULL, @a fetch_func and baton set to
3365 * NULL, @a preserved_exts set to NULL, @a depth_is_sticky set to
3366 * FALSE, and @a depth set according to @a recurse: if @a recurse is
3367 * TRUE, pass @c svn_depth_infinity, if FALSE, pass @c
3368 * svn_depth_files.
3370 * @deprecated Provided for backward compatibility with the 1.4 API.
3372 svn_error_t *
3373 svn_wc_get_update_editor2(svn_revnum_t *target_revision,
3374 svn_wc_adm_access_t *anchor,
3375 const char *target,
3376 svn_boolean_t use_commit_times,
3377 svn_boolean_t recurse,
3378 svn_wc_notify_func2_t notify_func,
3379 void *notify_baton,
3380 svn_cancel_func_t cancel_func,
3381 void *cancel_baton,
3382 const char *diff3_cmd,
3383 const svn_delta_editor_t **editor,
3384 void **edit_baton,
3385 svn_wc_traversal_info_t *ti,
3386 apr_pool_t *pool);
3389 * Similar to svn_wc_get_update_editor2(), but takes an svn_wc_notify_func_t
3390 * instead.
3392 * @deprecated Provided for backward compatibility with the 1.1 API.
3394 svn_error_t *
3395 svn_wc_get_update_editor(svn_revnum_t *target_revision,
3396 svn_wc_adm_access_t *anchor,
3397 const char *target,
3398 svn_boolean_t use_commit_times,
3399 svn_boolean_t recurse,
3400 svn_wc_notify_func_t notify_func,
3401 void *notify_baton,
3402 svn_cancel_func_t cancel_func,
3403 void *cancel_baton,
3404 const char *diff3_cmd,
3405 const svn_delta_editor_t **editor,
3406 void **edit_baton,
3407 svn_wc_traversal_info_t *ti,
3408 apr_pool_t *pool);
3411 * A variant of svn_wc_get_update_editor().
3413 * Set @a *editor and @a *edit_baton to an editor and baton for "switching"
3414 * a working copy to a new @a switch_url. (Right now, this URL must be
3415 * within the same repository that the working copy already comes
3416 * from.) @a switch_url must not be @c NULL.
3418 * If @a ti is non-NULL, record traversal info in @a ti, for use by
3419 * post-traversal accessors such as svn_wc_edited_externals().
3421 * @a anchor is an access baton, with a write lock, for the local path to the
3422 * working copy which will be used as the root of our editor. Further
3423 * locks will be acquired if the switch creates new directories. All
3424 * locks, both those in @a anchor and newly acquired ones, will be released
3425 * when the editor driver calls @c close_edit.
3427 * @a target is the entry in @a anchor that will actually be updated, or
3428 * empty if all of @a anchor should be updated.
3430 * The editor invokes @a notify_func with @a notify_baton as the switch
3431 * progresses, if @a notify_func is non-NULL.
3433 * If @a cancel_func is non-NULL, it will be called with @a cancel_baton as
3434 * the switch progresses to determine if it should continue.
3436 * If @a conflict_func is non-NULL, then invoke it with @a
3437 * conflict_baton whenever a conflict is encountered, giving the
3438 * callback a chance to resolve the conflict before the editor takes
3439 * more drastic measures (such as marking a file conflicted, or
3440 * bailing out of the switch).
3442 * If @a diff3_cmd is non-NULL, then use it as the diff3 command for
3443 * any merging; otherwise, use the built-in merge code.
3445 * @a preserved_exts is an array of filename patterns which, when
3446 * matched against the extensions of versioned files, determine for
3447 * which such files any related generated conflict files will preserve
3448 * the original file's extension as their own. If a file's extension
3449 * does not match any of the patterns in @a preserved_exts (which is
3450 * certainly the case if @a preserved_exts is @c NULL or empty),
3451 * generated conflict files will carry Subversion's custom extensions.
3453 * @a target_revision is a pointer to a revision location which, after
3454 * successful completion of the drive of this editor, will be
3455 * populated with the revision to which the working copy was updated.
3457 * If @a use_commit_times is TRUE, then all edited/added files will
3458 * have their working timestamp set to the last-committed-time. If
3459 * FALSE, the working files will be touched with the 'now' time.
3461 * @a depth and @a depth_is_sticky behave as for svn_wc_get_update_editor3().
3463 * If @a allow_unver_obstructions is TRUE, then allow unversioned
3464 * obstructions when adding a path.
3466 * @since New in 1.5.
3468 svn_error_t *
3469 svn_wc_get_switch_editor3(svn_revnum_t *target_revision,
3470 svn_wc_adm_access_t *anchor,
3471 const char *target,
3472 const char *switch_url,
3473 svn_boolean_t use_commit_times,
3474 svn_depth_t depth,
3475 svn_boolean_t depth_is_sticky,
3476 svn_boolean_t allow_unver_obstructions,
3477 svn_wc_notify_func2_t notify_func,
3478 void *notify_baton,
3479 svn_cancel_func_t cancel_func,
3480 void *cancel_baton,
3481 svn_wc_conflict_resolver_func_t conflict_func,
3482 void *conflict_baton,
3483 const char *diff3_cmd,
3484 apr_array_header_t *preserved_exts,
3485 const svn_delta_editor_t **editor,
3486 void **edit_baton,
3487 svn_wc_traversal_info_t *ti,
3488 apr_pool_t *pool);
3491 * Similar to svn_wc_get_switch_editor3() but with the
3492 * @a allow_unver_obstructions parameter always set to FALSE,
3493 * @a preserved_exts set to NULL, @a conflict_func and baton set to NULL,
3494 * @a depth_is_sticky set to FALSE, and @a depth set according to @a
3495 * recurse: if @a recurse is TRUE, pass @c svn_depth_infinity, if
3496 * FALSE, pass @c svn_depth_files.
3498 * @deprecated Provided for backward compatibility with the 1.4 API.
3500 svn_error_t *
3501 svn_wc_get_switch_editor2(svn_revnum_t *target_revision,
3502 svn_wc_adm_access_t *anchor,
3503 const char *target,
3504 const char *switch_url,
3505 svn_boolean_t use_commit_times,
3506 svn_boolean_t recurse,
3507 svn_wc_notify_func2_t notify_func,
3508 void *notify_baton,
3509 svn_cancel_func_t cancel_func,
3510 void *cancel_baton,
3511 const char *diff3_cmd,
3512 const svn_delta_editor_t **editor,
3513 void **edit_baton,
3514 svn_wc_traversal_info_t *ti,
3515 apr_pool_t *pool);
3518 * Similar to svn_wc_get_switch_editor2(), but takes an
3519 * @c svn_wc_notify_func_t instead.
3521 * @deprecated Provided for backward compatibility with the 1.1 API.
3523 svn_error_t *
3524 svn_wc_get_switch_editor(svn_revnum_t *target_revision,
3525 svn_wc_adm_access_t *anchor,
3526 const char *target,
3527 const char *switch_url,
3528 svn_boolean_t use_commit_times,
3529 svn_boolean_t recurse,
3530 svn_wc_notify_func_t notify_func,
3531 void *notify_baton,
3532 svn_cancel_func_t cancel_func,
3533 void *cancel_baton,
3534 const char *diff3_cmd,
3535 const svn_delta_editor_t **editor,
3536 void **edit_baton,
3537 svn_wc_traversal_info_t *ti,
3538 apr_pool_t *pool);
3542 /* A word about the implementation of working copy property storage:
3544 * Since properties are key/val pairs, you'd think we store them in
3545 * some sort of Berkeley DB-ish format, and even store pending changes
3546 * to them that way too.
3548 * However, we already have libsvn_subr/hashdump.c working, and it
3549 * uses a human-readable format. That will be very handy when we're
3550 * debugging, and presumably we will not be dealing with any huge
3551 * properties or property lists initially. Therefore, we will
3552 * continue to use hashdump as the internal mechanism for storing and
3553 * reading from property lists, but note that the interface here is
3554 * _not_ dependent on that. We can swap in a DB-based implementation
3555 * at any time and users of this library will never know the
3556 * difference.
3559 /** Set @a *props to a hash table mapping <tt>char *</tt> names onto
3560 * <tt>svn_string_t *</tt> values for all the regular properties of
3561 * @a path. Allocate the table, names, and values in @a pool. If
3562 * the node has no properties, or does not exist in the working copy,
3563 * then an empty hash is returned. @a adm_access is an access baton
3564 * set that contains @a path.
3566 svn_error_t *
3567 svn_wc_prop_list(apr_hash_t **props,
3568 const char *path,
3569 svn_wc_adm_access_t *adm_access,
3570 apr_pool_t *pool);
3573 /** Set @a *value to the value of property @a name for @a path, allocating
3574 * @a *value in @a pool. If no such prop, set @a *value to @c NULL.
3575 * @a name may be a regular or wc property; if it is an entry property,
3576 * return the error @c SVN_ERR_BAD_PROP_KIND. @a adm_access is an access
3577 * baton set that contains @a path.
3579 svn_error_t *
3580 svn_wc_prop_get(const svn_string_t **value,
3581 const char *name,
3582 const char *path,
3583 svn_wc_adm_access_t *adm_access,
3584 apr_pool_t *pool);
3587 * Set property @a name to @a value for @a path, or if @a value is
3588 * NULL, remove property @a name from @a path. @a adm_access is an
3589 * access baton with a write lock for @a path.
3591 * If @a skip_checks is TRUE, do no validity checking. But if @a
3592 * skip_checks is FALSE, and @a name is not a valid property for @a
3593 * path, return an error, either @c SVN_ERR_ILLEGAL_TARGET (if the
3594 * property is not appropriate for @a path), or @c
3595 * SVN_ERR_BAD_MIME_TYPE (if @a name is "svn:mime-type", but @a value
3596 * is not a valid mime-type).
3598 * @a name may be a wc property or a regular property; but if it is an
3599 * entry property, return the error @c SVN_ERR_BAD_PROP_KIND, even if
3600 * @a skip_checks is TRUE.
3602 * Use @a pool for temporary allocation.
3604 * @since New in 1.2.
3606 svn_error_t *
3607 svn_wc_prop_set2(const char *name,
3608 const svn_string_t *value,
3609 const char *path,
3610 svn_wc_adm_access_t *adm_access,
3611 svn_boolean_t skip_checks,
3612 apr_pool_t *pool);
3616 * Like svn_wc_prop_set2(), but with @a skip_checks always FALSE.
3618 * @deprecated Provided for backward compatibility with the 1.1 API.
3620 svn_error_t *
3621 svn_wc_prop_set(const char *name,
3622 const svn_string_t *value,
3623 const char *path,
3624 svn_wc_adm_access_t *adm_access,
3625 apr_pool_t *pool);
3628 /** Return TRUE iff @a name is a 'normal' property name. 'Normal' is
3629 * defined as a user-visible and user-tweakable property that shows up
3630 * when you fetch a proplist.
3632 * The function currently parses the namespace like so:
3634 * - 'svn:wc:' ==> a wcprop, stored/accessed separately via different API.
3636 * - 'svn:entry:' ==> an "entry" prop, shunted into the 'entries' file.
3638 * If these patterns aren't found, then the property is assumed to be
3639 * Normal.
3641 svn_boolean_t svn_wc_is_normal_prop(const char *name);
3645 /** Return TRUE iff @a name is a 'wc' property name. */
3646 svn_boolean_t svn_wc_is_wc_prop(const char *name);
3648 /** Return TRUE iff @a name is a 'entry' property name. */
3649 svn_boolean_t svn_wc_is_entry_prop(const char *name);
3651 /** Callback type used by @c svn_wc_canonicalize_svn_prop.
3653 * If @a mime_type is non-null, it sets @a *mime_type to the value of
3654 * @a SVN_PROP_MIME_TYPE for the path passed to @c
3655 * svn_wc_canonicalize_svn_prop (allocated from @a pool). If @a
3656 * stream is non-null, it writes the contents of the file to @a
3657 * stream.
3659 * (Currently, this is used if you are attempting to set the @a
3660 * SVN_PROP_EOL_STYLE property, to make sure that the value matches
3661 * the mime type and contents.)
3663 typedef svn_error_t *(*svn_wc_canonicalize_svn_prop_get_file_t)
3664 (const svn_string_t **mime_type,
3665 svn_stream_t *stream,
3666 void *baton,
3667 apr_pool_t *pool);
3670 /** Canonicalize the value of an svn:* property @a propname with
3671 * value @a propval.
3673 * If the property is not appropriate for a node of kind @a kind, or
3674 * is otherwise invalid, throw an error. Otherwise, set @a *propval_p
3675 * to a canonicalized version of the property value. If @a
3676 * skip_some_checks is TRUE, only some validity checks are taken.
3678 * Some validity checks require access to the contents and MIME type
3679 * of the target if it is a file; they will call @a prop_getter with @a
3680 * getter_baton, which then needs to set the MIME type and print the
3681 * contents of the file to the given stream.
3683 * @a path should be the path of the file in question; it is only used
3684 * for error messages.
3686 * ### This is not actually related to the WC, but it does need to call
3687 * ### svn_wc_parse_externals_description2.
3689 svn_error_t *
3690 svn_wc_canonicalize_svn_prop(const svn_string_t **propval_p,
3691 const char *propname,
3692 const svn_string_t *propval,
3693 const char *path,
3694 svn_node_kind_t kind,
3695 svn_boolean_t skip_some_checks,
3696 svn_wc_canonicalize_svn_prop_get_file_t prop_getter,
3697 void *getter_baton,
3698 apr_pool_t *pool);
3702 /* Diffs */
3706 * Return an @a editor/@a edit_baton for diffing a working copy against the
3707 * repository.
3709 * @a anchor/@a target represent the base of the hierarchy to be compared.
3711 * @a callbacks/@a callback_baton is the callback table to use when two
3712 * files are to be compared.
3714 * If @a depth is @c svn_depth_empty, just diff exactly @a target or
3715 * @a anchor if @a target is empty. If @c svn_depth_files then do the same
3716 * and for top-level file entries as well (if any). If
3717 * @c svn_depth_immediates, do the same as @c svn_depth_files but also diff
3718 * top-level subdirectories at @c svn_depth_empty. If @c svn_depth_infinity,
3719 * then diff fully recursively. In the latter case, @a anchor should be part
3720 * of an access baton set for the @a target hierarchy.
3722 * @a ignore_ancestry determines whether paths that have discontinuous node
3723 * ancestry are treated as delete/add or as simple modifications. If
3724 * @a ignore_ancestry is @c FALSE, then any discontinuous node ancestry will
3725 * result in the diff given as a full delete followed by an add.
3727 * If @a use_text_base is TRUE, then compare the repository against
3728 * the working copy's text-base files, rather than the working files.
3730 * Normally, the difference from repository->working_copy is shown.
3731 * If @a reverse_order is TRUE, then show working_copy->repository diffs.
3733 * If @a cancel_func is non-NULL, it will be used along with @a cancel_baton
3734 * to periodically check if the client has canceled the operation.
3736 * @a changelists is an array of <tt>const char *</tt> changelist
3737 * names, used as a restrictive filter on items whose differences are
3738 * reported; that is, don't generate diffs about any item unless
3739 * it's a member of one of those changelists. If @a changelists is
3740 * empty (or altogether @c NULL), no changelist filtering occurs.
3742 * @since New in 1.5.
3744 svn_error_t *
3745 svn_wc_get_diff_editor4(svn_wc_adm_access_t *anchor,
3746 const char *target,
3747 const svn_wc_diff_callbacks2_t *callbacks,
3748 void *callback_baton,
3749 svn_depth_t depth,
3750 svn_boolean_t ignore_ancestry,
3751 svn_boolean_t use_text_base,
3752 svn_boolean_t reverse_order,
3753 svn_cancel_func_t cancel_func,
3754 void *cancel_baton,
3755 const apr_array_header_t *changelists,
3756 const svn_delta_editor_t **editor,
3757 void **edit_baton,
3758 apr_pool_t *pool);
3761 * Similar to svn_wc_get_diff_editor4(), but with @a changelists
3762 * passed as @c NULL, and @a depth set to @c svn_depth_infinity if @a
3763 * recurse is TRUE, or @a svn_depth_files if @a recurse is FALSE.
3765 * @deprecated Provided for backward compatibility with the 1.4 API.
3767 * @since New in 1.2.
3769 svn_error_t *
3770 svn_wc_get_diff_editor3(svn_wc_adm_access_t *anchor,
3771 const char *target,
3772 const svn_wc_diff_callbacks2_t *callbacks,
3773 void *callback_baton,
3774 svn_boolean_t recurse,
3775 svn_boolean_t ignore_ancestry,
3776 svn_boolean_t use_text_base,
3777 svn_boolean_t reverse_order,
3778 svn_cancel_func_t cancel_func,
3779 void *cancel_baton,
3780 const svn_delta_editor_t **editor,
3781 void **edit_baton,
3782 apr_pool_t *pool);
3786 * Similar to svn_wc_get_diff_editor3(), but with an
3787 * @c svn_wc_diff_callbacks_t instead of @c svn_wc_diff_callbacks2_t.
3789 * @deprecated Provided for backward compatibility with the 1.1 API.
3791 svn_error_t *
3792 svn_wc_get_diff_editor2(svn_wc_adm_access_t *anchor,
3793 const char *target,
3794 const svn_wc_diff_callbacks_t *callbacks,
3795 void *callback_baton,
3796 svn_boolean_t recurse,
3797 svn_boolean_t ignore_ancestry,
3798 svn_boolean_t use_text_base,
3799 svn_boolean_t reverse_order,
3800 svn_cancel_func_t cancel_func,
3801 void *cancel_baton,
3802 const svn_delta_editor_t **editor,
3803 void **edit_baton,
3804 apr_pool_t *pool);
3808 * Similar to svn_wc_get_diff_editor2(), but with @a ignore_ancestry
3809 * always set to @c FALSE.
3811 * @deprecated Provided for backward compatibility with the 1.0 API.
3813 svn_error_t *
3814 svn_wc_get_diff_editor(svn_wc_adm_access_t *anchor,
3815 const char *target,
3816 const svn_wc_diff_callbacks_t *callbacks,
3817 void *callback_baton,
3818 svn_boolean_t recurse,
3819 svn_boolean_t use_text_base,
3820 svn_boolean_t reverse_order,
3821 svn_cancel_func_t cancel_func,
3822 void *cancel_baton,
3823 const svn_delta_editor_t **editor,
3824 void **edit_baton,
3825 apr_pool_t *pool);
3829 * Compare working copy against the text-base.
3831 * @a anchor/@a target represent the base of the hierarchy to be compared.
3833 * @a callbacks/@a callback_baton is the callback table to use when two
3834 * files are to be compared.
3836 * If @a depth is @c svn_depth_empty, just diff exactly @a target or
3837 * @a anchor if @a target is empty. If @c svn_depth_files then do the same
3838 * and for top-level file entries as well (if any). If
3839 * @c svn_depth_immediates, do the same as @c svn_depth_files but also diff
3840 * top-level subdirectories at @c svn_depth_empty. If @c svn_depth_infinity,
3841 * then diff fully recursively. In the latter case, @a anchor should be part
3842 * of an access baton set for the @a target hierarchy.
3844 * @a ignore_ancestry determines whether paths that have discontinuous node
3845 * ancestry are treated as delete/add or as simple modifications. If
3846 * @a ignore_ancestry is @c FALSE, then any discontinuous node ancestry will
3847 * result in the diff given as a full delete followed by an add.
3849 * @a changelists is an array of <tt>const char *</tt> changelist
3850 * names, used as a restrictive filter on items whose differences are
3851 * reported; that is, don't generate diffs about any item unless
3852 * it's a member of one of those changelists. If @a changelists is
3853 * empty (or altogether @c NULL), no changelist filtering occurs.
3855 * @since New in 1.5.
3857 svn_error_t *
3858 svn_wc_diff4(svn_wc_adm_access_t *anchor,
3859 const char *target,
3860 const svn_wc_diff_callbacks2_t *callbacks,
3861 void *callback_baton,
3862 svn_depth_t depth,
3863 svn_boolean_t ignore_ancestry,
3864 const apr_array_header_t *changelists,
3865 apr_pool_t *pool);
3869 * Similar to svn_wc_diff4(), but with @a changelists passed @c NULL,
3870 * and @a depth set to @c svn_depth_infinity if @a recurse is TRUE, or
3871 * @a svn_depth_files if @a recurse is FALSE.
3873 * @deprecated Provided for backward compatibility with the 1.2 API.
3875 svn_error_t *
3876 svn_wc_diff3(svn_wc_adm_access_t *anchor,
3877 const char *target,
3878 const svn_wc_diff_callbacks2_t *callbacks,
3879 void *callback_baton,
3880 svn_boolean_t recurse,
3881 svn_boolean_t ignore_ancestry,
3882 apr_pool_t *pool);
3885 * Similar to svn_wc_diff3(), but with a @c svn_wc_diff_callbacks_t argument
3886 * instead of @c svn_wc_diff_callbacks2_t.
3888 * @deprecated Provided for backward compatibility with the 1.1 API.
3890 svn_error_t *
3891 svn_wc_diff2(svn_wc_adm_access_t *anchor,
3892 const char *target,
3893 const svn_wc_diff_callbacks_t *callbacks,
3894 void *callback_baton,
3895 svn_boolean_t recurse,
3896 svn_boolean_t ignore_ancestry,
3897 apr_pool_t *pool);
3900 * Similar to svn_wc_diff2(), but with @a ignore_ancestry always set
3901 * to @c FALSE.
3903 * @deprecated Provided for backward compatibility with the 1.0 API.
3905 svn_error_t *
3906 svn_wc_diff(svn_wc_adm_access_t *anchor,
3907 const char *target,
3908 const svn_wc_diff_callbacks_t *callbacks,
3909 void *callback_baton,
3910 svn_boolean_t recurse,
3911 apr_pool_t *pool);
3914 /** Given a @a path to a file or directory under version control, discover
3915 * any local changes made to properties and/or the set of 'pristine'
3916 * properties. @a adm_access is an access baton set for @a path.
3918 * If @a propchanges is non-@c NULL, return these changes as an array of
3919 * @c svn_prop_t structures stored in @a *propchanges. The structures and
3920 * array will be allocated in @a pool. If there are no local property
3921 * modifications on @a path, then set @a *propchanges to @c NULL.
3923 * If @a original_props is non-@c NULL, then set @a *original_props to
3924 * hashtable (<tt>const char *name</tt> -> <tt>const svn_string_t *value</tt>)
3925 * that represents the 'pristine' property list of @a path. This hashtable is
3926 * allocated in @a pool, and can be used to compare old and new values of
3927 * properties.
3929 svn_error_t *
3930 svn_wc_get_prop_diffs(apr_array_header_t **propchanges,
3931 apr_hash_t **original_props,
3932 const char *path,
3933 svn_wc_adm_access_t *adm_access,
3934 apr_pool_t *pool);
3937 /** The outcome of a merge carried out (or tried as a dry-run) by
3938 * svn_wc_merge()
3940 typedef enum svn_wc_merge_outcome_t
3942 /** The working copy is (or would be) unchanged. The changes to be
3943 * merged were already present in the working copy
3945 svn_wc_merge_unchanged,
3947 /** The working copy has been (or would be) changed. */
3948 svn_wc_merge_merged,
3950 /** The working copy has been (or would be) changed, but there was (or
3951 * would be) a conflict
3953 svn_wc_merge_conflict,
3955 /** No merge was performed, probably because the target file was
3956 * either absent or not under version control.
3958 svn_wc_merge_no_merge
3960 } svn_wc_merge_outcome_t;
3962 /** Given paths to three fulltexts, merge the differences between @a left
3963 * and @a right into @a merge_target. (It may help to know that @a left,
3964 * @a right, and @a merge_target correspond to "OLDER", "YOURS", and "MINE",
3965 * respectively, in the diff3 documentation.) Use @a pool for any
3966 * temporary allocation.
3968 * @a adm_access is an access baton with a write lock for the directory
3969 * containing @a merge_target.
3971 * This function assumes that @a left and @a right are in repository-normal
3972 * form (linefeeds, with keywords contracted); if necessary,
3973 * @a merge_target is temporarily converted to this form to receive the
3974 * changes, then translated back again.
3976 * If @a merge_target is absent, or present but not under version
3977 * control, then set @a *merge_outcome to @c svn_wc_merge_no_merge and
3978 * return success without merging anything. (The reasoning is that if
3979 * the file is not versioned, then it is probably unrelated to the
3980 * changes being considered, so they should not be merged into it.)
3982 * @a dry_run determines whether the working copy is modified. When it
3983 * is @c FALSE the merge will cause @a merge_target to be modified, when it
3984 * is @c TRUE the merge will be carried out to determine the result but
3985 * @a merge_target will not be modified.
3987 * If @a diff3_cmd is non-NULL, then use it as the diff3 command for
3988 * any merging; otherwise, use the built-in merge code. If @a
3989 * merge_options is non-NULL, either pass its elements to @a diff3_cmd or
3990 * parse it and use as options to the internal merge code (@see
3991 * svn_diff_file_options_parse()). @a merge_options must contain
3992 * <tt>const char *</tt> elements.
3994 * The outcome of the merge is returned in @a *merge_outcome. If there
3995 * is a conflict and @a dry_run is @c FALSE, then attempt to call @a
3996 * conflict_func with @a conflict_baton (if non-NULL). If the
3997 * conflict callback cannot resolve the conflict, then:
3999 * * Put conflict markers around the conflicting regions in
4000 * @a merge_target, labeled with @a left_label, @a right_label, and
4001 * @a target_label. (If any of these labels are @c NULL, default
4002 * values will be used.)
4004 * * Copy @a left, @a right, and the original @a merge_target to unique
4005 * names in the same directory as @a merge_target, ending with the
4006 * suffixes ".LEFT_LABEL", ".RIGHT_LABEL", and ".TARGET_LABEL"
4007 * respectively.
4009 * * Mark the entry for @a merge_target as "conflicted", and track the
4010 * above mentioned backup files in the entry as well.
4012 * Binary case:
4014 * If @a merge_target is a binary file, then no merging is attempted,
4015 * the merge is deemed to be a conflict. If @a dry_run is @c FALSE the
4016 * working @a merge_target is untouched, and copies of @a left and
4017 * @a right are created next to it using @a left_label and @a right_label.
4018 * @a merge_target's entry is marked as "conflicted", and begins
4019 * tracking the two backup files. If @a dry_run is @c TRUE no files are
4020 * changed. The outcome of the merge is returned in @a *merge_outcome.
4022 * @since New in 1.5.
4024 svn_error_t *
4025 svn_wc_merge3(enum svn_wc_merge_outcome_t *merge_outcome,
4026 const char *left,
4027 const char *right,
4028 const char *merge_target,
4029 svn_wc_adm_access_t *adm_access,
4030 const char *left_label,
4031 const char *right_label,
4032 const char *target_label,
4033 svn_boolean_t dry_run,
4034 const char *diff3_cmd,
4035 const apr_array_header_t *merge_options,
4036 const apr_array_header_t *prop_diff,
4037 svn_wc_conflict_resolver_func_t conflict_func,
4038 void *conflict_baton,
4039 apr_pool_t *pool);
4041 /** Similar to svn_wc_merge3(), but with @a prop_diff, @a
4042 * conflict_func, @a conflict_baton set to NULL.
4044 * @deprecated Provided for backwards compatibility with the 1.4 API.
4046 svn_error_t *
4047 svn_wc_merge2(enum svn_wc_merge_outcome_t *merge_outcome,
4048 const char *left,
4049 const char *right,
4050 const char *merge_target,
4051 svn_wc_adm_access_t *adm_access,
4052 const char *left_label,
4053 const char *right_label,
4054 const char *target_label,
4055 svn_boolean_t dry_run,
4056 const char *diff3_cmd,
4057 const apr_array_header_t *merge_options,
4058 apr_pool_t *pool);
4061 /** Similar to svn_wc_merge2(), but with @a merge_options set to NULL.
4063 * @deprecated Provided for backwards compatibility with the 1.3 API.
4065 svn_error_t *
4066 svn_wc_merge(const char *left,
4067 const char *right,
4068 const char *merge_target,
4069 svn_wc_adm_access_t *adm_access,
4070 const char *left_label,
4071 const char *right_label,
4072 const char *target_label,
4073 svn_boolean_t dry_run,
4074 enum svn_wc_merge_outcome_t *merge_outcome,
4075 const char *diff3_cmd,
4076 apr_pool_t *pool);
4079 /** Given a @a path under version control, merge an array of @a
4080 * propchanges into the path's existing properties. @a propchanges is
4081 * an array of @c svn_prop_t objects, and @a baseprops is a hash
4082 * representing the original set of properties that @a propchanges is
4083 * working against. @a adm_access is an access baton for the directory
4084 * containing @a path.
4086 * If @a base_merge is @c FALSE only the working properties will be changed,
4087 * if it is @c TRUE both the base and working properties will be changed.
4089 * If @a state is non-NULL, set @a *state to the state of the properties
4090 * after the merge.
4092 * If conflicts are found when merging working properties, they are
4093 * described in a temporary .prej file (or appended to an already-existing
4094 * .prej file), and the entry is marked "conflicted". Base properties
4095 * are changed unconditionally, if @a base_merge is @c TRUE, they never result
4096 * in a conflict.
4098 * If @a path is not under version control, return the error
4099 * SVN_ERR_UNVERSIONED_RESOURCE and don't touch anyone's properties.
4101 * @since New in 1.5.
4103 svn_error_t *
4104 svn_wc_merge_props2(svn_wc_notify_state_t *state,
4105 const char *path,
4106 svn_wc_adm_access_t *adm_access,
4107 apr_hash_t *baseprops,
4108 const apr_array_header_t *propchanges,
4109 svn_boolean_t base_merge,
4110 svn_boolean_t dry_run,
4111 svn_wc_conflict_resolver_func_t conflict_func,
4112 void *conflict_baton,
4113 apr_pool_t *pool);
4117 * Same as svn_wc_merge_props2(), but with a @a conflict_func (and
4118 * baton) of NULL.
4120 * @deprecated Provided for backward compatibility with the 1.3 API.
4123 svn_error_t *
4124 svn_wc_merge_props(svn_wc_notify_state_t *state,
4125 const char *path,
4126 svn_wc_adm_access_t *adm_access,
4127 apr_hash_t *baseprops,
4128 const apr_array_header_t *propchanges,
4129 svn_boolean_t base_merge,
4130 svn_boolean_t dry_run,
4131 apr_pool_t *pool);
4135 * Similar to svn_wc_merge_props(), but no baseprops are given.
4136 * Instead, it's assumed that the incoming propchanges are based
4137 * against the working copy's own baseprops. While this assumption is
4138 * correct for 'svn update', it's incorrect for 'svn merge', and can
4139 * cause flawed behavior. (See issue #2035.)
4141 * @deprecated Provided for backward compatibility with the 1.2 API.
4143 svn_error_t *
4144 svn_wc_merge_prop_diffs(svn_wc_notify_state_t *state,
4145 const char *path,
4146 svn_wc_adm_access_t *adm_access,
4147 const apr_array_header_t *propchanges,
4148 svn_boolean_t base_merge,
4149 svn_boolean_t dry_run,
4150 apr_pool_t *pool);
4154 /** Given a @a path to a wc file, return a @a pristine_path which points to a
4155 * pristine version of the file. This is needed so clients can do
4156 * diffs. If the WC has no text-base, return a @c NULL instead of a
4157 * path.
4159 svn_error_t *
4160 svn_wc_get_pristine_copy_path(const char *path,
4161 const char **pristine_path,
4162 apr_pool_t *pool);
4166 * Recurse from @a path, cleaning up unfinished log business. Perform
4167 * necessary allocations in @a pool. Any working copy locks under @a path
4168 * will be taken over and then cleared by this function. If @a diff3_cmd
4169 * is non-NULL, then use it as the diff3 command for any merging; otherwise,
4170 * use the built-in merge code.
4172 * WARNING: there is no mechanism that will protect locks that are still
4173 * being used.
4175 * If @a cancel_func is non-NULL, invoke it with @a cancel_baton at
4176 * various points during the operation. If it returns an error
4177 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
4179 * @since New in 1.2.
4181 svn_error_t *
4182 svn_wc_cleanup2(const char *path,
4183 const char *diff3_cmd,
4184 svn_cancel_func_t cancel_func,
4185 void *cancel_baton,
4186 apr_pool_t *pool);
4189 * Similar to svn_wc_cleanup2(). @a optional_adm_access is an historic
4190 * relic and not used, it may be NULL.
4192 * @deprecated Provided for backward compatibility with the 1.1 API.
4194 svn_error_t *
4195 svn_wc_cleanup(const char *path,
4196 svn_wc_adm_access_t *optional_adm_access,
4197 const char *diff3_cmd,
4198 svn_cancel_func_t cancel_func,
4199 void *cancel_baton,
4200 apr_pool_t *pool);
4203 /** Relocation validation callback typedef.
4205 * Called for each relocated file/directory. @a uuid, if non-NULL, contains
4206 * the expected repository UUID, @a url contains the tentative URL.
4208 * @a baton is a closure object; it should be provided by the
4209 * implementation, and passed by the caller.
4211 * If @a root is TRUE, then the implementation should make sure that @a url
4212 * is the repository root. Else, it can be an URL inside the repository.
4213 * @a pool may be used for temporary allocations.
4215 * @since New in 1.5.
4217 typedef svn_error_t *(*svn_wc_relocation_validator3_t)(void *baton,
4218 const char *uuid,
4219 const char *url,
4220 const char *root_url,
4221 apr_pool_t *pool);
4223 /** Similar to @c svn_wc_relocation_validator3_t, but without
4224 * the @a root_url arguments.
4226 * @deprecated Provided for backwards compatibility with the 1.4 API.
4228 typedef svn_error_t *(*svn_wc_relocation_validator2_t)(void *baton,
4229 const char *uuid,
4230 const char *url,
4231 svn_boolean_t root,
4232 apr_pool_t *pool);
4234 /** Similar to @c svn_wc_relocation_validator2_t, but without
4235 * the @a root and @a pool arguments. @a uuid will not be NULL in this version
4236 * of the function.
4238 * @deprecated Provided for backwards compatibility with the 1.3 API.
4240 typedef svn_error_t *(*svn_wc_relocation_validator_t)(void *baton,
4241 const char *uuid,
4242 const char *url);
4244 /** Change repository references at @a path that begin with @a from
4245 * to begin with @a to instead. Perform necessary allocations in @a pool.
4246 * If @a recurse is TRUE, do so. @a validator (and its baton,
4247 * @a validator_baton), will be called for each newly generated URL.
4249 * @a adm_access is an access baton for the directory containing
4250 * @a path.
4252 * @since New in 1.5.
4254 svn_error_t *
4255 svn_wc_relocate3(const char *path,
4256 svn_wc_adm_access_t *adm_access,
4257 const char *from,
4258 const char *to,
4259 svn_boolean_t recurse,
4260 svn_wc_relocation_validator3_t validator,
4261 void *validator_baton,
4262 apr_pool_t *pool);
4264 /** Similar to svn_wc_relocate3(), but uses @c svn_wc_relocation_validator2_t.
4266 * @deprecated Provided for backwards compatibility with the 1.4 API. */
4267 svn_error_t *
4268 svn_wc_relocate2(const char *path,
4269 svn_wc_adm_access_t *adm_access,
4270 const char *from,
4271 const char *to,
4272 svn_boolean_t recurse,
4273 svn_wc_relocation_validator2_t validator,
4274 void *validator_baton,
4275 apr_pool_t *pool);
4277 /** Similar to svn_wc_relocate2(), but uses @c svn_wc_relocation_validator_t.
4279 * @deprecated Provided for backwards compatibility with the 1.3 API. */
4280 svn_error_t *
4281 svn_wc_relocate(const char *path,
4282 svn_wc_adm_access_t *adm_access,
4283 const char *from,
4284 const char *to,
4285 svn_boolean_t recurse,
4286 svn_wc_relocation_validator_t validator,
4287 void *validator_baton,
4288 apr_pool_t *pool);
4292 * Revert changes to @a path. Perform necessary allocations in @a pool.
4294 * @a parent_access is an access baton for the directory containing @a
4295 * path, unless @a path is a working copy root (as determined by @c
4296 * svn_wc_is_wc_root), in which case @a parent_access refers to @a
4297 * path itself.
4299 * If @a depth is @c svn_depth_empty, revert just @a path (if a
4300 * directory, then revert just the properties on that directory).
4301 * Else if @c svn_depth_files, revert @a path and any files
4302 * directly under @a path if it is directory. Else if
4303 * @c svn_depth_immediates, revert all of the preceding plus
4304 * properties on immediate subdirectories; else if @c svn_depth_infinity,
4305 * revert path and everything under it fully recursively.
4307 * @a changelists is an array of <tt>const char *</tt> changelist
4308 * names, used as a restrictive filter on items reverted; that is,
4309 * don't revert any item unless it's a member of one of those
4310 * changelists. If @a changelists is empty (or altogether @c NULL),
4311 * no changelist filtering occurs.
4313 * If @a cancel_func is non-NULL, call it with @a cancel_baton at
4314 * various points during the reversion process. If it returns an
4315 * error (typically @c SVN_ERR_CANCELLED), return that error
4316 * immediately.
4318 * If @a use_commit_times is TRUE, then all reverted working-files
4319 * will have their timestamp set to the last-committed-time. If
4320 * FALSE, the reverted working-files will be touched with the 'now' time.
4322 * For each item reverted, @a notify_func will be called with @a notify_baton
4323 * and the path of the reverted item. @a notify_func may be @c NULL if this
4324 * notification is not needed.
4326 * If @a path is not under version control, return the error
4327 * SVN_ERR_UNVERSIONED_RESOURCE.
4329 * @since New in 1.5.
4331 svn_error_t *
4332 svn_wc_revert3(const char *path,
4333 svn_wc_adm_access_t *parent_access,
4334 svn_depth_t depth,
4335 svn_boolean_t use_commit_times,
4336 const apr_array_header_t *changelists,
4337 svn_cancel_func_t cancel_func,
4338 void *cancel_baton,
4339 svn_wc_notify_func2_t notify_func,
4340 void *notify_baton,
4341 apr_pool_t *pool);
4344 * Similar to svn_wc_revert3(), but with @a changelists passed as @c
4345 * NULL, and @a depth set according to @a recursive: if @a recursive
4346 * is TRUE, @a depth is @c svn_depth_infinity; if FALSE, @a depth is
4347 * @c svn_depth_empty.
4349 * @note Most APIs map @a recurse==FALSE to @a depth==svn_depth_files;
4350 * revert is deliberately different.
4352 * @deprecated Provided for backward compatibility with the 1.2 API.
4354 svn_error_t *
4355 svn_wc_revert2(const char *path,
4356 svn_wc_adm_access_t *parent_access,
4357 svn_boolean_t recursive,
4358 svn_boolean_t use_commit_times,
4359 svn_cancel_func_t cancel_func,
4360 void *cancel_baton,
4361 svn_wc_notify_func2_t notify_func,
4362 void *notify_baton,
4363 apr_pool_t *pool);
4366 * Similar to svn_wc_revert2(), but takes an @c svn_wc_notify_func_t instead.
4368 * @deprecated Provided for backward compatibility with the 1.1 API.
4370 svn_error_t *
4371 svn_wc_revert(const char *path,
4372 svn_wc_adm_access_t *parent_access,
4373 svn_boolean_t recursive,
4374 svn_boolean_t use_commit_times,
4375 svn_cancel_func_t cancel_func,
4376 void *cancel_baton,
4377 svn_wc_notify_func_t notify_func,
4378 void *notify_baton,
4379 apr_pool_t *pool);
4382 /* Tmp files */
4384 /** Create a unique temporary file in administrative tmp/ area of
4385 * directory @a path. Return a handle in @a *fp and the path
4386 * in @a *new_name. Either @a fp or @a new_name can be NULL.
4388 * The flags will be <tt>APR_WRITE | APR_CREATE | APR_EXCL</tt> and
4389 * optionally @c APR_DELONCLOSE (if the @a delete_when argument is
4390 * set to @c svn_io_file_del_on_close).
4392 * This means that as soon as @a fp is closed, the tmp file will vanish.
4394 * @since New in 1.4
4396 svn_error_t *
4397 svn_wc_create_tmp_file2(apr_file_t **fp,
4398 const char **new_name,
4399 const char *path,
4400 svn_io_file_del_t delete_when,
4401 apr_pool_t *pool);
4404 /** Same as svn_wc_create_tmp_file2(), but with @a new_name set to @c NULL,
4405 * and without the ability to delete the file on pool cleanup.
4407 * @deprecated For compatibility with 1.3 API
4409 svn_error_t *
4410 svn_wc_create_tmp_file(apr_file_t **fp,
4411 const char *path,
4412 svn_boolean_t delete_on_close,
4413 apr_pool_t *pool);
4417 /* EOL conversion and keyword expansion. */
4419 /** Set @a xlated_path to a translated copy of @a src
4420 * or to @a src itself if no translation is necessary.
4421 * That is, if @a versioned_file's properties indicate newline conversion or
4422 * keyword expansion, point @a *xlated_path to a copy of @a src
4423 * whose newlines and keywords are converted using the translation
4424 * as requested by @a flags.
4426 * When translating to the normal form, inconsistent eol styles will be
4427 * repaired when appropriate for the given setting. When translating
4428 * from normal form, no EOL repair is performed (consistency is assumed).
4429 * This behaviour can be overridden by specifying
4430 * @c SVN_WC_TRANSLATE_FORCE_EOL_REPAIR.
4432 * The caller can explicitly request a new file to be returned by setting the
4433 * @c SVN_WC_TRANSLATE_FORCE_COPY flag in @a flags.
4435 * This function is generally used to get a file that can be compared
4436 * meaningfully against @a versioned_file's text base, if
4437 * @c SVN_WC_TRANSLATE_TO_NF is specified, against @a versioned_file itself
4438 * if @c SVN_WC_TRANSLATE_FROM_NF is specified.
4440 * Output files are created in the temp file area belonging to
4441 * @a versioned_file. By default they will be deleted at pool cleanup.
4443 * If @c SVN_WC_TRANSLATE_NO_OUTPUT_CLEANUP is specified, the default
4444 * pool cleanup handler to remove @a *xlated_path is not registered.
4446 * If an error is returned, the effect on @a *xlated_path is undefined.
4448 * @since New in 1.4
4450 svn_error_t *
4451 svn_wc_translated_file2(const char **xlated_path,
4452 const char *src,
4453 const char *versioned_file,
4454 svn_wc_adm_access_t *adm_access,
4455 apr_uint32_t flags,
4456 apr_pool_t *pool);
4459 /** Same as svn_wc_translated_file2, but will never clean up
4460 * temporary files.
4462 * @deprecated Provided for compatibility with the 1.3 API
4464 svn_error_t *
4465 svn_wc_translated_file(const char **xlated_p,
4466 const char *vfile,
4467 svn_wc_adm_access_t *adm_access,
4468 svn_boolean_t force_repair,
4469 apr_pool_t *pool);
4472 /** Returns a @a stream allocated in @a pool with access to the given
4473 * @a path taking the file properties from @a versioned_file using
4474 * @a adm_access.
4476 * When translation from normal form is requested
4477 * (@c SVN_WC_TRANSLATE_FROM_NF is specified in @a flags), @a path
4478 * is used as target path and stream read operations are not supported.
4479 * Conversely, if translation to normal form is requested
4480 * (@c SVN_WC_TRANSLATE_TO_NF is specified in @a flags), @a path is
4481 * used as source path and stream write operations are not supported.
4483 * The @a flags are the same constants as those used for
4484 * svn_wc_translated_file().
4486 * @since New in 1.5.
4488 svn_error_t *
4489 svn_wc_translated_stream(svn_stream_t **stream,
4490 const char *path,
4491 const char *versioned_file,
4492 svn_wc_adm_access_t *adm_access,
4493 apr_uint32_t flags,
4494 apr_pool_t *pool);
4497 /* Text/Prop Deltas Using an Editor */
4500 /** Send the local modifications for versioned file @a path (with
4501 * matching @a file_baton) through @a editor, then close @a file_baton
4502 * afterwards. Use @a pool for any temporary allocation and
4503 * @a adm_access as an access baton for @a path.
4505 * This process creates a copy of @a path with keywords and eol
4506 * untranslated. If @a tempfile is non-NULL, set @a *tempfile to the
4507 * path to this copy. Do not clean up the copy; caller can do that.
4508 * If @a digest is non-NULL, put the MD5 checksum of the
4509 * temporary file into @a digest, which must point to @c APR_MD5_DIGESTSIZE
4510 * bytes of storage. (The purpose of handing back the tmp copy is that
4511 * it is usually about to become the new text base anyway, but the
4512 * installation of the new text base is outside the scope of this
4513 * function.)
4515 * If @a fulltext, send the untranslated copy of @a path through @a editor
4516 * as full-text; else send it as svndiff against the current text base.
4518 * If sending a diff, and the recorded checksum for @a path's text-base
4519 * does not match the current actual checksum, then remove the tmp
4520 * copy (and set @a *tempfile to NULL if appropriate), and return the
4521 * error @c SVN_ERR_WC_CORRUPT_TEXT_BASE.
4523 * @note This is intended for use with both infix and postfix
4524 * text-delta styled editor drivers.
4526 * @since New in 1.4.
4528 svn_error_t *
4529 svn_wc_transmit_text_deltas2(const char **tempfile,
4530 unsigned char digest[],
4531 const char *path,
4532 svn_wc_adm_access_t *adm_access,
4533 svn_boolean_t fulltext,
4534 const svn_delta_editor_t *editor,
4535 void *file_baton,
4536 apr_pool_t *pool);
4538 /** Similar to svn_wc_transmit_text_deltas2(), but with @a digest set to NULL.
4540 * @deprecated Provided for backwards compatibility with the 1.3 API.
4542 svn_error_t *
4543 svn_wc_transmit_text_deltas(const char *path,
4544 svn_wc_adm_access_t *adm_access,
4545 svn_boolean_t fulltext,
4546 const svn_delta_editor_t *editor,
4547 void *file_baton,
4548 const char **tempfile,
4549 apr_pool_t *pool);
4552 /** Given a @a path with its accompanying @a entry, transmit all local
4553 * property modifications using the appropriate @a editor method (in
4554 * conjunction with @a baton). @a adm_access is an access baton set
4555 * that contains @a path. Use @a pool for all allocations.
4557 * If a temporary file remains after this function is finished, the
4558 * path to that file is returned in @a *tempfile (so the caller can
4559 * clean this up if it wishes to do so).
4561 * @note Starting version 1.5, no tempfile will ever be returned
4562 * anymore. If @a *tempfile is passed, its value is set to @c NULL.
4564 svn_error_t *
4565 svn_wc_transmit_prop_deltas(const char *path,
4566 svn_wc_adm_access_t *adm_access,
4567 const svn_wc_entry_t *entry,
4568 const svn_delta_editor_t *editor,
4569 void *baton,
4570 const char **tempfile,
4571 apr_pool_t *pool);
4574 /** Get the run-time configured list of ignore patterns from the
4575 * @c svn_config_t's in the @a config hash, and store them in @a *patterns.
4576 * Allocate @a *patterns and its contents in @a pool.
4578 svn_error_t *
4579 svn_wc_get_default_ignores(apr_array_header_t **patterns,
4580 apr_hash_t *config,
4581 apr_pool_t *pool);
4583 /** Get the list of ignore patterns from the @c svn_config_t's in the
4584 * @a config hash and the local ignore patterns from the directory
4585 * in @a adm_access, and store them in @a *patterns.
4586 * Allocate @a *patterns and its contents in @a pool.
4588 * @since New in 1.3.
4590 svn_error_t *
4591 svn_wc_get_ignores(apr_array_header_t **patterns,
4592 apr_hash_t *config,
4593 svn_wc_adm_access_t *adm_access,
4594 apr_pool_t *pool);
4596 /** Return TRUE iff @a str matches any of the elements of @a list, a
4597 * list of zero or more ignore patterns.
4599 * @since New in 1.5.
4601 svn_boolean_t
4602 svn_wc_match_ignore_list(const char *str,
4603 apr_array_header_t *list,
4604 apr_pool_t *pool);
4607 /** Add @a lock to the working copy for @a path. @a adm_access must contain
4608 * a write lock for @a path. If @a path is read-only, due to locking
4609 * properties, make it writable. Perform temporary allocations in @a
4610 * pool. */
4611 svn_error_t *
4612 svn_wc_add_lock(const char *path,
4613 const svn_lock_t *lock,
4614 svn_wc_adm_access_t *adm_access,
4615 apr_pool_t *pool);
4617 /** Remove any lock from @a path. @a adm_access must contain a
4618 * write-lock for @a path. If @a path has a lock and the locking
4619 * so specifies, make the file read-only. Don't return an error if @a
4620 * path didn't have a lock. Perform temporary allocations in @a pool. */
4621 svn_error_t *
4622 svn_wc_remove_lock(const char *path,
4623 svn_wc_adm_access_t *adm_access,
4624 apr_pool_t *pool);
4627 /** A structure to report a summary of a working copy, including the
4628 * mix of revisions found within it, whether any parts are switched or
4629 * locally modified, and whether it is a sparse checkout.
4631 * @note Fields may be added to the end of this structure in future
4632 * versions. Therefore, to preserve binary compatibility, users
4633 * should not directly allocate structures of this type.
4635 * @since New in 1.4
4637 typedef struct svn_wc_revision_status_t
4639 svn_revnum_t min_rev; /**< Lowest revision found */
4640 svn_revnum_t max_rev; /**< Highest revision found */
4642 svn_boolean_t switched; /**< Is anything switched? */
4643 svn_boolean_t modified; /**< Is anything modified? */
4645 /** Whether any WC paths are at a depth other than @c svn_depth_infinity.
4646 * @since New in 1.5.
4648 svn_boolean_t sparse_checkout;
4650 svn_wc_revision_status_t;
4652 /** Set @a *result_p to point to a new @c svn_wc_revision_status_t structure
4653 * containing a summary of the revision range and status of the working copy
4654 * at @a wc_path (not including "externals").
4656 * Set @a (*result_p)->min_rev and @a (*result_p)->max_rev respectively to the
4657 * lowest and highest revision numbers in the working copy. If @a committed
4658 * is TRUE, summarize the last-changed revisions, else the base revisions.
4660 * Set @a (*result_p)->switched to indicate whether any item in the WC is
4661 * switched relative to its parent. If @a trail_url is non-NULL, use it to
4662 * determine if @a wc_path itself is switched. It should be any trailing
4663 * portion of @a wc_path's expected URL, long enough to include any parts
4664 * that the caller considers might be changed by a switch. If it does not
4665 * match the end of @a wc_path's actual URL, then report a "switched"
4666 * status.
4668 * Set @a (*result_p)->modified to indicate whether any item is locally
4669 * modified.
4671 * If @a cancel_func is non-NULL, call it with @a cancel_baton to determine
4672 * if the client has cancelled the operation.
4674 * Allocate *result_p in @a pool.
4676 * @since New in 1.4
4678 svn_error_t *
4679 svn_wc_revision_status(svn_wc_revision_status_t **result_p,
4680 const char *wc_path,
4681 const char *trail_url,
4682 svn_boolean_t committed,
4683 svn_cancel_func_t cancel_func,
4684 void *cancel_baton,
4685 apr_pool_t *pool);
4689 * Set @a path's entry's 'changelist' attribute to @a changelist iff
4690 * @a changelist is not @c NULL; otherwise, remove any current
4691 * changelist assignment from @a path. @a adm_access is an access
4692 * baton set that contains @a path.
4694 * If @a cancel_func is not @c NULL, call it with @a cancel_baton to
4695 * determine if the client has cancelled the operation.
4697 * If @a notify_func is not @c NULL, call it with @a notify_baton to
4698 * report the change (using notification types @c
4699 * svn_wc_notify_changelist_set and @c svn_wc_notify_changelist_clear).
4701 * @note For now, directories are NOT allowed to be associated with
4702 * changelists; there is confusion about whether they should behave
4703 * as depth-0 or depth-infinity objects. If @a path is a directory,
4704 * return @c SVN_ERR_UNSUPPORTED_FEATURE.
4706 * @note This metadata is purely a client-side "bookkeeping"
4707 * convenience, and is entirely managed by the working copy.
4709 * @since New in 1.5.
4711 svn_error_t *
4712 svn_wc_set_changelist(const char *path,
4713 const char *changelist,
4714 svn_wc_adm_access_t *adm_access,
4715 svn_cancel_func_t cancel_func,
4716 void *cancel_baton,
4717 svn_wc_notify_func2_t notify_func,
4718 void *notify_baton,
4719 apr_pool_t *pool);
4721 /** @} */
4724 #ifdef __cplusplus
4726 #endif /* __cplusplus */
4728 #endif /* SVN_WC_H */