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