00001 /** 00002 * @copyright 00003 * ==================================================================== 00004 * Copyright (c) 2000-2008 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 Subversion's 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 * Notes: 00032 * The 'path' parameters to most of these functions can be 00033 * absolute or relative (relative to current working 00034 * directory). If there are any cases where they are 00035 * relative to the path associated with the 00036 * 'svn_wc_adm_access_t *adm_access' baton passed along 00037 * with the path, those cases should be explicitly 00038 * documented, and if they are not, please fix it. 00039 */ 00040 00041 #ifndef SVN_WC_H 00042 #define SVN_WC_H 00043 00044 00045 #include <apr.h> 00046 #include <apr_pools.h> 00047 #include <apr_tables.h> 00048 #include <apr_hash.h> 00049 00050 #include "svn_types.h" 00051 #include "svn_string.h" 00052 #include "svn_delta.h" 00053 #include "svn_error.h" 00054 #include "svn_opt.h" 00055 #include "svn_ra.h" /* for svn_ra_reporter_t type */ 00056 00057 #ifdef __cplusplus 00058 extern "C" { 00059 #endif /* __cplusplus */ 00060 00061 00062 /** 00063 * Get libsvn_wc version information. 00064 * 00065 * @since New in 1.1. 00066 */ 00067 const svn_version_t *svn_wc_version(void); 00068 00069 /** 00070 * @defgroup svn_wc Working copy management 00071 * @{ 00072 */ 00073 00074 /** Flags for use with svn_wc_translated_file2 00075 * 00076 * @defgroup translate_flags Translation flags 00077 * 00078 * @{ 00079 */ 00080 00081 /** Translate from Normal Form. 00082 * 00083 * The working copy text bases and repository files are stored 00084 * in normal form. Some files' contents - or ever representation - 00085 * differs between the working copy and the normal form. This flag 00086 * specifies to take the latter form as input and transform it 00087 * to the former. 00088 * 00089 * Either this flag or @c SVN_WC_TRANSLATE_TO_NF should be specified, 00090 * but not both. 00091 */ 00092 #define SVN_WC_TRANSLATE_FROM_NF 0x00000000 00093 00094 /** Translate to Normal Form. 00095 * 00096 * Either this flag or @c SVN_WC_TRANSLATE_FROM_NF should be specified, 00097 * but not both. 00098 */ 00099 #define SVN_WC_TRANSLATE_TO_NF 0x00000001 00100 00101 /** Force repair of eol styles, making sure the output file consistently 00102 * contains the one eol style as specified by the svn:eol-style 00103 * property and the required translation direction. 00104 * 00105 */ 00106 #define SVN_WC_TRANSLATE_FORCE_EOL_REPAIR 0x00000002 00107 00108 /** Don't register a pool cleanup to delete the output file */ 00109 #define SVN_WC_TRANSLATE_NO_OUTPUT_CLEANUP 0x00000004 00110 00111 /** Guarantee a new file is created on successful return. 00112 * The default shortcuts translation by returning the path 00113 * of the untranslated file when no translation is required. 00114 */ 00115 #define SVN_WC_TRANSLATE_FORCE_COPY 0x00000008 00116 00117 /** Use a non-wc-local tmp directory for creating output files, 00118 * instead of in the working copy admin tmp area which is the default. 00119 * 00120 * @since New in 1.4. 00121 */ 00122 #define SVN_WC_TRANSLATE_USE_GLOBAL_TMP 0x00000010 00123 00124 /** @} */ 00125 00126 00127 /* Locking/Opening/Closing */ 00128 00129 /** Baton for access to a working copy administrative area. 00130 * 00131 * One day all such access will require a baton, we're not there yet. 00132 * 00133 * Access batons can be grouped into sets, by passing an existing open 00134 * baton when opening a new baton. Given one baton in a set, other batons 00135 * may be retrieved. This allows an entire hierarchy to be locked, and 00136 * then the set of batons can be passed around by passing a single baton. 00137 */ 00138 typedef struct svn_wc_adm_access_t svn_wc_adm_access_t; 00139 00140 00141 /** 00142 * Return, in @a *adm_access, a pointer to a new access baton for the working 00143 * copy administrative area associated with the directory @a path. If 00144 * @a write_lock is TRUE the baton will include a write lock, otherwise the 00145 * baton can only be used for read access. If @a path refers to a directory 00146 * that is already write locked then the error @c SVN_ERR_WC_LOCKED will be 00147 * returned. The error @c SVN_ERR_WC_NOT_DIRECTORY will be returned if 00148 * @a path is not a versioned directory. 00149 * 00150 * If @a associated is an open access baton then @a adm_access will be added 00151 * to the set containing @a associated. @a associated can be @c NULL, in 00152 * which case @a adm_access is the start of a new set. 00153 * 00154 * @a levels_to_lock specifies how far to lock. Zero means just the specified 00155 * directory. Any negative value means to lock the entire working copy 00156 * directory hierarchy under @a path. A positive value indicates the number of 00157 * levels of directories to lock -- 1 means just immediate subdirectories, 2 00158 * means immediate subdirectories and their subdirectories, etc. All the 00159 * access batons will become part of the set containing @a adm_access. This 00160 * is an all-or-nothing option, if it is not possible to lock all the 00161 * requested directories then an error will be returned and @a adm_access will 00162 * be invalid, with the exception that subdirectories of @a path that are 00163 * missing from the physical filesystem will not be locked and will not cause 00164 * an error. The error @c SVN_ERR_WC_LOCKED will be returned if a 00165 * subdirectory of @a path is already write locked. 00166 * 00167 * If @a cancel_func is non-NULL, call it with @a cancel_baton to determine 00168 * if the client has cancelled the operation. 00169 * 00170 * @a pool will be used to allocate memory for the baton and any subsequently 00171 * cached items. If @a adm_access has not been closed when the pool is 00172 * cleared, it will be closed automatically at that point, and removed from 00173 * its set. A baton closed in this way will not remove physical locks from 00174 * the working copy if cleanup is required. 00175 * 00176 * The first baton in a set, with @a associated passed as @c NULL, must have 00177 * the longest lifetime of all the batons in the set. This implies it must be 00178 * the root of the hierarchy. 00179 * 00180 * @since New in 1.2. 00181 */ 00182 svn_error_t * 00183 svn_wc_adm_open3(svn_wc_adm_access_t **adm_access, 00184 svn_wc_adm_access_t *associated, 00185 const char *path, 00186 svn_boolean_t write_lock, 00187 int levels_to_lock, 00188 svn_cancel_func_t cancel_func, 00189 void *cancel_baton, 00190 apr_pool_t *pool); 00191 00192 /** 00193 * Similar to svn_wc_adm_open3(), but without cancellation support. 00194 * 00195 * @deprecated Provided for backward compatibility with the 1.1 API. 00196 */ 00197 SVN_DEPRECATED 00198 svn_error_t * 00199 svn_wc_adm_open2(svn_wc_adm_access_t **adm_access, 00200 svn_wc_adm_access_t *associated, 00201 const char *path, 00202 svn_boolean_t write_lock, 00203 int levels_to_lock, 00204 apr_pool_t *pool); 00205 00206 /** 00207 * Similar to svn_wc_adm_open2(), but with @a tree_lock instead of 00208 * @a levels_to_lock. @a levels_to_lock is set to -1 if @a tree_lock 00209 * is @c TRUE, else 0. 00210 * 00211 * @deprecated Provided for backward compatibility with the 1.0 API. 00212 */ 00213 SVN_DEPRECATED 00214 svn_error_t * 00215 svn_wc_adm_open(svn_wc_adm_access_t **adm_access, 00216 svn_wc_adm_access_t *associated, 00217 const char *path, 00218 svn_boolean_t write_lock, 00219 svn_boolean_t tree_lock, 00220 apr_pool_t *pool); 00221 00222 /** 00223 * Checks the working copy to determine the node type of @a path. If 00224 * @a path is a versioned directory then the behaviour is like that of 00225 * svn_wc_adm_open3(), otherwise, if @a path is a file or does not 00226 * exist, then the behaviour is like that of svn_wc_adm_open3() with 00227 * @a path replaced by the parent directory of @a path. If @a path is 00228 * an unversioned directory, the behaviour is also like that of 00229 * svn_wc_adm_open3() on the parent, except that if the open fails, 00230 * then the returned SVN_ERR_WC_NOT_DIRECTORY error refers to @a path, 00231 * not to @a path's parent. 00232 * 00233 * @since New in 1.2. 00234 */ 00235 svn_error_t * 00236 svn_wc_adm_probe_open3(svn_wc_adm_access_t **adm_access, 00237 svn_wc_adm_access_t *associated, 00238 const char *path, 00239 svn_boolean_t write_lock, 00240 int levels_to_lock, 00241 svn_cancel_func_t cancel_func, 00242 void *cancel_baton, 00243 apr_pool_t *pool); 00244 00245 /** 00246 * Similar to svn_wc_adm_probe_open3() without the cancel 00247 * functionality. 00248 * 00249 * @deprecated Provided for backward compatibility with the 1.1 API. 00250 */ 00251 SVN_DEPRECATED 00252 svn_error_t * 00253 svn_wc_adm_probe_open2(svn_wc_adm_access_t **adm_access, 00254 svn_wc_adm_access_t *associated, 00255 const char *path, 00256 svn_boolean_t write_lock, 00257 int levels_to_lock, 00258 apr_pool_t *pool); 00259 00260 /** 00261 * Similar to svn_wc_adm_probe_open2(), but with @a tree_lock instead of 00262 * @a levels_to_lock. @a levels_to_lock is set to -1 if @a tree_lock 00263 * is @c TRUE, else 0. 00264 * 00265 * @deprecated Provided for backward compatibility with the 1.0 API. 00266 */ 00267 SVN_DEPRECATED 00268 svn_error_t * 00269 svn_wc_adm_probe_open(svn_wc_adm_access_t **adm_access, 00270 svn_wc_adm_access_t *associated, 00271 const char *path, 00272 svn_boolean_t write_lock, 00273 svn_boolean_t tree_lock, 00274 apr_pool_t *pool); 00275 00276 /** 00277 * Open access batons for @a path and return in @a *anchor_access and 00278 * @a *target the anchor and target required to drive an editor. Return 00279 * in @a *target_access the access baton for the target, which may be the 00280 * same as @a *anchor_access (in which case @a *target is the empty 00281 * string, never NULL). All the access batons will be in the 00282 * @a *anchor_access set. 00283 * 00284 * @a levels_to_lock determines the levels_to_lock used when opening 00285 * @a path if @a path is a versioned directory, @a levels_to_lock is 00286 * ignored otherwise. If @a write_lock is @c TRUE the access batons 00287 * will hold write locks. 00288 * 00289 * If @a cancel_func is non-NULL, call it with @a cancel_baton to determine 00290 * if the client has cancelled the operation. 00291 * 00292 * This function is essentially a combination of svn_wc_adm_open3() and 00293 * svn_wc_get_actual_target(), with the emphasis on reducing physical IO. 00294 * 00295 * @since New in 1.2. 00296 */ 00297 svn_error_t * 00298 svn_wc_adm_open_anchor(svn_wc_adm_access_t **anchor_access, 00299 svn_wc_adm_access_t **target_access, 00300 const char **target, 00301 const char *path, 00302 svn_boolean_t write_lock, 00303 int levels_to_lock, 00304 svn_cancel_func_t cancel_func, 00305 void *cancel_baton, 00306 apr_pool_t *pool); 00307 00308 /** Return, in @a *adm_access, a pointer to an existing access baton associated 00309 * with @a path. @a path must be a directory that is locked as part of the 00310 * set containing the @a associated access baton. 00311 * 00312 * If the requested access baton is marked as missing in, or is simply 00313 * absent from, @a associated, return SVN_ERR_WC_NOT_LOCKED. 00314 * 00315 * @a pool is used only for local processing, it is not used for the batons. 00316 */ 00317 svn_error_t * 00318 svn_wc_adm_retrieve(svn_wc_adm_access_t **adm_access, 00319 svn_wc_adm_access_t *associated, 00320 const char *path, 00321 apr_pool_t *pool); 00322 00323 /** Check the working copy to determine the node type of @a path. If 00324 * @a path is a versioned directory then the behaviour is like that of 00325 * svn_wc_adm_retrieve(), otherwise, if @a path is a file, an unversioned 00326 * directory, or does not exist, then the behaviour is like that of 00327 * svn_wc_adm_retrieve() with @a path replaced by the parent directory of 00328 * @a path. 00329 */ 00330 svn_error_t * 00331 svn_wc_adm_probe_retrieve(svn_wc_adm_access_t **adm_access, 00332 svn_wc_adm_access_t *associated, 00333 const char *path, 00334 apr_pool_t *pool); 00335 00336 /** 00337 * Try various ways to obtain an access baton for @a path. 00338 * 00339 * First, try to obtain @a *adm_access via svn_wc_adm_probe_retrieve(), 00340 * but if this fails because @a associated can't give a baton for 00341 * @a path or @a path's parent, then try svn_wc_adm_probe_open3(), 00342 * this time passing @a write_lock and @a levels_to_lock. If there is 00343 * still no access because @a path is not a versioned directory, then 00344 * just set @a *adm_access to NULL and return success. But if it is 00345 * because @a path is locked, then return the error @c SVN_ERR_WC_LOCKED, 00346 * and the effect on @a *adm_access is undefined. (Or if the attempt 00347 * fails for any other reason, return the corresponding error, and the 00348 * effect on @a *adm_access is also undefined.) 00349 * 00350 * If svn_wc_adm_probe_open3() succeeds, then add @a *adm_access to 00351 * @a associated. 00352 * 00353 * If @a cancel_func is non-NULL, call it with @a cancel_baton to determine 00354 * if the client has cancelled the operation. 00355 * 00356 * Use @a pool only for local processing, not to allocate @a *adm_access. 00357 * 00358 * @since New in 1.2. 00359 */ 00360 svn_error_t * 00361 svn_wc_adm_probe_try3(svn_wc_adm_access_t **adm_access, 00362 svn_wc_adm_access_t *associated, 00363 const char *path, 00364 svn_boolean_t write_lock, 00365 int levels_to_lock, 00366 svn_cancel_func_t cancel_func, 00367 void *cancel_baton, 00368 apr_pool_t *pool); 00369 00370 /** 00371 * Similar to svn_wc_adm_probe_try3() without the cancel 00372 * functionality. 00373 * 00374 * @deprecated Provided for backward compatibility with the 1.1 API. 00375 */ 00376 SVN_DEPRECATED 00377 svn_error_t * 00378 svn_wc_adm_probe_try2(svn_wc_adm_access_t **adm_access, 00379 svn_wc_adm_access_t *associated, 00380 const char *path, 00381 svn_boolean_t write_lock, 00382 int levels_to_lock, 00383 apr_pool_t *pool); 00384 00385 /** 00386 * Similar to svn_wc_adm_probe_try2(), but with @a tree_lock instead of 00387 * @a levels_to_lock. @a levels_to_lock is set to -1 if @a tree_lock 00388 * is @c TRUE, else 0. 00389 * 00390 * @deprecated Provided for backward compatibility with the 1.0 API. 00391 */ 00392 SVN_DEPRECATED 00393 svn_error_t * 00394 svn_wc_adm_probe_try(svn_wc_adm_access_t **adm_access, 00395 svn_wc_adm_access_t *associated, 00396 const char *path, 00397 svn_boolean_t write_lock, 00398 svn_boolean_t tree_lock, 00399 apr_pool_t *pool); 00400 00401 00402 /** Give up the access baton @a adm_access, and its lock if any. This will 00403 * recursively close any batons in the same set that are direct 00404 * subdirectories of @a adm_access. Any physical locks will be removed from 00405 * the working copy. Lock removal is unconditional, there is no check to 00406 * determine if cleanup is required. 00407 */ 00408 svn_error_t *svn_wc_adm_close(svn_wc_adm_access_t *adm_access); 00409 00410 /** Return the path used to open the access baton @a adm_access */ 00411 const char *svn_wc_adm_access_path(svn_wc_adm_access_t *adm_access); 00412 00413 /** Return the pool used by access baton @a adm_access */ 00414 apr_pool_t *svn_wc_adm_access_pool(svn_wc_adm_access_t *adm_access); 00415 00416 /** Return @c TRUE is the access baton @a adm_access has a write lock, 00417 * @c FALSE otherwise. Compared to svn_wc_locked() this is a cheap, fast 00418 * function that doesn't access the filesystem. 00419 */ 00420 svn_boolean_t svn_wc_adm_locked(svn_wc_adm_access_t *adm_access); 00421 00422 /** Set @a *locked to non-zero if @a path is locked, else set it to zero. */ 00423 svn_error_t * 00424 svn_wc_locked(svn_boolean_t *locked, 00425 const char *path, 00426 apr_pool_t *pool); 00427 00428 00429 /** 00430 * Return @c TRUE if @a name is the name of the WC administrative 00431 * directory. Use @a pool for any temporary allocations. Only works 00432 * with base directory names, not paths or URIs. 00433 * 00434 * For compatibility, the default name (.svn) will always be treated 00435 * as an admin dir name, even if the working copy is actually using an 00436 * alternative name. 00437 * 00438 * @since New in 1.3. 00439 */ 00440 svn_boolean_t svn_wc_is_adm_dir(const char *name, apr_pool_t *pool); 00441 00442 00443 /** 00444 * Return the name of the administrative directory. 00445 * Use @a pool for any temporary allocations. 00446 * 00447 * The returned pointer will refer to either a statically allocated 00448 * string, or to a string allocated in @a pool. 00449 * 00450 * @since New in 1.3. 00451 */ 00452 const char *svn_wc_get_adm_dir(apr_pool_t *pool); 00453 00454 00455 /** 00456 * Use @a name for the administrative directory in the working copy. 00457 * Use @a pool for any temporary allocations. 00458 * 00459 * The list of valid names is limited. Currently only ".svn" (the 00460 * default) and "_svn" are allowed. 00461 * 00462 * @note This function changes global (per-process) state and must be 00463 * called in a single-threaded context during the initialization of a 00464 * Subversion client. 00465 * 00466 * @since New in 1.3. 00467 */ 00468 svn_error_t *svn_wc_set_adm_dir(const char *name, apr_pool_t *pool); 00469 00470 00471 00472 /** Traversal information is information gathered by a working copy 00473 * crawl or update. For example, the before and after values of the 00474 * svn:externals property are important after an update, and since 00475 * we're traversing the working tree anyway (a complete traversal 00476 * during the initial crawl, and a traversal of changed paths during 00477 * the checkout/update/switch), it makes sense to gather the 00478 * property's values then instead of making a second pass. 00479 */ 00480 typedef struct svn_wc_traversal_info_t svn_wc_traversal_info_t; 00481 00482 00483 /** Return a new, empty traversal info object, allocated in @a pool. */ 00484 svn_wc_traversal_info_t *svn_wc_init_traversal_info(apr_pool_t *pool); 00485 00486 00487 /** Set @a *externals_old and @a *externals_new to hash tables representing 00488 * changes to values of the svn:externals property on directories 00489 * traversed by @a traversal_info. 00490 * 00491 * @a traversal_info is obtained from svn_wc_init_traversal_info(), but is 00492 * only useful after it has been passed through another function, such 00493 * as svn_wc_crawl_revisions(), svn_wc_get_update_editor(), 00494 * svn_wc_get_switch_editor(), etc. 00495 * 00496 * Each hash maps <tt>const char *</tt> directory names onto 00497 * <tt>const char *</tt> values of the externals property for that directory. 00498 * The dir names are full paths -- that is, anchor plus target, not target 00499 * alone. The values are not parsed, they are simply copied raw, and are 00500 * never NULL: directories that acquired or lost the property are 00501 * simply omitted from the appropriate table. Directories whose value 00502 * of the property did not change show the same value in each hash. 00503 * 00504 * The hashes, keys, and values have the same lifetime as @a traversal_info. 00505 */ 00506 void 00507 svn_wc_edited_externals(apr_hash_t **externals_old, 00508 apr_hash_t **externals_new, 00509 svn_wc_traversal_info_t *traversal_info); 00510 00511 00512 /** Set @a *depths to a hash table mapping <tt>const char *</tt> 00513 * directory names (directories traversed by @a traversal_info) to 00514 * <tt>const char *</tt> values (the depths of those directories, as 00515 * converted by svn_depth_to_word()). 00516 * 00517 * @a traversal_info is obtained from svn_wc_init_traversal_info(), but is 00518 * only useful after it has been passed through another function, such 00519 * as svn_wc_crawl_revisions(), svn_wc_get_update_editor(), 00520 * svn_wc_get_switch_editor(), etc. 00521 * 00522 * The dir names are full paths -- that is, anchor plus target, not target 00523 * alone. The values are not allocated, they are static constant strings. 00524 * Although the values are never NULL, not all directories traversed 00525 * are necessarily listed. For example, directories which did not 00526 * have an svn:externals property set or modified are not included. 00527 * 00528 * The hashes and keys have the same lifetime as @a traversal_info. 00529 * 00530 * @since New in 1.5. 00531 */ 00532 void 00533 svn_wc_traversed_depths(apr_hash_t **depths, 00534 svn_wc_traversal_info_t *traversal_info); 00535 00536 00537 /** One external item. This usually represents one line from an 00538 * svn:externals description but with the path and URL 00539 * canonicalized. 00540 * 00541 * In order to avoid backwards compatibility problems clients should use 00542 * svn_wc_external_item_create() to allocate and intialize this structure 00543 * instead of doing so themselves. 00544 * 00545 * @since New in 1.5. 00546 */ 00547 typedef struct svn_wc_external_item2_t 00548 { 00549 /** The name of the subdirectory into which this external should be 00550 checked out. This is relative to the parent directory that 00551 holds this external item. (Note that these structs are often 00552 stored in hash tables with the target dirs as keys, so this 00553 field will often be redundant.) */ 00554 const char *target_dir; 00555 00556 /** Where to check out from. */ 00557 const char *url; 00558 00559 /** What revision to check out. The only valid kinds for this are 00560 svn_opt_revision_number, svn_opt_revision_date, and 00561 svn_opt_revision_head. */ 00562 svn_opt_revision_t revision; 00563 00564 /** The peg revision to use when checking out. The only valid kinds are 00565 svn_opt_revision_number, svn_opt_revision_date, and 00566 svn_opt_revision_head. */ 00567 svn_opt_revision_t peg_revision; 00568 00569 } svn_wc_external_item2_t; 00570 00571 /** 00572 * Initialize an external item. 00573 * Set @a *item to an external item object, allocated in @a pool. 00574 * 00575 * In order to avoid backwards compatibility problems, this function 00576 * is used to intialize and allocate the @c svn_wc_external_item2_t 00577 * structure rather than doing so explicitly, as the size of this 00578 * structure may change in the future. 00579 * 00580 * The current implementation never returns error, but callers should 00581 * still check for error, for compatibility with future versions. 00582 * 00583 * @since New in 1.5. 00584 */ 00585 svn_error_t * 00586 svn_wc_external_item_create(const svn_wc_external_item2_t **item, 00587 apr_pool_t *pool); 00588 00589 /** 00590 * Return a duplicate of @a item, allocated in @a pool. No part of the new 00591 * item will be shared with @a item. 00592 * 00593 * @since New in 1.5. 00594 */ 00595 svn_wc_external_item2_t * 00596 svn_wc_external_item2_dup(const svn_wc_external_item2_t *item, 00597 apr_pool_t *pool); 00598 00599 /** 00600 * One external item. Similar to svn_wc_external_item2_t, except 00601 * @a revision is interpreted as both the operational revision and the 00602 * peg revision. 00603 * 00604 * @deprecated Provided for backward compatibility with the 1.4 API. 00605 */ 00606 typedef struct svn_wc_external_item_t 00607 { 00608 /** Same as @c svn_wc_external_item2_t.target_dir */ 00609 const char *target_dir; 00610 00611 /** Same as @c svn_wc_external_item2_t.url */ 00612 const char *url; 00613 00614 /** Same as @c svn_wc_external_item2_t.revision */ 00615 svn_opt_revision_t revision; 00616 00617 } svn_wc_external_item_t; 00618 00619 /** 00620 * Return a duplicate of @a item, allocated in @a pool. No part of the new 00621 * item will be shared with @a item. 00622 * 00623 * @since New in 1.3. 00624 * 00625 * @deprecated Provided for backward compatibility with the 1.4 API. 00626 */ 00627 SVN_DEPRECATED 00628 svn_wc_external_item_t * 00629 svn_wc_external_item_dup(const svn_wc_external_item_t *item, 00630 apr_pool_t *pool); 00631 00632 /** 00633 * If @a externals_p is non-NULL, set @a *externals_p to an array of 00634 * @c svn_wc_external_item2_t * objects based on @a desc. The @a url 00635 * member of the objects will be canonicalized if @a canonicalize_url 00636 * is @c TRUE. 00637 * 00638 * If the format of @a desc is invalid, don't touch @a *externals_p and 00639 * return @c SVN_ERR_CLIENT_INVALID_EXTERNALS_DESCRIPTION. Thus, if 00640 * you just want to check the validity of an externals description, 00641 * and don't care about the parsed result, pass NULL for @a externals_p. 00642 * 00643 * The format of @a desc is the same as for values of the directory 00644 * property @c SVN_PROP_EXTERNALS, which see. 00645 * 00646 * Allocate the table, keys, and values in @a pool. 00647 * 00648 * Use @a parent_directory only in constructing error strings. 00649 * 00650 * @since New in 1.5. 00651 */ 00652 svn_error_t * 00653 svn_wc_parse_externals_description3(apr_array_header_t **externals_p, 00654 const char *parent_directory, 00655 const char *desc, 00656 svn_boolean_t canonicalize_url, 00657 apr_pool_t *pool); 00658 00659 /** 00660 * Similar to svn_wc_parse_externals_description3() with @a 00661 * canonicalize_url set to @c TRUE, but returns an array of @c 00662 * svn_wc_external_item_t * objects instead of @c 00663 * svn_wc_external_item2_t * objects 00664 * 00665 * @since New in 1.1. 00666 * 00667 * @deprecated Provided for backward compatibility with the 1.4 API. 00668 */ 00669 SVN_DEPRECATED 00670 svn_error_t * 00671 svn_wc_parse_externals_description2(apr_array_header_t **externals_p, 00672 const char *parent_directory, 00673 const char *desc, 00674 apr_pool_t *pool); 00675 00676 /** 00677 * Similar to svn_wc_parse_externals_description2(), but returns the 00678 * parsed externals in a hash instead of an array. This function 00679 * should not be used, as storing the externals in a hash causes their 00680 * order of evaluation to be not easily identifiable. 00681 * 00682 * @deprecated Provided for backward compatibility with the 1.0 API. 00683 */ 00684 SVN_DEPRECATED 00685 svn_error_t * 00686 svn_wc_parse_externals_description(apr_hash_t **externals_p, 00687 const char *parent_directory, 00688 const char *desc, 00689 apr_pool_t *pool); 00690 00691 00692 00693 /* Notification/callback handling. */ 00694 00695 /** 00696 * @defgroup svn_wc_notifications Notification callback handling 00697 * @{ 00698 * 00699 * In many cases, the WC library will scan a working copy and make 00700 * changes. The caller usually wants to know when each of these changes 00701 * has been made, so that it can display some kind of notification to 00702 * the user. 00703 * 00704 * These notifications have a standard callback function type, which 00705 * takes the path of the file that was affected, and a caller- 00706 * supplied baton. 00707 * 00708 * Note that the callback is a 'void' return -- this is a simple 00709 * reporting mechanism, rather than an opportunity for the caller to 00710 * alter the operation of the WC library. 00711 * 00712 * Note also that some of the actions are used across several 00713 * different Subversion commands. For example, the update actions are 00714 * also used for checkouts, switches, and merges. 00715 */ 00716 00717 /** The type of action occurring. */ 00718 typedef enum svn_wc_notify_action_t 00719 { 00720 /** Adding a path to revision control. */ 00721 svn_wc_notify_add = 0, 00722 00723 /** Copying a versioned path. */ 00724 svn_wc_notify_copy, 00725 00726 /** Deleting a versioned path. */ 00727 svn_wc_notify_delete, 00728 00729 /** Restoring a missing path from the pristine text-base. */ 00730 svn_wc_notify_restore, 00731 00732 /** Reverting a modified path. */ 00733 svn_wc_notify_revert, 00734 00735 /** A revert operation has failed. */ 00736 svn_wc_notify_failed_revert, 00737 00738 /** Resolving a conflict. */ 00739 svn_wc_notify_resolved, 00740 00741 /** Skipping a path. */ 00742 svn_wc_notify_skip, 00743 00744 /** Got a delete in an update. */ 00745 svn_wc_notify_update_delete, 00746 00747 /** Got an add in an update. */ 00748 svn_wc_notify_update_add, 00749 00750 /** Got any other action in an update. */ 00751 svn_wc_notify_update_update, 00752 00753 /** The last notification in an update (including updates of externals). */ 00754 svn_wc_notify_update_completed, 00755 00756 /** Updating an external module. */ 00757 svn_wc_notify_update_external, 00758 00759 /** The last notification in a status (including status on externals). */ 00760 svn_wc_notify_status_completed, 00761 00762 /** Running status on an external module. */ 00763 svn_wc_notify_status_external, 00764 00765 /** Committing a modification. */ 00766 svn_wc_notify_commit_modified, 00767 00768 /** Committing an addition. */ 00769 svn_wc_notify_commit_added, 00770 00771 /** Committing a deletion. */ 00772 svn_wc_notify_commit_deleted, 00773 00774 /** Committing a replacement. */ 00775 svn_wc_notify_commit_replaced, 00776 00777 /** Transmitting post-fix text-delta data for a file. */ 00778 svn_wc_notify_commit_postfix_txdelta, 00779 00780 /** Processed a single revision's blame. */ 00781 svn_wc_notify_blame_revision, 00782 00783 /** Locking a path. @since New in 1.2. */ 00784 svn_wc_notify_locked, 00785 00786 /** Unlocking a path. @since New in 1.2. */ 00787 svn_wc_notify_unlocked, 00788 00789 /** Failed to lock a path. @since New in 1.2. */ 00790 svn_wc_notify_failed_lock, 00791 00792 /** Failed to unlock a path. @since New in 1.2. */ 00793 svn_wc_notify_failed_unlock, 00794 00795 /** Tried adding a path that already exists. @since New in 1.5. */ 00796 svn_wc_notify_exists, 00797 00798 /** Changelist name set. @since New in 1.5. */ 00799 svn_wc_notify_changelist_set, 00800 00801 /** Changelist name cleared. @since New in 1.5. */ 00802 svn_wc_notify_changelist_clear, 00803 00804 /** Warn user that a path has moved from one changelist to another. 00805 @since New in 1.5. */ 00806 svn_wc_notify_changelist_moved, 00807 00808 /** A merge operation (to path) has begun. See @c merge_range in 00809 @c svn_wc_notify_t. @since New in 1.5. */ 00810 svn_wc_notify_merge_begin, 00811 00812 /** A merge operation (to path) from a foreign repository has begun. 00813 See @c merge_range in @c svn_wc_notify_t. @since New in 1.5. */ 00814 svn_wc_notify_foreign_merge_begin, 00815 00816 /** Replace notification. @since New in 1.5. */ 00817 svn_wc_notify_update_replace, 00818 00819 /** Property updated. @since New in 1.6. */ 00820 svn_wc_notify_property_updated 00821 00822 } svn_wc_notify_action_t; 00823 00824 00825 /** The type of notification that is occurring. */ 00826 typedef enum svn_wc_notify_state_t 00827 { 00828 svn_wc_notify_state_inapplicable = 0, 00829 00830 /** Notifier doesn't know or isn't saying. */ 00831 svn_wc_notify_state_unknown, 00832 00833 /** The state did not change. */ 00834 svn_wc_notify_state_unchanged, 00835 00836 /** The item wasn't present. */ 00837 svn_wc_notify_state_missing, 00838 00839 /** An unversioned item obstructed work. */ 00840 svn_wc_notify_state_obstructed, 00841 00842 /** Pristine state was modified. */ 00843 svn_wc_notify_state_changed, 00844 00845 /** Modified state had mods merged in. */ 00846 svn_wc_notify_state_merged, 00847 00848 /** Modified state got conflicting mods. */ 00849 svn_wc_notify_state_conflicted 00850 00851 } svn_wc_notify_state_t; 00852 00853 /** 00854 * What happened to a lock during an operation. 00855 * 00856 * @since New in 1.2. 00857 */ 00858 typedef enum svn_wc_notify_lock_state_t { 00859 svn_wc_notify_lock_state_inapplicable = 0, 00860 svn_wc_notify_lock_state_unknown, 00861 /** The lock wasn't changed. */ 00862 svn_wc_notify_lock_state_unchanged, 00863 /** The item was locked. */ 00864 svn_wc_notify_lock_state_locked, 00865 /** The item was unlocked. */ 00866 svn_wc_notify_lock_state_unlocked 00867 } svn_wc_notify_lock_state_t; 00868 00869 /** 00870 * Structure used in the @c svn_wc_notify_func2_t function. 00871 * 00872 * @c kind, @c content_state, @c prop_state and @c lock_state are from 00873 * after @c action, not before. 00874 * 00875 * @note If @c action is @c svn_wc_notify_update, then @c path has 00876 * already been installed, so it is legitimate for an implementation of 00877 * @c svn_wc_notify_func2_t to examine @c path in the working copy. 00878 * 00879 * @note The purpose of the @c kind, @c mime_type, @c content_state, and 00880 * @c prop_state fields is to provide "for free" information that an 00881 * implementation is likely to want, and which it would otherwise be 00882 * forced to deduce via expensive operations such as reading entries 00883 * and properties. However, if the caller does not have this 00884 * information, it will simply pass the corresponding `*_unknown' 00885 * values, and it is up to the implementation how to handle that 00886 * (i.e., whether to attempt deduction, or just to punt and 00887 * give a less informative notification). 00888 * 00889 * @note Callers of notification functions should use svn_wc_create_notify() 00890 * to create structures of this type to allow for extensibility. 00891 * 00892 * @since New in 1.2. 00893 */ 00894 typedef struct svn_wc_notify_t { 00895 /** Path, either absolute or relative to the current working directory 00896 * (i.e., not relative to an anchor). */ 00897 const char *path; 00898 /** Action that describes what happened to @c path. */ 00899 svn_wc_notify_action_t action; 00900 /** Node kind of @c path. */ 00901 svn_node_kind_t kind; 00902 /** If non-NULL, indicates the mime-type of @c path. 00903 * It is always @c NULL for directories. */ 00904 const char *mime_type; 00905 /** Points to the lock structure received from the repository when 00906 * @c action is @c svn_wc_notify_locked. For other actions, it is 00907 * @c NULL. */ 00908 const svn_lock_t *lock; 00909 /** Points to an error describing the reason for the failure when @c 00910 * action is @c svn_wc_notify_failed_lock or @c svn_wc_notify_failed_unlock. 00911 * Is @c NULL otherwise. */ 00912 svn_error_t *err; 00913 /** The type of notification that is occurring about node content. */ 00914 svn_wc_notify_state_t content_state; 00915 /** The type of notification that is occurring about node properties. */ 00916 svn_wc_notify_state_t prop_state; 00917 /** Reflects the addition or removal of a lock token in the working copy. */ 00918 svn_wc_notify_lock_state_t lock_state; 00919 /** When @c action is @c svn_wc_notify_update_completed, target revision 00920 * of the update, or @c SVN_INVALID_REVNUM if not available; when @c 00921 * action is @c svn_wc_notify_blame_revision, processed revision. 00922 * In all other cases, it is @c SVN_INVALID_REVNUM. */ 00923 svn_revnum_t revision; 00924 /** When @c action is @c svn_wc_notify_changelist_add or name. In all other 00925 * cases, it is @c NULL. @since New in 1.5 */ 00926 const char *changelist_name; 00927 /** When @c action is @c svn_wc_notify_merge_begin, and both the 00928 * left and right sides of the merge are from the same URL. In all 00929 * other cases, it is @c NULL. @since New in 1.5 */ 00930 svn_merge_range_t *merge_range; 00931 /** If non-NULL, specifies an absolute path prefix that can be subtracted 00932 * from the start of the absolute path in @c path. Its purpose is to 00933 * allow notification to remove a common prefix from all the paths 00934 * displayed for an operation. @since New in 1.6 */ 00935 const char *path_prefix; 00936 /* NOTE: Add new fields at the end to preserve binary compatibility. 00937 Also, if you add fields here, you have to update svn_wc_create_notify 00938 and svn_wc_dup_notify. */ 00939 } svn_wc_notify_t; 00940 00941 /** 00942 * Allocate an @c svn_wc_notify_t structure in @a pool, initialize and return 00943 * it. 00944 * 00945 * Set the @c path field of the created struct to @a path, and @c action to 00946 * @a action. Set all other fields to their @c _unknown, @c NULL or 00947 * invalid value, respectively. Make only a shallow copy of the pointer 00948 * @a path. 00949 * 00950 * @since New in 1.2. 00951 */ 00952 svn_wc_notify_t * 00953 svn_wc_create_notify(const char *path, 00954 svn_wc_notify_action_t action, 00955 apr_pool_t *pool); 00956 00957 /** 00958 * Return a deep copy of @a notify, allocated in @a pool. 00959 * 00960 * @since New in 1.2. 00961 */ 00962 svn_wc_notify_t * 00963 svn_wc_dup_notify(const svn_wc_notify_t *notify, 00964 apr_pool_t *pool); 00965 00966 /** 00967 * Notify the world that @a notify->action has happened to @a notify->path. 00968 * 00969 * Recommendation: callers of @c svn_wc_notify_func2_t should avoid 00970 * invoking it multiple times on the same path within a given 00971 * operation, and implementations should not bother checking for such 00972 * duplicate calls. For example, in an update, the caller should not 00973 * invoke the notify func on receiving a prop change and then again 00974 * on receiving a text change. Instead, wait until all changes have 00975 * been received, and then invoke the notify func once (from within 00976 * an @c svn_delta_editor_t's close_file(), for example), passing 00977 * the appropriate @a notify->content_state and @a notify->prop_state flags. 00978 * 00979 * @since New in 1.2. 00980 */ 00981 typedef void (*svn_wc_notify_func2_t)(void *baton, 00982 const svn_wc_notify_t *notify, 00983 apr_pool_t *pool); 00984 00985 /** 00986 * Similar to @c svn_wc_notify_func2_t, but takes the information as arguments 00987 * instead of struct fields. 00988 * 00989 * @deprecated Provided for backward compatibility with the 1.1 API. 00990 */ 00991 typedef void (*svn_wc_notify_func_t)(void *baton, 00992 const char *path, 00993 svn_wc_notify_action_t action, 00994 svn_node_kind_t kind, 00995 const char *mime_type, 00996 svn_wc_notify_state_t content_state, 00997 svn_wc_notify_state_t prop_state, 00998 svn_revnum_t revision); 00999 01000 /** @} */ 01001 01002 01003 /** 01004 * A simple callback type to wrap svn_ra_get_file(); see that 01005 * docstring for more information. 01006 * 01007 * This technique allows libsvn_client to 'wrap' svn_ra_get_file() and 01008 * pass it down into libsvn_wc functions, thus allowing the WC layer 01009 * to legally call the RA function via (blind) callback. 01010 * 01011 * @since New in 1.5 01012 */ 01013 typedef svn_error_t *(*svn_wc_get_file_t)(void *baton, 01014 const char *path, 01015 svn_revnum_t revision, 01016 svn_stream_t *stream, 01017 svn_revnum_t *fetched_rev, 01018 apr_hash_t **props, 01019 apr_pool_t *pool); 01020 01021 01022 /** 01023 * Interactive conflict handling 01024 * 01025 * @defgroup svn_wc_conflict Conflict callback functionality 01026 * 01027 * @{ 01028 * 01029 * This API gives a Subversion client application the opportunity to 01030 * define a callback that allows the user to resolve conflicts 01031 * interactively during updates and merges. 01032 * 01033 * If a conflict is discovered, libsvn_wc invokes the callback with an 01034 * @c svn_wc_conflict_description_t. This structure describes the 01035 * path in conflict, whether it's a text or property conflict, and may 01036 * also present up to three files that can be used to resolve the 01037 * conflict (perhaps by launching an editor or 3rd-party merging 01038 * tool). The structure also provides a possible fourth file (@c 01039 * merged_file) which, if not NULL, represents libsvn_wc's attempt to 01040 * contextually merge the first three files. (Note that libsvn_wc 01041 * will not attempt to merge a file that it believes is binary, and it 01042 * will only attempt to merge property values it believes to be a 01043 * series of multi-line text.) 01044 * 01045 * When the callback is finished interacting with the user, it 01046 * responds by returning a @c svn_wc_conflict_result_t. This 01047 * structure indicates whether the user wants to postpone the conflict 01048 * for later (allowing libsvn_wc to mark the path "conflicted" as 01049 * usual), or whether the user wants libsvn_wc to use one of the four 01050 * files as the "final" state for resolving the conflict immediately. 01051 * 01052 * Note that the callback is at liberty (and encouraged) to merge the 01053 * three files itself. If it does so, it signals this to libsvn_wc by 01054 * returning a choice of @c svn_wc_conflict_choose_merged. To return 01055 * the 'final' merged file to libsvn_wc, the callback has the option of 01056 * either: 01057 * 01058 * - editing the original @c merged_file in-place 01059 * 01060 * or, if libsvn_wc never supplied a merged_file in the 01061 * description structure (i.e. passed NULL for that field), 01062 * 01063 * - return the merged file in the @c svn_wc_conflict_result_t. 01064 * 01065 */ 01066 01067 /** The type of action being attempted on an object. 01068 * 01069 * @since New in 1.5. 01070 */ 01071 typedef enum svn_wc_conflict_action_t 01072 { 01073 svn_wc_conflict_action_edit, /* attempting to change text or props */ 01074 svn_wc_conflict_action_add, /* attempting to add object */ 01075 svn_wc_conflict_action_delete /* attempting to delete object */ 01076 01077 } svn_wc_conflict_action_t; 01078 01079 01080 /** The pre-existing condition which is causing a state of conflict. 01081 * 01082 * @since New in 1.5. 01083 */ 01084 typedef enum svn_wc_conflict_reason_t 01085 { 01086 svn_wc_conflict_reason_edited, /* local edits are already present */ 01087 svn_wc_conflict_reason_obstructed, /* another object is in the way */ 01088 svn_wc_conflict_reason_deleted, /* object is already schedule-delete */ 01089 svn_wc_conflict_reason_added, /* object is already added or schedule-add */ 01090 svn_wc_conflict_reason_missing, /* object is unknown or missing */ 01091 svn_wc_conflict_reason_unversioned /* object is unversioned */ 01092 01093 } svn_wc_conflict_reason_t; 01094 01095 01096 /** The type of conflict being described by an @c 01097 * svn_wc_conflict_description_t (see below). 01098 * 01099 * @since New in 1.5. 01100 */ 01101 typedef enum svn_wc_conflict_kind_t 01102 { 01103 svn_wc_conflict_kind_text, /* textual conflict (on a file) */ 01104 svn_wc_conflict_kind_property, /* property conflict (on a file or dir) */ 01105 svn_wc_conflict_kind_tree /* tree conflict (on a dir) */ 01106 01107 } svn_wc_conflict_kind_t; 01108 01109 01110 /** The user operation that exposed a conflict. 01111 * 01112 * @since New in 1.6. 01113 */ 01114 typedef enum svn_wc_operation_t 01115 { 01116 svn_wc_operation_update, 01117 svn_wc_operation_switch, 01118 svn_wc_operation_merge, 01119 01120 } svn_wc_operation_t; 01121 01122 01123 /** A struct that describes a conflict that has occurred in the 01124 * working copy. Passed to @c svn_wc_conflict_resolver_func_t. 01125 * 01126 * The conflict described by this structure is one of: 01127 * - a conflict on the content of the file node @a path 01128 * - a conflict on the property @a property_name of @a path 01129 * 01130 * @note Fields may be added to the end of this structure in future 01131 * versions. Therefore, to preserve binary compatibility, users 01132 * should not directly allocate structures of this type but should use 01133 * svn_wc_create_conflict_description_text() or 01134 * svn_wc_create_conflict_description_prop() or 01135 * svn_wc_create_conflict_description_tree() instead. 01136 * 01137 * @since New in 1.5. 01138 */ 01139 typedef struct svn_wc_conflict_description_t 01140 { 01141 /** The path that is in conflict (for a tree conflict, it is the victim) */ 01142 const char *path; 01143 01144 /** The node type of the path being operated on */ 01145 svn_node_kind_t node_kind; 01146 01147 /** What sort of conflict are we describing? */ 01148 svn_wc_conflict_kind_t kind; 01149 01150 /** The name of the property whose conflict is being described. 01151 * (Only if @a kind is 'property'; else undefined.) */ 01152 const char *property_name; 01153 01154 /** Whether svn thinks ('my' version of) @c path is a 'binary' file. 01155 * (Only if @c kind is 'text', else undefined.) */ 01156 svn_boolean_t is_binary; 01157 01158 /** The svn:mime-type property of ('my' version of) @c path, if available, 01159 * else NULL. 01160 * (Only if @c kind is 'text', else undefined.) */ 01161 const char *mime_type; 01162 01163 /** If not NULL, an open working copy access baton to either the 01164 * path itself (if @c path is a directory), or to the parent 01165 * directory (if @c path is a file.) */ 01166 svn_wc_adm_access_t *access; 01167 01168 /** The action being attempted on the conflicted node or property. 01169 * (When @c kind is 'text', this action must be 'edit'.) */ 01170 svn_wc_conflict_action_t action; 01171 01172 /** The state of the target node or property, relative to its merge-left 01173 * source, that is the reason for the conflict. 01174 * (When @c kind is 'text', this reason must be 'edited'.) */ 01175 svn_wc_conflict_reason_t reason; 01176 01177 /** If this is text-conflict and involves the merging of two files 01178 * descended from a common ancestor, here are the paths of up to 01179 * four fulltext files that can be used to interactively resolve the 01180 * conflict. All four files will be in repository-normal form -- LF 01181 * line endings and contracted keywords. (If any of these files are 01182 * not available, they default to NULL.) 01183 * 01184 * On the other hand, if this is a property-conflict, then these 01185 * paths represent temporary files that contain the three different 01186 * property-values in conflict. The fourth path (@c merged_file) 01187 * may or may not be NULL; if set, it represents libsvn_wc's 01188 * attempt to merge the property values together. (Remember that 01189 * property values are technically binary values, and thus can't 01190 * always be merged.) 01191 */ 01192 const char *base_file; /* common ancestor of the two files being merged */ 01193 01194 /** their version of the file */ 01195 const char *their_file; 01196 01197 /** my locally-edited version of the file */ 01198 const char *my_file; 01199 01200 /** merged version; may contain conflict markers */ 01201 const char *merged_file; 01202 01203 /** The operation that exposed the conflict. 01204 * Used only for tree conflicts. 01205 * 01206 * @since New in 1.6. 01207 */ 01208 svn_wc_operation_t operation; 01209 01210 } svn_wc_conflict_description_t; 01211 01212 /** 01213 * Allocate an @c svn_wc_conflict_description_t structure in @a pool, 01214 * initialize to represent a text conflict, and return it. 01215 * 01216 * Set the @c path field of the created struct to @a path, the @c access 01217 * field to @a adm_access, the @c kind field to @c 01218 * svn_wc_conflict_kind_text, the @c node_kind to @c svn_node_file, the @c 01219 * action to @c svn_wc_conflict_action_edit, and the @c reason to @c 01220 * svn_wc_conflict_reason_edited. Make only shallow copies of the pointer 01221 * arguments. 01222 * 01223 * @note: It is the caller's responsibility to set the other required fields 01224 * (such as the four file names and @c mime_type and @c is_binary). 01225 * 01226 * @since New in 1.6. 01227 */ 01228 svn_wc_conflict_description_t * 01229 svn_wc_conflict_description_create_text(const char *path, 01230 svn_wc_adm_access_t *adm_access, 01231 apr_pool_t *pool); 01232 01233 /** 01234 * Allocate an @c svn_wc_conflict_description_t structure in @a pool, 01235 * initialize to represent a property conflict, and return it. 01236 * 01237 * Set the @c path field of the created struct to @a path, the @c access 01238 * field to @a adm_access, the @c kind field to @c 01239 * svn_wc_conflict_kind_prop, the @c node_kind to @a node_kind, and the @c 01240 * property_name to @a property_name. Make only shallow copies of the pointer 01241 * arguments. 01242 * 01243 * @note: It is the caller's responsibility to set the other required fields 01244 * (such as the four file names and @c action and @c reason). 01245 * 01246 * @since New in 1.6. 01247 */ 01248 svn_wc_conflict_description_t * 01249 svn_wc_conflict_description_create_prop(const char *path, 01250 svn_wc_adm_access_t *adm_access, 01251 svn_node_kind_t node_kind, 01252 const char *property_name, 01253 apr_pool_t *pool); 01254 01255 /** 01256 * Allocate an @c svn_wc_conflict_description_t structure in @a pool, 01257 * initialize to represent a tree conflict, and return it. 01258 * 01259 * Set the @c path field of the created struct to @a path, the @c access 01260 * field to @a adm_access, the @c kind field to @c 01261 * svn_wc_conflict_kind_tree, the @c node_kind to @a node_kind, and the @c 01262 * operation to @a operation. Make only shallow copies of the pointer 01263 * arguments. 01264 * 01265 * @note: It is the caller's responsibility to set the other required fields 01266 * (such as the four file names and @c action and @c reason). 01267 * 01268 * @since New in 1.6. 01269 */ 01270 svn_wc_conflict_description_t * 01271 svn_wc_conflict_description_create_tree(const char *path, 01272 svn_wc_adm_access_t *adm_access, 01273 svn_node_kind_t node_kind, 01274 svn_wc_operation_t operation, 01275 apr_pool_t *pool); 01276 01277 01278 /** The way in which the conflict callback chooses a course of action. 01279 * 01280 * @since New in 1.5. 01281 */ 01282 typedef enum svn_wc_conflict_choice_t 01283 { 01284 /* Don't resolve the conflict now. Let libsvn_wc mark the path 01285 'conflicted', so user can run 'svn resolved' later. */ 01286 svn_wc_conflict_choose_postpone, 01287 01288 /* If their were files to choose from, select one as a way of 01289 resolving the conflict here and now. libsvn_wc will then do the 01290 work of "installing" the chosen file. 01291 */ 01292 svn_wc_conflict_choose_base, /* original version */ 01293 svn_wc_conflict_choose_theirs_full, /* incoming version */ 01294 svn_wc_conflict_choose_mine_full, /* own version */ 01295 svn_wc_conflict_choose_theirs_conflict, /* incoming (for conflicted hunks) */ 01296 svn_wc_conflict_choose_mine_conflict, /* own (for conflicted hunks) */ 01297 svn_wc_conflict_choose_merged /* merged version */ 01298 01299 } svn_wc_conflict_choice_t; 01300 01301 01302 /** The final result returned by @c svn_wc_conflict_resolver_func_t. 01303 * 01304 * @note Fields may be added to the end of this structure in future 01305 * versions. Therefore, to preserve binary compatibility, users 01306 * should not directly allocate structures of this type. Instead, 01307 * construct this structure using @c svn_wc_create_conflict_result() 01308 * below. 01309 * 01310 * @since New in 1.5. 01311 */ 01312 typedef struct svn_wc_conflict_result_t 01313 { 01314 /** A choice to either delay the conflict resolution or select a 01315 particular file to resolve the conflict. */ 01316 svn_wc_conflict_choice_t choice; 01317 01318 /** If not NULL, this is a path to a file which contains the client's 01319 (or more likely, the user's) merging of the three values in 01320 conflict. libsvn_wc accepts this file if (and only if) @c choice 01321 is set to @c svn_wc_conflict_choose_merged.*/ 01322 const char *merged_file; 01323 01324 /** If true, save a backup copy of merged_file (or the original 01325 merged_file from the conflict description, if merged_file is 01326 NULL) in the user's working copy. */ 01327 svn_boolean_t save_merged; 01328 01329 } svn_wc_conflict_result_t; 01330 01331 01332 /** 01333 * Allocate an @c svn_wc_conflict_result_t structure in @a pool, 01334 * initialize and return it. 01335 * 01336 * Set the @c choice field of the structure to @a choice, and @c 01337 * merged_file to @a merged_file. Set all other fields to their @c 01338 * _unknown, @c NULL or invalid value, respectively. Make only a shallow 01339 * copy of the pointer argument @a merged_file. 01340 * 01341 * @since New in 1.5. 01342 */ 01343 svn_wc_conflict_result_t * 01344 svn_wc_create_conflict_result(svn_wc_conflict_choice_t choice, 01345 const char *merged_file, 01346 apr_pool_t *pool); 01347 01348 01349 /** A callback used in svn_client_merge3(), svn_client_update3(), and 01350 * svn_client_switch2() for resolving conflicts during the application 01351 * of a tree delta to a working copy. 01352 * 01353 * @a description describes the exact nature of the conflict, and 01354 * provides information to help resolve it. @a baton is a closure 01355 * object; it should be provided by the implementation, and passed by 01356 * the caller. All allocations should be performed in @a pool. When 01357 * finished, the callback signals its resolution by returning a 01358 * structure in @a *result. (See @c svn_wc_conflict_result_t.) 01359 * 01360 * The values @c svn_wc_conflict_choose_mine_conflict and @c 01361 * svn_wc_conflict_choose_theirs_conflict are not legal for conflicts 01362 * in binary files or properties. 01363 * 01364 * Implementations of this callback are free to present the conflict 01365 * using any user interface. This may include simple contextual 01366 * conflicts in a file's text or properties, or more complex 01367 * 'tree'-based conflcts related to obstructed additions, deletions, 01368 * and edits. The callback implementation is free to decide which 01369 * sorts of conflicts to handle; it's also free to decide which types 01370 * of conflicts are automatically resolvable and which require user 01371 * interaction. 01372 * 01373 * @since New in 1.5. 01374 */ 01375 typedef svn_error_t *(*svn_wc_conflict_resolver_func_t) 01376 (svn_wc_conflict_result_t **result, 01377 const svn_wc_conflict_description_t *description, 01378 void *baton, 01379 apr_pool_t *pool); 01380 01381 /** @} */ 01382 01383 01384 01385 /** 01386 * A callback vtable invoked by our diff-editors, as they receive 01387 * diffs from the server. 'svn diff' and 'svn merge' both implement 01388 * their own versions of this table. 01389 * 01390 * Common parameters: 01391 * 01392 * @a adm_access will be an access baton for the directory containing 01393 * @a path, or @c NULL if the diff editor is not using access batons. 01394 * 01395 * If @a state is non-NULL, set @a *state to the state of the item 01396 * after the operation has been performed. (In practice, this is only 01397 * useful with merge, not diff; diff callbacks will probably set 01398 * @a *state to @c svn_wc_notify_state_unknown, since they do not change 01399 * the state and therefore do not bother to know the state after the 01400 * operation.) By default, @a state refers to the item's content 01401 * state. Functions concerned with property state have separate 01402 * @a contentstate and @a propstate arguments. 01403 * 01404 * @since New in 1.6. 01405 */ 01406 typedef struct svn_wc_diff_callbacks3_t 01407 { 01408 /** 01409 * A file @a path has changed. If @a tmpfile2 is non-NULL, the 01410 * contents have changed and those changes can be seen by comparing 01411 * @a tmpfile1 and @a tmpfile2, which represent @a rev1 and @a rev2 of 01412 * the file, respectively. 01413 * 01414 * If known, the @c svn:mime-type value of each file is passed into 01415 * @a mimetype1 and @a mimetype2; either or both of the values can 01416 * be NULL. The implementor can use this information to decide if 01417 * (or how) to generate differences. 01418 * 01419 * @a propchanges is an array of (@c svn_prop_t) structures. If it contains 01420 * any elements, the original list of properties is provided in 01421 * @a originalprops, which is a hash of @c svn_string_t values, keyed on the 01422 * property name. 01423 * 01424 */ 01425 svn_error_t *(*file_changed)(svn_wc_adm_access_t *adm_access, 01426 svn_wc_notify_state_t *contentstate, 01427 svn_wc_notify_state_t *propstate, 01428 const char *path, 01429 const char *tmpfile1, 01430 const char *tmpfile2, 01431 svn_revnum_t rev1, 01432 svn_revnum_t rev2, 01433 const char *mimetype1, 01434 const char *mimetype2, 01435 const apr_array_header_t *propchanges, 01436 apr_hash_t *originalprops, 01437 void *diff_baton); 01438 01439 /** 01440 * A file @a path was added. The contents can be seen by comparing 01441 * @a tmpfile1 and @a tmpfile2, which represent @a rev1 and @a rev2 01442 * of the file, respectively. (If either file is empty, the rev 01443 * will be 0.) 01444 * 01445 * If known, the @c svn:mime-type value of each file is passed into 01446 * @a mimetype1 and @a mimetype2; either or both of the values can 01447 * be NULL. The implementor can use this information to decide if 01448 * (or how) to generate differences. 01449 * 01450 * @a propchanges is an array of (@c svn_prop_t) structures. If it contains 01451 * any elements, the original list of properties is provided in 01452 * @a originalprops, which is a hash of @c svn_string_t values, keyed on the 01453 * property name. 01454 */ 01455 svn_error_t *(*file_added)(svn_wc_adm_access_t *adm_access, 01456 svn_wc_notify_state_t *contentstate, 01457 svn_wc_notify_state_t *propstate, 01458 const char *path, 01459 const char *tmpfile1, 01460 const char *tmpfile2, 01461 svn_revnum_t rev1, 01462 svn_revnum_t rev2, 01463 const char *mimetype1, 01464 const char *mimetype2, 01465 const apr_array_header_t *propchanges, 01466 apr_hash_t *originalprops, 01467 void *diff_baton); 01468 01469 /** 01470 * A file @a path was deleted. The [loss of] contents can be seen by 01471 * comparing @a tmpfile1 and @a tmpfile2. @a originalprops provides 01472 * the properties of the file. 01473 * 01474 * If known, the @c svn:mime-type value of each file is passed into 01475 * @a mimetype1 and @a mimetype2; either or both of the values can 01476 * be NULL. The implementor can use this information to decide if 01477 * (or how) to generate differences. 01478 */ 01479 svn_error_t *(*file_deleted)(svn_wc_adm_access_t *adm_access, 01480 svn_wc_notify_state_t *state, 01481 const char *path, 01482 const char *tmpfile1, 01483 const char *tmpfile2, 01484 const char *mimetype1, 01485 const char *mimetype2, 01486 apr_hash_t *originalprops, 01487 void *diff_baton); 01488 01489 /** 01490 * A directory @a path was added. @a rev is the revision that the 01491 * directory came from. 01492 */ 01493 svn_error_t *(*dir_added)(svn_wc_adm_access_t *adm_access, 01494 svn_wc_notify_state_t *state, 01495 const char *path, 01496 svn_revnum_t rev, 01497 void *diff_baton); 01498 01499 /** 01500 * A directory @a path was deleted. 01501 */ 01502 svn_error_t *(*dir_deleted)(svn_wc_adm_access_t *adm_access, 01503 svn_wc_notify_state_t *state, 01504 const char *path, 01505 void *diff_baton); 01506 01507 /** 01508 * A list of property changes (@a propchanges) was applied to the 01509 * directory @a path. 01510 * 01511 * The array is a list of (@c svn_prop_t) structures. 01512 * 01513 * The original list of properties is provided in @a original_props, 01514 * which is a hash of @c svn_string_t values, keyed on the property 01515 * name. 01516 */ 01517 svn_error_t *(*dir_props_changed)(svn_wc_adm_access_t *adm_access, 01518 svn_wc_notify_state_t *propstate, 01519 const char *path, 01520 const apr_array_header_t *propchanges, 01521 apr_hash_t *original_props, 01522 void *diff_baton); 01523 01524 /** 01525 * A directory @a path has been opened. @a rev is the revision that the 01526 * directory came from. 01527 * 01528 */ 01529 svn_error_t *(*dir_opened)(svn_wc_adm_access_t *adm_access, 01530 const char *path, 01531 svn_revnum_t rev, 01532 void *diff_baton); 01533 01534 /** 01535 * A directory @a path has been closed. 01536 * 01537 * If @a state is non-NULL, set @a *state to the tree-conflict state 01538 * of the directory. 01539 * 01540 * The client may now report the final state of the directory's 01541 * children (e.g., report a path as 'replaced'). 01542 */ 01543 svn_error_t *(*dir_closed)(svn_wc_adm_access_t *adm_access, 01544 svn_wc_notify_state_t *state, 01545 const char *path, 01546 void *diff_baton); 01547 01548 } svn_wc_diff_callbacks3_t; 01549 01550 /** 01551 * Similar to @c svn_wc_diff_callbacks3_t, but without dir_opened or 01552 * dir_closed functions. 01553 * 01554 * @deprecated Provided for backward compatibility with the 1.2 API. 01555 */ 01556 typedef struct svn_wc_diff_callbacks2_t 01557 { 01558 /** The same as @c file_changed in @c svn_wc_diff_callbacks3_t. */ 01559 svn_error_t *(*file_changed)(svn_wc_adm_access_t *adm_access, 01560 svn_wc_notify_state_t *contentstate, 01561 svn_wc_notify_state_t *propstate, 01562 const char *path, 01563 const char *tmpfile1, 01564 const char *tmpfile2, 01565 svn_revnum_t rev1, 01566 svn_revnum_t rev2, 01567 const char *mimetype1, 01568 const char *mimetype2, 01569 const apr_array_header_t *propchanges, 01570 apr_hash_t *originalprops, 01571 void *diff_baton); 01572 01573 /** The same as @c file_added in @c svn_wc_diff_callbacks3_t. */ 01574 svn_error_t *(*file_added)(svn_wc_adm_access_t *adm_access, 01575 svn_wc_notify_state_t *contentstate, 01576 svn_wc_notify_state_t *propstate, 01577 const char *path, 01578 const char *tmpfile1, 01579 const char *tmpfile2, 01580 svn_revnum_t rev1, 01581 svn_revnum_t rev2, 01582 const char *mimetype1, 01583 const char *mimetype2, 01584 const apr_array_header_t *propchanges, 01585 apr_hash_t *originalprops, 01586 void *diff_baton); 01587 01588 /** The same as @c file_deleted in @c svn_wc_diff_callbacks3_t. */ 01589 svn_error_t *(*file_deleted)(svn_wc_adm_access_t *adm_access, 01590 svn_wc_notify_state_t *state, 01591 const char *path, 01592 const char *tmpfile1, 01593 const char *tmpfile2, 01594 const char *mimetype1, 01595 const char *mimetype2, 01596 apr_hash_t *originalprops, 01597 void *diff_baton); 01598 01599 /** The same as @c dir_added in @c svn_wc_diff_callbacks3_t. */ 01600 svn_error_t *(*dir_added)(svn_wc_adm_access_t *adm_access, 01601 svn_wc_notify_state_t *state, 01602 const char *path, 01603 svn_revnum_t rev, 01604 void *diff_baton); 01605 01606 /** The same as @c dir_deleted in @c svn_wc_diff_callbacks3_t. */ 01607 svn_error_t *(*dir_deleted)(svn_wc_adm_access_t *adm_access, 01608 svn_wc_notify_state_t *state, 01609 const char *path, 01610 void *diff_baton); 01611 01612 /** The same as @c dir_props_changed in @c svn_wc_diff_callbacks3_t. */ 01613 svn_error_t *(*dir_props_changed)(svn_wc_adm_access_t *adm_access, 01614 svn_wc_notify_state_t *state, 01615 const char *path, 01616 const apr_array_header_t *propchanges, 01617