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 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 /** 00054 * @since New in 1.1. 00055 * 00056 * Get libsvn_wc version information. 00057 */ 00058 const svn_version_t *svn_wc_version (void); 00059 00060 00061 /* Locking/Opening/Closing */ 00062 00063 /** Baton for access to a working copy administrative area. 00064 * 00065 * One day all such access will require a baton, we're not there yet. 00066 * 00067 * Access batons can be grouped into sets, by passing an existing open 00068 * baton when opening a new baton. Given one baton in a set, other batons 00069 * may be retrieved. This allows an entire hierarchy to be locked, and 00070 * then the set of batons can be passed around by passing a single baton. 00071 */ 00072 typedef struct svn_wc_adm_access_t svn_wc_adm_access_t; 00073 00074 00075 /** 00076 * @since New in 1.2. 00077 * 00078 * Return, in @a *adm_access, a pointer to a new access baton for the working 00079 * copy administrative area associated with the directory @a path. If 00080 * @a write_lock is true the baton will include a write lock, otherwise the 00081 * baton can only be used for read access. If @a path refers to a directory 00082 * that is already write locked then the error @c SVN_ERR_WC_LOCKED will be 00083 * returned. The error @c SVN_ERR_WC_NOT_DIRECTORY will be returned if 00084 * @a path is not a versioned directory. 00085 * 00086 * If @a associated is an open access baton then @a adm_access will be added 00087 * to the set containing @a associated. @a associated can be @c NULL, in 00088 * which case @a adm_access is the start of a new set. 00089 * 00090 * @a depth specifies how much to lock. Zero means just the specified 00091 * directory. Any negative value means to lock the entire working copy 00092 * directory hierarchy under @a path. A positive value indicates the number of 00093 * levels of directories to lock -- 1 means just immediate subdirectories, 2 00094 * means immediate subdirectories and their subdirectories, etc. All the 00095 * access batons will become part of the set containing @a adm_access. This 00096 * is an all-or-nothing option, if it is not possible to lock all the 00097 * requested directories then an error will be returned and @a adm_access will 00098 * be invalid, with the exception that subdirectories of @a path that are 00099 * missing from the physical filesystem will not be locked and will not cause 00100 * an error. The error @c SVN_ERR_WC_LOCKED will be returned if a 00101 * subdirectory of @a path is already write locked. 00102 * 00103 * If @a cancel_func is non-null, call it with @a cancel_baton to determine 00104 * if the client has cancelled the operation. 00105 * 00106 * @a pool will be used to allocate memory for the baton and any subsequently 00107 * cached items. If @a adm_access has not been closed when the pool is 00108 * cleared, it will be closed automatically at that point, and removed from 00109 * its set. A baton closed in this way will not remove physical locks from 00110 * the working copy if cleanup is required. 00111 * 00112 * The first baton in a set, with @a associated passed as @c NULL, must have 00113 * the longest lifetime of all the batons in the set. This implies it must be 00114 * the root of the hierarchy. 00115 */ 00116 svn_error_t *svn_wc_adm_open3 (svn_wc_adm_access_t **adm_access, 00117 svn_wc_adm_access_t *associated, 00118 const char *path, 00119 svn_boolean_t write_lock, 00120 int depth, 00121 svn_cancel_func_t cancel_func, 00122 void *cancel_baton, 00123 apr_pool_t *pool); 00124 00125 /** 00126 * @deprecated Provided for backward compatibility with the 1.1 API. 00127 * 00128 * Similar to @c svn_wc_adm_open3(), but without cancellation support. 00129 */ 00130 svn_error_t *svn_wc_adm_open2 (svn_wc_adm_access_t **adm_access, 00131 svn_wc_adm_access_t *associated, 00132 const char *path, 00133 svn_boolean_t write_lock, 00134 int depth, 00135 apr_pool_t *pool); 00136 00137 /** 00138 * @deprecated Provided for backward compatibility with the 1.0 API. 00139 * 00140 * Similar to @c svn_wc_adm_open2(), but with @a tree_lock instead of 00141 * @a depth. @a depth is set to -1 if @a tree_lock is @c TRUE, else 0. 00142 */ 00143 svn_error_t *svn_wc_adm_open (svn_wc_adm_access_t **adm_access, 00144 svn_wc_adm_access_t *associated, 00145 const char *path, 00146 svn_boolean_t write_lock, 00147 svn_boolean_t tree_lock, 00148 apr_pool_t *pool); 00149 00150 /** 00151 * @since New in 1.2. 00152 * 00153 * Checks the working copy to determine the node type of @a path. If 00154 * @a path is a versioned directory then the behaviour is like that of 00155 * @c svn_wc_adm_open3, otherwise, if @a path is a file or does not 00156 * exist, then the behaviour is like that of @c svn_wc_adm_open3 with 00157 * @a path replaced by the parent directory of @a path. If @a path is 00158 * an unversioned directory, the behaviour is also like that of 00159 * @c svn_wc_adm_open3 on the parent, except that if the open fails, 00160 * then the returned SVN_ERR_WC_NOT_DIRECTORY error refers to @a path, 00161 * not to @a path's parent. 00162 */ 00163 svn_error_t *svn_wc_adm_probe_open3 (svn_wc_adm_access_t **adm_access, 00164 svn_wc_adm_access_t *associated, 00165 const char *path, 00166 svn_boolean_t write_lock, 00167 int depth, 00168 svn_cancel_func_t cancel_func, 00169 void *cancel_baton, 00170 apr_pool_t *pool); 00171 00172 /** 00173 * @deprecated Provided for backward compatibility with the 1.1 API. 00174 * 00175 * Similar to svn_wc_adm_probe_open3() without the cancel 00176 * functionality. 00177 */ 00178 svn_error_t *svn_wc_adm_probe_open2 (svn_wc_adm_access_t **adm_access, 00179 svn_wc_adm_access_t *associated, 00180 const char *path, 00181 svn_boolean_t write_lock, 00182 int depth, 00183 apr_pool_t *pool); 00184 00185 /** 00186 * @deprecated Provided for backward compatibility with the 1.0 API. 00187 * 00188 * Similar to @c svn_wc_adm_probe_open2(), but with @a tree_lock instead of 00189 * @a depth. @a depth is set to -1 if @a tree_lock is @c TRUE, else 0. 00190 */ 00191 svn_error_t *svn_wc_adm_probe_open (svn_wc_adm_access_t **adm_access, 00192 svn_wc_adm_access_t *associated, 00193 const char *path, 00194 svn_boolean_t write_lock, 00195 svn_boolean_t tree_lock, 00196 apr_pool_t *pool); 00197 00198 /** 00199 * @since New in 1.2. 00200 * 00201 * Open access batons for @a path and return in @a *anchor_access and 00202 * @a *target the anchor and target required to drive an editor. Return 00203 * in @a *target_access the access baton for the target, which may be the 00204 * same as @a *anchor_access. All the access batons will be in the 00205 * @a *anchor_access set. 00206 * 00207 * @a depth determines the depth used when opening @a path if @a path is a 00208 * versioned directory, @a depth is ignored otherwise. If @a write_lock is 00209 * @c TRUE the access batons will hold write locks. 00210 * 00211 * If @a cancel_func is non-null, call it with @a cancel_baton to determine 00212 * if the client has cancelled the operation. 00213 * 00214 * This function is essentially a combination of svn_wc_adm_open3 and 00215 * svn_wc_get_actual_target, with the emphasis on reducing physical IO. 00216 */ 00217 svn_error_t * 00218 svn_wc_adm_open_anchor (svn_wc_adm_access_t **anchor_access, 00219 svn_wc_adm_access_t **target_access, 00220 const char **target, 00221 const char *path, 00222 svn_boolean_t write_lock, 00223 int depth, 00224 svn_cancel_func_t cancel_func, 00225 void *cancel_baton, 00226 apr_pool_t *pool); 00227 00228 /** Return, in @a *adm_access, a pointer to an existing access baton associated 00229 * with @a path. @a path must be a directory that is locked as part of the 00230 * set containing the @a associated access baton. 00231 * 00232 * If the requested access baton is marked as missing in, or is simply 00233 * absent from, @a associated, return SVN_ERR_WC_NOT_LOCKED. 00234 * 00235 * @a pool is used only for local processing, it is not used for the batons. 00236 */ 00237 svn_error_t *svn_wc_adm_retrieve (svn_wc_adm_access_t **adm_access, 00238 svn_wc_adm_access_t *associated, 00239 const char *path, 00240 apr_pool_t *pool); 00241 00242 /** Checks the working copy to determine the node type of @a path. If 00243 * @a path is a versioned directory then the behaviour is like that of 00244 * @c svn_wc_adm_retrieve, otherwise, if @a path is a file, an unversioned 00245 * directory, or does not exist, then the behaviour is like that of 00246 * @c svn_wc_adm_retrieve with @a path replaced by the parent directory of 00247 * @a path. 00248 */ 00249 svn_error_t *svn_wc_adm_probe_retrieve (svn_wc_adm_access_t **adm_access, 00250 svn_wc_adm_access_t *associated, 00251 const char *path, 00252 apr_pool_t *pool); 00253 00254 /** 00255 * @since New in 1.2. 00256 * 00257 * Try various ways to obtain an access baton for @a path. 00258 * 00259 * First, try to obtain @a *adm_access via @c svn_wc_adm_probe_retrieve(), 00260 * but if this fails because @a associated can't give a baton for 00261 * @a path or @a path's parent, then try @c svn_wc_adm_probe_open3(), 00262 * this time passing @a write_lock and @a depth. If there is 00263 * still no access because @a path is not a versioned directory, then 00264 * just set @a *adm_access to null and return success. But if it is 00265 * because @a path is locked, then return the error @c SVN_ERR_WC_LOCKED, 00266 * and the effect on @a *adm_access is undefined. (Or if the attempt 00267 * fails for any other reason, return the corresponding error, and the 00268 * effect on @a *adm_access is also undefined.) 00269 * 00270 * If @c svn_wc_adm_probe_open3() succeeds, then add @a *adm_access to 00271 * @a associated. 00272 * 00273 * If @a cancel_func is non-null, call it with @a cancel_baton to determine 00274 * if the client has cancelled the operation. 00275 * 00276 * Use @a pool only for local processing, not to allocate @a *adm_access. 00277 */ 00278 svn_error_t *svn_wc_adm_probe_try3 (svn_wc_adm_access_t **adm_access, 00279 svn_wc_adm_access_t *associated, 00280 const char *path, 00281 svn_boolean_t write_lock, 00282 int depth, 00283 svn_cancel_func_t cancel_func, 00284 void *cancel_baton, 00285 apr_pool_t *pool); 00286 00287 /** 00288 * @deprecated Provided for backward compatibility with the 1.1 API. 00289 * 00290 * Similar to svn_wc_adm_probe_try3() without the cancel 00291 * functionality. 00292 */ 00293 svn_error_t *svn_wc_adm_probe_try2 (svn_wc_adm_access_t **adm_access, 00294 svn_wc_adm_access_t *associated, 00295 const char *path, 00296 svn_boolean_t write_lock, 00297 int depth, 00298 apr_pool_t *pool); 00299 00300 /** 00301 * @deprecated Provided for backward compatibility with the 1.0 API. 00302 * 00303 * Similar to @c svn_wc_adm_probe_try2(), but with @a tree_lock instead of 00304 * @a depth. @a depth is set to -1 if @a tree_lock is @c TRUE, else 0. 00305 */ 00306 svn_error_t *svn_wc_adm_probe_try (svn_wc_adm_access_t **adm_access, 00307 svn_wc_adm_access_t *associated, 00308 const char *path, 00309 svn_boolean_t write_lock, 00310 svn_boolean_t tree_lock, 00311 apr_pool_t *pool); 00312 00313 00314 /** Give up the access baton @a adm_access, and its lock if any. This will 00315 * recursively close any batons in the same set that are direct 00316 * subdirectories of @a adm_access. Any physical locks will be removed from 00317 * the working copy. Lock removal is unconditional, there is no check to 00318 * determine if cleanup is required. 00319 */ 00320 svn_error_t *svn_wc_adm_close (svn_wc_adm_access_t *adm_access); 00321 00322 /** Return the path used to open the access baton @a adm_access */ 00323 const char *svn_wc_adm_access_path (svn_wc_adm_access_t *adm_access); 00324 00325 /** Return the pool used by access baton @a adm_access */ 00326 apr_pool_t *svn_wc_adm_access_pool (svn_wc_adm_access_t *adm_access); 00327 00328 /** Return @c TRUE is the access baton @a adm_access has a write lock, 00329 * @c FALSE otherwise. Compared to @c svn_wc_locked this is a cheap, fast 00330 * function that doesn't access the filesystem. 00331 */ 00332 svn_boolean_t svn_wc_adm_locked(svn_wc_adm_access_t *adm_access); 00333 00334 /** Set @a *locked to non-zero if @a path is locked, else set it to zero. */ 00335 svn_error_t *svn_wc_locked (svn_boolean_t *locked, 00336 const char *path, 00337 apr_pool_t *pool); 00338 00339 00340 00341 /** Traversal information is information gathered by a working copy 00342 * crawl or update. For example, the before and after values of the 00343 * svn:externals property are important after an update, and since 00344 * we're traversing the working tree anyway (a complete traversal 00345 * during the initial crawl, and a traversal of changed paths during 00346 * the checkout/update/switch), it makes sense to gather the 00347 * property's values then instead of making a second pass. 00348 */ 00349 typedef struct svn_wc_traversal_info_t svn_wc_traversal_info_t; 00350 00351 00352 /** Return a new, empty traversal info object, allocated in @a pool. */ 00353 svn_wc_traversal_info_t *svn_wc_init_traversal_info (apr_pool_t *pool); 00354 00355 00356 /** Set @a *externals_old and @a *externals_new to hash tables representing 00357 * changes to values of the svn:externals property on directories 00358 * traversed by @a traversal_info. 00359 * 00360 * @a traversal_info is obtained from @c svn_wc_init_traversal_info, but is 00361 * only useful after it has been passed through another function, such 00362 * as @c svn_wc_crawl_revisions, @c svn_wc_get_update_editor, 00363 * @c svn_wc_get_checkout_editor, @c svn_wc_get_switch_editor, etc. 00364 * 00365 * Each hash maps <tt>const char *</tt> directory names onto 00366 * <tt>const char *</tt> values of the externals property for that directory. 00367 * The dir names are full paths -- that is, anchor plus target, not target 00368 * alone. The values are not parsed, they are simply copied raw, and are 00369 * never null: directories that acquired or lost the property are 00370 * simply omitted from the appropriate table. Directories whose value 00371 * of the property did not change show the same value in each hash. 00372 * 00373 * The hashes, keys, and values have the same lifetime as @a traversal_info. 00374 */ 00375 void svn_wc_edited_externals (apr_hash_t **externals_old, 00376 apr_hash_t **externals_new, 00377 svn_wc_traversal_info_t *traversal_info); 00378 00379 00380 /** One external item. This usually represents one line from an 00381 * svn:externals description but with the path and URL 00382 * canonicalized. 00383 */ 00384 typedef struct svn_wc_external_item_t 00385 { 00386 /** The name of the subdirectory into which this external should be 00387 checked out. This is relative to the parent directory that 00388 holds this external item. (Note that these structs are often 00389 stored in hash tables with the target dirs as keys, so this 00390 field will often be redundant.) */ 00391 const char *target_dir; 00392 00393 /** Where to check out from. */ 00394 const char *url; 00395 00396 /** What revision to check out. The only valid kinds for this are 00397 svn_opt_revision_number, svn_opt_revision_date, and 00398 svn_opt_revision_head. */ 00399 svn_opt_revision_t revision; 00400 00401 } svn_wc_external_item_t; 00402 00403 00404 /** 00405 * @since New in 1.1. 00406 * 00407 * If @a externals_p is non-null, set @a *externals_p to an array of 00408 * @a svn_wc_external_item_t * objects based on @a desc. 00409 * 00410 * If the format of @a desc is invalid, don't touch @a *externals_p and 00411 * return @c SVN_ERR_CLIENT_INVALID_EXTERNALS_DESCRIPTION. Thus, if 00412 * you just want to check the validity of an externals description, 00413 * and don't care about the parsed result, pass null for @a externals_p. 00414 * 00415 * The format of @a desc is the same as for values of the directory 00416 * property @c SVN_PROP_EXTERNALS, which see. 00417 * 00418 * Allocate the table, keys, and values in @a pool. 00419 * 00420 * Use @a parent_directory only in constructing error strings. 00421 */ 00422 svn_error_t * 00423 svn_wc_parse_externals_description2 (apr_array_header_t **externals_p, 00424 const char *parent_directory, 00425 const char *desc, 00426 apr_pool_t *pool); 00427 00428 00429 /** 00430 * @deprecated Provided for backward compatibility with the 1.0 API. 00431 * 00432 * Similar to svn_wc_parse_externals_description2, but returns the 00433 * parsed externals in a hash instead of an array. This function 00434 * should not be used, as storing the externals in a hash causes their 00435 * order of evaluation to be not easily identifiable. 00436 */ 00437 svn_error_t * 00438 svn_wc_parse_externals_description (apr_hash_t **externals_p, 00439 const char *parent_directory, 00440 const char *desc, 00441 apr_pool_t *pool); 00442 00443 00444 00445 /* Notification/callback handling. */ 00446 00447 /** 00448 * @defgroup svn_wc_notifications notification callback handling 00449 * @{ 00450 * 00451 * In many cases, the WC library will scan a working copy and make 00452 * changes. The caller usually wants to know when each of these changes 00453 * has been made, so that it can display some kind of notification to 00454 * the user. 00455 * 00456 * These notifications have a standard callback function type, which 00457 * takes the path of the file that was affected, and a caller- 00458 * supplied baton. 00459 * 00460 * Note that the callback is a 'void' return -- this is a simple 00461 * reporting mechanism, rather than an opportunity for the caller to 00462 * alter the operation of the WC library. 00463 * 00464 * Note also that some of the actions are used across several 00465 * different Subversion commands. For example, the update actions are 00466 * also used for checkouts, switches, and merges. 00467 */ 00468 00469 /** The type of action occurring. */ 00470 typedef enum svn_wc_notify_action_t 00471 { 00472 /** Adding a path to revision control. */ 00473 svn_wc_notify_add = 0, 00474 00475 /** Copying a versioned path. */ 00476 svn_wc_notify_copy, 00477 00478 /** Deleting a versioned path. */ 00479 svn_wc_notify_delete, 00480 00481 /** Restoring a missing path from the pristine text-base. */ 00482 svn_wc_notify_restore, 00483 00484 /** Reverting a modified path. */ 00485 svn_wc_notify_revert, 00486 00487 /** A revert operation has failed. */ 00488 svn_wc_notify_failed_revert, 00489 00490 /** Resolving a conflict. */ 00491 svn_wc_notify_resolved, 00492 00493 /** Skipping a path. */ 00494 svn_wc_notify_skip, 00495 00496 /** Got a delete in an update. */ 00497 svn_wc_notify_update_delete, 00498 00499 /** Got an add in an update. */ 00500 svn_wc_notify_update_add, 00501 00502 /** Got any other action in an update. */ 00503 svn_wc_notify_update_update, 00504 00505 /** The last notification in an update (including updates of externals). */ 00506 svn_wc_notify_update_completed, 00507 00508 /** Updating an external module. */ 00509 svn_wc_notify_update_external, 00510 00511 /** The last notification in a status (including status on externals). */ 00512 svn_wc_notify_status_completed, 00513 00514 /** Running status on an external module. */ 00515 svn_wc_notify_status_external, 00516 00517 /** Committing a modification. */ 00518 svn_wc_notify_commit_modified, 00519 00520 /** Committing an addition. */ 00521 svn_wc_notify_commit_added, 00522 00523 /** Committing a deletion. */ 00524 svn_wc_notify_commit_deleted, 00525 00526 /** Committing a replacement. */ 00527 svn_wc_notify_commit_replaced, 00528 00529 /** Transmitting post-fix text-delta data for a file. */ 00530 svn_wc_notify_commit_postfix_txdelta, 00531 00532 /** Processed a single revision's blame. */ 00533 svn_wc_notify_blame_revision, 00534 00535 /** @since New in 1.2. Locking a path. */ 00536 svn_wc_notify_locked, 00537 00538 /** @since New in 1.2. Unlocking a path. */ 00539 svn_wc_notify_unlocked, 00540 00541 /** @since New in 1.2. Failed to lock a path. */ 00542 svn_wc_notify_failed_lock, 00543 00544 /** @since New in 1.2. Failed to unlock a path. */ 00545 svn_wc_notify_failed_unlock 00546 } svn_wc_notify_action_t; 00547 00548 00549 /** The type of notification that is occurring. */ 00550 typedef enum svn_wc_notify_state_t 00551 { 00552 svn_wc_notify_state_inapplicable = 0, 00553 00554 /** Notifier doesn't know or isn't saying. */ 00555 svn_wc_notify_state_unknown, 00556 00557 /** The state did not change. */ 00558 svn_wc_notify_state_unchanged, 00559 00560 /** The item wasn't present. */ 00561 svn_wc_notify_state_missing, 00562 00563 /** An unversioned item obstructed work. */ 00564 svn_wc_notify_state_obstructed, 00565 00566 /** Pristine state was modified. */ 00567 svn_wc_notify_state_changed, 00568 00569 /** Modified state had mods merged in. */ 00570 svn_wc_notify_state_merged, 00571 00572 /** Modified state got conflicting mods. */ 00573 svn_wc_notify_state_conflicted 00574 00575 } svn_wc_notify_state_t; 00576 00577 /** @since New in 1.2. 00578 * 00579 * What happened to a lock during an operation. 00580 * 00581 */ 00582 typedef enum svn_wc_notify_lock_state_t { 00583 svn_wc_notify_lock_state_inapplicable = 0, 00584 svn_wc_notify_lock_state_unknown, 00585 /** The lock wasn't changed. */ 00586 svn_wc_notify_lock_state_unchanged, 00587 /** The item was locked. */ 00588 svn_wc_notify_lock_state_locked, 00589 /** The item was unlocked. */ 00590 svn_wc_notify_lock_state_unlocked 00591 } svn_wc_notify_lock_state_t; 00592 00593 /** @since New in 1.2. 00594 * 00595 * Structure used in the @c svn_wc_notify_func2_t function. 00596 * 00597 * @c path is either absolute or relative to the current working directory 00598 * (i.e., not relative to an anchor). @c action describes what happened 00599 * to @c path. 00600 * 00601 * @c kind, @c content_state, @c prop_state and @c lock_state are from 00602 * after @c action, not before. @c lock_state reflects the addition 00603 * or removal of a lock token in the working copy. 00604 * 00605 * If @c mime_type is non-null, it indicates the mime-type of @c path. 00606 * It is always @c NULL for directories. 00607 * 00608 * If @c action is @c svn_wc_notify_update_completed, @c revision is the 00609 * target revision of the update, or @c SVN_INVALID_REVNUM if not 00610 * available. If @c action is @c svn_wc_notify_blame_revision, @c 00611 * revision is the processed revision. In all other cases, @c 00612 * revision is @c SVN_INVALID_REVNUM. 00613 * 00614 * For an @c action of svn_wc_notify_locked, @c lock is the lock 00615 * structure received from the repository. For other actions, it is 00616 * @c NULL. 00617 * 00618 * @c err is @c NULL, except when @c action is @c 00619 * svn_wc_notify_failed_lock or @c svn_wc_notify_failed_unlock, in 00620 * which case it points to an error describing the reason for the failure. 00621 * 00622 * Note that if @c action is @c svn_wc_notify_update, then @c path has 00623 * already been installed, so it is legitimate for an implementation of 00624 * @c svn_wc_notify_func2_t to examine @c path in the working copy. 00625 * 00626 * @note The purpose of the @c kind, @c mime_type, @c content_state, and 00627 * @c prop_state fields is to provide "for free" information that an 00628 * implementation is likely to want, and which it would otherwise be 00629 * forced to deduce via expensive operations such as reading entries 00630 * and properties. However, if the caller does not have this 00631 * information, it will simply pass the corresponding `*_unknown' 00632 * values, and it is up to the implementation how to handle that 00633 * (i.e., whether to attempt deduction, or just to punt and 00634 * give a less informative notification). 00635 * 00636 * @note Callers of notification functions should use @c svn_wc_create_notify 00637 * to create structures of this type to allow for extensibility. */ 00638 typedef struct svn_wc_notify_t { 00639 const char *path; 00640 svn_wc_notify_action_t action; 00641 svn_node_kind_t kind; 00642 const char *mime_type; 00643 const svn_lock_t *lock; 00644 svn_error_t *err; 00645 svn_wc_notify_state_t content_state; 00646 svn_wc_notify_state_t prop_state; 00647 svn_wc_notify_lock_state_t lock_state; 00648 svn_revnum_t revision; 00649 /* NOTE: Add new fields at the end to preserve binary compatibility. 00650 Also, if you add fields here, you have to update svn_wc_create_notify 00651 and svn_wc_dup_notify. */ 00652 } svn_wc_notify_t; 00653 00654 /** @since New in 1.2. 00655 * 00656 * Allocate an @c svn_wc_notify_t structure in @a pool, initialize and return 00657 * it. 00658 * 00659 * Set the @c path field of the created struct to @a path, and @c action to 00660 * @a action. Set all other fields to their @c _unknown, @c NULL or 00661 * invalid value, respectively. 00662 */ 00663 svn_wc_notify_t * 00664 svn_wc_create_notify (const char *path, svn_wc_notify_action_t action, 00665 apr_pool_t *pool); 00666 00667 /** @since New in 1.2. 00668 * 00669 * Return a deep copy of @a notify, allocated in @a pool. 00670 */ 00671 svn_wc_notify_t * 00672 svn_wc_dup_notify (const svn_wc_notify_t *notify, apr_pool_t *pool); 00673 00674 /** @since New in 1.2. 00675 * 00676 * Notify the world that @a notify->action has happened to @a notify->path. 00677 * 00678 * Recommendation: callers of @c svn_wc_notify_func2_t should avoid 00679 * invoking it multiple times on the same path within a given 00680 * operation, and implementations should not bother checking for such 00681 * duplicate calls. For example, in an update, the caller should not 00682 * invoke the notify func on receiving a prop change and then again 00683 * on receiving a text change. Instead, wait until all changes have 00684 * been received, and then invoke the notify func once (from within 00685 * an @c svn_delta_editor_t's @c close_file(), for example), passing 00686 * the appropriate @a notify->content_state and @a notify->prop_state flags. 00687 */ 00688 typedef void (*svn_wc_notify_func2_t) (void *baton, 00689 const svn_wc_notify_t *notify, 00690 apr_pool_t *pool); 00691 00692 /** @deprecated Provided for backward compatibility with the 1.1 API. 00693 * 00694 * Similar to @c svn_wc_notify_func2_t, but takes the information as arguments 00695 * instead of struct fields. */ 00696 typedef void (*svn_wc_notify_func_t) (void *baton, 00697 const char *path, 00698 svn_wc_notify_action_t action, 00699 svn_node_kind_t kind, 00700 const char *mime_type, 00701 svn_wc_notify_state_t content_state, 00702 svn_wc_notify_state_t prop_state, 00703 svn_revnum_t revision); 00704 00705 /** @} */ 00706 00707 00708 00709 /** 00710 * @since New in 1.2. 00711 * 00712 * A callback vtable invoked by our diff-editors, as they receive 00713 * diffs from the server. 'svn diff' and 'svn merge' both implement 00714 * their own versions of this table. 00715 */ 00716 typedef struct svn_wc_diff_callbacks2_t 00717 { 00718 /** A file @a path has changed. If tmpfile2 is non-null, the 00719 * contents have changed and those changes can be seen by comparing 00720 * @a tmpfile1 and @a tmpfile2, which represent @a rev1 and @a rev2 of 00721 * the file, respectively. 00722 * 00723 * If known, the @c svn:mime-type value of each file is passed into 00724 * @a mimetype1 and @a mimetype2; either or both of the values can 00725 * be NULL. The implementor can use this information to decide if 00726 * (or how) to generate differences. 00727 * 00728 * @a propchanges is an array of (@c svn_prop_t) structures. If it has 00729 * any elements, the original list of properties is provided in 00730 * @a originalprops, which is a hash of @c svn_string_t values, keyed on the 00731 * property name. 00732 * 00733 * @a adm_access will be an access baton for the directory containing 00734 * @a path, or @c NULL if the diff editor is not using access batons. 00735 * 00736 * If @a contentstate is non-null, set @a *contentstate to the state of 00737 * the file contents after the operation has been performed. The same 00738 * applies for @a propstate regarding the property changes. (In 00739 * practice, this is only useful with merge, not diff; diff callbacks 00740 * will probably set @a *contentstate and @a *propstate to 00741 * @c svn_wc_notify_state_unknown, since they do not change the state and 00742 * therefore do not bother to know the state after the operation.) 00743 */ 00744 svn_error_t *(*file_changed) (svn_wc_adm_access_t *adm_access, 00745 svn_wc_notify_state_t *contentstate, 00746 svn_wc_notify_state_t *propstate, 00747 const char *path, 00748 const char *tmpfile1, 00749 const char *tmpfile2, 00750 svn_revnum_t rev1, 00751 svn_revnum_t rev2, 00752 const char *mimetype1, 00753 const char *mimetype2, 00754 const apr_array_header_t *propchanges, 00755 apr_hash_t *originalprops, 00756 void *diff_baton); 00757 00758 /** A file @a path was added. The contents can be seen by comparing 00759 * @a tmpfile1 and @a tmpfile2, which represent @a rev1 and @a rev2 00760 * of the file, respectively. (If either file is empty, the rev 00761 * will be 0.) 00762 * 00763 * If known, the @c svn:mime-type value of each file is passed into 00764 * @a mimetype1 and @a mimetype2; either or both of the values can 00765 * be NULL. The implementor can use this information to decide if 00766 * (or how) to generate differences. 00767 * 00768 * @a propchanges is an array of (@c svn_prop_t) structures. If it contains 00769 * any elements, the original list of properties is provided in 00770 * @a originalprops, which is a hash of @c svn_string_t values, keyed on the 00771 * property name. 00772 * 00773 * @a adm_access will be an access baton for the directory containing 00774 * @a path, or @c NULL if the diff editor is not using access batons. 00775 * 00776 * If @a contentstate is non-null, set @a *contentstate to the state of the 00777 * file contents after the operation has been performed. The same 00778 * applies for @a propstate regarding the property changes. (In practice, 00779 * this is only useful with merge, not diff; diff callbacks will 00780 * probably set @a *contentstate and *propstate to 00781 * @c svn_wc_notify_state_unknown, since they do not change the state 00782 * and therefore do not bother to know the state after the operation.) 00783 * 00784 */ 00785 svn_error_t *(*file_added) (svn_wc_adm_access_t *adm_access, 00786 svn_wc_notify_state_t *contentstate, 00787 svn_wc_notify_state_t *propstate, 00788 const char *path, 00789 const char *tmpfile1, 00790 const char *tmpfile2, 00791 svn_revnum_t rev1, 00792 svn_revnum_t rev2, 00793 const char *mimetype1, 00794 const char *mimetype2, 00795 const apr_array_header_t *propchanges, 00796 apr_hash_t *originalprops, 00797 void *diff_baton); 00798 00799 /** A file @a path was deleted. The [loss of] contents can be seen by 00800 * comparing @a tmpfile1 and @a tmpfile2. @a originalprops provides 00801 * the properties of the file. 00802 * 00803 * If known, the @c svn:mime-type value of each file is passed into 00804 * @a mimetype1 and @a mimetype2; either or both of the values can 00805 * be NULL. The implementor can use this information to decide if 00806 * (or how) to generate differences. 00807 * 00808 * @a adm_access will be an access baton for the directory containing 00809 * @a path, or @c NULL if the diff editor is not using access batons. 00810 * 00811 * If @a state is non-null, set @a *state to the state of the item 00812 * after the delete operation has been performed. (In practice, 00813 * this is only useful with merge, not diff; diff callbacks will 00814 * probably set @a *state to @c svn_wc_notify_state_unknown, since 00815 * they do not change the state and therefore do not bother to know 00816 * the state after the operation.) 00817 */ 00818 svn_error_t *(*file_deleted) (svn_wc_adm_access_t *adm_access, 00819 svn_wc_notify_state_t *state, 00820 const char *path, 00821 const char *tmpfile1, 00822 const char *tmpfile2, 00823 const char *mimetype1, 00824 const char *mimetype2, 00825 apr_hash_t *originalprops, 00826 void *diff_baton); 00827 00828 /** A directory @a path was added. @a rev is the revision that the 00829 * directory came from. 00830 * 00831 * @a adm_access will be an access baton for the directory containing 00832 * @a path, or @c NULL if the diff editor is not using access batons. 00833 */ 00834 svn_error_t *(*dir_added) (svn_wc_adm_access_t *adm_access, 00835 svn_wc_notify_state_t *state, 00836 const char *path, 00837 svn_revnum_t rev, 00838 void *diff_baton); 00839 00840 /** A directory @a path was deleted. 00841 * 00842 * @a adm_access will be an access baton for the directory containing 00843 * @a path, or @c NULL if the diff editor is not using access batons. 00844 * 00845 * If @a state is non-null, set @a *state to the state of the item 00846 * after the delete operation has been performed. (In practice, 00847 * this is only useful with merge, not diff; diff callbacks will 00848 * probably set @a *state to @c svn_wc_notify_state_unknown, since 00849 * they do not change the state and therefore do not bother to know 00850 * the state after the operation.) 00851 */ 00852 svn_error_t *(*dir_deleted) (svn_wc_adm_access_t *adm_access, 00853 svn_wc_notify_state_t *state, 00854 const char *path, 00855 void *diff_baton); 00856 00857 /** A list of property changes (@a propchanges) was applied to the 00858 * directory @a path. 00859 * 00860 * The array is a list of (@c svn_prop_t) structures. 00861 * 00862 * The original list of properties is provided in @a original_props, 00863 * which is a hash of @c svn_string_t values, keyed on the property 00864 * name. 00865 * 00866 * @a adm_access will be an access baton for the directory containing 00867 * @a path, or @c NULL if the diff editor is not using access batons. 00868 * 00869 * If @a state is non-null, set @a *state to the state of the properties 00870 * after the operation has been performed. (In practice, this is only 00871 * useful with merge, not diff; diff callbacks will probably set @a *state 00872 * to @c svn_wc_notify_state_unknown, since they do not change the state 00873 * and therefore do not bother to know the state after the operation.) 00874 */ 00875 svn_error_t *(*dir_props_changed) (svn_wc_adm_access_t *adm_access, 00876 svn_wc_notify_state_t *state, 00877 const char *path, 00878 const apr_array_header_t *propchanges, 00879 apr_hash_t *original_props, 00880 void *diff_baton); 00881 00882 } svn_wc_diff_callbacks2_t; 00883 00884 /** 00885 * @deprecated Provided for backward compatibility with the 1.1 API. 00886 * 00887 * Similar to @c svn_wc_callbakcs2_t, but with file additions/content 00888 * changes and property changes split into different functions. 00889 */ 00890 typedef struct svn_wc_diff_callbacks_t 00891 { 00892 /** Similar to @c file_changed in @c svn_wc_diff_callbacks2_t, but without 00893 * property change information. @a tmpfile2 is never NULL. @a state applies 00894 * to the file contents. */ 00895 svn_error_t *(*file_changed) (svn_wc_adm_access_t *adm_access, 00896 svn_wc_notify_state_t *state, 00897 const char *path, 00898 const char *tmpfile1, 00899 const char *tmpfile2, 00900 svn_revnum_t rev1, 00901 svn_revnum_t rev2, 00902 const char *mimetype1, 00903 const char *mimetype2, 00904 void *diff_baton); 00905 00906 /** Similar to @c file_added in @c svn_wc_diff_callbacks2_t, but without 00907 * property change information. @a *state applies to the file contents. */ 00908 svn_error_t *(*file_added) (svn_wc_adm_access_t *adm_access, 00909 svn_wc_notify_state_t *state, 00910 const char *path, 00911 const char *tmpfile1, 00912 const char *tmpfile2, 00913 svn_revnum_t rev1, 00914 svn_revnum_t rev2, 00915 const char *mimetype1, 00916 const char *mimetype2, 00917 void *diff_baton); 00918 00919 /** Similar to @c file_deleted in @c svn_wc_diff_callbacks2_t, but without 00920 * the properties. */ 00921 svn_error_t *(*file_deleted) (svn_wc_adm_access_t *adm_access, 00922 svn_wc_notify_state_t *state, 00923 const char *path, 00924 const char *tmpfile1, 00925 const char *tmpfile2, 00926 const char *mimetype1, 00927 const char *mimetype2, 00928 void *diff_baton); 00929 00930 /** The same as @c dir_added in @c svn_wc_diff_callbacks2_t. */ 00931 svn_error_t *(*dir_added) (svn_wc_adm_access_t *adm_access, 00932 svn_wc_notify_state_t *state, 00933 const char *path, 00934 svn_revnum_t rev, 00935 void *diff_baton); 00936 00937 /** The same as @c dir_deleted in @c svn_diff_callbacks2_t. */ 00938 svn_error_t *(*dir_deleted) (svn_wc_adm_access_t *adm_access, 00939 svn_wc_notify_state_t *state, 00940 const char *path, 00941 void *diff_baton); 00942 00943 /** Similar to @c dir_props_changed in @c svn_diff_callbacks2_t, but this 00944 * function is called for files as well as directories. */ 00945 svn_error_t *(*props_changed) (svn_wc_adm_access_t *adm_access, 00946 svn_wc_notify_state_t *state, 00947 const char *path, 00948 const apr_array_header_t *propchanges, 00949 apr_hash_t *original_props, 00950 void *diff_baton); 00951 00952 } svn_wc_diff_callbacks_t; 00953 00954 00955 /* Asking questions about a working copy. */ 00956 00957 /** Set @a *wc_format to @a path's working copy format version number if 00958 * @a path is a valid working copy directory, else set it to 0. 00959 * Return error @c APR_ENOENT if @a path does not exist at all. 00960 */ 00961 svn_error_t *svn_wc_check_wc (const char *path, 00962 int *wc_format, 00963 apr_pool_t *pool); 00964 00965 00966 /** Set @a *has_binary_prop to @c TRUE iff @a path has been marked 00967 * with a property indicating that it is non-text (in other words, binary). 00968 * @a adm_access is an access baton set that contains @a path. 00969 */ 00970 svn_error_t *svn_wc_has_binary_prop (svn_boolean_t *has_binary_prop, 00971 const char *path, 00972 svn_wc_adm_access_t *adm_access, 00973 apr_pool_t *pool); 00974 00975 00976 /* Detecting modification. */ 00977 00978 /** Set @a *modified_p to non-zero if @a filename's text is modified 00979 * with regard to the base revision, else set @a *modified_p to zero. 00980 * @a filename is a path to the file, not just a basename. @a adm_access 00981 * must be an access baton for @a filename. 00982 * 00983 * If @a force_comparison is @c TRUE, this function will not allow 00984 * early return mechanisms that avoid actual content comparison. 00985 * Instead, if there is a text base, a full byte-by-byte comparison 00986 * will be done, and the entry checksum verified as well. (This means 00987 * that if the text base is much longer than the working file, every 00988 * byte of the text base will still be examined.) 00989 * 00990 * If @a filename does not exist, consider it unmodified. If it exists 00991 * but is not under revision control (not even scheduled for 00992 * addition), return the error @c SVN_ERR_ENTRY_NOT_FOUND. */ 00993 svn_error_t *svn_wc_text_modified_p (svn_boolean_t *modified_p, 00994 const char *filename, 00995 svn_boolean_t force_comparison, 00996 svn_wc_adm_access_t *adm_access, 00997 apr_pool_t *pool); 00998 00999 01000 /** Set @a *modified_p to non-zero if @a path's properties are modified 01001 * with regard to the base revision, else set @a modified_p to zero. 01002 * @a adm_access must be an access baton for @a path. 01003 */ 01004 svn_error_t *svn_wc_props_modified_p (svn_boolean_t *modified_p, 01005 const char *path, 01006 svn_wc_adm_access_t *adm_access, 01007 apr_pool_t *pool); 01008 01009 01010 01011 01012 /** Administrative subdir. 01013 * 01014 * Ideally, this would be completely private to wc internals (in fact, 01015 * it used to be that @c adm_subdir() in adm_files.c was the only function 01016 * who knew the adm subdir's name). However, import wants to protect 01017 * against importing administrative subdirs, so now the name is a 01018 * matter of public record. 01019 */ 01020 #define SVN_WC_ADM_DIR_NAME ".svn" 01021 01022 01023 01024 /* Entries and status. */ 01025 01026 /** The schedule states an entry can be in. */ 01027 typedef enum svn_wc_schedule_t 01028 { 01029 /** Nothing special here */ 01030 svn_wc_schedule_normal, 01031 01032 /** Slated for addition */ 01033 svn_wc_schedule_add, 01034 01035 /** Slated for deletion */ 01036 svn_wc_schedule_delete, 01037 01038 /** Slated for replacement (delete + add) */ 01039 svn_wc_schedule_replace 01040 01041 } svn_wc_schedule_t; 01042 01043 01044 /** A working copy entry -- that is, revision control information about 01045 * one versioned entity. 01046 */ 01047 typedef struct svn_wc_entry_t 01048 { 01049 /* IMPORTANT: If you extend this structure, check svn_wc_entry_dup to see 01050 if you need to extend that as well. */ 01051 01052 /* General Attributes */ 01053 01054 /** entry's name */ 01055 const char *name; 01056 01057 /** base revision */ 01058 svn_revnum_t revision; 01059 01060 /** url in repository */ 01061 const char *url; 01062 01063 /** canonical repository URL */ 01064 const char *repos; 01065 01066 /** repository uuid */ 01067 const char *uuid; 01068 01069 /** node kind (file, dir, ...) */ 01070 svn_node_kind_t kind; 01071 01072 /* State information */ 01073 01074 /** scheduling (add, delete, replace ...) */ 01075 svn_wc_schedule_t schedule; 01076 01077 /** in a copied state */ 01078 svn_boolean_t copied; 01079 01080 /** deleted, but parent rev lags behind */ 01081 svn_boolean_t deleted; 01082 01083 /** absent -- we know an entry of this name exists, but that's all 01084 (usually this happens because of authz restrictions) */ 01085 svn_boolean_t absent; 01086 01087 /** for THIS_DIR entry, implies whole entries file is incomplete */ 01088 svn_boolean_t incomplete; 01089 01090 /** copyfrom location */ 01091 const char *copyfrom_url; 01092 01093 /** copyfrom revision */ 01094 svn_revnum_t copyfrom_rev; 01095 01096 /** old version of conflicted file */ 01097 const char *conflict_old; 01098 01099 /** new version of conflicted file */ 01100 const char *conflict_new; 01101 01102 /** working version of conflicted file */ 01103 const char *conflict_wrk; 01104 01105 /** property reject file */ 01106 const char *prejfile; 01107 01108 /** last up-to-date time for text contents (0 means no information available) 01109 */ 01110 apr_time_t text_time; 01111 01112 /** last up-to-date time for properties (0 means no information available) */ 01113 apr_time_t prop_time; 01114 01115 /** base64-encoded checksum for the untranslated text base file, 01116 * can be @c NULL for backwards compatibility. 01117 */ 01118 const char *checksum; 01119 01120 /* "Entry props" */ 01121 01122 /** last revision this was changed */ 01123 svn_revnum_t cmt_rev; 01124 01125 /** last date this was changed */ 01126 apr_time_t cmt_date; 01127 01128 /** last commit author of this item */ 01129 const char *cmt_author; 01130 01131 /** @since New in 1.2 01132 * lock token or NULL if path not locked in this WC */ 01133 const char *lock_token; 01134 /** @since New in 1.2 01135 * lock owner, or NULL if not locked in this WC */ 01136 const char *lock_owner; 01137 /** @since New in 1.2 01138 * lock comment or NULL if not locked in this WC or no comment */ 01139 const char *lock_comment; 01140 /** @since New in 1.2 01141 * Lock creation date or 0 if not locked in this WC */ 01142 apr_time_t lock_creation_date; 01143 01144 /* IMPORTANT: If you extend this structure, check svn_wc_entry_dup to see 01145 if you need to extend that as well. */ 01146 } svn_wc_entry_t; 01147 01148 01149 /** How an entries file's owner dir is named in the entries file. */ 01150 #define SVN_WC_ENTRY_THIS_DIR "" 01151 01152 01153 /** Set @a *entry to an entry for @a path, allocated in the access baton 01154 * pool. If @a show_hidden is true, return the entry even if it's in 01155 * 'deleted' or 'absent' state. If @a path is not under revision 01156 * control, or if entry is hidden, not scheduled for re-addition, 01157 * and @a show_hidden is @c FALSE, then set @a *entry to @c NULL. 01158 * 01159 * @a *entry should not be modified, since doing so modifies the entries 01160 * cache in @a adm_access without changing the entries file on disk. 01161 * 01162 * If @a path is not a directory then @a adm_access must be an access baton 01163 * for the parent directory of @a path. To avoid needing to know whether 01164 * @a path is a directory or not, if @a path is a directory @a adm_access 01165 * can still be an access baton for the parent of @a path so long as the 01166 * access baton for @a path itself is in the same access baton set. 01167 * 01168 * Note that it is possible for @a path to be absent from disk but still 01169 * under revision control; and conversely, it is possible for @a path to 01170 * be present, but not under revision control. 01171 * 01172 * Use @a pool only for local processing. 01173 */ 01174 svn_error_t *svn_wc_entry (const svn_wc_entry_t **entry, 01175 const char *path, 01176 svn_wc_adm_access_t *adm_access, 01177 svn_boolean_t show_hidden, 01178 apr_pool_t *pool); 01179 01180 01181 /** Parse the `entries' file for @a adm_access and return a hash @a entries, 01182 * whose keys are (<tt>const char *</tt>) entry names and values are 01183 * (<tt>svn_wc_entry_t *</tt>). The hash @a entries, and its keys and 01184 * values, are allocated from the pool used to open the @a adm_access 01185 * baton (that's how the entries caching works). @a pool is used for 01186 * transient allocations. 01187 * 01188 * Entries that are in a 'deleted' or 'absent' state (and not 01189 * scheduled for re-addition) are not returned in the hash, unless 01190 * @a show_hidden is true. 01191 * 01192 * Important note: the @a entries hash is the entries cache in @a adm_access 01193 * and so usually the hash itself, the keys and the values should be treated 01194 * as read-only. If any of these are modified then it is the caller's 01195 * responsibility to ensure that the entries file on disk is updated. Treat 01196 * the hash values as type (<tt>const svn_wc_entry_t *</tt>) if you wish to 01197 * avoid accidental modification. Modifying the schedule member is a 01198 * particularly bad idea, as the entries writing process relies on having 01199 * access to the original schedule. Use a duplicate entry to modify the 01200 * schedule. 01201 * 01202 * Important note: only the entry structures representing files and 01203 * @c SVN_WC_ENTRY_THIS_DIR contain complete information. The entry 01204 * structures representing subdirs have only the `kind' and `state' 01205 * fields filled in. If you want info on a subdir, you must use this 01206 * routine to open its @a path and read the @c SVN_WC_ENTRY_THIS_DIR 01207 * structure, or call @c svn_wc_entry on its @a path. 01208 */ 01209 svn_error_t *svn_wc_entries_read (apr_hash_t **entries, 01210 svn_wc_adm_access_t *adm_access, 01211 svn_boolean_t show_hidden, 01212 apr_pool_t *pool); 01213 01214 01215 /** Return a duplicate of @a entry, allocated in @a pool. No part of the new 01216 * entry will be shared with @a entry. 01217 */ 01218 svn_wc_entry_t *svn_wc_entry_dup (const svn_wc_entry_t *entry, 01219 apr_pool_t *pool); 01220 01221 01222 /** Given a @a dir_path under version control, decide if one of its 01223 * entries (@a entry) is in state of conflict; return the answers in 01224 * @a text_conflicted_p and @a prop_conflicted_p. 01225 * 01226 * (If the entry mentions that a .rej or .prej exist, but they are 01227 * both removed, assume the conflict has been resolved by the user.) 01228 */ 01229 svn_error_t *svn_wc_conflicted_p (svn_boolean_t *text_conflicted_p, 01230 svn_boolean_t *prop_conflicted_p, 01231 const char *dir_path, 01232 const svn_wc_entry_t *entry, 01233 apr_pool_t *pool); 01234 01235 /** Set @a *url and @a *rev to the ancestor URL and revision for @a path, 01236 * allocating in @a pool. @a adm_access must be an access baton for @a path. 01237 * 01238 * If @a url or @a rev is null, then ignore it (just don't return the 01239 * corresponding information). 01240 */ 01241 svn_error_t *svn_wc_get_ancestry (char **url, 01242 svn_revnum_t *rev, 01243 const char *path, 01244 svn_wc_adm_access_t *adm_access, 01245 apr_pool_t *pool); 01246 01247 01248 /** A callback vtable invoked by the generic entry-walker function. */ 01249 typedef struct svn_wc_entry_callbacks_t 01250 { 01251 /** An @a entry was found at @a path. */ 01252 svn_error_t *(*found_entry) (const char *path, 01253 const svn_wc_entry_t *entry, 01254 void *walk_baton, 01255 apr_pool_t *pool); 01256 01257 /* ### add more callbacks as new callers need them. */ 01258 01259 } svn_wc_entry_callbacks_t; 01260 01261 01262 /** 01263 * @since New in 1.2. 01264 * 01265 * A generic entry-walker. 01266 * 01267 * Do a recursive depth-first entry-walk beginning on @a path, which can 01268 * be a file or dir. Call callbacks in @a walk_callbacks, passing 01269 * @a walk_baton to each. Use @a pool for looping, recursion, and to 01270 * allocate all entries returned. @a adm_access must be an access baton 01271 * for @a path. 01272 * 01273 * If @a cancel_func is non-null, call it with @a cancel_baton to determine 01274 * if the client has cancelled the operation. 01275 * 01276 * Like our other entries interfaces, entries that are in a 'deleted' 01277 * or 'absent' state (and not scheduled for re-addition) are not 01278 * discovered, unless @a show_hidden is true. 01279 * 01280 * When a new directory is entered, @c SVN_WC_ENTRY_THIS_DIR will always 01281 * be returned first. 01282 * 01283 * Note: callers should be aware that each directory will be 01284 * returned *twice*: first as an entry within its parent, and 01285 * subsequently as the '.' entry within itself. The two calls can be 01286 * distinguished by looking for @c SVN_WC_ENTRY_THIS_DIR in the 'name' 01287 * field of the entry. 01288 */ 01289 svn_error_t *svn_wc_walk_entries2 (const char *path, 01290 svn_wc_adm_access_t *adm_access, 01291 const svn_wc_entry_callbacks_t 01292 *walk_callbacks, 01293 void *walk_baton, 01294 svn_boolean_t show_hidden, 01295 svn_cancel_func_t cancel_func, 01296 void *cancel_baton, 01297 apr_pool_t *pool); 01298 01299 /** 01300 * @deprecated Provided for backward compatibility with the 1.0 API. 01301 * 01302 * Similar to svn_wc_walk_entries2(), but without cancellation support. 01303 */ 01304 svn_error_t *svn_wc_walk_entries (const char *path, 01305 svn_wc_adm_access_t *adm_access, 01306 const svn_wc_entry_callbacks_t 01307 *walk_callbacks, 01308 void *walk_baton, 01309 svn_boolean_t show_hidden, 01310 apr_pool_t *pool); 01311 01312 01313 /** Mark missing @a path as 'deleted' in its @a parent's list of entries. 01314 * 01315 * Return @c SVN_ERR_WC_PATH_FOUND if @a path isn't actually missing. 01316 */ 01317 svn_error_t *svn_wc_mark_missing_deleted (const char *path, 01318 svn_wc_adm_access_t *parent, 01319 apr_pool_t *pool); 01320 01321 01322 01323 /** Ensure that an administrative area exists for @a path, so that @a 01324 * path is a working copy subdir based on @a url at @a revision, and 01325 * with repository UUID @a uuid. @a uuid may be @c NULL. 01326 * 01327 * If the administrative area does not exist, then create it and 01328 * initialize it to an unlocked state. 01329 * 01330 * If the administrative area already exists then the given @a url 01331 * must match the URL in the administrative area or an error will be 01332 * returned. The given @a revision must also match except for the 01333 * special case of adding a directory that has a name matching one 01334 * scheduled for deletion, in which case @a revision must be zero. 01335 * 01336 * Do not ensure existence of @a path itself; if @a path does not 01337 * exist, return error. 01338 */ 01339 svn_error_t *svn_wc_ensure_adm (const char *path, 01340 const char *uuid, 01341 const char *url, 01342 svn_revnum_t revision, 01343 apr_pool_t *pool); 01344 01345 01346 01347 /** 01348 * @defgroup svn_wc_status working copy status. 01349 * @{ 01350 * 01351 * We have two functions for getting working copy status: one function 01352 * for getting the status of exactly one thing, and another for 01353 * getting the statuses of (potentially) multiple things. 01354 * 01355 * The WebDAV concept of "depth" may be useful in understanding the 01356 * motivation behind this. Suppose we're getting the status of 01357 * directory D. The three depth levels would mean 01358 * 01359 * depth 0: D itself (just the named directory) 01360 * depth 1: D and its immediate children (D + its entries) 01361 * depth Infinity: D and all its descendants (full recursion) 01362 * 01363 * To offer all three levels, we could have one unified function, 01364 * taking a `depth' parameter. Unfortunately, because this function 01365 * would have to handle multiple return values as well as the single 01366 * return value case, getting the status of just one entity would 01367 * become cumbersome: you'd have to roll through a hash to find one 01368 * lone status. 01369 * 01370 * So we have @c svn_wc_status() for depth 0, and 01371 * @c svn_wc_get_status_editor() for depths 1 and 2, since the latter 01372 * two involve multiple return values. 01373 * 01374 * NOTE: The status structures may contain a @c NULL ->entry field. 01375 * This indicates an item that is not versioned in the working copy. 01376 */ 01377 01378 enum svn_wc_status_kind 01379 { 01380 /** does not exist */ 01381 svn_wc_status_none = 1, 01382 01383 /** is not a versioned thing in this wc */ 01384 svn_wc_status_unversioned, 01385 01386 /** exists, but uninteresting. */ 01387 svn_wc_status_normal, 01388 01389 /** is scheduled for addition */ 01390 svn_wc_status_added, 01391 01392 /** under v.c., but is missing */ 01393 svn_wc_status_missing, 01394 01395 /** scheduled for deletion */ 01396 svn_wc_status_deleted, 01397 01398 /** was deleted and then re-added */ 01399 svn_wc_status_replaced, 01400 01401 /** text or props have been modified */ 01402 svn_wc_status_modified, 01403 01404 /** local mods received repos mods */ 01405 svn_wc_status_merged, 01406 01407 /** local mods received conflicting repos mods */ 01408 svn_wc_status_conflicted, 01409 01410 /** a resource marked as ignored */ 01411 svn_wc_status_ignored, 01412 01413 /** an unversioned resource is in the way of the versioned resource */ 01414 svn_wc_status_obstructed, 01415 01416 /** an unversioned path populated by an svn:external property */ 01417 svn_wc_status_external, 01418 01419 /** a directory doesn't contain a complete entries list */ 01420 svn_wc_status_incomplete 01421 }; 01422 01423 /** @since New in 1.2. 01424 * 01425 * Structure for holding the "status" of a working copy item. 01426 * 01427 * The item's entry data is in @a entry, augmented and possibly shadowed 01428 * by the other fields. @a entry is @c NULL if this item is not under 01429 * version control. 01430 * 01431 * @note Fields may be added to the end of this structure in future 01432 * versions. Therefore, users shouldn't allocate structures of this 01433 * type, to preserve binary compatibility. 01434 */ 01435 typedef struct svn_wc_status2_t 01436 { 01437 /** Can be @c NULL if not under version control. */ 01438 svn_wc_entry_t *entry; 01439 01440 /** The status of the entries text. */ 01441 enum svn_wc_status_kind text_status; 01442 01443 /** The status of the entries properties. */ 01444 enum svn_wc_status_kind prop_status; 01445 01446 /** a directory can be 'locked' if a working copy update was interrupted. */ 01447 svn_boolean_t locked; 01448 01449 /** a file or directory can be 'copied' if it's scheduled for 01450 * addition-with-history (or part of a subtree that is scheduled as such.). 01451 */ 01452 svn_boolean_t copied; 01453 01454 /** a file or directory can be 'switched' if the switch command has been 01455 * used. 01456 */ 01457 svn_boolean_t switched; 01458 01459 /** The entry's text status in the repository. */ 01460 enum svn_wc_status_kind repos_text_status; 01461 01462 /** The entry's property status in the repository. */ 01463 enum svn_wc_status_kind repos_prop_status; 01464 01465 /** The entry's lock in the repository, if any. */ 01466 svn_lock_t *repos_lock; 01467 01468 } svn_wc_status2_t; 01469 01470 01471 01472 /** @deprecated Provided for backwards compatibility with the 1.1 API. 01473 * 01474 * Same as svn_wc_status2_t, but without the svn_lock_t 'repos_lock' field. 01475 */ 01476 typedef struct svn_wc_status_t 01477 { 01478 /** Can be @c NULL if not under version control. */ 01479 svn_wc_entry_t *entry; 01480 01481 /** The status of the entries text. */ 01482 enum svn_wc_status_kind text_status; 01483 01484 /** The status of the entries properties. */ 01485 enum svn_wc_status_kind prop_status; 01486 01487 /** a directory can be 'locked' if a working copy update was interrupted. */ 01488 svn_boolean_t locked; 01489 01490 /** a file or directory can be 'copied' if it's scheduled for 01491 * addition-with-history (or part of a subtree that is scheduled as such.). 01492 */ 01493 svn_boolean_t copied; 01494 01495 /** a file or directory can be 'switched' if the switch command has been 01496 * used. 01497 */ 01498 svn_boolean_t switched; 01499 01500 /** The entry's text status in the repository. */ 01501 enum svn_wc_status_kind repos_text_status; 01502 01503 /** The entry's property status in the repository. */ 01504 enum svn_wc_status_kind repos_prop_status; 01505 01506 } svn_wc_status_t; 01507 01508 01509 01510 /** @since New in 1.2. 01511 * 01512 * Return a deep copy of the @a orig_stat status structure, allocated 01513 * in @a pool. 01514 */ 01515 svn_wc_status2_t *svn_wc_dup_status2 (svn_wc_status2_t *orig_stat, 01516 apr_pool_t *pool); 01517 01518 01519 /** @deprecated Provided for backwards compatibility with the 1.1 API. 01520 * 01521 * Same as svn_wc_dup_status2(), but for older svn_wc_status_t structures. 01522 */ 01523 svn_wc_status_t *svn_wc_dup_status (svn_wc_status_t *orig_stat, 01524 apr_pool_t *pool); 01525 01526 01527 /** @since New in 1.2. 01528 * 01529 * Fill @a *status for @a path, allocating in @a pool, with the exception 01530 * of the @c repos_rev field, which is normally filled in by the caller. 01531 * @a adm_access must be an access baton for @a path. 01532 * 01533 * Here are some things to note about the returned structure. A quick 01534 * examination of the @c status->text_status after a successful return of 01535 * this function can reveal the following things: 01536 * 01537 * - @c svn_wc_status_none : @a path is not versioned, and is either not 01538 * present on disk, or is ignored by svn's 01539 * default ignore regular expressions or the 01540 * svn:ignore property setting for @a path's 01541 * parent directory. 01542 * 01543 * - @c svn_wc_status_missing : @a path is versioned, but is missing from 01544 * the working copy. 01545 * 01546 * - @c svn_wc_status_unversioned : @a path is not versioned, but is 01547 * present on disk and not being 01548 * ignored (see above). 01549 * 01550 * The other available results for the @c text_status field are more 01551 * straightforward in their meanings. See the comments on the 01552 * @c svn_wc_status_kind structure for some hints. 01553 */ 01554 svn_error_t *svn_wc_status2 (svn_wc_status2_t **status, 01555 const char *path, 01556 svn_wc_adm_access_t *adm_access, 01557 apr_pool_t *pool); 01558 01559 01560 /** @deprecated Provided for backwards compatibility with the 1.1 API. 01561 * 01562 * Same as svn_wc_status2(), but for older svn_wc_status_t structures. 01563 */ 01564 svn_error_t *svn_wc_status (svn_wc_status_t **status, 01565 const char *path, 01566 svn_wc_adm_access_t *adm_access, 01567 apr_pool_t *pool); 01568 01569 01570 01571 01572 /** @since New in 1.2. 01573 * 01574 * A callback for reporting a @a status about @a path. 01575 * 01576 * @a baton is a closure object; it should be provided by the 01577 * implementation, and passed by the caller. 01578 */ 01579 typedef void (*svn_wc_status_func2_t) (void *baton, 01580 const char *path, 01581 svn_wc_status2_t *status); 01582 01583 /** @deprecated Provided for backwards compatibility with the 1.1 API. 01584 * 01585 * Same as svn_wc_status_func2_t(), but for older svn_wc_status_t structures. 01586 */ 01587 typedef void (*svn_wc_status_func_t) (void *baton, 01588 const char *path, 01589 svn_wc_status_t *status); 01590 01591 01592 /** @since New in 1.2. 01593 * 01594 * Set @a *editor and @a *edit_baton to an editor that generates @c 01595 * svn_wc_status2_t structures and sends them through @a status_func / 01596 * @a status_baton. @a anchor is an access baton, with a tree lock, 01597 * for the local path to the working copy which will be used as the 01598 * root of our editor. If @a target is not empty, it represents an 01599 * entry in the @a anchor path which is the subject of the editor 01600 * drive (otherwise, the @a anchor is the subject). 01601 * 01602 * If @a set_locks_baton is non-@c NULL, it will be set to a baton that can 01603 * be used in a call to the @c svn_wc_status_set_repos_locks function. 01604 * 01605 * Callers drive this editor to describe working copy out-of-dateness 01606 * with respect to the repository. If this information is not 01607 * available or not desired, callers should simply call the 01608 * close_edit() function of the @a editor vtable. 01609 * 01610 * If the editor driver calls @a editor's set_target_revision() vtable 01611 * function, then when the edit drive is completed, @a *edit_revision 01612 * will contain the revision delivered via that interface, and any 01613 * status items reported during the drive will have their @c repos_rev 01614 * field set to this same revision. 01615 * 01616 * @a config is a hash mapping @c SVN_CONFIG_CATEGORY's to @c 01617 * svn_config_t's. 01618 * 01619 * Assuming the target is a directory, then: 01620 * 01621 * - If @a get_all is false, then only locally-modified entries will be 01622 * returned. If true, then all entries will be returned. 01623 * 01624 * - If @a recurse is false, status structures will be returned only 01625 * for the target and its immediate children. Otherwise, this 01626 * operation is fully recursive. 01627 * 01628 * If @a no_ignore is set, statuses that would typically be ignored 01629 * will instead be reported. 01630 * 01631 * If @a cancel_func is non-null, call it with @a cancel_baton while building 01632 * the @a statushash to determine if the client has cancelled the operation. 01633 * 01634 * If @a traversal_info is non-null, then record pre-update traversal 01635 * state in it. (Caller should obtain @a traversal_info from 01636 * @c svn_wc_init_traversal_info.) 01637 * 01638 * Allocate the editor itself in @a pool, but the editor does temporary 01639 * allocations in a subpool of @a pool. 01640 */ 01641 svn_error_t *svn_wc_get_status_editor2 (const svn_delta_editor_t **editor, 01642 void **edit_baton, 01643 void **set_locks_baton, 01644 svn_revnum_t *edit_revision, 01645 svn_wc_adm_access_t *anchor, 01646 const char *target, 01647 apr_hash_t *config, 01648 svn_boolean_t recurse, 01649 svn_boolean_t get_all, 01650 svn_boolean_t no_ignore, 01651 svn_wc_status_func2_t status_func, 01652 void *status_baton, 01653 svn_cancel_func_t cancel_func, 01654 void *cancel_baton, 01655 svn_wc_traversal_info_t *traversal_info, 01656 apr_pool_t *pool); 01657 01658 01659 /** @deprecated Provided for backwards compatibility with the 1.1 API. 01660 * 01661 * Same as svn_wc_get_status_editor2, but with @a set_locks_baton set 01662 * to @c NULL, and taking a deprecated svn_wc_status_func_t argument. */ 01663 svn_error_t *svn_wc_get_status_editor (const svn_delta_editor_t **editor, 01664 void **edit_baton, 01665 svn_revnum_t *edit_revision, 01666 svn_wc_adm_access_t *anchor, 01667 const char *target, 01668 apr_hash_t *config, 01669 svn_boolean_t recurse, 01670 svn_boolean_t get_all, 01671 svn_boolean_t no_ignore, 01672 svn_wc_status_func_t status_func, 01673 void *status_baton, 01674 svn_cancel_func_t cancel_func, 01675 void *cancel_baton, 01676 svn_wc_traversal_info_t *traversal_info, 01677 apr_pool_t *pool); 01678 01679 01680 /** @since New in 1.2. 01681 * 01682 * Associate @a locks, a hash table mapping <tt>const char*</tt> 01683 * absolute repository paths to <tt>svn_lock_t</tt> objects, with a 01684 * @a set_locks_baton returned by an earlier call to 01685 * @c svn_wc_get_status_editor2. @a repos_root is the repository root URL. 01686 * Perform all allocations in @a pool. 01687 * 01688 * @note @a locks will not be copied, so it must be valid throughout the 01689 * edit. @a pool must also not be destroyed or cleared before the edit is 01690 * finished. 01691 */ 01692 svn_error_t * 01693 svn_wc_status_set_repos_locks (void *set_locks_baton, 01694 apr_hash_t *locks, 01695 const char *repos_root, 01696 apr_pool_t *pool); 01697 01698 /** @} */ 01699 01700 01701 /** @since New in 1.2. 01702 * 01703 * Copy @a src to @a dst_basename in @a dst_parent, and schedule 01704 * @a dst_basename for addition to the repository, remembering the copy 01705 * history. 01706 * 01707 * @a src must be a file or directory under version control; @a dst_parent 01708 * must be a directory under version control in the same working copy; 01709 * @a dst_basename will be the name of the copied item, and it must not 01710 * exist already. 01711 * 01712 * If @a cancel_func is non-null, call it with @a cancel_baton at 01713 * various points during the operation. If it returns an error 01714 * (typically @c SVN_ERR_CANCELLED), return that error immediately. 01715 * 01716 * For each file or directory copied, @a notify_func will be called 01717 * with its path and the @a notify_baton. @a notify_func may be @c NULL 01718 * if you are not interested in this information. 01719 * 01720 * Important: this is a variant of @c svn_wc_add. No changes will happen 01721 * to the repository until a commit occurs. This scheduling can be 01722 * removed with @c svn_client_revert. 01723 */ 01724 svn_error_t *svn_wc_copy2 (const char *src, 01725 svn_wc_adm_access_t *dst_parent, 01726 const char *dst_basename, 01727 svn_cancel_func_t cancel_func, 01728 void *cancel_baton, 01729 svn_wc_notify_func2_t notify_func, 01730 void *notify_baton, 01731 apr_pool_t *pool); 01732 01733 /** @deprecated Provided for backwards compatibility with the 1.1 API. 01734 * 01735 * Similar to @c svn_wc_copy2, but takes an @c svn_wc_notify_func_t instead. 01736 */ 01737 svn_error_t *svn_wc_copy (const char *src, 01738 svn_wc_adm_access_t *dst_parent, 01739 const char *dst_basename, 01740 svn_cancel_func_t cancel_func, 01741 void *cancel_baton, 01742 svn_wc_notify_func_t notify_func, 01743 void *notify_baton, 01744 apr_pool_t *pool); 01745 01746 /** @since New in 1.2. 01747 * 01748 * Schedule @a path for deletion, it will be deleted from the repository on 01749 * the next commit. If @a path refers to a directory, then a recursive 01750 * deletion will occur. @a adm_access must hold a write lock for the parent 01751 * of @a path. 01752 * 01753 * This function immediately deletes all files, modified and unmodified, 01754 * versioned and unversioned from the working copy. It also immediately 01755 * deletes unversioned directories and directories that are scheduled to be 01756 * added. Only versioned directories will remain in the working copy, 01757 * these get deleted by the update following the commit. 01758 * 01759 * If @a cancel_func is non-null, call it with @a cancel_baton at 01760 * various points during the operation. If it returns an error 01761 * (typically @c SVN_ERR_CANCELLED), return that error immediately. 01762 * 01763 * For each path marked for deletion, @a notify_func will be called with 01764 * the @a notify_baton and that path. The @a notify_func callback may be 01765 * @c NULL if notification is not needed. 01766 */ 01767 svn_error_t *svn_wc_delete2 (const char *path, 01768 svn_wc_adm_access_t *adm_access, 01769 svn_cancel_func_t cancel_func, 01770 void *cancel_baton, 01771 svn_wc_notify_func2_t notify_func, 01772 void *notify_baton, 01773 apr_pool_t *pool); 01774 01775 /** @deprecated Provided for backwards compatibility with the 1.1 API. 01776 * 01777 * Similar to @c svn_wc_delete2, but takes an @c svn_wc_notify_func_t instead. 01778 */ 01779 svn_error_t *svn_wc_delete (const char *path, 01780 svn_wc_adm_access_t *adm_access, 01781 svn_cancel_func_t cancel_func, 01782 void *cancel_baton, 01783 svn_wc_notify_func_t notify_func, 01784 void *notify_baton, 01785 apr_pool_t *pool); 01786 01787 01788 /** @since New in 1.2. 01789 * 01790 * Put @a path under version control by adding an entry in its parent, 01791 * and, if @a path is a directory, adding an administrative area. The 01792 * new entry and anything under it is scheduled for addition to the 01793 * repository. @a parent_access should hold a write lock for the parent 01794 * directory of @a path. If @a path is a directory then an access baton 01795 * for @a path will be added to the set containing @a parent_access. 01796 * 01797 * If @a path does not exist, return @c SVN_ERR_WC_PATH_NOT_FOUND. 01798 * 01799 * If @a copyfrom_url is non-null, it and @a copyfrom_rev are used as 01800 * `copyfrom' args. This is for copy operations, where one wants 01801 * to schedule @a path for addition with a particular history. 01802 * 01803 * If @a cancel_func is non-null, call it with @a cancel_baton at 01804 * various points during the operation. If it returns an error 01805 * (typically @c SVN_ERR_CANCELLED), return that error immediately. 01806 * 01807 * When the @a path has been added, then @a notify_func will be called 01808 * (if it is not @c NULL) with the @a notify_baton and the path. 01809 * 01810 * Return @c SVN_ERR_WC_NODE_KIND_CHANGE if @a path is both an unversioned 01811 * directory and a file that is scheduled for deletion or in state deleted. 01812 * 01813 *<pre> ### This function currently does double duty -- it is also 01814 * ### responsible for "switching" a working copy directory over to a 01815 * ### new copyfrom ancestry and scheduling it for addition. Here is 01816 * ### the old doc string from Ben, lightly edited to bring it 01817 * ### up-to-date, explaining the true, secret life of this function:</pre> 01818 * 01819 * Given a @a path within a working copy of type KIND, follow this algorithm: 01820 * 01821 * - if @a path is not under version control: 01822 * - Place it under version control and schedule for addition; 01823 * if @a copyfrom_url is non-null, use it and @a copyfrom_rev as 01824 * 'copyfrom' history 01825 * 01826 * - if @a path is already under version control: 01827 * (This can only happen when a directory is copied, in which 01828 * case ancestry must have been supplied as well.) 01829 * 01830 * - Schedule the directory itself for addition with copyfrom history. 01831 * - Mark all its children with a 'copied' flag 01832 * - Rewrite all the URLs to what they will be after a commit. 01833 * - ### TODO: remove old wcprops too, see the '###'below 01834 * 01835 *<pre> ### I think possibly the "switchover" functionality should be 01836 * ### broken out into a separate function, but its all intertwined in 01837 * ### the code right now. Ben, thoughts? Hard? Easy? Mauve?</pre> 01838 * 01839 * ### Update: see "###" comment in svn_wc_add_repos_file()'s doc 01840 * string about this. 01841 */ 01842 svn_error_t *svn_wc_add2 (const char *path, 01843 svn_wc_adm_access_t *parent_access, 01844 const char *copyfrom_url, 01845 svn_revnum_t copyfrom_rev, 01846 svn_cancel_func_t cancel_func, 01847 void *cancel_baton, 01848 svn_wc_notify_func2_t notify_func, 01849 void *notify_baton, 01850 apr_pool_t *pool); 01851 01852 /** @deprecated Provided for backwards compatibility with the 1.1 API. 01853 * 01854 * Similar to @c svn_wc_add2, but takes an @c svn_wc_notify_func_t instead. 01855 */ 01856 svn_error_t *svn_wc_add (const char *path, 01857 svn_wc_adm_access_t *parent_access, 01858 const char *copyfrom_url, 01859 svn_revnum_t copyfrom_rev, 01860 svn_cancel_func_t cancel_func, 01861 void *cancel_baton, 01862 svn_wc_notify_func_t notify_func, 01863 void *notify_baton, 01864 apr_pool_t *pool); 01865 01866 /** Add a file to a working copy at @a dst_path, obtaining the file's 01867 * contents from @a new_text_path and its properties from @a new_props, 01868 * which normally come from the repository file represented by the 01869 * copyfrom args, see below. The new file will be scheduled for 01870 * addition with history. 01871 * 01872 * Automatically remove @a new_text_path upon successful completion. 01873 * 01874 * @a adm_access, or an access baton in its associated set, must 01875 * contain a write lock for the parent of @a dst_path. 01876 * 01877 * If @a copyfrom_url is non-null, then @a copyfrom_rev must be a 01878 * valid revision number, and together they are the copyfrom history 01879 * for the new file. 01880 * 01881 * Use @a pool for temporary allocations. 01882 * 01883 * ### This function is very redundant with svn_wc_add(). Ideally, 01884 * we'd merge them, so that svn_wc_add() would just take optional 01885 * new_props and optional copyfrom information. That way it could be 01886 * used for both 'svn add somefilesittingonmydisk' and for adding 01887 * files from repositories, with or without copyfrom history. 01888 * 01889 * The problem with this Ideal Plan is that svn_wc_add() also takes 01890 * care of recursive URL-rewriting. There's a whole comment in its 01891 * doc string about how that's really weird, outside its core mission, 01892 * etc, etc. So another part of the Ideal Plan is that that 01893 * functionality of svn_wc_add() would move into a separate function. 01894 */ 01895 svn_error_t *svn_wc_add_repos_file (const char *dst_path, 01896 svn_wc_adm_access_t *adm_access, 01897 const char *new_text_path, 01898 apr_hash_t *new_props, 01899 const char *copyfrom_url, 01900 svn_revnum_t copyfrom_rev, 01901 apr_pool_t *pool); 01902 01903 01904 /** Remove entry @a name in @a adm_access from revision control. @a name 01905 * must be either a file or @c SVN_WC_ENTRY_THIS_DIR. @a adm_access must 01906 * hold a write lock. 01907 * 01908 * If @a name is a file, all its info will be removed from @a adm_access's 01909 * administrative directory. If @a name is @c SVN_WC_ENTRY_THIS_DIR, then 01910 * @a adm_access's entire administrative area will be deleted, along with 01911 * *all* the administrative areas anywhere in the tree below @a adm_access. 01912 * 01913 * Normally, only administrative data is removed. However, if 01914 * @a destroy_wf is true, then all working file(s) and dirs are deleted 01915 * from disk as well. When called with @a destroy_wf, any locally 01916 * modified files will *not* be deleted, and the special error 01917 * @c SVN_ERR_WC_LEFT_LOCAL_MOD might be returned. (Callers only need to 01918 * check for this special return value if @a destroy_wf is true.) 01919 * 01920 * If @a instant_error is TRUE, then return @c 01921 * SVN_ERR_WC_LEFT_LOCAL_MOD the instant a locally modified file is 01922 * encountered. Otherwise, leave locally modified files in place and 01923 * return the error only after all the recursion is complete. 01924 01925 * If @a cancel_func is non-null, call it with @a cancel_baton at 01926 * various points during the removal. If it returns an error 01927 * (typically @c SVN_ERR_CANCELLED), return that error immediately. 01928 * 01929 * WARNING: This routine is exported for careful, measured use by 01930 * libsvn_client. Do *not* call this routine unless you really 01931 * understand what the heck you're doing. 01932 */ 01933 svn_error_t * 01934 svn_wc_remove_from_revision_control (svn_wc_adm_access_t *adm_access, 01935 const char *name, 01936 svn_boolean_t destroy_wf, 01937 svn_boolean_t instant_error, 01938 svn_cancel_func_t cancel_func, 01939 void *cancel_baton, 01940 apr_pool_t *pool); 01941 01942 01943 /** 01944 * @since New in 1.2. 01945 * 01946 * Assuming @a path is under version control and in a state of conflict, 01947 * then take @a path *out* of this state. If @a resolve_text is true then 01948 * any text conflict is resolved, if @a resolve_props is true then any 01949 * property conflicts are resolved. If @a recurse is true, then search 01950 * recursively for conflicts to resolve. 01951 * 01952 * @a adm_access is an access baton, with a write lock, for @a path. 01953 * 01954 * Needless to say, this function doesn't touch conflict markers or 01955 * anything of that sort -- only a human can semantically resolve a 01956 * conflict. Instead, this function simply marks a file as "having 01957 * been resolved", clearing the way for a commit. 01958 * 01959 * The implementation details are opaque, as our "conflicted" criteria 01960 * might change over time. (At the moment, this routine removes the 01961 * three fulltext 'backup' files and any .prej file created in a conflict, 01962 * and modifies @a path's entry.) 01963 * 01964 * If @a path is not under version control, return @c SVN_ERR_ENTRY_NOT_FOUND. 01965 * If @a path isn't in a state of conflict to begin with, do nothing, and 01966 * return @c SVN_NO_ERROR. 01967 * 01968 * If @c path was successfully taken out of a state of conflict, report this 01969 * information to @c notify_func (if non-@c NULL.) If only text or only 01970 * property conflict resolution was requested, and it was successful, then 01971 * success gets reported. 01972 */ 01973 svn_error_t *svn_wc_resolved_conflict2 (const char *path, 01974 svn_wc_adm_access_t *adm_access, 01975 svn_boolean_t resolve_text, 01976 svn_boolean_t resolve_props, 01977 svn_boolean_t recurse, 01978 svn_wc_notify_func2_t notify_func, 01979 void *notify_baton, 01980 svn_cancel_func_t cancel_func, 01981 void *cancel_baton, 01982 apr_pool_t *pool); 01983 01984 /** 01985 * @deprecated Provided for backward compatibility with the 1.0 API. 01986 * 01987 * Similar to svn_wc_resolved_conflict2(), but takes an 01988 * svn_wc_notify_func_t and doesn't have cancellation support. 01989 */ 01990 svn_error_t *svn_wc_resolved_conflict (const char *path, 01991 svn_wc_adm_access_t *adm_access, 01992 svn_boolean_t resolve_text, 01993 svn_boolean_t resolve_props, 01994 svn_boolean_t recurse, 01995 svn_wc_notify_func_t notify_func, 01996 void *notify_baton, 01997 apr_pool_t *pool); 01998 01999 02000 /* Commits. */ 02001 02002 /** @since New in 1.2. 02003 * Bump a successfully committed absolute @a path to @a new_revnum after a 02004 * commit succeeds. @a rev_date and @a rev_author are the (server-side) 02005 * date and author of the new revision; one or both may be @c NULL. 02006 * @a adm_access must hold a write lock appropriate for @a path. 02007 * 02008 * If non-null, @a wcprops is an array of <tt>svn_prop_t *</tt> changes to 02009 * wc properties; if an @c svn_prop_t->value is null, then that property is 02010 * deleted. 02011 * 02012 * If @a remove_lock is @c TRUE, any entryprops related to a repository 02013 * lock will be removed. 02014 * 02015 * If @a recurse is true and @a path is a directory, then bump every 02016 * versioned object at or under @a path. This is usually done for 02017 * copied trees. 02018 */ 02019 svn_error_t *svn_wc_process_committed2 (const char *path, 02020 svn_wc_adm_access_t *adm_access, 02021 svn_boolean_t recurse, 02022 svn_revnum_t new_revnum, 02023 const char *rev_date, 02024 const char *rev_author, 02025 apr_array_header_t *wcprop_changes, 02026 svn_boolean_t remove_lock, 02027 apr_pool_t *pool); 02028 02029 02030 /** @deprecated Provided for backwards compability with the 1.1 API. 02031 * 02032 * Similar to @c svn_wc_process_committed2, but with @a remove_lock set to 02033 * @a FALSE. */ 02034 svn_error_t *svn_wc_process_committed (const char *path, 02035 svn_wc_adm_access_t *adm_access, 02036 svn_boolean_t recurse, 02037 svn_revnum_t new_revnum, 02038 const char *rev_date, 02039 const char *rev_author, 02040 apr_array_header_t *wcprop_changes, 02041 apr_pool_t *pool); 02042 02043 02044 02045 02046 02047 /** @since New in 1.2. 02048 * 02049 * Do a depth-first crawl in a working copy, beginning at @a path. 02050 * 02051 * Communicate the `state' of the working copy's revisions to 02052 * @a reporter/@a report_baton. Obviously, if @a path is a file instead 02053 * of a directory, this depth-first crawl will be a short one. 02054 * 02055 * No locks are or logs are created, nor are any animals harmed in the 02056 * process. No cleanup is necessary. @a adm_access must be an access 02057 * baton for the @a path hierarchy, it does not require a write lock. 02058 * 02059 * After all revisions are reported, @a reporter->finish_report() is 02060 * called, which immediately causes the RA layer to update the working 02061 * copy. Thus the return value may very well reflect the result of 02062 * the update! 02063 * 02064 * If @a restore_files is true, then unexpectedly missing working files 02065 * will be restored from the administrative directory's cache. For each 02066 * file restored, the @a notify_func function will be called with the 02067 * @a notify_baton and the path of the restored file. @a notify_func may 02068 * be @c NULL if this notification is not required. If @a 02069 * use_commit_times is true, then set restored files' timestamps to 02070 * their last-commit-times. 02071 * 02072 * If @a traversal_info is non-null, then record pre-update traversal 02073 * state in it. (Caller should obtain @a traversal_info from 02074 * @c svn_wc_init_traversal_info.) 02075 */ 02076 svn_error_t * 02077 svn_wc_crawl_revisions2 (const char *path, 02078 svn_wc_adm_access_t *adm_access, 02079 const svn_ra_reporter2_t *reporter, 02080 void *report_baton, 02081 svn_boolean_t restore_files, 02082 svn_boolean_t recurse, 02083 svn_boolean_t use_commit_times, 02084 svn_wc_notify_func2_t notify_func, 02085 void *notify_baton, 02086 svn_wc_traversal_info_t *traversal_info, 02087 apr_pool_t *pool); 02088 02089 /** @deprecated Provided for backwards compatibility with the 1.1 API. 02090 * 02091 * Similar to @c svn_wc_crawl_revisions2, but takes an svn_wc_notify_func_t 02092 * and a @c svn_reporter_t instead. 02093 */ 02094 svn_error_t * 02095 svn_wc_crawl_revisions (const char *path, 02096 svn_wc_adm_access_t *adm_access, 02097 const svn_ra_reporter_t *reporter, 02098 void *report_baton, 02099 svn_boolean_t restore_files, 02100 svn_boolean_t recurse, 02101 svn_boolean_t use_commit_times, 02102 svn_wc_notify_func_t notify_func, 02103 void *notify_baton, 02104 svn_wc_traversal_info_t *traversal_info, 02105 apr_pool_t *pool); 02106 02107 02108 /* Updates. */ 02109 02110 /** Set @a *wc_root to @c TRUE if @a path represents a "working copy root", 02111 * @c FALSE otherwise. Use @a pool for any intermediate allocations. 02112 * 02113 * If @a path is not found, return the error @c SVN_ERR_ENTRY_NOT_FOUND. 02114 * 02115 * NOTE: Due to the way in which "WC-root-ness" is calculated, passing 02116 * a @a path of `.' to this function will always return @c TRUE. 02117 */ 02118 svn_error_t *svn_wc_is_wc_root (svn_boolean_t *wc_root, 02119 const char *path, 02120 svn_wc_adm_access_t *adm_access, 02121 apr_pool_t *pool); 02122 02123 02124 /** Conditionally split @a path into an @a anchor and @a target for the 02125 * purpose of updating and committing. 02126 * 02127 * @a anchor is the directory at which the update or commit editor 02128 * should be rooted. 02129 * 02130 * @a target is the actual subject (relative to the @a anchor) of the 02131 * update/commit, or "" if the @a anchor itself is the subject. 02132 * 02133 * Allocate @a anchor and @a target in @a pool. 02134 */ 02135 svn_error_t *svn_wc_get_actual_target (const char *path, 02136 const char **anchor, 02137 const char **target, 02138 apr_pool_t *pool); 02139 02140 02141 02142 /* Update and update-like functionality. */ 02143 02144 /** @since New in 1.2. 02145 * 02146 * Set @a *editor and @a *edit_baton to an editor and baton for updating a 02147 * working copy. 02148 * 02149 * If @a ti is non-null, record traversal info in @a ti, for use by 02150 * post-traversal accessors such as @c svn_wc_edited_externals(). 02151 * 02152 * @a anchor is an access baton, with a write lock, for the local path to the 02153 * working copy which will be used as the root of our editor. Further 02154 * locks will be acquired if the update creates new directories. All 02155 * locks, both those in @a anchor and newly acquired ones, will be released 02156 * when the editor driver calls @c close_edit. 02157 * 02158 * @a target is the entry in @a anchor that will actually be updated, or 02159 * empty if all of @a anchor should be updated. 02160 * 02161 * The editor invokes @a notify_func with @a notify_baton as the update 02162 * progresses, if @a notify_func is non-null. 02163 * 02164 * If @a cancel_func is non-null, the editor will invoke @a cancel_func with 02165 * @a cancel_baton as the update progresses to see if it should continue. 02166 * 02167 * If @a diff3_cmd is non-null, then use it as the diff3 command for 02168 * any merging; otherwise, use the built-in merge code. 02169 * 02170 * @a target_revision is a pointer to a revision location which, after 02171 * successful completion of the drive of this editor, will be 02172 * populated with the revision to which the working copy was updated. 02173 * 02174 * If @a use_commit_times is TRUE, then all edited/added files will 02175 * have their working timestamp set to the last-committed-time. If 02176 * FALSE, the working files will be touched with the 'now' time. 02177 * 02178 */ 02179 svn_error_t *svn_wc_get_update_editor2 (svn_revnum_t *target_revision, 02180 svn_wc_adm_access_t *anchor, 02181 const char *target, 02182 svn_boolean_t use_commit_times, 02183 svn_boolean_t recurse, 02184 svn_wc_notify_func2_t notify_func, 02185 void *notify_baton, 02186 svn_cancel_func_t cancel_func, 02187 void *cancel_baton, 02188 const char *diff3_cmd, 02189 const svn_delta_editor_t **editor, 02190 void **edit_baton, 02191 svn_wc_traversal_info_t *ti, 02192 apr_pool_t *pool); 02193 02194 /** @deprecated Provided for backwards compatibility with the 1.1 API. 02195 * 02196 * Similar to @c svn_wc_get_update_editor, but takes an svn_wc_notify_func_t 02197 * instead. 02198 */ 02199 svn_error_t *svn_wc_get_update_editor (svn_revnum_t *target_revision, 02200 svn_wc_adm_access_t *anchor, 02201 const char *target, 02202 svn_boolean_t use_commit_times, 02203 svn_boolean_t recurse, 02204 svn_wc_notify_func_t notify_func, 02205 void *notify_baton, 02206 svn_cancel_func_t cancel_func, 02207 void *cancel_baton, 02208 const char *diff3_cmd, 02209 const svn_delta_editor_t **editor, 02210 void **edit_baton, 02211 svn_wc_traversal_info_t *ti, 02212 apr_pool_t *pool); 02213 02214 /** @since New in 1.2. 02215 * 02216 * A variant of @c svn_wc_get_update_editor(). 02217 * 02218 * Set @a *editor and @a *edit_baton to an editor and baton for "switching" 02219 * a working copy to a new @a switch_url. (Right now, this URL must be 02220 * within the same repository that the working copy already comes 02221 * from.) @a switch_url must not be @c NULL. 02222 * 02223 * If @a ti is non-null, record traversal info in @a ti, for use by 02224 * post-traversal accessors such as @c svn_wc_edited_externals(). 02225 * 02226 * @a anchor is an access baton, with a write lock, for the local path to the 02227 * working copy which will be used as the root of our editor. Further 02228 * locks will be acquired if the switch creates new directories. All 02229 * locks, both those in @a anchor and newly acquired ones, will be released 02230 * when the editor driver calls @c close_edit. 02231 * 02232 * @a target is the entry in @a anchor that will actually be updated, or 02233 * empty if all of @a anchor should be updated. 02234 * 02235 * The editor invokes @a notify_func with @a notify_baton as the switch 02236 * progresses, if @a notify_func is non-null. 02237 * 02238 * If @a cancel_func is non-null, it will be called with @a cancel_baton as 02239 * the switch progresses to determine if it should continue. 02240 * 02241 * If @a diff3_cmd is non-null, then use it as the diff3 command for 02242 * any merging; otherwise, use the built-in merge code. 02243 * 02244 * @a target_revision is a pointer to a revision location which, after 02245 * successful completion of the drive of this editor, will be 02246 * populated with the revision to which the working copy was updated. 02247 * 02248 * If @a use_commit_times is TRUE, then all edited/added files will 02249 * have their working timestamp set to the last-committed-time. If 02250 * FALSE, the working files will be touched with the 'now' time. 02251 * 02252 */ 02253 svn_error_t *svn_wc_get_switch_editor2 (svn_revnum_t *target_revision, 02254 svn_wc_adm_access_t *anchor, 02255 const char *target, 02256 const char *switch_url, 02257 svn_boolean_t use_commit_times, 02258 svn_boolean_t recurse, 02259 svn_wc_notify_func2_t notify_func, 02260 void *notify_baton, 02261 svn_cancel_func_t cancel_func, 02262 void *cancel_baton, 02263 const char *diff3_cmd, 02264 const svn_delta_editor_t **editor, 02265 void **edit_baton, 02266 svn_wc_traversal_info_t *ti, 02267 apr_pool_t *pool); 02268 02269 /** @deprecated Provided for backwards compatibility with the 1.2 API. 02270 * 02271 * Similar to @c svn_wc_get_switch_editor, but takes an @c svn_wc_notify_func_t 02272 * instead. 02273 */ 02274 svn_error_t *svn_wc_get_switch_editor (svn_revnum_t *target_revision, 02275 svn_wc_adm_access_t *anchor, 02276 const char *target, 02277 const char *switch_url, 02278 svn_boolean_t use_commit_times, 02279 svn_boolean_t recurse, 02280 svn_wc_notify_func_t notify_func, 02281 void *notify_baton, 02282 svn_cancel_func_t cancel_func, 02283 void *cancel_baton, 02284 const char *diff3_cmd, 02285 const svn_delta_editor_t **editor, 02286 void **edit_baton, 02287 svn_wc_traversal_info_t *ti, 02288 apr_pool_t *pool); 02289 02290 02291 02292 /* A word about the implementation of working copy property storage: 02293 * 02294 * Since properties are key/val pairs, you'd think we store them in 02295 * some sort of Berkeley DB-ish format, and even store pending changes 02296 * to them that way too. 02297 * 02298 * However, we already have libsvn_subr/hashdump.c working, and it 02299 * uses a human-readable format. That will be very handy when we're 02300 * debugging, and presumably we will not be dealing with any huge 02301 * properties or property lists initially. Therefore, we will 02302 * continue to use hashdump as the internal mechanism for storing and 02303 * reading from property lists, but note that the interface here is 02304 * _not_ dependent on that. We can swap in a DB-based implementation 02305 * at any time and users of this library will never know the 02306 * difference. 02307 */ 02308 02309 /** Set @a *props to a hash table mapping <tt>char *</tt> names onto 02310 * <tt>svn_string_t *</tt> values for all the regular properties of 02311 * @a path. Allocate the table, names, and values in @a pool. If 02312 * the node has no properties, an empty hash is returned. @a adm_access 02313 * is an access baton set that contains @a path. 02314 */ 02315 svn_error_t *svn_wc_prop_list (apr_hash_t **props, 02316 const char *path, 02317 svn_wc_adm_access_t *adm_access, 02318 apr_pool_t *pool); 02319 02320 02321 /** Set @a *value to the value of property @a name for @a path, allocating 02322 * @a *value in @a pool. If no such prop, set @a *value to @c NULL. 02323 * @a name may be a regular or wc property; if it is an entry property, 02324 * return the error @c SVN_ERR_BAD_PROP_KIND. @a adm_access is an access 02325 * baton set that contains @a path. 02326 */ 02327 svn_error_t *svn_wc_prop_get (const svn_string_t **value, 02328 const char *name, 02329 const char *path, 02330 svn_wc_adm_access_t *adm_access, 02331 apr_pool_t *pool); 02332 02333 /** 02334 * @since New in 1.2. 02335 * 02336 * Set property @a name to @a value for @a path, or if @a value is 02337 * null, remove property @a name from @a path. @a adm_access is an 02338 * access baton with a write lock for @a path. 02339 * 02340 * If @a skip_checks is true, do no validity checking. But if @a 02341 * skip_checks is false, and @a name is not a valid property for @a 02342 * path, return an error, either @c SVN_ERR_ILLEGAL_TARGET (if the 02343 * property is not appropriate for @a path), or @c 02344 * SVN_ERR_BAD_MIME_TYPE (if @a name is "svn:mime-type", but @a value 02345 * is not a valid mime-type). 02346 * 02347 * @a name may be a wc property or a regular property; but if it is an 02348 * entry property, return the error @c SVN_ERR_BAD_PROP_KIND, even if 02349 * @a skip_checks is true. 02350 * 02351 * Use @a pool for temporary allocation. 02352 */ 02353 svn_error_t *svn_wc_prop_set2 (const char *name, 02354 const svn_string_t *value, 02355 const char *path, 02356 svn_wc_adm_access_t *adm_access, 02357 svn_boolean_t skip_checks, 02358 apr_pool_t *pool); 02359 02360 02361 /** 02362 * @deprecated Provided for backward compatibility with the 1.1 API. 02363 * 02364 * Like svn_wc_prop_set2(), but with @a skip_checks always false. 02365 */ 02366 svn_error_t *svn_wc_prop_set (const char *name, 02367 const svn_string_t *value, 02368 const char *path, 02369 svn_wc_adm_access_t *adm_access, 02370 apr_pool_t *pool); 02371 02372 02373 /** Return true iff @a name is a 'normal' property name. 'Normal' is 02374 * defined as a user-visible and user-tweakable property that shows up 02375 * when you fetch a proplist. 02376 * 02377 * The function currently parses the namespace like so: 02378 * 02379 * - 'svn:wc:' ==> a wcprop, stored/accessed separately via different API. 02380 * 02381 * - 'svn:entry:' ==> an "entry" prop, shunted into the 'entries' file. 02382 * 02383 * If these patterns aren't found, then the property is assumed to be 02384 * Normal. 02385 */ 02386 svn_boolean_t svn_wc_is_normal_prop (const char *name); 02387 02388 02389 02390 /** Return true iff @a name is a 'wc' property name. */ 02391 svn_boolean_t svn_wc_is_wc_prop (const char *name); 02392 02393 /** Return true iff @a name is a 'entry' property name. */ 02394 svn_boolean_t svn_wc_is_entry_prop (const char *name); 02395 02396 02397 02398 02399 /* Diffs */ 02400 02401 02402 /** 02403 * @since New in 1.2. 02404 * 02405 * Return an @a editor/@a edit_baton for diffing a working copy against the 02406 * repository. 02407 * 02408 * @a anchor/@a target represent the base of the hierarchy to be compared. 02409 * 02410 * @a callbacks/@a callback_baton is the callback table to use when two 02411 * files are to be compared. 02412 * 02413 * @a recurse determines whether to descend into subdirectories when @a target 02414 * is a directory. If @a recurse is @c TRUE then @a anchor should be part of 02415 * an access baton set for the @a target hierarchy. 02416 * 02417 * @a ignore_ancestry determines whether paths that have discontinuous node 02418 * ancestry are treated as delete/add or as simple modifications. If 02419 * @a ignore_ancestry is @c FALSE, then any discontinuous node ancestry will 02420 * result in the diff given as a full delete followed by an add. 02421 * 02422 * If @a use_text_base is true, then compare the repository against 02423 * the working copy's text-base files, rather than the working files. 02424 * 02425 * Normally, the difference from repository->working_copy is shown. 02426 * If @ reverse_order is true, then show working_copy->repository diffs. 02427 * 02428 * If @a cancel_func is non-null, it will be used along with @a cancel_baton 02429 * to periodically check if the client has canceled the operation. 02430 */ 02431 svn_error_t *svn_wc_get_diff_editor3 (svn_wc_adm_access_t *anchor, 02432 const char *target, 02433 const svn_wc_diff_callbacks2_t *callbacks, 02434 void *callback_baton, 02435 svn_boolean_t recurse, 02436 svn_boolean_t ignore_ancestry, 02437 svn_boolean_t use_text_base, 02438 svn_boolean_t reverse_order, 02439 svn_cancel_func_t cancel_func, 02440 void *cancel_baton, 02441 const svn_delta_editor_t **editor, 02442 void **edit_baton, 02443 apr_pool_t *pool); 02444 02445 02446 /** 02447 * @deprecated Provided for backward compatibility with the 1.1 API. 02448 * 02449 * Similar to @c svn_wc_get_diff_editor3(), but with an 02450 * @c svn_wc_diff_callbacks_t instead of @c svn_wc_diff_callbacks2_t. */ 02451 svn_error_t *svn_wc_get_diff_editor2 (svn_wc_adm_access_t *anchor, 02452 const char *target, 02453 const svn_wc_diff_callbacks_t *callbacks, 02454 void *callback_baton, 02455 svn_boolean_t recurse, 02456 svn_boolean_t ignore_ancestry, 02457 svn_boolean_t use_text_base, 02458 svn_boolean_t reverse_order, 02459 svn_cancel_func_t cancel_func, 02460 void *cancel_baton, 02461 const svn_delta_editor_t **editor, 02462 void **edit_baton, 02463 apr_pool_t *pool); 02464 02465 02466 /** 02467 * @deprecated Provided for backward compatibility with the 1.0 API. 02468 * 02469 * Similar to svn_wc_get_diff_editor2(), but with @a ignore_ancestry 02470 * always set to @c FALSE. 02471 */ 02472 svn_error_t *svn_wc_get_diff_editor (svn_wc_adm_access_t *anchor, 02473 const char *target, 02474 const svn_wc_diff_callbacks_t *callbacks, 02475 void *callback_baton, 02476 svn_boolean_t recurse, 02477 svn_boolean_t use_text_base, 02478 svn_boolean_t reverse_order, 02479 svn_cancel_func_t cancel_func, 02480 void *cancel_baton, 02481 const svn_delta_editor_t **editor, 02482 void **edit_baton, 02483 apr_pool_t *pool); 02484 02485 02486 /** 02487 * @since New in 1.2. 02488 * 02489 * Compare working copy against the text-base. 02490 * 02491 * @a anchor/@a target represent the base of the hierarchy to be compared. 02492 * 02493 * @a callbacks/@a callback_baton is the callback table to use when two 02494 * files are to be compared. 02495 * 02496 * @a recurse determines whether to descend into subdirectories when @a target 02497 * is a directory. If @a recurse is @c TRUE then @a anchor should be part of 02498 * an access baton set for the @a target hierarchy. 02499 * 02500 * @a ignore_ancestry determines whether paths that have discontinuous node 02501 * ancestry are treated as delete/add or as simple modifications. If 02502 * @a ignore_ancestry is @c FALSE, then any discontinuous node ancestry will 02503 * result in the diff given as a full delete followed by an add. 02504 */ 02505 svn_error_t *svn_wc_diff3 (svn_wc_adm_access_t *anchor, 02506 const char *target, 02507 const svn_wc_diff_callbacks2_t *callbacks, 02508 void *callback_baton, 02509 svn_boolean_t recurse, 02510 svn_boolean_t ignore_ancestry, 02511 apr_pool_t *pool); 02512 02513 /** 02514 * @deprecated Provided for backward compatibility with the 1.1 API. 02515 * 02516 * Similar to @c svn_wc_diff3, but with a @c svn_wc_diff_callbacks_t argument 02517 * instead of @c svn_wc_diff_callbacks2_t. */ 02518 svn_error_t *svn_wc_diff2 (svn_wc_adm_access_t *anchor, 02519 const char *target, 02520 const svn_wc_diff_callbacks_t *callbacks, 02521 void *callback_baton, 02522 svn_boolean_t recurse, 02523 svn_boolean_t ignore_ancestry, 02524 apr_pool_t *pool); 02525 02526 /** 02527 * @deprecated Provided for backward compatibility with the 1.0 API. 02528 * 02529 * Similar to svn_wc_diff2(), but with @a ignore_ancestry always set 02530 * to @c FALSE. 02531 */ 02532 svn_error_t *svn_wc_diff (svn_wc_adm_access_t *anchor, 02533 const char *target, 02534 const svn_wc_diff_callbacks_t *callbacks, 02535 void *callback_baton, 02536 svn_boolean_t recurse, 02537 apr_pool_t *pool); 02538 02539 02540 /** Given a @a path to a file or directory under version control, discover 02541 * any local changes made to properties and/or the set of 'pristine' 02542 * properties. @a adm_access is an access baton set for @a path. 02543 * 02544 * If @a propchanges is non-@c NULL, return these changes as an array of 02545 * @c svn_prop_t structures stored in @a *propchanges. The structures and 02546 * array will be allocated in @a pool. If there are no local property 02547 * modifications on @a path, then set @a *propchanges to @c NULL. 02548 * 02549 * If @a original_props is non-@c NULL, then set @a *original_props to 02550 * hashtable (<tt>const char *name</tt> -> <tt>const svn_string_t *value</tt>) 02551 * that represents the 'pristine' property list of @a path. This hashtable is 02552 * allocated in @a pool, and can be used to compare old and new values of 02553 * properties. 02554 */ 02555 svn_error_t *svn_wc_get_prop_diffs (apr_array_header_t **propchanges, 02556 apr_hash_t **original_props, 02557 const char *path, 02558 svn_wc_adm_access_t *adm_access, 02559 apr_pool_t *pool); 02560 02561 02562 /** The outcome of a merge carried out (or tried as a dry-run) by 02563 * @c svn_wc_merge 02564 */ 02565 typedef enum svn_wc_merge_outcome_t 02566 { 02567 /** The working copy is (or would be) unchanged. The changes to be 02568 * merged were already present in the working copy 02569 */ 02570 svn_wc_merge_unchanged, 02571 02572 /** The working copy has been (or would be) changed. */ 02573 svn_wc_merge_merged, 02574 02575 /** The working copy has been (or would be) changed, but there was (or 02576 * would be) a conflict 02577 */ 02578 svn_wc_merge_conflict, 02579 02580 /** No merge was performed, probably because the target file was 02581 * either absent or not under version control. 02582 */ 02583 svn_wc_merge_no_merge 02584 02585 } svn_wc_merge_outcome_t; 02586 02587 /** Given paths to three fulltexts, merge the differences between @a left 02588 * and @a right into @a merge_target. (It may help to know that @a left, 02589 * @a right, and @a merge_target correspond to "OLDER", "YOURS", and "MINE", 02590 * respectively, in the diff3 documentation.) Use @a pool for any 02591 * temporary allocation. 02592 * 02593 * @a adm_access is an access baton with a write lock for the directory 02594 * containing @a merge_target. 02595 * 02596 * This function assumes that @a left and @a right are in repository-normal 02597 * form (linefeeds, with keywords contracted); if necessary, 02598 * @a merge_target is temporarily converted to this form to receive the 02599 * changes, then translated back again. 02600 * 02601 * If @a merge_target is absent, or present but not under version 02602 * control, then set @a *merge_outcome to svn_wc_merge_no_merge and 02603 * return success without merging anything. (The reasoning is that if 02604 * the file is not versioned, then it is probably unrelated to the 02605 * changes being considered, so they should not be merged into it.) 02606 * 02607 * @a dry_run determines whether the working copy is modified. When it 02608 * is @c FALSE the merge will cause @a merge_target to be modified, when it 02609 * is @c TRUE the merge will be carried out to determine the result but 02610 * @a merge_target will not be modified. 02611 * 02612 * If @a diff3_cmd is non-null, then use it as the diff3 command for 02613 * any merging; otherwise, use the built-in merge code. 02614 * 02615 * The outcome of the merge is returned in @a *merge_outcome. If there is 02616 * a conflict and @a dry_run is @c FALSE, then 02617 * 02618 * * Put conflict markers around the conflicting regions in 02619 * @a merge_target, labeled with @a left_label, @a right_label, and 02620 * @a target_label. (If any of these labels are @c NULL, default 02621 * values will be used.) 02622 * 02623 * * Copy @a left, @a right, and the original @a merge_target to unique 02624 * names in the same directory as @a merge_target, ending with the 02625 * suffixes ".LEFT_LABEL", ".RIGHT_LABEL", and ".TARGET_LABEL" 02626 * respectively. 02627 * 02628 * * Mark the entry for @a merge_target as "conflicted", and track the 02629 * above mentioned backup files in the entry as well. 02630 * 02631 * Binary case: 02632 * 02633 * If @a merge_target is a binary file, then no merging is attempted, 02634 * the merge is deemed to be a conflict. If @a dry_run is @c FALSE the 02635 * working @a merge_target is untouched, and copies of @a left and 02636 * @a right are created next to it using @a left_label and @a right_label. 02637 * @a merge_target's entry is marked as "conflicted", and begins 02638 * tracking the two backup files. If @a dry_run is @c TRUE no files are 02639 * changed. The outcome of the merge is returned in @a *merge_outcome. 02640 */ 02641 svn_error_t *svn_wc_merge (const char *left, 02642 const char *right, 02643 const char *merge_target, 02644 svn_wc_adm_access_t *adm_access, 02645 const char *left_label, 02646 const char *right_label, 02647 const char *target_label, 02648 svn_boolean_t dry_run, 02649 enum svn_wc_merge_outcome_t *merge_outcome, 02650 const char *diff3_cmd, 02651 apr_pool_t *pool); 02652 02653 02654 /** Given a @a path under version control, merge an array of @a propchanges 02655 * into the path's existing properties. @a propchanges is an array of 02656 * @c svn_prop_t objects. @a adm_access is an access baton for the directory 02657 * containing @a path. 02658 * 02659 * If @a base_merge is @c FALSE only the working properties will be changed, 02660 * if it is @c TRUE both the base and working properties will be changed. 02661 * 02662 * If @a state is non-null, set @a *state to the state of the properties 02663 * after the merge. 02664 * 02665 * If conflicts are found when merging working properties, they are 02666 * described in a temporary .prej file (or appended to an already-existing 02667 * .prej file), and the entry is marked "conflicted". Base properties 02668 * are changed unconditionally, if @a base_merge is @c TRUE, they never result 02669 * in a conflict. 02670 * 02671 * If @a path is not under version control, return the error 02672 * SVN_ERR_UNVERSIONED_RESOURCE and don't touch anyone's properties. 02673 */ 02674 svn_error_t * 02675 svn_wc_merge_prop_diffs (svn_wc_notify_state_t *state, 02676 const char *path, 02677 svn_wc_adm_access_t *adm_access, 02678 const apr_array_header_t *propchanges, 02679 svn_boolean_t base_merge, 02680 svn_boolean_t dry_run, 02681 apr_pool_t *pool); 02682 02683 02684 02685 /** Given a @a path to a wc file, return a @a pristine_path which points to a 02686 * pristine version of the file. This is needed so clients can do 02687 * diffs. If the WC has no text-base, return a @c NULL instead of a 02688 * path. 02689 */ 02690 svn_error_t *svn_wc_get_pristine_copy_path (const char *path, 02691 const char **pristine_path, 02692 apr_pool_t *pool); 02693 02694 02695 /** 02696 * @since New in 1.2. 02697 * 02698 * Recurse from @a path, cleaning up unfinished log business. Perform 02699 * necessary allocations in @a pool. Any working copy locks under @a path 02700 * will be taken over and then cleared by this function. If @a diff3_cmd 02701 * is non-null, then use it as the diff3 command for any merging; otherwise, 02702 * use the built-in merge code. 02703 * 02704 * WARNING: there is no mechanism that will protect locks that are still 02705 * being used. 02706 * 02707 * If @a cancel_func is non-null, invoke it with @a cancel_baton at 02708 * various points during the operation. If it returns an error 02709 * (typically @c SVN_ERR_CANCELLED), return that error immediately. 02710 */ 02711 svn_error_t * 02712 svn_wc_cleanup2 (const char *path, 02713 const char *diff3_cmd, 02714 svn_cancel_func_t cancel_func, 02715 void *cancel_baton, 02716 apr_pool_t *pool); 02717 02718 /** 02719 * @deprecated Provided for backward compatibility with the 1.1 API. 02720 * 02721 * Similar to svn_wc_cleanup2(). @a optional_adm_access is an historic 02722 * relic and not used, it may be NULL. 02723 */ 02724 svn_error_t * 02725 svn_wc_cleanup (const char *path, 02726 svn_wc_adm_access_t *optional_adm_access, 02727 const char *diff3_cmd, 02728 svn_cancel_func_t cancel_func, 02729 void *cancel_baton, 02730 apr_pool_t *pool); 02731 02732 02733 /** Relocation validation callback typedef. 02734 * 02735 * Called for each relocated file/directory. @a uuid contains the 02736 * expected repository UUID, @a url contains the tentative URL. 02737 * 02738 * @a baton is a closure object; it should be provided by the 02739 * implementation, and passed by the caller. 02740 */ 02741 typedef svn_error_t *(*svn_wc_relocation_validator_t) (void *baton, 02742 const char *uuid, 02743 const char *url); 02744 02745 02746 /** Change repository references at @a path that begin with @a from 02747 * to begin with @a to instead. Perform necessary allocations in @a pool. 02748 * If @a recurse is true, do so. @a validator (and its baton, 02749 * @a validator_baton), will be called for each newly generated URL. 02750 * 02751 * @a adm_access is an access baton for the directory containing 02752 * @a path. 02753 */ 02754 svn_error_t * 02755 svn_wc_relocate (const char *path, 02756 svn_wc_adm_access_t *adm_access, 02757 const char *from, 02758 const char *to, 02759 svn_boolean_t recurse, 02760 svn_wc_relocation_validator_t validator, 02761 void *validator_baton, 02762 apr_pool_t *pool); 02763 02764 02765 /** @since New in 1.2. 02766 * 02767 * Revert changes to @a path (perhaps in a @a recursive fashion). Perform 02768 * necessary allocations in @a pool. 02769 * 02770 * @a parent_access is an access baton for the directory containing @a path, 02771 * unless @a path is a wc root, in which case @a parent_access refers to 02772 * @a path itself. 02773 * 02774 * If @a cancel_func is non-null, call it with @a cancel_baton at 02775 * various points during the reversion process. If it returns an 02776 * error (typically @c SVN_ERR_CANCELLED), return that error 02777 * immediately. 02778 * 02779 * If @a use_commit_times is TRUE, then all reverted working-files 02780 * will have their timestamp set to the last-committed-time. If 02781 * FALSE, the reverted working-files will be touched with the 'now' time. 02782 * 02783 * For each item reverted, @a notify_func will be called with @a notify_baton 02784 * and the path of the reverted item. @a notify_func may be @c NULL if this 02785 * notification is not needed. 02786 * 02787 * If @a path is not under version control, return the error 02788 * SVN_ERR_UNVERSIONED_RESOURCE. 02789 */ 02790 svn_error_t * 02791 svn_wc_revert2 (const char *path, 02792 svn_wc_adm_access_t *parent_access, 02793 svn_boolean_t recursive, 02794 svn_boolean_t use_commit_times, 02795 svn_cancel_func_t cancel_func, 02796 void *cancel_baton, 02797 svn_wc_notify_func2_t notify_func, 02798 void *notify_baton, 02799 apr_pool_t *pool); 02800 02801 /** @deprecated Provided for backwards compatibility with the 1.1 API. 02802 * 02803 * Similar to @c svn_wc_revert2, but takes an @c svn_wc_notify_func_t instead. 02804 */ 02805 svn_error_t * 02806 svn_wc_revert (const char *path, 02807 svn_wc_adm_access_t *parent_access, 02808 svn_boolean_t recursive, 02809 svn_boolean_t use_commit_times, 02810 svn_cancel_func_t cancel_func, 02811 void *cancel_baton, 02812 svn_wc_notify_func_t notify_func, 02813 void *notify_baton, 02814 apr_pool_t *pool); 02815 02816 02817 /* Tmp files */ 02818 02819 /** Create a unique temporary file in administrative tmp/ area of 02820 * directory @a path. Return a handle in @a *fp. 02821 * 02822 * The flags will be <tt>APR_WRITE | APR_CREATE | APR_EXCL</tt> and 02823 * optionally @c APR_DELONCLOSE (if the @a delete_on_close argument is 02824 * set @c TRUE). 02825 * 02826 * This means that as soon as @a fp is closed, the tmp file will vanish. 02827 */ 02828 svn_error_t * 02829 svn_wc_create_tmp_file (apr_file_t **fp, 02830 const char *path, 02831 svn_boolean_t delete_on_close, 02832 apr_pool_t *pool); 02833 02834 02835 02836 /* Eol conversion and keyword expansion. */ 02837 02838 /** Set @a *xlated_p to a path to a possibly translated copy of versioned 02839 * file @a vfile, or to @a vfile itself if no translation is necessary. 02840 * That is, if @a vfile's properties indicate newline conversion or 02841 * keyword expansion, point @a *xlated_p to a copy of @a vfile whose 02842 * newlines are unconverted and keywords contracted, in whatever 02843 * manner is indicated by @a vfile's properties; otherwise, set @a *xlated_p 02844 * to @a vfile. 02845 * 02846 * If @a force_repair is set, the translated file will have any 02847 * inconsistent line endings repaired. This should only be used when 02848 * the resultant file is being created for comparison against @a vfile's 02849 * text base. 02850 * 02851 * Caller is responsible for detecting if they are different (pointer 02852 * comparison is sufficient), and for removing @a *xlated_p if 02853 * necessary. 02854 * 02855 * This function is generally used to get a file that can be compared 02856 * meaningfully against @a vfile's text base. 02857 * 02858 * If @a *xlated_p is different from @a vfile, then choose @a *xlated_p's 02859 * name using @c svn_io_open_unique_file() with @c SVN_WC__TMP_EXT, and 02860 * allocate it in @a pool. Also use @a pool for any temporary allocation. 02861 * 02862 * If an error is returned, the effect on @a *xlated_p is undefined. 02863 */ 02864 svn_error_t *svn_wc_translated_file (const char **xlated_p, 02865 const char *vfile, 02866 svn_wc_adm_access_t *adm_access, 02867 svn_boolean_t force_repair, 02868 apr_pool_t *pool); 02869 02870 02871 02872 /* Text/Prop Deltas Using an Editor */ 02873 02874 02875 /** Send the local modifications for versioned file @a path (with 02876 * matching @a file_baton) through @a editor, then close @a file_baton 02877 * afterwards. Use @a pool for any temporary allocation and 02878 * @a adm_access as an access baton for @a path. 02879 * 02880 * This process creates a copy of @a path with keywords and eol 02881 * untranslated. If @a tempfile is non-null, set @a *tempfile to the 02882 * path to this copy. Do not clean up the copy; caller can do that. 02883 * (The purpose of handing back the tmp copy is that it is usually about 02884 * to become the new text base anyway, but the installation of the new 02885 * text base is outside the scope of this function.) 02886 * 02887 * If @a fulltext, send the untranslated copy of @a path through @a editor 02888 * as full-text; else send it as svndiff against the current text base. 02889 * 02890 * If sending a diff, and the recorded checksum for @a path's text-base 02891 * does not match the current actual checksum, then remove the tmp 02892 * copy (and set @a *tempfile to null if appropriate), and return the 02893 * error @c SVN_ERR_WC_CORRUPT_TEXT_BASE. 02894 * 02895 * Note: this is intended for use with both infix and postfix 02896 * text-delta styled editor drivers. 02897 */ 02898 svn_error_t *svn_wc_transmit_text_deltas (const char *path, 02899 svn_wc_adm_access_t *adm_access, 02900 svn_boolean_t fulltext, 02901 const svn_delta_editor_t *editor, 02902 void *file_baton, 02903 const char **tempfile, 02904 apr_pool_t *pool); 02905 02906 02907 /** Given a @a path with its accompanying @a entry, transmit all local 02908 * property modifications using the appropriate @a editor method (in 02909 * conjunction with @a baton). @a adm_access is an access baton set 02910 * that contains @a path. Use @a pool for all allocations. 02911 * 02912 * If a temporary file remains after this function is finished, the 02913 * path to that file is returned in @a *tempfile (so the caller can 02914 * clean this up if it wishes to do so). 02915 */ 02916 svn_error_t *svn_wc_transmit_prop_deltas (const char *path, 02917 svn_wc_adm_access_t *adm_access, 02918 const svn_wc_entry_t *entry, 02919 const svn_delta_editor_t *editor, 02920 void *baton, 02921 const char **tempfile, 02922 apr_pool_t *pool); 02923 02924 02925 /** Get the run-time configured list of ignore patterns from the 02926 * @c svn_config_t's in the @a config hash, and store them in @a *patterns. 02927 * Allocate @a *patterns and its contents in @a pool. 02928 */ 02929 svn_error_t *svn_wc_get_default_ignores (apr_array_header_t **patterns, 02930 apr_hash_t *config, 02931 apr_pool_t *pool); 02932 02933 02934 /** Add @a lock to the working copy for @a path. @a adm_access must contain 02935 * a write lock for @a path. If @a path is read-only, due to locking 02936 * properties, make it writable. Perform temporary allocations in @a 02937 * pool. */ 02938 svn_error_t *svn_wc_add_lock (const char *path, const svn_lock_t *lock, 02939 svn_wc_adm_access_t *adm_access, 02940 apr_pool_t *pool); 02941 02942 /** Remove any lock from @a path. @a adm_access must contain a 02943 * write-lock for @a path. If @a path has a lock and the locking 02944 * so specifies, make the file read-only. Don't return an error if @a 02945 * path didn't have a lock. Perform temporary allocations in @a pool. */ 02946 svn_error_t *svn_wc_remove_lock (const char *path, 02947 svn_wc_adm_access_t *adm_access, 02948 apr_pool_t *pool); 02949 02950 02951 #ifdef __cplusplus 02952 } 02953 #endif /* __cplusplus */ 02954 02955 #endif /* SVN_WC_H */