00001 /**
00002 * @copyright
00003 * ====================================================================
00004 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
00005 *
00006 * This software is licensed as described in the file COPYING, which
00007 * you should have received as part of this distribution. The terms
00008 * are also available at http://subversion.tigris.org/license-1.html.
00009 * If newer versions of this license are posted there, you may use a
00010 * newer version instead, at your option.
00011 *
00012 * This software consists of voluntary contributions made by many
00013 * individuals. For exact contribution history, see the revision
00014 * history and logs, available at http://subversion.tigris.org/.
00015 * ====================================================================
00016 * @endcopyright
00017 *
00018 * @file svn_wc.h
00019 * @brief public interface for the Subversion Working Copy Library
00020 *
00021 * Requires:
00022 * - A working copy
00023 *
00024 * Provides:
00025 * - Ability to manipulate working copy's versioned data.
00026 * - Ability to manipulate working copy's administrative files.
00027 *
00028 * Used By:
00029 * - Clients.
00030 */
00031
00032 #ifndef SVN_WC_H
00033 #define SVN_WC_H
00034
00035
00036 #include <apr.h>
00037 #include <apr_pools.h>
00038 #include <apr_tables.h>
00039 #include <apr_hash.h>
00040
00041 #include "svn_types.h"
00042 #include "svn_string.h"
00043 #include "svn_delta.h"
00044 #include "svn_error.h"
00045 #include "svn_opt.h"
00046 #include "svn_ra.h" /* for svn_ra_reporter_t type */
00047
00048 #ifdef __cplusplus
00049 extern "C" {
00050 #endif /* __cplusplus */
00051
00052
00053 /* Locking/Opening/Closing */
00054
00055 /** Baton for access to a working copy administrative area.
00056 *
00057 * One day all such access will require a baton, we're not there yet.
00058 *
00059 * Access batons can be grouped into sets, by passing an existing open
00060 * baton when opening a new baton. Given one baton in a set, other batons
00061 * may be retrieved. This allows an entire hierarchy to be locked, and
00062 * then the set of batons can be passed around by passing a single baton.
00063 */
00064 typedef struct svn_wc_adm_access_t svn_wc_adm_access_t;
00065
00066
00067 /** Return, in @a *adm_access, a pointer to a new access baton for the working
00068 * copy administrative area associated with the directory @a path. If
00069 * @a write_lock is true the baton will include a write lock, otherwise the
00070 * baton can only be used for read access. If @a path refers to a directory
00071 * that is already write locked then the error @c SVN_ERR_WC_LOCKED will be
00072 * returned. The error @c SVN_ERR_WC_NOT_DIRECTORY will be returned if
00073 * @a path is not a versioned directory.
00074 *
00075 * If @a associated is an open access baton then @a adm_access will be added
00076 * to the set containing @a associated. @a associated can be @c NULL, in
00077 * which case @a adm_access is the start of a new set.
00078 *
00079 * If @a tree_lock is @c TRUE then the working copy directory hierarchy under
00080 * @a path will be locked. All the access batons will become part of the set
00081 * containing @a adm_access. This is an all-or-nothing option, if it is not
00082 * possible to lock the entire tree then an error will be returned and
00083 * @a adm_access will be invalid, with the exception that subdirectories of
00084 * @a path that are missing from the physical filesystem will not be locked
00085 * and will not cause an error. The error @c SVN_ERR_WC_LOCKED will be
00086 * returned if a subdirectory of @a path is already write locked.
00087 *
00088 * @a pool will be used to allocate memory for the baton and any subsequently
00089 * cached items. If @a adm_access has not been closed when the pool is
00090 * cleared, it will be closed automatically at that point, and removed from
00091 * its set. A baton closed in this way will not remove physical locks from
00092 * the working copy if cleanup is required.
00093 *
00094 * The first baton in a set, with @a associated passed as @c NULL, must have
00095 * the longest lifetime of all the batons in the set. This implies it must be
00096 * the root of the hierarchy.
00097 */
00098 svn_error_t *svn_wc_adm_open (svn_wc_adm_access_t **adm_access,
00099 svn_wc_adm_access_t *associated,
00100 const char *path,
00101 svn_boolean_t write_lock,
00102 svn_boolean_t tree_lock,
00103 apr_pool_t *pool);
00104
00105 /** Checks the working copy to determine the node type of @a path. If
00106 * @a path is a versioned directory then the behaviour is like that of
00107 * @c svn_wc_adm_open, otherwise, if @a path is a file or does not
00108 * exist, then the behaviour is like that of @c svn_wc_adm_open with
00109 * @a path replaced by the parent directory of @a path. If @a path is
00110 * an unversioned directory, the behaviour is also like that of
00111 * @c svn_wc_adm_open on the parent, except that if the open fails,
00112 * then the returned SVN_ERR_WC_NOT_DIRECTORY error refers to @a path,
00113 * not to @a path's parent.
00114 */
00115 svn_error_t *svn_wc_adm_probe_open (svn_wc_adm_access_t **adm_access,
00116 svn_wc_adm_access_t *associated,
00117 const char *path,
00118 svn_boolean_t write_lock,
00119 svn_boolean_t tree_lock,
00120 apr_pool_t *pool);
00121
00122 /** Return, in @a *adm_access, a pointer to an existing access baton associated
00123 * with @a path. @a path must be a directory that is locked as part of the
00124 * set containing the @a associated access baton.
00125 *
00126 * If the requested access baton is marked as missing in, or is simply
00127 * absent from, @a associated, return SVN_ERR_WC_NOT_LOCKED.
00128 *
00129 * @a pool is used only for local processing, it is not used for the batons.
00130 */
00131 svn_error_t *svn_wc_adm_retrieve (svn_wc_adm_access_t **adm_access,
00132 svn_wc_adm_access_t *associated,
00133 const char *path,
00134 apr_pool_t *pool);
00135
00136 /** Checks the working copy to determine the node type of @a path. If
00137 * @a path is a versioned directory then the behaviour is like that of
00138 * @c svn_wc_adm_retrieve, otherwise, if @a path is a file, an unversioned
00139 * directory, or does not exist, then the behaviour is like that of
00140 * @c svn_wc_adm_retrieve with @a path replaced by the parent directory of
00141 * @a path.
00142 */
00143 svn_error_t *svn_wc_adm_probe_retrieve (svn_wc_adm_access_t **adm_access,
00144 svn_wc_adm_access_t *associated,
00145 const char *path,
00146 apr_pool_t *pool);
00147
00148 /** Try various ways to obtain an access baton for @a path.
00149 *
00150 * First, try to obtain @a *adm_access via @c svn_wc_adm_probe_retrieve(),
00151 * but if this fails because @a associated can't give a baton for
00152 * @a path or @a path's parent, then try @c svn_wc_adm_probe_open(),
00153 * this time passing @a write_lock and @a tree_lock. If there is
00154 * still no access because @a path is not a versioned directory, then
00155 * just set @a *adm_access to null and return success. But if it is
00156 * because @a path is locked, then return the error @c SVN_ERR_WC_LOCKED,
00157 * and the effect on @a *adm_access is undefined. (Or if the attempt
00158 * fails for any other reason, return the corresponding error, and the
00159 * effect on @a *adm_access is also undefined.)
00160 *
00161 * If @c svn_wc_adm_probe_open() succeeds, then add @a *adm_access to
00162 * @a associated.
00163 *
00164 * Use @a pool only for local processing, not to allocate @a *adm_access.
00165 */
00166 svn_error_t *svn_wc_adm_probe_try (svn_wc_adm_access_t **adm_access,
00167 svn_wc_adm_access_t *associated,
00168 const char *path,
00169 svn_boolean_t write_lock,
00170 svn_boolean_t tree_lock,
00171 apr_pool_t *pool);
00172
00173
00174 /** Give up the access baton @a adm_access, and its lock if any. This will
00175 * recursively close any batons in the same set that are direct
00176 * subdirectories of @a adm_access. Any physical locks will be removed from
00177 * the working copy. Lock removal is unconditional, there is no check to
00178 * determine if cleanup is required.
00179 */
00180 svn_error_t *svn_wc_adm_close (svn_wc_adm_access_t *adm_access);
00181
00182 /** Return the path used to open the access baton @a adm_access */
00183 const char *svn_wc_adm_access_path (svn_wc_adm_access_t *adm_access);
00184
00185 /** Return the pool used by access baton @a adm_access */
00186 apr_pool_t *svn_wc_adm_access_pool (svn_wc_adm_access_t *adm_access);
00187
00188 /** Return @c TRUE is the access baton @a adm_access has a write lock,
00189 * @c FALSE otherwise. Compared to @c svn_wc_locked this is a cheap, fast
00190 * function that doesn't access the filesystem.
00191 */
00192 svn_boolean_t svn_wc_adm_locked(svn_wc_adm_access_t *adm_access);
00193
00194 /** Set @a *locked to non-zero if @a path is locked, else set it to zero. */
00195 svn_error_t *svn_wc_locked (svn_boolean_t *locked,
00196 const char *path,
00197 apr_pool_t *pool);
00198
00199
00200
00201 /** Traversal information is information gathered by a working copy
00202 * crawl or update. For example, the before and after values of the
00203 * svn:externals property are important after an update, and since
00204 * we're traversing the working tree anyway (a complete traversal
00205 * during the initial crawl, and a traversal of changed paths during
00206 * the checkout/update/switch), it makes sense to gather the
00207 * property's values then instead of making a second pass.
00208 */
00209 typedef struct svn_wc_traversal_info_t svn_wc_traversal_info_t;
00210
00211
00212 /** Return a new, empty traversal info object, allocated in @a pool. */
00213 svn_wc_traversal_info_t *svn_wc_init_traversal_info (apr_pool_t *pool);
00214
00215
00216 /** Set @a *externals_old and @a *externals_new to hash tables representing
00217 * changes to values of the svn:externals property on directories
00218 * traversed by @a traversal_info.
00219 *
00220 * @a traversal_info is obtained from @c svn_wc_init_traversal_info, but is
00221 * only useful after it has been passed through another function, such
00222 * as @c svn_wc_crawl_revisions, @c svn_wc_get_update_editor,
00223 * @c svn_wc_get_checkout_editor, @c svn_wc_get_switch_editor, etc.
00224 *
00225 * Each hash maps <tt>const char *</tt> directory names onto
00226 * <tt>const char *</tt> values of the externals property for that directory.
00227 * The dir names are full paths -- that is, anchor plus target, not target
00228 * alone. The values are not parsed, they are simply copied raw, and are
00229 * never null: directories that acquired or lost the property are
00230 * simply omitted from the appropriate table. Directories whose value
00231 * of the property did not change show the same value in each hash.
00232 *
00233 * The hashes, keys, and values have the same lifetime as @a traversal_info.
00234 */
00235 void svn_wc_edited_externals (apr_hash_t **externals_old,
00236 apr_hash_t **externals_new,
00237 svn_wc_traversal_info_t *traversal_info);
00238
00239
00240 /** One external item. This usually represents one line from an
00241 * svn:externals description but with the path and URL
00242 * canonicalized.
00243 */
00244 typedef struct svn_wc_external_item_t
00245 {
00246 /** The name of the subdirectory into which this external should be
00247 checked out. This is relative to the parent directory that
00248 holds this external item. (Note that these structs are often
00249 stored in hash tables with the target dirs as keys, so this
00250 field will often be redundant.) */
00251 const char *target_dir;
00252
00253 /** Where to check out from. */
00254 const char *url;
00255
00256 /** What revision to check out. The only valid kinds for this are
00257 svn_opt_revision_number, svn_opt_revision_date, and
00258 svn_opt_revision_head. */
00259 svn_opt_revision_t revision;
00260
00261 } svn_wc_external_item_t;
00262
00263
00264 /** If @a externals_p is non-null, set @a *externals_p to a hash table
00265 * whose keys are subdirectory names and values are @a
00266 * svn_wc_external_item_t * objects, based on @a desc.
00267 *
00268 * If the format of @a desc is invalid, don't touch @a *externals_p and
00269 * return @c SVN_ERR_CLIENT_INVALID_EXTERNALS_DESCRIPTION. Thus, if
00270 * you just want to check the validity of an externals description,
00271 * and don't care about the parsed result, pass null for @a externals_p.
00272 *
00273 * The format of @a desc is the same as for values of the directory
00274 * property @c SVN_PROP_EXTERNALS, which see.
00275 *
00276 * Allocate the table, keys, and values in @a pool.
00277 *
00278 * Use @a parent_directory only in constructing error strings.
00279 */
00280 svn_error_t *svn_wc_parse_externals_description (apr_hash_t **externals_p,
00281 const char *parent_directory,
00282 const char *desc,
00283 apr_pool_t *pool);
00284
00285
00286
00287 /* Notification/callback handling. */
00288
00289 /**
00290 * @defgroup svn_wc_notifications notification callback handling
00291 * @{
00292 *
00293 * In many cases, the WC library will scan a working copy and make
00294 * changes. The caller usually wants to know when each of these changes
00295 * has been made, so that it can display some kind of notification to
00296 * the user.
00297 *
00298 * These notifications have a standard callback function type, which
00299 * takes the path of the file that was affected, and a caller-
00300 * supplied baton.
00301 *
00302 * Note that the callback is a 'void' return -- this is a simple
00303 * reporting mechanism, rather than an opportunity for the caller to
00304 * alter the operation of the WC library.
00305 *
00306 * Note also that some of the actions are used across several
00307 * different Subversion commands. For example, the update actions are
00308 * also used for checkouts, switches, and merges.
00309 */
00310
00311 /** The type of action occurring. */
00312 typedef enum svn_wc_notify_action_t
00313 {
00314 /** Adding a path to revision control. */
00315 svn_wc_notify_add = 0,
00316
00317 /** Copying a versioned path. */
00318 svn_wc_notify_copy,
00319
00320 /** Deleting a versioned path. */
00321 svn_wc_notify_delete,
00322
00323 /** Restoring a missing path from the pristine text-base. */
00324 svn_wc_notify_restore,
00325
00326 /** Reverting a modified path. */
00327 svn_wc_notify_revert,
00328
00329 /** A revert operation has failed. */
00330 svn_wc_notify_failed_revert,
00331
00332 /** Resolving a conflict. */
00333 svn_wc_notify_resolved,
00334
00335 /** Skipping a path. */
00336 svn_wc_notify_skip,
00337
00338 /** Got a delete in an update. */
00339 svn_wc_notify_update_delete,
00340
00341 /** Got an add in an update. */
00342 svn_wc_notify_update_add,
00343
00344 /** Got any other action in an update. */
00345 svn_wc_notify_update_update,
00346
00347 /** The last notification in an update (including updates of externals). */
00348 svn_wc_notify_update_completed,
00349
00350 /** Updating an external module. */
00351 svn_wc_notify_update_external,
00352
00353 /** The last notification in a status (including status on externals). */
00354 svn_wc_notify_status_completed,
00355
00356 /** Running status on an external module. */
00357 svn_wc_notify_status_external,
00358
00359 /** Committing a modification. */
00360 svn_wc_notify_commit_modified,
00361
00362 /** Committing an addition. */
00363 svn_wc_notify_commit_added,
00364
00365 /** Committing a deletion. */
00366 svn_wc_notify_commit_deleted,
00367
00368 /** Committing a replacement. */
00369 svn_wc_notify_commit_replaced,
00370
00371 /** Transmitting post-fix text-delta data for a file. */
00372 svn_wc_notify_commit_postfix_txdelta,
00373
00374 /** Processed a single revision's blame. */
00375 svn_wc_notify_blame_revision
00376 } svn_wc_notify_action_t;
00377
00378
00379 /** The type of notification that is occurring. */
00380 typedef enum svn_wc_notify_state_t
00381 {
00382 svn_wc_notify_state_inapplicable = 0,
00383
00384 /** Notifier doesn't know or isn't saying. */
00385 svn_wc_notify_state_unknown,
00386
00387 /** The state did not change. */
00388 svn_wc_notify_state_unchanged,
00389
00390 /** The item wasn't present. */
00391 svn_wc_notify_state_missing,
00392
00393 /** An unversioned item obstructed work. */
00394 svn_wc_notify_state_obstructed,
00395
00396 /** Pristine state was modified. */
00397 svn_wc_notify_state_changed,
00398
00399 /** Modified state had mods merged in. */
00400 svn_wc_notify_state_merged,
00401
00402 /** Modified state got conflicting mods. */
00403 svn_wc_notify_state_conflicted
00404
00405 } svn_wc_notify_state_t;
00406
00407
00408 /** Notify the world that @a action has happened to @a path. @a path is
00409 * either absolute or relative to cwd (i.e., not relative to an anchor).
00410 *
00411 * @a kind, @a content_state and @a prop_state are from after @a action,
00412 * not before.
00413 *
00414 * If @a mime_type is non-null, it indicates the mime-type of @a path. It
00415 * is always @c NULL for directories.
00416 *
00417 * @a revision is @c SVN_INVALID_REVNUM, except when @a action is
00418 * @c svn_wc_notify_update_completed, in which case @a revision is
00419 * the target revision of the update if available, else it is still
00420 * @c SVN_INVALID_REVNUM.
00421 *
00422 * Note that if @a action is @c svn_wc_notify_update, then @a path has
00423 * already been installed, so it is legitimate for an implementation of
00424 * @c svn_wc_notify_func_t to examine @a path in the working copy.
00425 *
00426 * ### Design Notes:
00427 *
00428 * The purpose of the @a kind, @a mime_type, @a content_state, and
00429 * @a prop_state fields is to provide "for free" information that this
00430 * function is likely to want, and which it would otherwise be forced
00431 * to deduce via expensive operations such as reading entries and
00432 * properties. However, if the caller does not have this information,
00433 * it will simply pass the corresponding `*_unknown' values, and it is
00434 * up to the implementation how to handle that (i.e., whether or not to
00435 * attempt deduction, or just to punt and give a less informative
00436 * notification).
00437 *
00438 * Recommendation: callers of @c svn_wc_notify_func_t should avoid
00439 * invoking it multiple times on the same @a path within a given
00440 * operation, and implementations should not bother checking for such
00441 * duplicate calls. For example, in an update, the caller should not
00442 * invoke the notify func on receiving a prop change and then again
00443 * on receiving a text change. Instead, wait until all changes have
00444 * been received, and then invoke the notify func once (from within
00445 * an @c svn_delta_editor_t's @c close_file(), for example), passing
00446 * the appropriate @a content_state and @a prop_state flags.
00447 */
00448 typedef void (*svn_wc_notify_func_t) (void *baton,
00449 const char *path,
00450 svn_wc_notify_action_t action,
00451 svn_node_kind_t kind,
00452 const char *mime_type,
00453 svn_wc_notify_state_t content_state,
00454 svn_wc_notify_state_t prop_state,
00455 svn_revnum_t revision);
00456
00457 /** @} */
00458
00459
00460
00461 /** A callback vtable invoked by our diff-editors, as they receive
00462 * diffs from the server. 'svn diff' and 'svn merge' both implement
00463 * their own versions of this table.
00464 */
00465 typedef struct svn_wc_diff_callbacks_t
00466 {
00467 /** A file @a path has changed. The changes can be seen by comparing
00468 * @a tmpfile1 and @a tmpfile2, which represent @a rev1 and @a rev2 of
00469 * the file, respectively.
00470 *
00471 * If known, the @c svn:mime-type value of each file is passed into
00472 * @a mimetype1 and @a mimetype2; either or both of the values can
00473 * be NULL. The implementor can use this information to decide if
00474 * (or how) to generate differences.
00475 *
00476 * @a adm_access will be an access baton for the directory containing
00477 * @a path, or @c NULL if the diff editor is not using access batons.
00478 *
00479 * If @a state is non-null, set @a *state to the state of the file
00480 * contents after the operation has been performed. (In practice,
00481 * this is only useful with merge, not diff; diff callbacks will
00482 * probably set @a *state to @c svn_wc_notify_state_unknown, since
00483 * they do not change the state and therefore do not bother to know
00484 * the state after the operation.)
00485 */
00486 svn_error_t *(*file_changed) (svn_wc_adm_access_t *adm_access,
00487 svn_wc_notify_state_t *state,
00488 const char *path,
00489 const char *tmpfile1,
00490 const char *tmpfile2,
00491 svn_revnum_t rev1,
00492 svn_revnum_t rev2,
00493 const char *mimetype1,
00494 const char *mimetype2,
00495 void *diff_baton);
00496
00497 /** A file @a path was added. The contents can be seen by comparing
00498 * @a tmpfile1 and @a tmpfile2, which represent @a rev1 and @a rev2
00499 * of the file, respectively. (If either file is empty, the rev
00500 * will be 0.)
00501 *
00502 * If known, the @c svn:mime-type value of each file is passed into
00503 * @a mimetype1 and @a mimetype2; either or both of the values can
00504 * be NULL. The implementor can use this information to decide if
00505 * (or how) to generate differences.
00506 *
00507 * @a adm_access will be an access baton for the directory containing
00508 * @a path, or @c NULL if the diff editor is not using access batons.
00509 *
00510 * If @a state is non-null, set @a *state to the state of the file
00511 * contents after the operation has been performed. (In practice,
00512 * this is only useful with merge, not diff; diff callbacks will
00513 * probably set @a *state to @c svn_wc_notify_state_unknown, since
00514 * they do not change the state and therefore do not bother to know
00515 * the state after the operation.)
00516 *
00517 */
00518 svn_error_t *(*file_added) (svn_wc_adm_access_t *adm_access,
00519 svn_wc_notify_state_t *state,
00520 const char *path,
00521 const char *tmpfile1,
00522 const char *tmpfile2,
00523 svn_revnum_t rev1,
00524 svn_revnum_t rev2,
00525 const char *mimetype1,
00526 const char *mimetype2,
00527 void *diff_baton);
00528
00529 /** A file @a path was deleted. The [loss of] contents can be seen by
00530 * comparing @a tmpfile1 and @a tmpfile2.
00531 *
00532 * If known, the @c svn:mime-type value of each file is passed into
00533 * @a mimetype1 and @a mimetype2; either or both of the values can
00534 * be NULL. The implementor can use this information to decide if
00535 * (or how) to generate differences.
00536 *
00537 * @a adm_access will be an access baton for the directory containing
00538 * @a path, or @c NULL if the diff editor is not using access batons.
00539 *
00540 * If @a state is non-null, set @a *state to the state of the item
00541 * after the delete operation has been performed. (In practice,
00542 * this is only useful with merge, not diff; diff callbacks will
00543 * probably set @a *state to @c svn_wc_notify_state_unknown, since
00544 * they do not change the state and therefore do not bother to know
00545 * the state after the operation.)
00546 */
00547 svn_error_t *(*file_deleted) (svn_wc_adm_access_t *adm_access,
00548 svn_wc_notify_state_t *state,
00549 const char *path,
00550 const char *tmpfile1,
00551 const char *tmpfile2,
00552 const char *mimetype1,
00553 const char *mimetype2,
00554 void *diff_baton);
00555
00556 /** A directory @a path was added. @a rev is the revision that the
00557 * directory came from.
00558 *
00559 * @a adm_access will be an access baton for the directory containing
00560 * @a path, or @c NULL if the diff editor is not using access batons.
00561 */
00562 svn_error_t *(*dir_added) (svn_wc_adm_access_t *adm_access,
00563 svn_wc_notify_state_t *state,
00564 const char *path,
00565 svn_revnum_t rev,
00566 void *diff_baton);
00567
00568 /** A directory @a path was deleted.
00569 *
00570 * @a adm_access will be an access baton for the directory containing
00571 * @a path, or @c NULL if the diff editor is not using access batons.
00572 *
00573 * If @a state is non-null, set @a *state to the state of the item
00574 * after the delete operation has been performed. (In practice,
00575 * this is only useful with merge, not diff; diff callbacks will
00576 * probably set @a *state to @c svn_wc_notify_state_unknown, since
00577 * they do not change the state and therefore do not bother to know
00578 * the state after the operation.)
00579 */
00580 svn_error_t *(*dir_deleted) (svn_wc_adm_access_t *adm_access,
00581 svn_wc_notify_state_t *state,
00582 const char *path,
00583 void *diff_baton);
00584
00585 /** A list of property changes (@a propchanges) was applied to @a path.
00586 *
00587 * The array is a list of (@c svn_prop_t) structures.
00588 *
00589 * The original list of properties is provided in @a original_props,
00590 * which is a hash of @c svn_string_t values, keyed on the property
00591 * name.
00592 *
00593 * @a adm_access will be an access baton for the directory containing
00594 * @a path, or @c NULL if the diff editor is not using access batons.
00595 *
00596 * If @a state is non-null, set @a *state to the state of the properties
00597 * after the operation has been performed. (In practice, this is only
00598 * useful with merge, not diff; diff callbacks will probably set @a *state
00599 * to @c svn_wc_notify_state_unknown, since they do not change the state
00600 * and therefore do not bother to know the state after the operation.)
00601 */
00602 svn_error_t *(*props_changed) (svn_wc_adm_access_t *adm_access,
00603 svn_wc_notify_state_t *state,
00604 const char *path,
00605 const apr_array_header_t *propchanges,
00606 apr_hash_t *original_props,
00607 void *diff_baton);
00608
00609 } svn_wc_diff_callbacks_t;
00610
00611
00612 /* Asking questions about a working copy. */
00613
00614 /** Set @a *wc_format to @a path's working copy format version number if
00615 * @a path is a valid working copy directory, else set it to 0.
00616 * Return error @c APR_ENOENT if @a path does not exist at all.
00617 */
00618 svn_error_t *svn_wc_check_wc (const char *path,
00619 int *wc_format,
00620 apr_pool_t *pool);
00621
00622
00623 /** Set @a *has_binary_prop to @c TRUE iff @a path has been marked
00624 * with a property indicating that it is non-text (in other words, binary).
00625 * @a adm_access is an access baton set that contains @path.
00626 */
00627 svn_error_t *svn_wc_has_binary_prop (svn_boolean_t *has_binary_prop,
00628 const char *path,
00629 svn_wc_adm_access_t *adm_access,
00630 apr_pool_t *pool);
00631
00632
00633 /* Detecting modification. */
00634
00635 /** Set @a *modified_p to non-zero if @a filename's text is modified
00636 * with regard to the base revision, else set @a *modified_p to zero.
00637 * @a filename is a path to the file, not just a basename. @a adm_access
00638 * must be an access baton for @a filename.
00639 *
00640 * If @a force_comparison is @c TRUE, this function will not allow
00641 * early return mechanisms that avoid actual content comparison.
00642 *
00643 * If @a filename does not exist, consider it unmodified. If it exists
00644 * but is not under revision control (not even scheduled for
00645 * addition), return the error @c SVN_ERR_ENTRY_NOT_FOUND. */
00646 svn_error_t *svn_wc_text_modified_p (svn_boolean_t *modified_p,
00647 const char *filename,
00648 svn_boolean_t force_comparison,
00649 svn_wc_adm_access_t *adm_access,
00650 apr_pool_t *pool);
00651
00652
00653 /** Set @a *modified_p to non-zero if @a path's properties are modified
00654 * with regard to the base revision, else set @a modified_p to zero.
00655 * @a adm_access must be an access baton for @a path.
00656 */
00657 svn_error_t *svn_wc_props_modified_p (svn_boolean_t *modified_p,
00658 const char *path,
00659 svn_wc_adm_access_t *adm_access,
00660 apr_pool_t *pool);
00661
00662
00663
00664
00665 /** Administrative subdir.
00666 *
00667 * Ideally, this would be completely private to wc internals (in fact,
00668 * it used to be that @c adm_subdir() in adm_files.c was the only function
00669 * who knew the adm subdir's name). However, import wants to protect
00670 * against importing administrative subdirs, so now the name is a
00671 * matter of public record.
00672 */
00673 #define SVN_WC_ADM_DIR_NAME ".svn"
00674
00675
00676
00677 /* Entries and status. */
00678
00679 /** The schedule states an entry can be in. */
00680 typedef enum svn_wc_schedule_t
00681 {
00682 /** Nothing special here */
00683 svn_wc_schedule_normal,
00684
00685 /** Slated for addition */
00686 svn_wc_schedule_add,
00687
00688 /** Slated for deletion */
00689 svn_wc_schedule_delete,
00690
00691 /** Slated for replacement (delete + add) */
00692 svn_wc_schedule_replace
00693
00694 } svn_wc_schedule_t;
00695
00696
00697 /** A working copy entry -- that is, revision control information about
00698 * one versioned entity.
00699 */
00700 typedef struct svn_wc_entry_t
00701 {
00702 /* IMPORTANT: If you extend this structure, check svn_wc_entry_dup to see
00703 if you need to extend that as well. */
00704
00705 /* General Attributes */
00706
00707 /** entry's name */
00708 const char *name;
00709
00710 /** base revision */
00711 svn_revnum_t revision;
00712
00713 /** url in repository */
00714 const char *url;
00715
00716 /** canonical repository URL */
00717 const char *repos;
00718
00719 /** repository uuid */
00720 const char *uuid;
00721
00722 /** node kind (file, dir, ...) */
00723 svn_node_kind_t kind;
00724
00725 /* State information */
00726
00727 /** scheduling (add, delete, replace ...) */
00728 svn_wc_schedule_t schedule;
00729
00730 /** in a copied state */
00731 svn_boolean_t copied;
00732
00733 /** deleted, but parent rev lags behind */
00734 svn_boolean_t deleted;
00735
00736 /** absent -- we know an entry of this name exists, but that's all
00737 (usually this happens because of authz restrictions) */
00738 svn_boolean_t absent;
00739
00740 /** for THIS_DIR entry, implies whole entries file is incomplete */
00741 svn_boolean_t incomplete;
00742
00743 /** copyfrom location */
00744 const char *copyfrom_url;
00745
00746 /** copyfrom revision */
00747 svn_revnum_t copyfrom_rev;
00748
00749 /** old version of conflicted file */
00750 const char *conflict_old;
00751
00752 /** new version of conflicted file */
00753 const char *conflict_new;
00754
00755 /** working version of conflicted file */
00756 const char *conflict_wrk;
00757
00758 /** property reject file */
00759 const char *prejfile;
00760
00761 /** last up-to-date time for text contents (0 means no information available)
00762 */
00763 apr_time_t text_time;
00764
00765 /** last up-to-date time for properties (0 means no information available) */
00766 apr_time_t prop_time;
00767
00768 /** base64-encoded checksum for the untranslated text base file,
00769 * can be @c NULL for backwards compatibility.
00770 */
00771 const char *checksum;
00772
00773 /* "Entry props" */
00774
00775 /** last revision this was changed */
00776 svn_revnum_t cmt_rev;
00777
00778 /** last date this was changed */
00779 apr_time_t cmt_date;
00780
00781 /** last commit author of this item */
00782 const char *cmt_author;
00783
00784 /* IMPORTANT: If you extend this structure, check svn_wc_entry_dup to see
00785 if you need to extend that as well. */
00786 } svn_wc_entry_t;
00787
00788
00789 /** How an entries file's owner dir is named in the entries file. */
00790 #define SVN_WC_ENTRY_THIS_DIR ""
00791
00792
00793 /** Set @a *entry to an entry for @a path, allocated in the access baton
00794 * pool. If @a show_hidden is true, return the entry even if it's in
00795 * 'deleted' or 'absent' state. If @a path is not under revision
00796 * control, or if entry is hidden, not scheduled for re-addition,
00797 * and @a show_hidden is @c FALSE, then set @a *entry to @c NULL.
00798 *
00799 * @a *entry should not be modified, since doing so modifies the entries
00800 * cache in @a adm_access without changing the entries file on disk.
00801 *
00802 * If @a path is not a directory then @a adm_access must be an access baton
00803 * for the parent directory of @a path. To avoid needing to know whether
00804 * @a path is a directory or not, if @a path is a directory @a adm_access
00805 * can still be an access baton for the parent of @a path so long as the
00806 * access baton for @a path itself is in the same access baton set.
00807 *
00808 * Note that it is possible for @a path to be absent from disk but still
00809 * under revision control; and conversely, it is possible for @a path to
00810 * be present, but not under revision control.
00811 *
00812 * Use @a pool only for local processing.
00813 */
00814 svn_error_t *svn_wc_entry (const svn_wc_entry_t **entry,
00815 const char *path,
00816 svn_wc_adm_access_t *adm_access,
00817 svn_boolean_t show_hidden,
00818 apr_pool_t *pool);
00819
00820
00821 /** Parse the `entries' file for @a adm_access and return a hash @a entries,
00822 * whose keys are (<tt>const char *</tt>) entry names and values are
00823 * (<tt>svn_wc_entry_t *</tt>). Allocate @a entries, and its keys and
00824 * values, in @a pool.
00825 *
00826 * Entries that are in a 'deleted' or 'absent' state (and not
00827 * scheduled for re-addition) are not returned in the hash, unless
00828 * @a show_hidden is true.
00829 *
00830 * Important note: the @a entries hash is the entries cache in @a adm_access
00831 * and so usually the hash itself, the keys and the values should be treated
00832 * as read-only. If any of these are modified then it is the caller's
00833 * responsibility to ensure that the entries file on disk is updated. Treat
00834 * the hash values as type (<tt>const svn_wc_entry_t *</tt>) if you wish to
00835 * avoid accidental modification. Modifying the schedule member is a
00836 * particularly bad idea, as the entries writing process relies on having
00837 * access to the original schedule. Use a duplicate entry to modify the
00838 * schedule.
00839 *
00840 * Important note: only the entry structures representing files and
00841 * @c SVN_WC_ENTRY_THIS_DIR contain complete information. The entry
00842 * structures representing subdirs have only the `kind' and `state'
00843 * fields filled in. If you want info on a subdir, you must use this
00844 * routine to open its @a path and read the @c SVN_WC_ENTRY_THIS_DIR
00845 * structure, or call @c svn_wc_entry on its @a path.
00846 */
00847 svn_error_t *svn_wc_entries_read (apr_hash_t **entries,
00848 svn_wc_adm_access_t *adm_access,
00849 svn_boolean_t show_hidden,
00850 apr_pool_t *pool);
00851
00852
00853 /** Return a duplicate of @a entry, allocated in @a pool. No part of the new
00854 * entry will be shared with @a entry.
00855 */
00856 svn_wc_entry_t *svn_wc_entry_dup (const svn_wc_entry_t *entry,
00857 apr_pool_t *pool);
00858
00859
00860 /** Given a @a dir_path under version control, decide if one of its
00861 * entries (@a entry) is in state of conflict; return the answers in
00862 * @a text_conflicted_p and @a prop_conflicted_p.
00863 *
00864 * (If the entry mentions that a .rej or .prej exist, but they are
00865 * both removed, assume the conflict has been resolved by the user.)
00866 */
00867 svn_error_t *svn_wc_conflicted_p (svn_boolean_t *text_conflicted_p,
00868 svn_boolean_t *prop_conflicted_p,
00869 const char *dir_path,
00870 const svn_wc_entry_t *entry,
00871 apr_pool_t *pool);
00872
00873 /** Set @a *url and @a *rev to the ancestor URL and revision for @a path,
00874 * allocating in @a pool. @a adm_access must be an access baton for @a path.
00875 *
00876 * If @a url or @a rev is null, then ignore it (just don't return the
00877 * corresponding information).
00878 */
00879 svn_error_t *svn_wc_get_ancestry (char **url,
00880 svn_revnum_t *rev,
00881 const char *path,
00882 svn_wc_adm_access_t *adm_access,
00883 apr_pool_t *pool);
00884
00885
00886 /** A callback vtable invoked by the generic entry-walker function. */
00887 typedef struct svn_wc_entry_callbacks_t
00888 {
00889 /** An @a entry was found at @a path. */
00890 svn_error_t *(*found_entry) (const char *path,
00891 const svn_wc_entry_t *entry,
00892 void *walk_baton,
00893 apr_pool_t *pool);
00894
00895 /* ### add more callbacks as new callers need them. */
00896
00897 } svn_wc_entry_callbacks_t;
00898
00899
00900 /** A generic entry-walker.
00901 *
00902 * Do a recursive depth-first entry-walk beginning on @a path, which can
00903 * be a file or dir. Call callbacks in @a walk_callbacks, passing
00904 * @a walk_baton to each. Use @a pool for looping, recursion, and to
00905 * allocate all entries returned. @a adm_access must be an access baton
00906 * for @a path.
00907 *
00908 * Like our other entries interfaces, entries that are in a 'deleted'
00909 * or 'absent' state (and not scheduled for re-addition) are not
00910 * discovered, unless @a show_hidden is true.
00911 *
00912 * When a new directory is entered, @c SVN_WC_ENTRY_THIS_DIR will always
00913 * be returned first.
00914 *
00915 * Note: callers should be aware that each directory will be
00916 * returned *twice*: first as an entry within its parent, and
00917 * subsequently as the '.' entry within itself. The two calls can be
00918 * distinguished by looking for @c SVN_WC_ENTRY_THIS_DIR in the 'name'
00919 * field of the entry.
00920 */
00921 svn_error_t *svn_wc_walk_entries (const char *path,
00922 svn_wc_adm_access_t *adm_access,
00923 const svn_wc_entry_callbacks_t
00924 *walk_callbacks,
00925 void *walk_baton,
00926 svn_boolean_t show_hidden,
00927 apr_pool_t *pool);
00928
00929
00930 /** Mark missing @a path as 'deleted' in its @a parent's list of entries.
00931 *
00932 * Return @c SVN_ERR_WC_PATH_FOUND if @a path isn't actually missing.
00933 */
00934 svn_error_t *svn_wc_mark_missing_deleted (const char *path,
00935 svn_wc_adm_access_t *parent,
00936 apr_pool_t *pool);
00937
00938
00939
00940 /** Ensure that an administrative area exists for @a path, so that @a
00941 * path is a working copy subdir based on @a url at @a revision, and
00942 * with repository UUID @a uuid.
00943 *
00944 * If the administrative area does not exist then it will be created and
00945 * initialized to an unlocked state.
00946 *
00947 * If the administrative area already exists then the given @a url
00948 * must match the URL in the administrative area or an error will be
00949 * returned. The given @a revision must also match except for the
00950 * special case of adding a directory that has a name matching one
00951 * scheduled for deletion, in which case @a revision must be zero.
00952 *
00953 * @a uuid may be @c NULL.
00954
00955 * Do not ensure existence of @a path itself; if @a path does not
00956 * exist, return error.
00957 */
00958 svn_error_t *svn_wc_ensure_adm (const char *path,
00959 const char *uuid,
00960 const char *url,
00961 svn_revnum_t revision,
00962 apr_pool_t *pool);
00963
00964
00965
00966 /**
00967 * @defgroup svn_wc_status working copy status.
00968 * @{
00969 *
00970 * We have two functions for getting working copy status: one function
00971 * for getting the status of exactly one thing, and another for
00972 * getting the statuses of (potentially) multiple things.
00973 *
00974 * The WebDAV concept of "depth" may be useful in understanding the
00975 * motivation behind this. Suppose we're getting the status of
00976 * directory D. The three depth levels would mean
00977 *
00978 * depth 0: D itself (just the named directory)
00979 * depth 1: D and its immediate children (D + its entries)
00980 * depth Infinity: D and all its descendants (full recursion)
00981 *
00982 * To offer all three levels, we could have one unified function,
00983 * taking a `depth' parameter. Unfortunately, because this function
00984 * would have to handle multiple return values as well as the single
00985 * return value case, getting the status of just one entity would
00986 * become cumbersome: you'd have to roll through a hash to find one
00987 * lone status.
00988 *
00989 * So we have @c svn_wc_status() for depth 0, and @c svn_wc_statuses() for
00990 * depths 1 and 2, since the latter two involve multiple return
00991 * values.
00992 *
00993 * NOTE: Status structures returned by @c svn_wc_status() or found in
00994 * the hash created by @c svn_wc_statuses() may contain a @c NULL ->entry
00995 * field. This indicates an item that is not versioned in the working
00996 * copy.
00997 */
00998
00999 enum svn_wc_status_kind
01000 {
01001 /** does not exist */
01002 svn_wc_status_none = 1,
01003
01004 /** is not a versioned thing in this wc */
01005 svn_wc_status_unversioned,
01006
01007 /** exists, but uninteresting. */
01008 svn_wc_status_normal,
01009
01010 /** is scheduled for addition */
01011 svn_wc_status_added,
01012
01013 /** under v.c., but is missing */
01014 svn_wc_status_missing,
01015
01016 /** scheduled for deletion */
01017 svn_wc_status_deleted,
01018
01019 /** was deleted and then re-added */
01020 svn_wc_status_replaced,
01021
01022 /** text or props have been modified */
01023 svn_wc_status_modified,
01024
01025 /** local mods received repos mods */
01026 svn_wc_status_merged,
01027
01028 /** local mods received conflicting repos mods */
01029 svn_wc_status_conflicted,
01030
01031 /** a resource marked as ignored */
01032 svn_wc_status_ignored,
01033
01034 /** an unversioned resource is in the way of the versioned resource */
01035 svn_wc_status_obstructed,
01036
01037 /** an unversioned path populated by an svn:external property */
01038 svn_wc_status_external,
01039
01040 /** a directory doesn't contain a complete entries list */
01041 svn_wc_status_incomplete
01042 };
01043
01044 /** Structure for holding the "status" of a working copy item.
01045 *
01046 * The item's entry data is in @a entry, augmented and possibly shadowed
01047 * by the other fields. @a entry is @c NULL if this item is not under
01048 * version control.
01049 */
01050 typedef struct svn_wc_status_t
01051 {
01052 /** Can be @c NULL if not under version control. */
01053 svn_wc_entry_t *entry;
01054
01055 /** The status of the entries text. */
01056 enum svn_wc_status_kind text_status;
01057
01058 /** The status of the entries properties. */
01059 enum svn_wc_status_kind prop_status;
01060
01061 /** a directory can be 'locked' if a working copy update was interrupted. */
01062 svn_boolean_t locked;
01063
01064 /** a file or directory can be 'copied' if it's scheduled for
01065 * addition-with-history (or part of a subtree that is scheduled as such.).
01066 */
01067 svn_boolean_t copied;
01068
01069 /** a file or directory can be 'switched' if the switch command has been
01070 * used.
01071 */
01072 svn_boolean_t switched;
01073
01074 /** The entry's text status in the repository. */
01075 enum svn_wc_status_kind repos_text_status;
01076
01077 /** The entry's property status in the repository. */
01078 enum svn_wc_status_kind repos_prop_status;
01079
01080 } svn_wc_status_t;
01081
01082
01083 /** Return a deep copy of the @a orig_stat status structure, allocated
01084 * in @a pool.
01085 */
01086 svn_wc_status_t *svn_wc_dup_status (svn_wc_status_t *orig_stat,
01087 apr_pool_t *pool);
01088
01089
01090 /** Fill @a *status for @a path, allocating in @a pool, with the exception
01091 * of the @c repos_rev field, which is normally filled in by the caller.
01092 * @a adm_access must be an access baton for @a path.
01093 *
01094 * Here are some things to note about the returned structure. A quick
01095 * examination of the @c status->text_status after a successful return of
01096 * this function can reveal the following things:
01097 *
01098 * - @c svn_wc_status_none : @a path is not versioned, and is either not
01099 * present on disk, or is ignored by svn's
01100 * default ignore regular expressions or the
01101 * svn:ignore property setting for @a path's
01102 * parent directory.
01103 *
01104 * - @c svn_wc_status_missing : @a path is versioned, but is missing from
01105 * the working copy.
01106 *
01107 * - @c svn_wc_status_unversioned : @a path is not versioned, but is
01108 * present on disk and not being
01109 * ignored (see above).
01110 *
01111 * The other available results for the @c text_status field are more
01112 * straightforward in their meanings. See the comments on the
01113 * @c svn_wc_status_kind structure above for some hints.
01114 */
01115 svn_error_t *svn_wc_status (svn_wc_status_t **status,
01116 const char *path,
01117 svn_wc_adm_access_t *adm_access,
01118 apr_pool_t *pool);
01119
01120
01121
01122
01123 /** A callback for reporting an @c svn_wc_status_t * item @a status
01124 for @a path. @a baton is provided to the */
01125 typedef void (*svn_wc_status_func_t) (void *baton,
01126 const char *path,
01127 svn_wc_status_t *status);
01128
01129
01130 /** Set @a *editor and @a *edit_baton to an editor that generates @c
01131 * svn_wc_status_t structures and sends them through @a status_func /
01132 * @a status_baton. @a anchor is an access baton, with a tree lock,
01133 * for the local path to the working copy which will be used as the
01134 * root of our editor. If @a target is not empty, it represents an
01135 * entry in the @a anchor path which is the subject of the editor
01136 * drive (otherwise, the @a anchor is the subject).
01137 *
01138 * Callers drive this editor to describe working copy out-of-dateness
01139 * with respect to the repository. If this information is not
01140 * available or not desired, callers should simply call the
01141 * close_edit() function of the @a editor vtable.
01142 *
01143 * If the editor driver calls @a editor's set_target_revision() vtable
01144 * function, then when the edit drive is completed, @a *edit_revision
01145 * will contain the revision delivered via that interface, and any
01146 * status items reported during the drive will have their @c repos_rev
01147 * field set to this same revision.
01148 *
01149 * @a config is a hash mapping @c SVN_CONFIG_CATEGORY's to @c
01150 * svn_config_t's.
01151 *
01152 * Assuming the target is a directory, then:
01153 *
01154 * - If @a get_all is false, then only locally-modified entries will be
01155 * returned. If true, then all entries will be returned.
01156 *
01157 * - If @a descend is false, status structures will be returned only
01158 * for the target and its immediate children. Otherwise, this
01159 * operation is fully recursive.
01160 *
01161 * If @a no_ignore is set, statuses that would typically be ignored
01162 * will instead be reported.
01163 *
01164 * If @a cancel_func is non-null, call it with @a cancel_baton while building
01165 * the @a statushash to determine if the client has cancelled the operation.
01166 *
01167 * If @a traversal_info is non-null, then record pre-update traversal
01168 * state in it. (Caller should obtain @a traversal_info from
01169 * @c svn_wc_init_traversal_info.)
01170 *
01171 * Allocate the editor itself in @a pool, but the editor does temporary
01172 * allocations in a subpool of @a pool.
01173 */
01174 svn_error_t *svn_wc_get_status_editor (const svn_delta_editor_t **editor,
01175 void **edit_baton,
01176 svn_revnum_t *edit_revision,
01177 svn_wc_adm_access_t *anchor,
01178 const char *target,
01179 apr_hash_t *config,
01180 svn_boolean_t descend,
01181 svn_boolean_t get_all,
01182 svn_boolean_t no_ignore,
01183 svn_wc_status_func_t status_func,
01184 void *status_baton,
01185 svn_cancel_func_t cancel_func,
01186 void *cancel_baton,
01187 svn_wc_traversal_info_t *traversal_info,
01188 apr_pool_t *pool);
01189
01190 /** @} */
01191
01192
01193 /** Copy @a src to @a dst_basename in @a dst_parent, and schedule
01194 * @a dst_basename for addition to the repository, remembering the copy
01195 * history.
01196 *
01197 * @a src must be a file or directory under version control; @a dst_parent
01198 * must be a directory under version control in the same working copy;
01199 * @a dst_basename will be the name of the copied item, and it must not
01200 * exist already.
01201 *
01202 * If @a cancel_func is non-null, call it with @a cancel_baton at
01203 * various points during the operation. If it returns an error
01204 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
01205 *
01206 * For each file or directory copied, @a notify_func will be called
01207 * with its path and the @a notify_baton. @a notify_func may be @c NULL
01208 * if you are not interested in this information.
01209 *
01210 * Important: this is a variant of @c svn_wc_add. No changes will happen
01211 * to the repository until a commit occurs. This scheduling can be
01212 * removed with @c svn_client_revert.
01213 */
01214 svn_error_t *svn_wc_copy (const char *src,
01215 svn_wc_adm_access_t *dst_parent,
01216 const char *dst_basename,
01217 svn_cancel_func_t cancel_func,
01218 void *cancel_baton,
01219 svn_wc_notify_func_t notify_func,
01220 void *notify_baton,
01221 apr_pool_t *pool);
01222
01223
01224 /** Schedule @a path for deletion, it will be deleted from the repository on
01225 * the next commit. If @a path refers to a directory, then a recursive
01226 * deletion will occur. @a adm_access must hold a write lock for the parent
01227 * of @a path.
01228 *
01229 * This function immediately deletes all files, modified and unmodified,
01230 * versioned and unversioned from the working copy. It also immediately
01231 * deletes unversioned directories and directories that are scheduled to be
01232 * added. Only versioned directories will remain in the working copy,
01233 * these get deleted by the update following the commit.
01234 *
01235 * If @a cancel_func is non-null, call it with @a cancel_baton at
01236 * various points during the operation. If it returns an error
01237 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
01238 *
01239 * For each path marked for deletion, @a notify_func will be called with
01240 * the @a notify_baton and that path. The @a notify_func callback may be
01241 * @c NULL if notification is not needed.
01242 */
01243 svn_error_t *svn_wc_delete (const char *path,
01244 svn_wc_adm_access_t *adm_access,
01245 svn_cancel_func_t cancel_func,
01246 void *cancel_baton,
01247 svn_wc_notify_func_t notify_func,
01248 void *notify_baton,
01249 apr_pool_t *pool);
01250
01251
01252 /** Put @a path under version control by adding an entry in its parent,
01253 * and, if @a path is a directory, adding an administrative area. The
01254 * new entry and anything under it is scheduled for addition to the
01255 * repository. @a parent_access should hold a write lock for the parent
01256 * directory of @a path. If @a path is a directory then an access baton
01257 * for @a path will be added to the set containing @a parent_access.
01258 *
01259 * If @a path does not exist, return @c SVN_ERR_WC_PATH_NOT_FOUND.
01260 *
01261 * If @a copyfrom_url is non-null, it and @a copyfrom_rev are used as
01262 * `copyfrom' args. This is for copy operations, where one wants
01263 * to schedule @a path for addition with a particular history.
01264 *
01265 * If @a cancel_func is non-null, call it with @a cancel_baton at
01266 * various points during the operation. If it returns an error
01267 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
01268 *
01269 * When the @a path has been added, then @a notify_func will be called
01270 * (if it is not @c NULL) with the @a notify_baton and the path.
01271 *
01272 * Return @c SVN_ERR_WC_NODE_KIND_CHANGE if @a path is both an unversioned
01273 * directory and a file that is scheduled for deletion or in state deleted.
01274 *
01275 *<pre> ### This function currently does double duty -- it is also
01276 * ### responsible for "switching" a working copy directory over to a
01277 * ### new copyfrom ancestry and scheduling it for addition. Here is
01278 * ### the old doc string from Ben, lightly edited to bring it
01279 * ### up-to-date, explaining the true, secret life of this function:</pre>
01280 *
01281 * Given a @a path within a working copy of type KIND, follow this algorithm:
01282 *
01283 * - if @a path is not under version control:
01284 * - Place it under version control and schedule for addition;
01285 * if @a copyfrom_url is non-null, use it and @a copyfrom_rev as
01286 * 'copyfrom' history
01287 *
01288 * - if @a path is already under version control:
01289 * (This can only happen when a directory is copied, in which
01290 * case ancestry must have been supplied as well.)
01291 *
01292 * - Schedule the directory itself for addition with copyfrom history.
01293 * - Mark all its children with a 'copied' flag
01294 * - Rewrite all the URLs to what they will be after a commit.
01295 * - ### TODO: remove old wcprops too, see the '###'below
01296 *
01297 *<pre> ### I think possibly the "switchover" functionality should be
01298 * ### broken out into a separate function, but its all intertwined in
01299 * ### the code right now. Ben, thoughts? Hard? Easy? Mauve?</pre>
01300 *
01301 * ### Update: see "###" comment in svn_wc_add_repos_file()'s doc
01302 * string about this.
01303 */
01304 svn_error_t *svn_wc_add (const char *path,
01305 svn_wc_adm_access_t *parent_access,
01306 const char *copyfrom_url,
01307 svn_revnum_t copyfrom_rev,
01308 svn_cancel_func_t cancel_func,
01309 void *cancel_baton,
01310 svn_wc_notify_func_t notify_func,
01311 void *notify_baton,
01312 apr_pool_t *pool);
01313
01314
01315 /** Add a file to a working copy at @a dst_path, obtaining the file's
01316 * contents from @a new_text_path and its properties from @a new_props,
01317 * which normally come from the repository file represented by the
01318 * copyfrom args, see below. The new file will be scheduled for
01319 * addition with history.
01320 *
01321 * Automatically remove @a new_text_path upon successful completion.
01322 *
01323 * @a adm_access, or an access baton in its associated set, must
01324 * contain a write lock for the parent of @a dst_path.
01325 *
01326 * If @a copyfrom_url is non-null, then @a copyfrom_rev must be a
01327 * valid revision number, and together they are the copyfrom history
01328 * for the new file.
01329 *
01330 * Use @a pool for temporary allocations.
01331 *
01332 * ### This function is very redundant with svn_wc_add(). Ideally,
01333 * we'd merge them, so that svn_wc_add() would just take optional
01334 * new_props and optional copyfrom information. That way it could be
01335 * used for both 'svn add somefilesittingonmydisk' and for adding
01336 * files from repositories, with or without copyfrom history.
01337 *
01338 * The problem with this Ideal Plan is that svn_wc_add() also takes
01339 * care of recursive URL-rewriting. There's a whole comment in its
01340 * doc string about how that's really weird, outside its core mission,
01341 * etc, etc. So another part of the Ideal Plan is that that
01342 * functionality of svn_wc_add() would move into a separate function.
01343 */
01344 svn_error_t *svn_wc_add_repos_file (const char *dst_path,
01345 svn_wc_adm_access_t *adm_access,
01346 const char *new_text_path,
01347 apr_hash_t *new_props,
01348 const char *copyfrom_url,
01349 svn_revnum_t copyfrom_rev,
01350 apr_pool_t *pool);
01351
01352
01353 /** Remove entry @a name in @a adm_access from revision control. @a name
01354 * must be either a file or @c SVN_WC_ENTRY_THIS_DIR. @a adm_access must
01355 * hold a write lock.
01356 *
01357 * If @a name is a file, all its info will be removed from @a adm_access's
01358 * administrative directory. If @a name is @c SVN_WC_ENTRY_THIS_DIR, then
01359 * @a adm_access's entire administrative area will be deleted, along with
01360 * *all* the administrative areas anywhere in the tree below @a adm_access.
01361 *
01362 * Normally, only administrative data is removed. However, if
01363 * @a destroy_wf is true, then all working file(s) and dirs are deleted
01364 * from disk as well. When called with @a destroy_wf, any locally
01365 * modified files will *not* be deleted, and the special error
01366 * @c SVN_ERR_WC_LEFT_LOCAL_MOD might be returned. (Callers only need to
01367 * check for this special return value if @a destroy_wf is true.)
01368 *
01369 * If @a instant_error is TRUE, then return @c
01370 * SVN_ERR_WC_LEFT_LOCAL_MOD the instant a locally modified file is
01371 * encountered. Otherwise, leave locally modified files in place and
01372 * return the error only after all the recursion is complete.
01373
01374 * If @a cancel_func is non-null, call it with @a cancel_baton at
01375 * various points during the removal. If it returns an error
01376 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
01377 *
01378 * WARNING: This routine is exported for careful, measured use by
01379 * libsvn_client. Do *not* call this routine unless you really
01380 * understand what the heck you're doing.
01381 */
01382 svn_error_t *
01383 svn_wc_remove_from_revision_control (svn_wc_adm_access_t *adm_access,
01384 const char *name,
01385 svn_boolean_t destroy_wf,
01386 svn_boolean_t instant_error,
01387 svn_cancel_func_t cancel_func,
01388 void *cancel_baton,
01389 apr_pool_t *pool);
01390
01391
01392 /** Assuming @a path is under version control and in a state of conflict,
01393 * then take @a path *out* of this state. If @a resolve_text is true then
01394 * any text conflict is resolved, if @a resolve_props is true then any
01395 * property conflicts are resolved. If @a recursive is true, then search
01396 * recursively for conflicts to resolve.
01397 *
01398 * @a adm_access is an access baton, with a write lock, for @a path.
01399 *
01400 * Needless to say, this function doesn't touch conflict markers or
01401 * anything of that sort -- only a human can semantically resolve a
01402 * conflict. Instead, this function simply marks a file as "having
01403 * been resolved", clearing the way for a commit.
01404 *
01405 * The implementation details are opaque, as our "conflicted" criteria
01406 * might change over time. (At the moment, this routine removes the
01407 * three fulltext 'backup' files and any .prej file created in a conflict,
01408 * and modifies @a path's entry.)
01409 *
01410 * If @a path is not under version control, return @c SVN_ERR_ENTRY_NOT_FOUND.
01411 * If @a path isn't in a state of conflict to begin with, do nothing, and
01412 * return @c SVN_NO_ERROR.
01413 *
01414 * If @c path was successfully taken out of a state of conflict, report this
01415 * information to @c notify_func (if non-@c NULL.) If only text or only
01416 * property conflict resolution was requested, and it was successful, then
01417 * success gets reported.
01418 */
01419 svn_error_t *svn_wc_resolved_conflict (const char *path,
01420 svn_wc_adm_access_t *adm_access,
01421 svn_boolean_t resolve_text,
01422 svn_boolean_t resolve_props,
01423 svn_boolean_t recursive,
01424 svn_wc_notify_func_t notify_func,
01425 void *notify_baton,
01426 apr_pool_t *pool);
01427
01428
01429 /* Commits. */
01430
01431 /** Bump a successfully committed absolute @a path to @a new_revnum after a
01432 * commit succeeds. @a rev_date and @a rev_author are the (server-side)
01433 * date and author of the new revision; one or both may be @c NULL.
01434 * @a adm_access must hold a write lock appropriate for @a path.
01435 *
01436 * If non-null, @a wcprops is an array of <tt>svn_prop_t *</tt> changes to
01437 * wc properties; if an @c svn_prop_t->value is null, then that property is
01438 * deleted.
01439 *
01440 * If @a recurse is true and @a path is a directory, then bump every
01441 * versioned object at or under @a path. This is usually done for
01442 * copied trees.
01443 */
01444 svn_error_t *svn_wc_process_committed (const char *path,
01445 svn_wc_adm_access_t *adm_access,
01446 svn_boolean_t recurse,
01447 svn_revnum_t new_revnum,
01448 const char *rev_date,
01449 const char *rev_author,
01450 apr_array_header_t *wcprop_changes,
01451 apr_pool_t *pool);
01452
01453
01454
01455
01456
01457 /** Do a depth-first crawl in a working copy, beginning at @a path.
01458 *
01459 * Communicate the `state' of the working copy's revisions to
01460 * @a reporter/@a report_baton. Obviously, if @a path is a file instead
01461 * of a directory, this depth-first crawl will be a short one.
01462 *
01463 * No locks are or logs are created, nor are any animals harmed in the
01464 * process. No cleanup is necessary. @a adm_access must be an access
01465 * baton for the @a path hierarchy, it does not require a write lock.
01466 *
01467 * After all revisions are reported, @a reporter->finish_report() is
01468 * called, which immediately causes the RA layer to update the working
01469 * copy. Thus the return value may very well reflect the result of
01470 * the update!
01471 *
01472 * If @a restore_files is true, then unexpectedly missing working files
01473 * will be restored from the administrative directory's cache. For each
01474 * file restored, the @a notify_func function will be called with the
01475 * @a notify_baton and the path of the restored file. @a notify_func may
01476 * be @c NULL if this notification is not required. If @a
01477 * use_commit_times is true, then set restored files' timestamps to
01478 * their last-commit-times.
01479 *
01480 * If @a traversal_info is non-null, then record pre-update traversal
01481 * state in it. (Caller should obtain @a traversal_info from
01482 * @c svn_wc_init_traversal_info.)
01483 */
01484 svn_error_t *
01485 svn_wc_crawl_revisions (const char *path,
01486 svn_wc_adm_access_t *adm_access,
01487 const svn_ra_reporter_t *reporter,
01488 void *report_baton,
01489 svn_boolean_t restore_files,
01490 svn_boolean_t recurse,
01491 svn_boolean_t use_commit_times,
01492 svn_wc_notify_func_t notify_func,
01493 void *notify_baton,
01494 svn_wc_traversal_info_t *traversal_info,
01495 apr_pool_t *pool);
01496
01497
01498 /* Updates. */
01499
01500 /** Set @a *wc_root to @c TRUE if @a path represents a "working copy root",
01501 * @c FALSE otherwise. Use @a pool for any intermediate allocations.
01502 *
01503 * If @a path is not found, return the error @c SVN_ERR_ENTRY_NOT_FOUND.
01504 *
01505 * NOTE: Due to the way in which "WC-root-ness" is calculated, passing
01506 * a @a path of `.' to this function will always return @c TRUE.
01507 */
01508 svn_error_t *svn_wc_is_wc_root (svn_boolean_t *wc_root,
01509 const char *path,
01510 svn_wc_adm_access_t *adm_access,
01511 apr_pool_t *pool);
01512
01513
01514 /** Conditionally split @a path into an @a anchor and @a target for the
01515 * purpose of updating and committing.
01516 *
01517 * @a anchor is the directory at which the update or commit editor
01518 * should be rooted.
01519 *
01520 * @a target is the actual subject (relative to the @a anchor) of the
01521 * update/commit, or "" if the @a anchor itself is the subject.
01522 *
01523 * Allocate @a anchor and @a target in @a pool.
01524 */
01525 svn_error_t *svn_wc_get_actual_target (const char *path,
01526 const char **anchor,
01527 const char **target,
01528 apr_pool_t *pool);
01529
01530
01531
01532 /* Update and update-like functionality. */
01533
01534 /** Set @a *editor and @a *edit_baton to an editor and baton for updating a
01535 * working copy.
01536 *
01537 * If @a ti is non-null, record traversal info in @a ti, for use by
01538 * post-traversal accessors such as @c svn_wc_edited_externals().
01539 *
01540 * @a anchor is an access baton, with a write lock, for the local path to the
01541 * working copy which will be used as the root of our editor. Further
01542 * locks will be acquired if the update creates new directories. All
01543 * locks, both those in @a anchor and newly acquired ones, will be released
01544 * when the editor driver calls @c close_edit.
01545 *
01546 * @a target is the entry in @a anchor that will actually be updated, or
01547 * empty if all of @a anchor should be updated.
01548 *
01549 * The editor invokes @a notify_func with @a notify_baton as the update
01550 * progresses, if @a notify_func is non-null.
01551 *
01552 * If @a cancel_func is non-null, the editor will invoke @a cancel_func with
01553 * @a cancel_baton as the update progresses to see if it should continue.
01554 *
01555 * If @a diff3_cmd is non-null, then use it as the diff3 command for
01556 * any merging; otherwise, use the built-in merge code.
01557 *
01558 * @a target_revision is a pointer to a revision location which, after
01559 * successful completion of the drive of this editor, will be
01560 * populated with the revision to which the working copy was updated.
01561 *
01562 * If @a use_commit_times is TRUE, then all edited/added files will
01563 * have their working timestamp set to the last-committed-time. If
01564 * FALSE, the working files will be touched with the 'now' time.
01565 *
01566 */
01567 svn_error_t *svn_wc_get_update_editor (svn_revnum_t *target_revision,
01568 svn_wc_adm_access_t *anchor,
01569 const char *target,
01570 svn_boolean_t use_commit_times,
01571 svn_boolean_t recurse,
01572 svn_wc_notify_func_t notify_func,
01573 void *notify_baton,
01574 svn_cancel_func_t cancel_func,
01575 void *cancel_baton,
01576 const char *diff3_cmd,
01577 const svn_delta_editor_t **editor,
01578 void **edit_baton,
01579 svn_wc_traversal_info_t *ti,
01580 apr_pool_t *pool);
01581
01582
01583 /** A variant of @c svn_wc_get_update_editor().
01584 *
01585 * Set @a *editor and @a *edit_baton to an editor and baton for "switching"
01586 * a working copy to a new @a switch_url. (Right now, this URL must be
01587 * within the same repository that the working copy already comes
01588 * from.) @a switch_url must not be @c NULL.
01589 *
01590 * If @a ti is non-null, record traversal info in @a ti, for use by
01591 * post-traversal accessors such as @c svn_wc_edited_externals().
01592 *
01593 * @a anchor is an access baton, with a write lock, for the local path to the
01594 * working copy which will be used as the root of our editor. Further
01595 * locks will be acquired if the switch creates new directories. All
01596 * locks, both those in @a anchor and newly acquired ones, will be released
01597 * when the editor driver calls @c close_edit.
01598 *
01599 * @a target is the entry in @a anchor that will actually be updated, or
01600 * empty if all of @a anchor should be updated.
01601 *
01602 * The editor invokes @a notify_func with @a notify_baton as the switch
01603 * progresses, if @a notify_func is non-null.
01604 *
01605 * If @a cancel_func is non-null, it will be called with @a cancel_baton as
01606 * the switch progresses to determine if it should continue.
01607 *
01608 * If @a diff3_cmd is non-null, then use it as the diff3 command for
01609 * any merging; otherwise, use the built-in merge code.
01610 *
01611 * @a target_revision is a pointer to a revision location which, after
01612 * successful completion of the drive of this editor, will be
01613 * populated with the revision to which the working copy was updated.
01614 *
01615 * If @a use_commit_times is TRUE, then all edited/added files will
01616 * have their working timestamp set to the last-committed-time. If
01617 * FALSE, the working files will be touched with the 'now' time.
01618 *
01619 */
01620 svn_error_t *svn_wc_get_switch_editor (svn_revnum_t *target_revision,
01621 svn_wc_adm_access_t *anchor,
01622 const char *target,
01623 const char *switch_url,
01624 svn_boolean_t use_commit_times,
01625 svn_boolean_t recurse,
01626 svn_wc_notify_func_t notify_func,
01627 void *notify_baton,
01628 svn_cancel_func_t cancel_func,
01629 void *cancel_baton,
01630 const char *diff3_cmd,
01631 const svn_delta_editor_t **editor,
01632 void **edit_baton,
01633 svn_wc_traversal_info_t *ti,
01634 apr_pool_t *pool);
01635
01636
01637
01638 /* A word about the implementation of working copy property storage:
01639 *
01640 * Since properties are key/val pairs, you'd think we store them in
01641 * some sort of Berkeley DB-ish format, and even store pending changes
01642 * to them that way too.
01643 *
01644 * However, we already have libsvn_subr/hashdump.c working, and it
01645 * uses a human-readable format. That will be very handy when we're
01646 * debugging, and presumably we will not be dealing with any huge
01647 * properties or property lists initially. Therefore, we will
01648 * continue to use hashdump as the internal mechanism for storing and
01649 * reading from property lists, but note that the interface here is
01650 * _not_ dependent on that. We can swap in a DB-based implementation
01651 * at any time and users of this library will never know the
01652 * difference.
01653 */
01654
01655 /** Set @a *props to a hash table mapping <tt>char *</tt> names onto
01656 * <tt>svn_string_t *</tt> values for all the regular properties of
01657 * @a path. Allocate the table, names, and values in @a pool. If
01658 * the node has no properties, an empty hash is returned. @a adm_access
01659 * is an access baton set that contains @a path.
01660 */
01661 svn_error_t *svn_wc_prop_list (apr_hash_t **props,
01662 const char *path,
01663 svn_wc_adm_access_t *adm_access,
01664 apr_pool_t *pool);
01665
01666
01667 /** Set @a *value to the value of property @a name for @a path, allocating
01668 * @a *value in @a pool. If no such prop, set @a *value to @c NULL.
01669 * @a name may be a regular or wc property; if it is an entry property,
01670 * return the error @c SVN_ERR_BAD_PROP_KIND. @a adm_access is an access
01671 * baton set that contains @a path.
01672 */
01673 svn_error_t *svn_wc_prop_get (const svn_string_t **value,
01674 const char *name,
01675 const char *path,
01676 svn_wc_adm_access_t *adm_access,
01677 apr_pool_t *pool);
01678
01679 /** Set property @a name to @a value for @a path. Do any temporary
01680 * allocation in @a pool. If @a name is not a valid property for @a path,
01681 * return @c SVN_ERR_ILLEGAL_TARGET. If @a value is null, remove property
01682 * @a name. @a adm_access must be an access baton with a write lock for
01683 * @a path.
01684 *
01685 * @a name may be a wc property or a regular property; but if it is an
01686 * entry property, return the error @c SVN_ERR_BAD_PROP_KIND.
01687 */
01688 svn_error_t *svn_wc_prop_set (const char *name,
01689 const svn_string_t *value,
01690 const char *path,
01691 svn_wc_adm_access_t *adm_access,
01692 apr_pool_t *pool);
01693
01694
01695 /** Return true iff @a name is a 'normal' property name. 'Normal' is
01696 * defined as a user-visible and user-tweakable property that shows up
01697 * when you fetch a proplist.
01698 *
01699 * The function currently parses the namespace like so:
01700 *
01701 * - 'svn:wc:' ==> a wcprop, stored/accessed separately via different API.
01702 *
01703 * - 'svn:entry:' ==> an "entry" prop, shunted into the 'entries' file.
01704 *
01705 * If these patterns aren't found, then the property is assumed to be
01706 * Normal.
01707 */
01708 svn_boolean_t svn_wc_is_normal_prop (const char *name);
01709
01710
01711
01712 /** Return true iff @a name is a 'wc' property name. */
01713 svn_boolean_t svn_wc_is_wc_prop (const char *name);
01714
01715 /** Return true iff @a name is a 'entry' property name. */
01716 svn_boolean_t svn_wc_is_entry_prop (const char *name);
01717
01718
01719
01720
01721 /* Diffs */
01722
01723
01724 /** Return an @a editor/@a edit_baton for diffing a working copy against the
01725 * repository.
01726 *
01727 * @a anchor/@a target represent the base of the hierarchy to be compared.
01728 *
01729 * @a callbacks/@a callback_baton is the callback table to use when two
01730 * files are to be compared.
01731 *
01732 * @a recurse determines whether to descend into subdirectories when @a target
01733 * is a directory. If @a recurse is @c TRUE then @a anchor should be part of
01734 * an access baton set for the @a target hierarchy.
01735 *
01736 * If @a use_text_base is true, then compare the repository against
01737 * the working copy's text-base files, rather than the working files.
01738 *
01739 * Normally, the difference from repository->working_copy is shown.
01740 * If @ reverse_order is true, then show working_copy->repository diffs.
01741 *
01742 * If @a cancel_func is non-null, it will be used along with @a cancel_baton
01743 * to periodically check if the client has canceled the operation.
01744 */
01745 svn_error_t *svn_wc_get_diff_editor (svn_wc_adm_access_t *anchor,
01746 const char *target,
01747 const svn_wc_diff_callbacks_t *callbacks,
01748 void *callback_baton,
01749 svn_boolean_t recurse,
01750 svn_boolean_t use_text_base,
01751 svn_boolean_t reverse_order,
01752 svn_cancel_func_t cancel_func,
01753 void *cancel_baton,
01754 const svn_delta_editor_t **editor,
01755 void **edit_baton,
01756 apr_pool_t *pool);
01757
01758
01759 /** Compare working copy against the text-base.
01760 *
01761 * @a anchor/@a target represent the base of the hierarchy to be compared.
01762 *
01763 * @a callbacks/@a callback_baton is the callback table to use when two
01764 * files are to be compared.
01765 *
01766 * @a recurse determines whether to descend into subdirectories when @a target
01767 * is a directory. If @a recurse is @c TRUE then @a anchor should be part of
01768 * an access baton set for the @a target hierarchy.
01769 */
01770 svn_error_t *svn_wc_diff (svn_wc_adm_access_t *anchor,
01771 const char *target,
01772 const svn_wc_diff_callbacks_t *callbacks,
01773 void *callback_baton,
01774 svn_boolean_t recurse,
01775 apr_pool_t *pool);
01776
01777 /** Given a @a path to a file or directory under version control, discover
01778 * any local changes made to properties and/or the set of 'pristine'
01779 * properties. @a adm_access is an access baton set for @a path.
01780 *
01781 * If @a propchanges is non-@c NULL, return these changes as an array of
01782 * @c svn_prop_t structures stored in @a *propchanges. The structures and
01783 * array will be allocated in @a pool. If there are no local property
01784 * modifications on @a path, then set @a *propchanges to @c NULL.
01785 *
01786 * If @a original_props is non-@c NULL, then set @a *original_props to
01787 * hashtable (<tt>const char *name</tt> -> <tt>const svn_string_t *value</tt>)
01788 * that represents the 'pristine' property list of @a path. This hashtable is
01789 * allocated in @a pool, and can be used to compare old and new values of
01790 * properties.
01791 */
01792 svn_error_t *svn_wc_get_prop_diffs (apr_array_header_t **propchanges,
01793 apr_hash_t **original_props,
01794 const char *path,
01795 svn_wc_adm_access_t *adm_access,
01796 apr_pool_t *pool);
01797
01798
01799 /** The outcome of a merge carried out (or tried as a dry-run) by
01800 * @c svn_wc_merge
01801 */
01802 typedef enum svn_wc_merge_outcome_t
01803 {
01804 /** The working copy is (or would be) unchanged. The changes to be
01805 * merged were already present in the working copy
01806 */
01807 svn_wc_merge_unchanged,
01808
01809 /** The working copy has been (or would be) changed. */
01810 svn_wc_merge_merged,
01811
01812 /** The working copy has been (or would be) changed, but there was (or
01813 * would be) a conflict
01814 */
01815 svn_wc_merge_conflict,
01816
01817 /** No merge was performed, probably because the target file was
01818 * either absent or not under version control.
01819 */
01820 svn_wc_merge_no_merge
01821
01822 } svn_wc_merge_outcome_t;
01823
01824 /** Given paths to three fulltexts, merge the differences between @a left
01825 * and @a right into @a merge_target. (It may help to know that @a left,
01826 * @a right, and @a merge_target correspond to "OLDER", "YOURS", and "MINE",
01827 * respectively, in the diff3 documentation.) Use @a pool for any
01828 * temporary allocation.
01829 *
01830 * @a adm_access is an access baton with a write lock for the directory
01831 * containing @a merge_target.
01832 *
01833 * This function assumes that @a left and @a right are in repository-normal
01834 * form (linefeeds, with keywords contracted); if necessary,
01835 * @a merge_target is temporarily converted to this form to receive the
01836 * changes, then translated back again.
01837 *
01838 * If @a merge_target is absent, or present but not under version
01839 * control, then set @a *merge_outcome to svn_wc_merge_no_merge and
01840 * return success without merging anything. (The reasoning is that if
01841 * the file is not versioned, then it is probably unrelated to the
01842 * changes being considered, so they should not be merged into it.)
01843 *
01844 * @a dry_run determines whether the working copy is modified. When it
01845 * is @c FALSE the merge will cause @a merge_target to be modified, when it
01846 * is @c TRUE the merge will be carried out to determine the result but
01847 * @a merge_target will not be modified.
01848 *
01849 * If @a diff3_cmd is non-null, then use it as the diff3 command for
01850 * any merging; otherwise, use the built-in merge code.
01851 *
01852 * The outcome of the merge is returned in @a *merge_outcome. If there is
01853 * a conflict and @a dry_run is @c FALSE, then
01854 *
01855 * * Put conflict markers around the conflicting regions in
01856 * @a merge_target, labeled with @a left_label, @a right_label, and
01857 * @a target_label. (If any of these labels are @c NULL, default
01858 * values will be used.)
01859 *
01860 * * Copy @a left, @a right, and the original @a merge_target to unique
01861 * names in the same directory as @a merge_target, ending with the
01862 * suffixes ".LEFT_LABEL", ".RIGHT_LABEL", and ".TARGET_LABEL"
01863 * respectively.
01864 *
01865 * * Mark the entry for @a merge_target as "conflicted", and track the
01866 * above mentioned backup files in the entry as well.
01867 *
01868 * Binary case:
01869 *
01870 * If @a merge_target is a binary file, then no merging is attempted,
01871 * the merge is deemed to be a conflict. If @a dry_run is @c FALSE the
01872 * working @a merge_target is untouched, and copies of @a left and
01873 * @a right are created next to it using @a left_label and @a right_label.
01874 * @a merge_target's entry is marked as "conflicted", and begins
01875 * tracking the two backup files. If @a dry_run is @c TRUE no files are
01876 * changed. The outcome of the merge is returned in @a *merge_outcome.
01877 */
01878 svn_error_t *svn_wc_merge (const char *left,
01879 const char *right,
01880 const char *merge_target,
01881 svn_wc_adm_access_t *adm_access,
01882 const char *left_label,
01883 const char *right_label,
01884 const char *target_label,
01885 svn_boolean_t dry_run,
01886 enum svn_wc_merge_outcome_t *merge_outcome,
01887 const char *diff3_cmd,
01888 apr_pool_t *pool);
01889
01890
01891 /** Given a @a path under version control, merge an array of @a propchanges
01892 * into the path's existing properties. @a propchanges is an array of
01893 * @c svn_prop_t objects. @a adm_access is an access baton for the directory
01894 * containing @a path.
01895 *
01896 * If @a base_merge is @c FALSE only the working properties will be changed,
01897 * if it is @c TRUE both the base and working properties will be changed.
01898 *
01899 * If @a state is non-null, set @a *state to the state of the properties
01900 * after the merge.
01901 *
01902 * If conflicts are found when merging working properties, they are
01903 * described in a temporary .prej file (or appended to an already-existing
01904 * .prej file), and the entry is marked "conflicted". Base properties
01905 * are changed unconditionally, if @a base_merge is @c TRUE, they never result
01906 * in a conflict.
01907 */
01908 svn_error_t *
01909 svn_wc_merge_prop_diffs (svn_wc_notify_state_t *state,
01910 const char *path,
01911 svn_wc_adm_access_t *adm_access,
01912 const apr_array_header_t *propchanges,
01913 svn_boolean_t base_merge,
01914 svn_boolean_t dry_run,
01915 apr_pool_t *pool);
01916
01917
01918
01919 /** Given a @a path to a wc file, return a @a pristine_path which points to a
01920 * pristine version of the file. This is needed so clients can do
01921 * diffs. If the WC has no text-base, return a @c NULL instead of a
01922 * path.
01923 */
01924 svn_error_t *svn_wc_get_pristine_copy_path (const char *path,
01925 const char **pristine_path,
01926 apr_pool_t *pool);
01927
01928
01929 /** Recurse from @a path, cleaning up unfinished log business. Perform
01930 * necessary allocations in @a pool. Any working copy locks under @a path
01931 * will be taken over and then cleared by this function. If @a diff3_cmd
01932 * is non-null, then use it as the diff3 command for any merging; otherwise,
01933 * use the built-in merge code.
01934 *
01935 * WARNING: there is no mechanism that will protect locks that are still
01936 * being used.
01937 *
01938 * If @a cancel_func is non-null, invoke it with @a cancel_baton at
01939 * various points during the operation. If it returns an error
01940 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
01941 */
01942 svn_error_t *
01943 svn_wc_cleanup (const char *path,
01944 svn_wc_adm_access_t *optional_adm_access,
01945 const char *diff3_cmd,
01946 svn_cancel_func_t cancel_func,
01947 void *cancel_baton,
01948 apr_pool_t *pool);
01949
01950
01951 /** Relocation validation callback typedef.
01952 *
01953 * Called for each relocated file/directory. @a uuid contains the
01954 * expected repository UUID, @a url contains the tentative URL.
01955 */
01956 typedef svn_error_t *(*svn_wc_relocation_validator_t) (void *baton,
01957 const char *uuid,
01958 const char *url);
01959
01960
01961 /** Change repository references at @a path that begin with @a from
01962 * to begin with @a to instead. Perform necessary allocations in @a pool.
01963 * If @a recurse is true, do so. @a validator (and its baton,
01964 * @a validator_baton), will be called for each newly generated URL.
01965 *
01966 * @a adm_access is an access baton for the directory containing
01967 * @a path, and must not be NULL.
01968 */
01969 svn_error_t *
01970 svn_wc_relocate (const char *path,
01971 svn_wc_adm_access_t *adm_access,
01972 const char *from,
01973 const char *to,
01974 svn_boolean_t recurse,
01975 svn_wc_relocation_validator_t validator,
01976 void *validator_baton,
01977 apr_pool_t *pool);
01978
01979
01980 /** Revert changes to @a path (perhaps in a @a recursive fashion). Perform
01981 * necessary allocations in @a pool.
01982 *
01983 * @a parent_access is an access baton for the directory containing @a path,
01984 * unless @a path is a wc root, in which case @a parent_access refers to
01985 * @a path itself.
01986 *
01987 * If @cancel_func is non-null, call it with @a cancel_baton at
01988 * various points during the reversion process. If it returns an
01989 * error (typically @c SVN_ERR_CANCELLED), return that error
01990 * immediately.
01991 *
01992 * If @a use_commit_times is TRUE, then all reverted working-files
01993 * will have their timestamp set to the last-committed-time. If
01994 * FALSE, the reverted working-files will be touched with the 'now' time.
01995 *
01996 * For each item reverted, @a notify_func will be called with @a notify_baton
01997 * and the path of the reverted item. @a notify_func may be @c NULL if this
01998 * notification is not needed.
01999 */
02000 svn_error_t *
02001 svn_wc_revert (const char *path,
02002 svn_wc_adm_access_t *parent_access,
02003 svn_boolean_t recursive,
02004 svn_boolean_t use_commit_times,
02005 svn_cancel_func_t cancel_func,
02006 void *cancel_baton,
02007 svn_wc_notify_func_t notify_func,
02008 void *notify_baton,
02009 apr_pool_t *pool);
02010
02011
02012
02013 /* Tmp files */
02014
02015 /** Create a unique temporary file in administrative tmp/ area of
02016 * directory @a path. Return a handle in @a *fp.
02017 *
02018 * The flags will be <tt>APR_WRITE | APR_CREATE | APR_EXCL</tt> and
02019 * optionally @c APR_DELONCLOSE (if the @a delete_on_close argument is
02020 * set @c TRUE).
02021 *
02022 * This means that as soon as @a fp is closed, the tmp file will vanish.
02023 */
02024 svn_error_t *
02025 svn_wc_create_tmp_file (apr_file_t **fp,
02026 const char *path,
02027 svn_boolean_t delete_on_close,
02028 apr_pool_t *pool);
02029
02030
02031
02032 /* Eol conversion and keyword expansion. */
02033
02034 /** Set @a *xlated_p to a path to a possibly translated copy of versioned
02035 * file @a vfile, or to @a vfile itself if no translation is necessary.
02036 * That is, if @a vfile's properties indicate newline conversion or
02037 * keyword expansion, point @a *xlated_p to a copy of @a vfile whose
02038 * newlines are unconverted and keywords contracted, in whatever
02039 * manner is indicated by @a vfile's properties; otherwise, set @a *xlated_p
02040 * to @a vfile.
02041 *
02042 * If @a force_repair is set, the translated file will have any
02043 * inconsistent line endings repaired. This should only be used when
02044 * the resultant file is being created for comparison against @a vfile's
02045 * text base.
02046 *
02047 * Caller is responsible for detecting if they are different (pointer
02048 * comparison is sufficient), and for removing @a *xlated_p if
02049 * necessary.
02050 *
02051 * This function is generally used to get a file that can be compared
02052 * meaningfully against @a vfile's text base.
02053 *
02054 * If @a *xlated_p is different from @a vfile, then choose @a *xlated_p's
02055 * name using @c svn_io_open_unique_file() with @c SVN_WC__TMP_EXT, and
02056 * allocate it in @a pool. Also use @a pool for any temporary allocation.
02057 *
02058 * If an error is returned, the effect on @a *xlated_p is undefined.
02059 */
02060 svn_error_t *svn_wc_translated_file (const char **xlated_p,
02061 const char *vfile,
02062 svn_wc_adm_access_t *adm_access,
02063 svn_boolean_t force_repair,
02064 apr_pool_t *pool);
02065
02066
02067
02068 /* Text/Prop Deltas Using an Editor */
02069
02070
02071 /** Send the local modifications for versioned file @a path (with
02072 * matching @a file_baton) through @a editor, then close @a file_baton
02073 * afterwards. Use @a pool for any temporary allocation and
02074 * @a adm_access as an access baton for @a path.
02075 *
02076 * This process creates a copy of @a path with keywords and eol
02077 * untranslated. If @a tempfile is non-null, set @a *tempfile to the
02078 * path to this copy. Do not clean up the copy; caller can do that.
02079 * (The purpose of handing back the tmp copy is that it is usually about
02080 * to become the new text base anyway, but the installation of the new
02081 * text base is outside the scope of this function.)
02082 *
02083 * If @a fulltext, send the untranslated copy of @a path through @a editor
02084 * as full-text; else send it as svndiff against the current text base.
02085 *
02086 * If sending a diff, and the recorded checksum for @a path's text-base
02087 * does not match the current actual checksum, then remove the tmp
02088 * copy (and set @a *tempfile to null if appropriate), and return the
02089 * error @c SVN_ERR_WC_CORRUPT_TEXT_BASE.
02090 *
02091 * Note: this is intended for use with both infix and postfix
02092 * text-delta styled editor drivers.
02093 */
02094 svn_error_t *svn_wc_transmit_text_deltas (const char *path,
02095 svn_wc_adm_access_t *adm_access,
02096 svn_boolean_t fulltext,
02097 const svn_delta_editor_t *editor,
02098 void *file_baton,
02099 const char **tempfile,
02100 apr_pool_t *pool);
02101
02102
02103 /** Given a @a path with its accompanying @a entry, transmit all local
02104 * property modifications using the appropriate @a editor method (in
02105 * conjunction with @a baton). @a adm_access is an access baton set
02106 * that contains @a path. Use @a pool for all allocations.
02107 *
02108 * If a temporary file remains after this function is finished, the
02109 * path to that file is returned in @a *tempfile (so the caller can
02110 * clean this up if it wishes to do so).
02111 */
02112 svn_error_t *svn_wc_transmit_prop_deltas (const char *path,
02113 svn_wc_adm_access_t *adm_access,
02114 const svn_wc_entry_t *entry,
02115 const svn_delta_editor_t *editor,
02116 void *baton,
02117 const char **tempfile,
02118 apr_pool_t *pool);
02119
02120
02121 /** Get the run-time configured list of ignore patterns from the
02122 * @c svn_config_t's in the @a config hash, and store them in @a *patterns.
02123 * Allocate @a *patterns and its contents in @a pool.
02124 */
02125 svn_error_t *svn_wc_get_default_ignores (apr_array_header_t **patterns,
02126 apr_hash_t *config,
02127 apr_pool_t *pool);
02128
02129
02130
02131 #ifdef __cplusplus
02132 }
02133 #endif /* __cplusplus */
02134
02135 #endif /* SVN_WC_H */
1.2.14 written by Dimitri van Heesch,
© 1997-2002