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_repos.h 00019 * @brief Tools built on top of the filesystem. 00020 */ 00021 00022 00023 #ifndef SVN_REPOS_H 00024 #define SVN_REPOS_H 00025 00026 #include <apr_pools.h> 00027 #include <apr_hash.h> 00028 #include "svn_fs.h" 00029 #include "svn_delta.h" 00030 #include "svn_types.h" 00031 #include "svn_error.h" 00032 #include "svn_version.h" 00033 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif /* __cplusplus */ 00038 00039 /* ---------------------------------------------------------------*/ 00040 00041 /** 00042 * Get libsvn_repos version information. 00043 * 00044 * @since New in 1.1. 00045 */ 00046 const svn_version_t * 00047 svn_repos_version(void); 00048 00049 00050 00051 /** Callback type for checking authorization on paths produced by (at 00052 * least) svn_repos_dir_delta2(). 00053 * 00054 * Set @a *allowed to TRUE to indicate that some operation is 00055 * authorized for @a path in @a root, or set it to FALSE to indicate 00056 * unauthorized (presumably according to state stored in @a baton). 00057 * 00058 * Do not assume @a pool has any lifetime beyond this call. 00059 * 00060 * The exact operation being authorized depends on the callback 00061 * implementation. For read authorization, for example, the caller 00062 * would implement an instance that does read checking, and pass it as 00063 * a parameter named [perhaps] 'authz_read_func'. The receiver of 00064 * that parameter might also take another parameter named 00065 * 'authz_write_func', which although sharing this type, would be a 00066 * different implementation. 00067 * 00068 * @note If someday we want more sophisticated authorization states 00069 * than just yes/no, @a allowed can become an enum type. 00070 */ 00071 typedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed, 00072 svn_fs_root_t *root, 00073 const char *path, 00074 void *baton, 00075 apr_pool_t *pool); 00076 00077 00078 /** An enum defining the kinds of access authz looks up. 00079 * 00080 * @since New in 1.3. 00081 */ 00082 typedef enum 00083 { 00084 /** No access. */ 00085 svn_authz_none = 0, 00086 00087 /** Path can be read. */ 00088 svn_authz_read = 1, 00089 00090 /** Path can be altered. */ 00091 svn_authz_write = 2, 00092 00093 /** The other access credentials are recursive. */ 00094 svn_authz_recursive = 4 00095 } svn_repos_authz_access_t; 00096 00097 00098 /** Callback type for checking authorization on paths produced by 00099 * the repository commit editor. 00100 * 00101 * Set @a *allowed to TRUE to indicate that the @a required access on 00102 * @a path in @a root is authorized, or set it to FALSE to indicate 00103 * unauthorized (presumable according to state stored in @a baton). 00104 * 00105 * If @a path is NULL, the callback should perform a global authz 00106 * lookup for the @a required access. That is, the lookup should 00107 * check if the @a required access is granted for at least one path of 00108 * the repository, and set @a *allowed to TRUE if so. @a root may 00109 * also be NULL if @a path is NULL. 00110 * 00111 * This callback is very similar to svn_repos_authz_func_t, with the 00112 * exception of the addition of the @a required parameter. 00113 * This is due to historical reasons: when authz was first implemented 00114 * for svn_repos_dir_delta2(), it seemed there would need only checks 00115 * for read and write operations, hence the svn_repos_authz_func_t 00116 * callback prototype and usage scenario. But it was then realized 00117 * that lookups due to copying needed to be recursive, and that 00118 * brute-force recursive lookups didn't square with the O(1) 00119 * performances a copy operation should have. 00120 * 00121 * So a special way to ask for a recursive lookup was introduced. The 00122 * commit editor needs this capability to retain acceptable 00123 * performance. Instead of revving the existing callback, causing 00124 * unnecessary revving of functions that don't actually need the 00125 * extended functionality, this second, more complete callback was 00126 * introduced, for use by the commit editor. 00127 * 00128 * Some day, it would be nice to reunite these two callbacks and do 00129 * the necessary revving anyway, but for the time being, this dual 00130 * callback mechanism will do. 00131 */ 00132 typedef svn_error_t *(*svn_repos_authz_callback_t) 00133 (svn_repos_authz_access_t required, 00134 svn_boolean_t *allowed, 00135 svn_fs_root_t *root, 00136 const char *path, 00137 void *baton, 00138 apr_pool_t *pool); 00139 00140 /** 00141 * Similar to @c svn_file_rev_handler_t, but without the @a 00142 * result_of_merge parameter. 00143 * 00144 * @deprecated Provided for backward compatibility with 1.4 API. 00145 * @since New in 1.1. 00146 */ 00147 typedef svn_error_t *(*svn_repos_file_rev_handler_t) 00148 (void *baton, 00149 const char *path, 00150 svn_revnum_t rev, 00151 apr_hash_t *rev_props, 00152 svn_txdelta_window_handler_t *delta_handler, 00153 void **delta_baton, 00154 apr_array_header_t *prop_diffs, 00155 apr_pool_t *pool); 00156 00157 00158 /** The repository object. */ 00159 typedef struct svn_repos_t svn_repos_t; 00160 00161 /* Opening and creating repositories. */ 00162 00163 00164 /** Find the root path of the repository that contains @a path. 00165 * 00166 * If a repository was found, the path to the root of the repository 00167 * is returned, else @c NULL. The pointer to the returned path may be 00168 * equal to @a path. 00169 */ 00170 const char * 00171 svn_repos_find_root_path(const char *path, 00172 apr_pool_t *pool); 00173 00174 /** Set @a *repos_p to a repository object for the repository at @a path. 00175 * 00176 * Allocate @a *repos_p in @a pool. 00177 * 00178 * Acquires a shared lock on the repository, and attaches a cleanup 00179 * function to @a pool to remove the lock. If no lock can be acquired, 00180 * returns error, with undefined effect on @a *repos_p. If an exclusive 00181 * lock is present, this blocks until it's gone. 00182 */ 00183 svn_error_t * 00184 svn_repos_open(svn_repos_t **repos_p, 00185 const char *path, 00186 apr_pool_t *pool); 00187 00188 /** Create a new Subversion repository at @a path, building the necessary 00189 * directory structure, creating the filesystem, and so on. 00190 * Return the repository object in @a *repos_p, allocated in @a pool. 00191 * 00192 * @a config is a client configuration hash of @c svn_config_t * items 00193 * keyed on config category names, and may be NULL. 00194 * 00195 * @a fs_config is passed to the filesystem, and may be NULL. 00196 * 00197 * @a unused_1 and @a unused_2 are not used and should be NULL. 00198 */ 00199 svn_error_t * 00200 svn_repos_create(svn_repos_t **repos_p, 00201 const char *path, 00202 const char *unused_1, 00203 const char *unused_2, 00204 apr_hash_t *config, 00205 apr_hash_t *fs_config, 00206 apr_pool_t *pool); 00207 00208 /** 00209 * Upgrade the Subversion repository (and its underlying versioned 00210 * filesystem) located in the directory @a path to the latest version 00211 * supported by this library. If the requested upgrade is not 00212 * supported due to the current state of the repository or it 00213 * underlying filesystem, return @c SVN_ERR_REPOS_UNSUPPORTED_UPGRADE 00214 * or @c SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no 00215 * changes to the repository or filesystem. 00216 * 00217 * Acquires an exclusive lock on the repository, upgrades the 00218 * repository, and releases the lock. If an exclusive lock can't be 00219 * acquired, returns error. 00220 * 00221 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 00222 * returned if the lock is not immediately available. 00223 * 00224 * If @a start_callback is not NULL, it will be called with @a 00225 * start_callback_baton as argument before the upgrade starts, but 00226 * after the exclusive lock has been acquired. 00227 * 00228 * Use @a pool for necessary allocations. 00229 * 00230 * @note This functionality is provided as a convenience for 00231 * administrators wishing to make use of new Subversion functionality 00232 * without a potentially costly full repository dump/load. As such, 00233 * the operation performs only the minimum amount of work needed to 00234 * accomplish this while maintaining the integrity of the repository. 00235 * It does *not* guarantee the most optimized repository state as a 00236 * dump and subsequent load would. 00237 * 00238 * @since New in 1.5. 00239 */ 00240 svn_error_t * 00241 svn_repos_upgrade(const char *path, 00242 svn_boolean_t nonblocking, 00243 svn_error_t *(*start_callback)(void *baton), 00244 void *start_callback_baton, 00245 apr_pool_t *pool); 00246 00247 /** Destroy the Subversion repository found at @a path, using @a pool for any 00248 * necessary allocations. 00249 */ 00250 svn_error_t * 00251 svn_repos_delete(const char *path, 00252 apr_pool_t *pool); 00253 00254 /** 00255 * Set @a *has to TRUE if @a repos has @a capability (one of the 00256 * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set 00257 * @a *has to FALSE. 00258 * 00259 * If @a capability isn't recognized, throw @c SVN_ERR_UNKNOWN_CAPABILITY, 00260 * with the effect on @a *has undefined. 00261 * 00262 * Use @a pool for all allocation. 00263 * 00264 * @since New in 1.5. 00265 */ 00266 svn_error_t * 00267 svn_repos_has_capability(svn_repos_t *repos, 00268 svn_boolean_t *has, 00269 const char *capability, 00270 apr_pool_t *pool); 00271 00272 /** 00273 * The capability of doing the right thing with merge-tracking 00274 * information, both storing it and responding to queries about it. 00275 * 00276 * @since New in 1.5. 00277 */ 00278 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo" 00279 /* *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY *** 00280 * 00281 * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to 00282 * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid 00283 * colons for their own reasons. While this RA limitation has no 00284 * direct impact on repository capabilities, there's no reason to be 00285 * gratuitously different either. 00286 */ 00287 00288 00289 /** Return the filesystem associated with repository object @a repos. */ 00290 svn_fs_t * 00291 svn_repos_fs(svn_repos_t *repos); 00292 00293 00294 /** Make a hot copy of the Subversion repository found at @a src_path 00295 * to @a dst_path. 00296 * 00297 * Copy a possibly live Subversion repository from @a src_path to 00298 * @a dst_path. If @a clean_logs is @c TRUE, perform cleanup on the 00299 * source filesystem as part of the copy operation; currently, this 00300 * means deleting copied, unused logfiles for a Berkeley DB source 00301 * repository. 00302 */ 00303 svn_error_t * 00304 svn_repos_hotcopy(const char *src_path, 00305 const char *dst_path, 00306 svn_boolean_t clean_logs, 00307 apr_pool_t *pool); 00308 00309 /** 00310 * Run database recovery procedures on the repository at @a path, 00311 * returning the database to a consistent state. Use @a pool for all 00312 * allocation. 00313 * 00314 * Acquires an exclusive lock on the repository, recovers the 00315 * database, and releases the lock. If an exclusive lock can't be 00316 * acquired, returns error. 00317 * 00318 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 00319 * returned if the lock is not immediately available. 00320 * 00321 * If @a start_callback is not NULL, it will be called with @a 00322 * start_callback_baton as argument before the recovery starts, but 00323 * after the exclusive lock has been acquired. 00324 * 00325 * If @a cancel_func is not @c NULL, it is called periodically with 00326 * @a cancel_baton as argument to see if the client wishes to cancel 00327 * the recovery. 00328 * 00329 * @note On some platforms the exclusive lock does not exclude other 00330 * threads in the same process so this function should only be called 00331 * by a single threaded process, or by a multi-threaded process when 00332 * no other threads are accessing the repository. 00333 * 00334 * @since New in 1.5. 00335 */ 00336 svn_error_t * 00337 svn_repos_recover3(const char *path, 00338 svn_boolean_t nonblocking, 00339 svn_error_t *(*start_callback)(void *baton), 00340 void *start_callback_baton, 00341 svn_cancel_func_t cancel_func, 00342 void * cancel_baton, 00343 apr_pool_t *pool); 00344 00345 /** 00346 * Similar to svn_repos_recover3(), but without cancellation support. 00347 * 00348 * @deprecated Provided for backward compatibility with the 1.4 API. 00349 */ 00350 SVN_DEPRECATED 00351 svn_error_t * 00352 svn_repos_recover2(const char *path, 00353 svn_boolean_t nonblocking, 00354 svn_error_t *(*start_callback)(void *baton), 00355 void *start_callback_baton, 00356 apr_pool_t *pool); 00357 00358 /** 00359 * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and 00360 * with no callbacks provided. 00361 * 00362 * @deprecated Provided for backward compatibility with the 1.0 API. 00363 */ 00364 SVN_DEPRECATED 00365 svn_error_t * 00366 svn_repos_recover(const char *path, 00367 apr_pool_t *pool); 00368 00369 /** This function is a wrapper around svn_fs_berkeley_logfiles(), 00370 * returning log file paths relative to the root of the repository. 00371 * 00372 * @copydoc svn_fs_berkeley_logfiles() 00373 */ 00374 svn_error_t * 00375 svn_repos_db_logfiles(apr_array_header_t **logfiles, 00376 const char *path, 00377 svn_boolean_t only_unused, 00378 apr_pool_t *pool); 00379 00380 00381 00382 /* Repository Paths */ 00383 00384 /** Return the top-level repository path allocated in @a pool. */ 00385 const char * 00386 svn_repos_path(svn_repos_t *repos, 00387 apr_pool_t *pool); 00388 00389 /** Return the path to @a repos's filesystem directory, allocated in 00390 * @a pool. 00391 */ 00392 const char * 00393 svn_repos_db_env(svn_repos_t *repos, 00394 apr_pool_t *pool); 00395 00396 /** Return path to @a repos's config directory, allocated in @a pool. */ 00397 const char * 00398 svn_repos_conf_dir(svn_repos_t *repos, 00399 apr_pool_t *pool); 00400 00401 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */ 00402 const char * 00403 svn_repos_svnserve_conf(svn_repos_t *repos, 00404 apr_pool_t *pool); 00405 00406 /** Return path to @a repos's lock directory, allocated in @a pool. */ 00407 const char * 00408 svn_repos_lock_dir(svn_repos_t *repos, 00409 apr_pool_t *pool); 00410 00411 /** Return path to @a repos's db lockfile, allocated in @a pool. */ 00412 const char * 00413 svn_repos_db_lockfile(svn_repos_t *repos, 00414 apr_pool_t *pool); 00415 00416 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */ 00417 const char * 00418 svn_repos_db_logs_lockfile(svn_repos_t *repos, 00419 apr_pool_t *pool); 00420 00421 /** Return the path to @a repos's hook directory, allocated in @a pool. */ 00422 const char * 00423 svn_repos_hook_dir(svn_repos_t *repos, 00424 apr_pool_t *pool); 00425 00426 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */ 00427 const char * 00428 svn_repos_start_commit_hook(svn_repos_t *repos, 00429 apr_pool_t *pool); 00430 00431 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */ 00432 const char * 00433 svn_repos_pre_commit_hook(svn_repos_t *repos, 00434 apr_pool_t *pool); 00435 00436 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */ 00437 const char * 00438 svn_repos_post_commit_hook(svn_repos_t *repos, 00439 apr_pool_t *pool); 00440 00441 /** Return the path to @a repos's pre-revprop-change hook, allocated in 00442 * @a pool. 00443 */ 00444 const char * 00445 svn_repos_pre_revprop_change_hook(svn_repos_t *repos, 00446 apr_pool_t *pool); 00447 00448 /** Return the path to @a repos's post-revprop-change hook, allocated in 00449 * @a pool. 00450 */ 00451 const char * 00452 svn_repos_post_revprop_change_hook(svn_repos_t *repos, 00453 apr_pool_t *pool); 00454 00455 00456 /** @defgroup svn_repos_lock_hooks Paths to lock hooks 00457 * @{ 00458 * @since New in 1.2. */ 00459 00460 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */ 00461 const char * 00462 svn_repos_pre_lock_hook(svn_repos_t *repos, 00463 apr_pool_t *pool); 00464 00465 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */ 00466 const char * 00467 svn_repos_post_lock_hook(svn_repos_t *repos, 00468 apr_pool_t *pool); 00469 00470 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */ 00471 const char * 00472 svn_repos_pre_unlock_hook(svn_repos_t *repos, 00473 apr_pool_t *pool); 00474 00475 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */ 00476 const char * 00477 svn_repos_post_unlock_hook(svn_repos_t *repos, 00478 apr_pool_t *pool); 00479 00480 /** @} */ 00481 00482 /* ---------------------------------------------------------------*/ 00483 00484 /* Reporting the state of a working copy, for updates. */ 00485 00486 00487 /** 00488 * Construct and return a @a report_baton that will be passed to the 00489 * other functions in this section to describe the state of a pre-existing 00490 * tree (typically, a working copy). When the report is finished, 00491 * @a editor/@a edit_baton will be driven in such a way as to transform the 00492 * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the 00493 * reported hierarchy to @a tgt_path. 00494 * 00495 * @a fs_base is the absolute path of the node in the filesystem at which 00496 * the comparison should be rooted. @a target is a single path component, 00497 * used to limit the scope of the report to a single entry of @a fs_base, 00498 * or "" if all of @a fs_base itself is the main subject of the report. 00499 * 00500 * @a tgt_path and @a revnum is the fs path/revision pair that is the 00501 * "target" of the delta. @a tgt_path should be provided only when 00502 * the source and target paths of the report differ. That is, @a tgt_path 00503 * should *only* be specified when specifying that the resultant editor 00504 * drive be one that transforms the reported hierarchy into a pristine tree 00505 * of @a tgt_path at revision @a revnum. A @c NULL value for @a tgt_path 00506 * will indicate that the editor should be driven in such a way as to 00507 * transform the reported hierarchy to revision @a revnum, preserving the 00508 * reported hierarchy. 00509 * 00510 * @a text_deltas instructs the driver of the @a editor to enable 00511 * the generation of text deltas. 00512 * 00513 * @a ignore_ancestry instructs the driver to ignore node ancestry 00514 * when determining how to transmit differences. 00515 * 00516 * @a send_copyfrom_args instructs the driver to send 'copyfrom' 00517 * arguments to the editor's add_file() and add_directory() methods, 00518 * whenever it deems feasible. 00519 * 00520 * The @a authz_read_func and @a authz_read_baton are passed along to 00521 * svn_repos_dir_delta2(); see that function for how they are used. 00522 * 00523 * All allocation for the context and collected state will occur in 00524 * @a pool. 00525 * 00526 * @a depth is the requested depth of the editor drive. 00527 * 00528 * If @a depth is @c svn_depth_unknown, the editor will affect only the 00529 * paths reported by the individual calls to @c svn_repos_set_path3 and 00530 * @c svn_repos_link_path3. 00531 * 00532 * For example, if the reported tree is the @c A subdir of the Greek Tree 00533 * (see Subversion's test suite), at depth @c svn_depth_empty, but the 00534 * @c A/B subdir is reported at depth @c svn_depth_infinity, then 00535 * repository-side changes to @c A/mu, or underneath @c A/C and @c 00536 * A/D, would not be reflected in the editor drive, but changes 00537 * underneath @c A/B would be. 00538 * 00539 * Additionally, the editor driver will call @c add_directory and 00540 * and @c add_file for directories with an appropriate depth. For 00541 * example, a directory reported at @c svn_depth_files will receive 00542 * file (but not directory) additions. A directory at @c svn_depth_empty 00543 * will receive neither. 00544 * 00545 * If @a depth is @c svn_depth_files, @c svn_depth_immediates or 00546 * @c svn_depth_infinity and @a depth is greater than the reported depth 00547 * of the working copy, then the editor driver will emit editor 00548 * operations so as to upgrade the working copy to this depth. 00549 * 00550 * If @a depth is @c svn_depth_empty, @c svn_depth_files, 00551 * @c svn_depth_immediates and @a depth is lower 00552 * than or equal to the depth of the working copy, then the editor 00553 * operations will affect only paths at or above @a depth. 00554 * 00555 * @since New in 1.5. 00556 */ 00557 svn_error_t * 00558 svn_repos_begin_report2(void **report_baton, 00559 svn_revnum_t revnum, 00560 svn_repos_t *repos, 00561 const char *fs_base, 00562 const char *target, 00563 const char *tgt_path, 00564 svn_boolean_t text_deltas, 00565 svn_depth_t depth, 00566 svn_boolean_t ignore_ancestry, 00567 svn_boolean_t send_copyfrom_args, 00568 const svn_delta_editor_t *editor, 00569 void *edit_baton, 00570 svn_repos_authz_func_t authz_read_func, 00571 void *authz_read_baton, 00572 apr_pool_t *pool); 00573 00574 /** 00575 * The same as svn_repos_begin_report2(), but taking a boolean 00576 * @a recurse flag, and sending FALSE for @a send_copyfrom_args. 00577 * 00578 * If @a recurse is TRUE, the editor driver will drive the editor with 00579 * a depth of @c svn_depth_infinity; if FALSE, then with a depth of 00580 * @c svn_depth_files. 00581 * 00582 * @note @a username is ignored, and has been removed in a revised 00583 * version of this API. 00584 * 00585 * @deprecated Provided for backward compatibility with the 1.4 API. 00586 */ 00587 SVN_DEPRECATED 00588 svn_error_t * 00589 svn_repos_begin_report(void **report_baton, 00590 svn_revnum_t revnum, 00591 const char *username, 00592 svn_repos_t *repos, 00593 const char *fs_base, 00594 const char *target, 00595 const char *tgt_path, 00596 svn_boolean_t text_deltas, 00597 svn_boolean_t recurse, 00598 svn_boolean_t ignore_ancestry, 00599 const svn_delta_editor_t *editor, 00600 void *edit_baton, 00601 svn_repos_authz_func_t authz_read_func, 00602 void *authz_read_baton, 00603 apr_pool_t *pool); 00604 00605 00606 /** 00607 * Given a @a report_baton constructed by svn_repos_begin_report2(), 00608 * record the presence of @a path, at @a revision with depth @a depth, 00609 * in the current tree. 00610 * 00611 * @a path is relative to the anchor/target used in the creation of the 00612 * @a report_baton. 00613 * 00614 * @a revision may be SVN_INVALID_REVNUM if (for example) @a path 00615 * represents a locally-added path with no revision number, or @a 00616 * depth is @c svn_depth_exclude. 00617 * 00618 * @a path may not be underneath a path on which svn_repos_set_path3() 00619 * was previously called with @c svn_depth_exclude in this report. 00620 * 00621 * The first call of this in a given report usually passes an empty 00622 * @a path; this is used to set up the correct root revision for the editor 00623 * drive. 00624 * 00625 * A depth of @c svn_depth_unknown is not allowed, and results in an 00626 * error. 00627 * 00628 * If @a start_empty is TRUE and @a path is a directory, then require the 00629 * caller to explicitly provide all the children of @a path - do not assume 00630 * that the tree also contains all the children of @a path at @a revision. 00631 * This is for 'low confidence' client reporting. 00632 * 00633 * If the caller has a lock token for @a path, then @a lock_token should 00634 * be set to that token. Else, @a lock_token should be NULL. 00635 * 00636 * All temporary allocations are done in @a pool. 00637 * 00638 * @since New in 1.5. 00639 */ 00640 svn_error_t * 00641 svn_repos_set_path3(void *report_baton, 00642 const char *path, 00643 svn_revnum_t revision, 00644 svn_depth_t depth, 00645 svn_boolean_t start_empty, 00646 const char *lock_token, 00647 apr_pool_t *pool); 00648 00649 /** 00650 * Similar to svn_repos_set_path3(), but with @a depth set to 00651 * @c svn_depth_infinity. 00652 * 00653 * @deprecated Provided for backward compatibility with the 1.4 API. 00654 */ 00655 SVN_DEPRECATED 00656 svn_error_t * 00657 svn_repos_set_path2(void *report_baton, 00658 const char *path, 00659 svn_revnum_t revision, 00660 svn_boolean_t start_empty, 00661 const char *lock_token, 00662 apr_pool_t *pool); 00663 00664 /** 00665 * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL. 00666 * 00667 * @deprecated Provided for backward compatibility with the 1.1 API. 00668 */ 00669 SVN_DEPRECATED 00670 svn_error_t * 00671 svn_repos_set_path(void *report_baton, 00672 const char *path, 00673 svn_revnum_t revision, 00674 svn_boolean_t start_empty, 00675 apr_pool_t *pool); 00676 00677 /** 00678 * Given a @a report_baton constructed by svn_repos_begin_report2(), 00679 * record the presence of @a path in the current tree, containing the contents 00680 * of @a link_path at @a revision with depth @a depth. 00681 * 00682 * A depth of @c svn_depth_unknown is not allowed, and results in an 00683 * error. 00684 * 00685 * @a path may not be underneath a path on which svn_repos_set_path3() 00686 * was previously called with @c svn_depth_exclude in this report. 00687 * 00688 * Note that while @a path is relative to the anchor/target used in the 00689 * creation of the @a report_baton, @a link_path is an absolute filesystem 00690 * path! 00691 * 00692 * If @a start_empty is TRUE and @a path is a directory, then require the 00693 * caller to explicitly provide all the children of @a path - do not assume 00694 * that the tree also contains all the children of @a link_path at 00695 * @a revision. This is for 'low confidence' client reporting. 00696 * 00697 * If the caller has a lock token for @a link_path, then @a lock_token 00698 * should be set to that token. Else, @a lock_token should be NULL. 00699 * 00700 * All temporary allocations are done in @a pool. 00701 * 00702 * @since New in 1.5. 00703 */ 00704 svn_error_t * 00705 svn_repos_link_path3(void *report_baton, 00706 const char *path, 00707 const char *link_path, 00708 svn_revnum_t revision, 00709 svn_depth_t depth, 00710 svn_boolean_t start_empty, 00711 const char *lock_token, 00712 apr_pool_t *pool); 00713 00714 /** 00715 * Similar to svn_repos_link_path3(), but with @a depth set to 00716 * @c svn_depth_infinity. 00717 * 00718 * @deprecated Provided for backward compatibility with the 1.4 API. 00719 */ 00720 SVN_DEPRECATED 00721 svn_error_t * 00722 svn_repos_link_path2(void *report_baton, 00723 const char *path, 00724 const char *link_path, 00725 svn_revnum_t revision, 00726 svn_boolean_t start_empty, 00727 const char *lock_token, 00728 apr_pool_t *pool); 00729 00730 /** 00731 * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL. 00732 * 00733 * @deprecated Provided for backward compatibility with the 1.1 API. 00734 */ 00735 SVN_DEPRECATED 00736 svn_error_t * 00737 svn_repos_link_path(void *report_baton, 00738 const char *path, 00739 const char *link_path, 00740 svn_revnum_t revision, 00741 svn_boolean_t start_empty, 00742 apr_pool_t *pool); 00743 00744 /** Given a @a report_baton constructed by svn_repos_begin_report2(), 00745 * record the non-existence of @a path in the current tree. 00746 * 00747 * @a path may not be underneath a path on which svn_repos_set_path3() 00748 * was previously called with @c svn_depth_exclude in this report. 00749 * 00750 * (This allows the reporter's driver to describe missing pieces of a 00751 * working copy, so that 'svn up' can recreate them.) 00752 * 00753 * All temporary allocations are done in @a pool. 00754 */ 00755 svn_error_t * 00756 svn_repos_delete_path(void *report_baton, 00757 const char *path, 00758 apr_pool_t *pool); 00759 00760 /** Given a @a report_baton constructed by svn_repos_begin_report2(), 00761 * finish the report and drive the editor as specified when the report 00762 * baton was constructed. 00763 * 00764 * If an error occurs during the driving of the editor, do NOT abort the 00765 * edit; that responsibility belongs to the caller of this function, if 00766 * it happens at all. 00767 * 00768 * After the call to this function, @a report_baton is no longer valid; 00769 * it should not be passed to any other reporting functions, including 00770 * svn_repos_abort_report(). 00771 */ 00772 svn_error_t * 00773 svn_repos_finish_report(void *report_baton, 00774 apr_pool_t *pool); 00775 00776 00777 /** Given a @a report_baton constructed by svn_repos_begin_report2(), 00778 * abort the report. This function can be called anytime before 00779 * svn_repos_finish_report() is called. 00780 * 00781 * After the call to this function, @a report_baton is no longer valid; 00782 * it should not be passed to any other reporting functions. 00783 */ 00784 svn_error_t * 00785 svn_repos_abort_report(void *report_baton, 00786 apr_pool_t *pool); 00787 00788 00789 /* ---------------------------------------------------------------*/ 00790 00791 /* The magical dir_delta update routines. */ 00792 00793 /** Use the provided @a editor and @a edit_baton to describe the changes 00794 * necessary for making a given node (and its descendants, if it is a 00795 * directory) under @a src_root look exactly like @a tgt_path under 00796 * @a tgt_root. @a src_entry is the node to update. If @a src_entry 00797 * is empty, then compute the difference between the entire tree 00798 * anchored at @a src_parent_dir under @a src_root and @a tgt_path 00799 * under @a tgt_root. Else, describe the changes needed to update 00800 * only that entry in @a src_parent_dir. Typically, callers of this 00801 * function will use a @a tgt_path that is the concatenation of @a 00802 * src_parent_dir and @a src_entry. 00803 * 00804 * @a src_root and @a tgt_root can both be either revision or transaction 00805 * roots. If @a tgt_root is a revision, @a editor's set_target_revision() 00806 * will be called with the @a tgt_root's revision number, else it will 00807 * not be called at all. 00808 * 00809 * If @a authz_read_func is non-NULL, invoke it before any call to 00810 * 00811 * @a editor->open_root 00812 * @a editor->add_directory 00813 * @a editor->open_directory 00814 * @a editor->add_file 00815 * @a editor->open_file 00816 * 00817 * passing @a tgt_root, the same path that would be passed to the 00818 * editor function in question, and @a authz_read_baton. If the 00819 * @a *allowed parameter comes back TRUE, then proceed with the planned 00820 * editor call; else if FALSE, then invoke @a editor->absent_file or 00821 * @a editor->absent_directory as appropriate, except if the planned 00822 * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE. 00823 * 00824 * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to 00825 * the window handler returned by @a editor->apply_textdelta(). 00826 * 00827 * If @a depth is @c svn_depth_empty, invoke @a editor calls only on 00828 * @a src_entry (or @a src_parent_dir, if @a src_entry is empty). 00829 * If @a depth is @c svn_depth_files, also invoke the editor on file 00830 * children, if any; if @c svn_depth_immediates, invoke it on 00831 * immediate subdirectories as well as files; if @c svn_depth_infinity, 00832 * recurse fully. 00833 * 00834 * If @a entry_props is @c TRUE, accompany each opened/added entry with 00835 * propchange editor calls that relay special "entry props" (this 00836 * is typically used only for working copy updates). 00837 * 00838 * @a ignore_ancestry instructs the function to ignore node ancestry 00839 * when determining how to transmit differences. 00840 * 00841 * Before completing successfully, this function calls @a editor's 00842 * close_edit(), so the caller should expect its @a edit_baton to be 00843 * invalid after its use with this function. 00844 * 00845 * Do any allocation necessary for the delta computation in @a pool. 00846 * This function's maximum memory consumption is at most roughly 00847 * proportional to the greatest depth of the tree under @a tgt_root, not 00848 * the total size of the delta. 00849 * 00850 * ### svn_repos_dir_delta2 is mostly superceded by the reporter 00851 * ### functionality (svn_repos_begin_report2 and friends). 00852 * ### svn_repos_dir_delta2 does allow the roots to be transaction 00853 * ### roots rather than just revision roots, and it has the 00854 * ### entry_props flag. Almost all of Subversion's own code uses the 00855 * ### reporter instead; there are some stray references to the 00856 * ### svn_repos_dir_delta[2] in comments which should probably 00857 * ### actually refer to the reporter. 00858 */ 00859 svn_error_t * 00860 svn_repos_dir_delta2(svn_fs_root_t *src_root, 00861 const char *src_parent_dir, 00862 const char *src_entry, 00863 svn_fs_root_t *tgt_root, 00864 const char *tgt_path, 00865 const svn_delta_editor_t *editor, 00866 void *edit_baton, 00867 svn_repos_authz_func_t authz_read_func, 00868 void *authz_read_baton, 00869 svn_boolean_t text_deltas, 00870 svn_depth_t depth, 00871 svn_boolean_t entry_props, 00872 svn_boolean_t ignore_ancestry, 00873 apr_pool_t *pool); 00874 00875 /** 00876 * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass 00877 * @c svn_depth_infinity for @a depth, and if @a recurse is FALSE, 00878 * pass @c svn_depth_files for @a depth. 00879 * 00880 * @deprecated Provided for backward compatibility with the 1.4 API. 00881 */ 00882 SVN_DEPRECATED 00883 svn_error_t * 00884 svn_repos_dir_delta(svn_fs_root_t *src_root, 00885 const char *src_parent_dir, 00886 const char *src_entry, 00887 svn_fs_root_t *tgt_root, 00888 const char *tgt_path, 00889 const svn_delta_editor_t *editor, 00890 void *edit_baton, 00891 svn_repos_authz_func_t authz_read_func, 00892 void *authz_read_baton, 00893 svn_boolean_t text_deltas, 00894 svn_boolean_t recurse, 00895 svn_boolean_t entry_props, 00896 svn_boolean_t ignore_ancestry, 00897 apr_pool_t *pool); 00898 00899 00900 /** Use the provided @a editor and @a edit_baton to describe the 00901 * skeletal changes made in a particular filesystem @a root 00902 * (revision or transaction). 00903 * 00904 * Changes will be limited to those within @a base_dir, and if 00905 * @a low_water_mark is set to something other than @c SVN_INVALID_REVNUM 00906 * it is assumed that the client has no knowledge of revisions prior to 00907 * @a low_water_mark. Together, these two arguments define the portion of 00908 * the tree that the client is assumed to have knowledge of, and thus any 00909 * copies of data from outside that part of the tree will be sent in their 00910 * entirety, not as simple copies or deltas against a previous version. 00911 * 00912 * The @a editor passed to this function should be aware of the fact 00913 * that, if @a send_deltas is FALSE, calls to its change_dir_prop(), 00914 * change_file_prop(), and apply_textdelta() functions will not 00915 * contain meaningful data, and merely serve as indications that 00916 * properties or textual contents were changed. 00917 * 00918 * If @a send_deltas is @c TRUE, the text and property deltas for changes 00919 * will be sent, otherwise NULL text deltas and empty prop changes will be 00920 * used. 00921 * 00922 * If @a authz_read_func is non-NULL, it will be used to determine if the 00923 * user has read access to the data being accessed. Data that the user 00924 * cannot access will be skipped. 00925 * 00926 * @note This editor driver passes SVN_INVALID_REVNUM for all 00927 * revision parameters in the editor interface except the copyfrom 00928 * parameter of the add_file() and add_directory() editor functions. 00929 * 00930 * @since New in 1.4. 00931 */ 00932 svn_error_t * 00933 svn_repos_replay2(svn_fs_root_t *root, 00934 const char *base_dir, 00935 svn_revnum_t low_water_mark, 00936 svn_boolean_t send_deltas, 00937 const svn_delta_editor_t *editor, 00938 void *edit_baton, 00939 svn_repos_authz_func_t authz_read_func, 00940 void *authz_read_baton, 00941 apr_pool_t *pool); 00942 00943 /** 00944 * Similar to svn_repos_replay2(), but with @a base_dir set to @c "", 00945 * @a low_water_mark set to @c SVN_INVALID_REVNUM, @a send_deltas 00946 * set to @c FALSE, and @a authz_read_func and @a authz_read_baton 00947 * set to @c NULL. 00948 * 00949 * @deprecated Provided for backward compatibility with the 1.3 API. 00950 */ 00951 SVN_DEPRECATED 00952 svn_error_t * 00953 svn_repos_replay(svn_fs_root_t *root, 00954 const svn_delta_editor_t *editor, 00955 void *edit_baton, 00956 apr_pool_t *pool); 00957 00958 /* ---------------------------------------------------------------*/ 00959 00960 /* Making commits. */ 00961 00962 /** 00963 * Return an @a editor and @a edit_baton to commit changes to the 00964 * filesystem of @a repos, beginning at location 'rev:@a base_path', 00965 * where "rev" is the argument given to open_root(). 00966 * 00967 * @a repos is a previously opened repository. @a repos_url is the 00968 * decoded URL to the base of the repository, and is used to check 00969 * copyfrom paths. @a txn is a filesystem transaction object to use 00970 * during the commit, or @c NULL to indicate that this function should 00971 * create (and fully manage) a new transaction. 00972 * 00973 * Store the contents of @a revprop_table, a hash mapping <tt>const 00974 * char *</tt> property names to @c svn_string_t values, as properties 00975 * of the commit transaction, including author and log message if 00976 * present. 00977 * 00978 * @note @c SVN_PROP_REVISION_DATE may be present in @a revprop_table, but 00979 * it will be overwritten when the transaction is committed. 00980 * 00981 * Iff @a authz_callback is provided, check read/write authorizations 00982 * on paths accessed by editor operations. An operation which fails 00983 * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or 00984 * SVN_ERR_AUTHZ_UNWRITABLE. 00985 * 00986 * Calling @a (*editor)->close_edit completes the commit. 00987 * 00988 * If @a callback is non-NULL, then before @c close_edit returns (but 00989 * after the commit has succeeded) @c close_edit will invoke 00990 * @a callback with a filled-in @c svn_commit_info_t *, @a callback_baton, 00991 * and @a pool or some subpool thereof as arguments. If @a callback 00992 * returns an error, that error will be returned from @c close_edit, 00993 * otherwise if there was a post-commit hook failure, then that error 00994 * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. 00995 * (Note that prior to Subversion 1.6, @a callback cannot be NULL; if 00996 * you don't need a callback, pass a dummy function.) 00997 * 00998 * Calling @a (*editor)->abort_edit aborts the commit, and will also 00999 * abort the commit transaction unless @a txn was supplied (not @c 01000 * NULL). Callers who supply their own transactions are responsible 01001 * for cleaning them up (either by committing them, or aborting them). 01002 * 01003 * @since New in 1.5. 01004 */ 01005 svn_error_t * 01006 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor, 01007 void **edit_baton, 01008 svn_repos_t *repos, 01009 svn_fs_txn_t *txn, 01010 const char *repos_url, 01011 const char *base_path, 01012 apr_hash_t *revprop_table, 01013 svn_commit_callback2_t callback, 01014 void *callback_baton, 01015 svn_repos_authz_callback_t authz_callback, 01016 void *authz_baton, 01017 apr_pool_t *pool); 01018 01019 /** 01020 * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table 01021 * set to a hash containing @a user and @a log_msg as the 01022 * @c SVN_PROP_REVISION_AUTHOR and @c SVN_PROP_REVISION_LOG properties, 01023 * respectively. @a user and @a log_msg may both be @c NULL. 01024 * 01025 * @since New in 1.4. 01026 * 01027 * @deprecated Provided for backward compatibility with the 1.4 API. 01028 */ 01029 SVN_DEPRECATED 01030 svn_error_t * 01031 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor, 01032 void **edit_baton, 01033 svn_repos_t *repos, 01034 svn_fs_txn_t *txn, 01035 const char *repos_url, 01036 const char *base_path, 01037 const char *user, 01038 const char *log_msg, 01039 svn_commit_callback2_t callback, 01040 void *callback_baton, 01041 svn_repos_authz_callback_t authz_callback, 01042 void *authz_baton, 01043 apr_pool_t *pool); 01044 01045 /** 01046 * Similar to svn_repos_get_commit_editor4(), but 01047 * uses the svn_commit_callback_t type. 01048 * 01049 * @since New in 1.3. 01050 * 01051 * @deprecated Provided for backward compatibility with the 1.3 API. 01052 */ 01053 SVN_DEPRECATED 01054 svn_error_t * 01055 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor, 01056 void **edit_baton, 01057 svn_repos_t *repos, 01058 svn_fs_txn_t *txn, 01059 const char *repos_url, 01060 const char *base_path, 01061 const char *user, 01062 const char *log_msg, 01063 svn_commit_callback_t callback, 01064 void *callback_baton, 01065 svn_repos_authz_callback_t authz_callback, 01066 void *authz_baton, 01067 apr_pool_t *pool); 01068 01069 /** 01070 * Similar to svn_repos_get_commit_editor3(), but with @a 01071 * authz_callback and @a authz_baton set to @c NULL. 01072 * 01073 * @deprecated Provided for backward compatibility with the 1.2 API. 01074 */ 01075 SVN_DEPRECATED 01076 svn_error_t * 01077 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor, 01078 void **edit_baton, 01079 svn_repos_t *repos, 01080 svn_fs_txn_t *txn, 01081 const char *repos_url, 01082 const char *base_path, 01083 const char *user, 01084 const char *log_msg, 01085 svn_commit_callback_t callback, 01086 void *callback_baton, 01087 apr_pool_t *pool); 01088 01089 01090 /** 01091 * Similar to svn_repos_get_commit_editor2(), but with @a txn always 01092 * set to @c NULL. 01093 * 01094 * @deprecated Provided for backward compatibility with the 1.1 API. 01095 */ 01096 SVN_DEPRECATED 01097 svn_error_t * 01098 svn_repos_get_commit_editor(const svn_delta_editor_t **editor, 01099 void **edit_baton, 01100 svn_repos_t *repos, 01101 const char *repos_url, 01102 const char *base_path, 01103 const char *user, 01104 const char *log_msg, 01105 svn_commit_callback_t callback, 01106 void *callback_baton, 01107 apr_pool_t *pool); 01108 01109 /* ---------------------------------------------------------------*/ 01110 01111 /* Finding particular revisions. */ 01112 01113 /** Set @a *revision to the revision number in @a repos's filesystem that was 01114 * youngest at time @a tm. 01115 */ 01116 svn_error_t * 01117 svn_repos_dated_revision(svn_revnum_t *revision, 01118 svn_repos_t *repos, 01119 apr_time_t tm, 01120 apr_pool_t *pool); 01121 01122 01123 /** Given a @a root/@a path within some filesystem, return three pieces of 01124 * information allocated in @a pool: 01125 * 01126 * - set @a *committed_rev to the revision in which the object was 01127 * last modified. (In fs parlance, this is the revision in which 01128 * the particular node-rev-id was 'created'.) 01129 * 01130 * - set @a *committed_date to the date of said revision, or @c NULL 01131 * if not available. 01132 * 01133 * - set @a *last_author to the author of said revision, or @c NULL 01134 * if not available. 01135 */ 01136 svn_error_t * 01137 svn_repos_get_committed_info(svn_revnum_t *committed_rev, 01138 const char **committed_date, 01139 const char **last_author, 01140 svn_fs_root_t *root, 01141 const char *path, 01142 apr_pool_t *pool); 01143 01144 01145 /** 01146 * Set @a *dirent to an @c svn_dirent_t associated with @a path in @a 01147 * root. If @a path does not exist in @a root, set @a *dirent to 01148 * NULL. Use @a pool for memory allocation. 01149 * 01150 * @since New in 1.2. 01151 */ 01152 svn_error_t * 01153 svn_repos_stat(svn_dirent_t **dirent, 01154 svn_fs_root_t *root, 01155 const char *path, 01156 apr_pool_t *pool); 01157 01158 01159 /** 01160 * Given @a path which exists at revision @a start in @a fs, set 01161 * @a *deleted to the revision @a path was first deleted, within the 01162 * inclusive revision range set by @a start and @a end. If @a path 01163 * does not exist at revision @a start or was not deleted within the 01164 * specified range, then set @a *deleted to SVN_INVALID_REVNUM. 01165 * Use @a pool for memory allocation. 01166 * 01167 * @since New in 1.5. 01168 */ 01169 svn_error_t * 01170 svn_repos_deleted_rev(svn_fs_t *fs, 01171 const char *path, 01172 svn_revnum_t start, 01173 svn_revnum_t end, 01174 svn_revnum_t *deleted, 01175 apr_pool_t *pool); 01176 01177 01178 /** Callback type for use with svn_repos_history(). @a path and @a 01179 * revision represent interesting history locations in the lifetime 01180 * of the path passed to svn_repos_history(). @a baton is the same 01181 * baton given to svn_repos_history(). @a pool is provided for the 01182 * convenience of the implementor, who should not expect it to live 01183 * longer than a single callback call. 01184 * 01185 * Signal to callback driver to stop processing/invoking this callback 01186 * by returning the @c SVN_ERR_CEASE_INVOCATION error code. 01187 * 01188 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 01189 */ 01190 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton, 01191 const char *path, 01192 svn_revnum_t revision, 01193 apr_pool_t *pool); 01194 01195 /** 01196 * Call @a history_func (with @a history_baton) for each interesting 01197 * history location in the lifetime of @a path in @a fs, from the 01198 * youngest of @a end and @a start to the oldest. Stop processing if 01199 * @a history_func returns @c SVN_ERR_CEASE_INVOCATION. Only cross 01200 * filesystem copy history if @a cross_copies is @c TRUE. And do all 01201 * of this in @a pool. 01202 * 01203 * If @a authz_read_func is non-NULL, then use it (and @a 01204 * authz_read_baton) to verify that @a path in @a end is readable; if 01205 * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability 01206 * of every ancestral path/revision pair before pushing them at @a 01207 * history_func. If a pair is deemed unreadable, then do not send 01208 * them; instead, immediately stop traversing history and return 01209 * SVN_NO_ERROR. 01210 * 01211 * @since New in 1.1. 01212 * 01213 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 01214 */ 01215 svn_error_t * 01216 svn_repos_history2(svn_fs_t *fs, 01217 const char *path, 01218 svn_repos_history_func_t history_func, 01219 void *history_baton, 01220 svn_repos_authz_func_t authz_read_func, 01221 void *authz_read_baton, 01222 svn_revnum_t start, 01223 svn_revnum_t end, 01224 svn_boolean_t cross_copies, 01225 apr_pool_t *pool); 01226 01227 /** 01228 * Similar to svn_repos_history2(), but with @a authz_read_func 01229 * and @a authz_read_baton always set to NULL. 01230 * 01231 * @deprecated Provided for backward compatibility with the 1.0 API. 01232 */ 01233 SVN_DEPRECATED 01234 svn_error_t * 01235 svn_repos_history(svn_fs_t *fs, 01236 const char *path, 01237 svn_repos_history_func_t history_func, 01238 void *history_baton, 01239 svn_revnum_t start, 01240 svn_revnum_t end, 01241 svn_boolean_t cross_copies, 01242 apr_pool_t *pool); 01243 01244 01245 /** 01246 * Set @a *locations to be a mapping of the revisions to the paths of 01247 * the file @a fs_path present at the repository in revision 01248 * @a peg_revision, where the revisions are taken out of the array 01249 * @a location_revisions. 01250 * 01251 * @a location_revisions is an array of svn_revnum_t's and @a *locations 01252 * maps 'svn_revnum_t *' to 'const char *'. 01253 * 01254 * If optional @a authz_read_func is non-NULL, then use it (and @a 01255 * authz_read_baton) to verify that the peg-object is readable. If not, 01256 * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func 01257 * to check that every path returned in the hash is readable. If an 01258 * unreadable path is encountered, stop tracing and return 01259 * SVN_NO_ERROR. 01260 * 01261 * @a pool is used for all allocations. 01262 * 01263 * @since New in 1.1. 01264 */ 01265 svn_error_t * 01266 svn_repos_trace_node_locations(svn_fs_t *fs, 01267 apr_hash_t **locations, 01268 const char *fs_path, 01269 svn_revnum_t peg_revision, 01270 apr_array_header_t *location_revisions, 01271 svn_repos_authz_func_t authz_read_func, 01272 void *authz_read_baton, 01273 apr_pool_t *pool); 01274 01275 01276 /** 01277 * Call @a receiver and @a receiver_baton to report successive 01278 * location segments in revisions between @a start_rev and @a end_rev 01279 * (inclusive) for the line of history identified by the peg-object @a 01280 * path in @a peg_revision (and in @a repos). 01281 * 01282 * @a end_rev may be @c SVN_INVALID_REVNUM to indicate that you want 01283 * to trace the history of the object to its origin. 01284 * 01285 * @a start_rev may be @c SVN_INVALID_REVNUM to indicate "the HEAD 01286 * revision". Otherwise, @a start_rev must be younger than @a end_rev 01287 * (unless @a end_rev is @c SVN_INVALID_REVNUM). 01288 * 01289 * @a peg_revision may be @c SVN_INVALID_REVNUM to indicate "the HEAD 01290 * revision", and must evaluate to be at least as young as @a start_rev. 01291 * 01292 * If optional @a authz_read_func is not @c NULL, then use it (and @a 01293 * authz_read_baton) to verify that the peg-object is readable. If 01294 * not, return @c SVN_ERR_AUTHZ_UNREADABLE. Also use the @a 01295 * authz_read_func to check that every path reported in a location 01296 * segment is readable. If an unreadable path is encountered, report 01297 * a final (possibly truncated) location segment (if any), stop 01298 * tracing history, and return @c SVN_NO_ERROR. 01299 * 01300 * @a pool is used for all allocations. 01301 * 01302 * @since New in 1.5. 01303 */ 01304 svn_error_t * 01305 svn_repos_node_location_segments(svn_repos_t *repos, 01306 const char *path, 01307 svn_revnum_t peg_revision, 01308 svn_revnum_t start_rev, 01309 svn_revnum_t end_rev, 01310 svn_location_segment_receiver_t receiver, 01311 void *receiver_baton, 01312 svn_repos_authz_func_t authz_read_func, 01313 void *authz_read_baton, 01314 apr_pool_t *pool); 01315 01316 01317 /* ### other queries we can do someday -- 01318 01319 * fetch the last revision created by <user> 01320 (once usernames become revision properties!) 01321 * fetch the last revision where <path> was modified 01322 01323 */ 01324 01325 01326 01327 /* ---------------------------------------------------------------*/ 01328 01329 /* Retrieving log messages. */ 01330 01331 01332 /** 01333 * Invoke @a receiver with @a receiver_baton on each log message from 01334 * @a start to @a end in @a repos's filesystem. @a start may be greater 01335 * or less than @a end; this just controls whether the log messages are 01336 * processed in descending or ascending revision number order. 01337 * 01338 * If @a start or @a end is @c SVN_INVALID_REVNUM, it defaults to youngest. 01339 * 01340 * If @a paths is non-NULL and has one or more elements, then only show 01341 * revisions in which at least one of @a paths was changed (i.e., if 01342 * file, text or props changed; if dir, props or entries changed or any node 01343 * changed below it). Each path is a <tt>const char *</tt> representing 01344 * an absolute path in the repository. If @a paths is NULL or empty, 01345 * show all revisions regardless of what paths were changed in those 01346 * revisions. 01347 * 01348 * If @a limit is non-zero then only invoke @a receiver on the first 01349 * @a limit logs. 01350 * 01351 * If @a discover_changed_paths, then each call to @a receiver passes a 01352 * hash mapping paths committed in that revision to information about them 01353 * as the receiver's @a changed_paths argument. 01354 * Otherwise, each call to @a receiver passes NULL for @a changed_paths. 01355 * 01356 * If @a strict_node_history is set, copy history (if any exists) will 01357 * not be traversed while harvesting revision logs for each path. 01358 * 01359 * If @a include_merged_revisions is set, log information for revisions 01360 * which have been merged to @a targets will also be returned. 01361 * 01362 * If @a revprops is NULL, retrieve all revprops; else, retrieve only the 01363 * revprops named in the array (i.e. retrieve none if the array is empty). 01364 * 01365 * If any invocation of @a receiver returns error, return that error 01366 * immediately and without wrapping it. 01367 * 01368 * If @a start or @a end is a non-existent revision, return the error 01369 * @c SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver. 01370 * 01371 * If optional @a authz_read_func is non-NULL, then use this function 01372 * (along with optional @a authz_read_baton) to check the readability 01373 * of each changed-path in each revision about to be "pushed" at 01374 * @a receiver. If a revision has some changed-paths readable and 01375 * others unreadable, unreadable paths are omitted from the 01376 * changed_paths field and only svn:author and svn:date will be 01377 * available in the revprops field. If a revision has no 01378 * changed-paths readable at all, then all paths are omitted and no 01379 * revprops are available. 01380 * 01381 * See also the documentation for @c svn_log_entry_receiver_t. 01382 * 01383 * Use @a pool for temporary allocations. 01384 * 01385 * @since New in 1.5. 01386 */ 01387 svn_error_t * 01388 svn_repos_get_logs4(svn_repos_t *repos, 01389 const apr_array_header_t *paths, 01390 svn_revnum_t start, 01391 svn_revnum_t end, 01392 int limit, 01393 svn_boolean_t discover_changed_paths, 01394 svn_boolean_t strict_node_history, 01395 svn_boolean_t include_merged_revisions, 01396 const apr_array_header_t *revprops, 01397 svn_repos_authz_func_t authz_read_func, 01398 void *authz_read_baton, 01399 svn_log_entry_receiver_t receiver, 01400 void *receiver_baton, 01401 apr_pool_t *pool); 01402 01403 /** 01404 * Same as svn_repos_get_logs4(), but with @a receiver being @c 01405 * svn_log_message_receiver_t instead of @c svn_log_entry_receiver_t. 01406 * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is 01407 * svn:author, svn:date, and svn:log. If @a paths is empty, nothing 01408 * is returned. 01409 * 01410 * @since New in 1.2. 01411 * @deprecated Provided for backward compatibility with the 1.4 API. 01412 */ 01413 SVN_DEPRECATED 01414 svn_error_t * 01415 svn_repos_get_logs3(svn_repos_t *repos, 01416 const apr_array_header_t *paths, 01417 svn_revnum_t start, 01418 svn_revnum_t end, 01419 int limit, 01420 svn_boolean_t discover_changed_paths, 01421 svn_boolean_t strict_node_history, 01422 svn_repos_authz_func_t authz_read_func, 01423 void *authz_read_baton, 01424 svn_log_message_receiver_t receiver, 01425 void *receiver_baton, 01426 apr_pool_t *pool); 01427 01428 01429 /** 01430 * Same as svn_repos_get_logs3(), but with @a limit always set to 0. 01431 * 01432 * @deprecated Provided for backward compatibility with the 1.1 API. 01433 */ 01434 SVN_DEPRECATED 01435 svn_error_t * 01436 svn_repos_get_logs2(svn_repos_t *repos, 01437 const apr_array_header_t *paths, 01438 svn_revnum_t start, 01439 svn_revnum_t end, 01440 svn_boolean_t discover_changed_paths, 01441 svn_boolean_t strict_node_history, 01442 svn_repos_authz_func_t authz_read_func, 01443 void *authz_read_baton, 01444 svn_log_message_receiver_t receiver, 01445 void *receiver_baton, 01446 apr_pool_t *pool); 01447 01448 /** 01449 * Same as svn_repos_get_logs2(), but with @a authz_read_func and 01450 * @a authz_read_baton always set to NULL. 01451 * 01452 * @deprecated Provided for backward compatibility with the 1.0 API. 01453 */ 01454 SVN_DEPRECATED 01455 svn_error_t * 01456 svn_repos_get_logs(svn_repos_t *repos, 01457 const apr_array_header_t *paths, 01458 svn_revnum_t start, 01459 svn_revnum_t end, 01460 svn_boolean_t discover_changed_paths, 01461 svn_boolean_t strict_node_history, 01462 svn_log_message_receiver_t receiver, 01463 void *receiver_baton, 01464 apr_pool_t *pool); 01465 01466 01467 01468 /* ---------------------------------------------------------------*/ 01469 01470 /* Retrieving mergeinfo. */ 01471 01472 /** 01473 * Fetch the mergeinfo for @a paths at @a revision in @a repos, and 01474 * set @a *catalog to a catalog of this mergeinfo. @a *catalog will 01475 * never be @c NULL but may be empty. 01476 * 01477 * @a inherit indicates whether explicit, explicit or inherited, or 01478 * only inherited mergeinfo for @a paths is fetched. 01479 * 01480 * If @a revision is @c SVN_INVALID_REVNUM, it defaults to youngest. 01481 * 01482 * If @a include_descendants is TRUE, then additionally return the 01483 * mergeinfo for any descendant of any element of @a paths which has 01484 * the @c SVN_PROP_MERGEINFO property explicitly set on it. (Note 01485 * that inheritance is only taken into account for the elements in @a 01486 * paths; descendants of the elements in @a paths which get their 01487 * mergeinfo via inheritance are not included in @a *catalog.) 01488 * 01489 * If optional @a authz_read_func is non-NULL, then use this function 01490 * (along with optional @a authz_read_baton) to check the readability 01491 * of each path which mergeinfo was requested for (from @a paths). 01492 * Silently omit unreadable paths from the request for mergeinfo. 01493 * 01494 * Use @a pool for all allocations. 01495 * 01496 * @since New in 1.5. 01497 */ 01498 svn_error_t * 01499 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog, 01500 svn_repos_t *repos, 01501 const apr_array_header_t *paths, 01502 svn_revnum_t revision, 01503 svn_mergeinfo_inheritance_t inherit, 01504 svn_boolean_t include_descendants, 01505 svn_repos_authz_func_t authz_read_func, 01506 void *authz_read_baton, 01507 apr_pool_t *pool); 01508 01509 01510 /* ---------------------------------------------------------------*/ 01511 01512 /* Retrieving multiple revisions of a file. */ 01513 01514 /** 01515 * Retrieve a subset of the interesting revisions of a file @a path in 01516 * @a repos as seen in revision @a end. Invoke @a handler with 01517 * @a handler_baton as its first argument for each such revision. 01518 * @a pool is used for all allocations. See svn_fs_history_prev() for 01519 * a discussion of interesting revisions. 01520 * 01521 * If optional @a authz_read_func is non-NULL, then use this function 01522 * (along with optional @a authz_read_baton) to check the readability 01523 * of the rev-path in each interesting revision encountered. 01524 * 01525 * Revision discovery happens from @a end to @a start, and if an 01526 * unreadable revision is encountered before @a start is reached, then 01527 * revision discovery stops and only the revisions from @a end to the 01528 * oldest readable revision are returned (So it will appear that @a 01529 * path was added without history in the latter revision). 01530 * 01531 * If there is an interesting revision of the file that is less than or 01532 * equal to start, the iteration will start at that revision. Else, the 01533 * iteration will start at the first revision of the file in the repository, 01534 * which has to be less than or equal to end. Note that if the function 01535 * succeeds, @a handler will have been called at least once. 01536 * 01537 * In a series of calls, the file contents for the first interesting revision 01538 * will be provided as a text delta against the empty file. In the following 01539 * calls, the delta will be against the contents for the previous call. 01540 * 01541 * If @a include_merged_revisions is TRUE, revisions which a included as a 01542 * result of a merge between @a start and @a end will be included. 01543 * 01544 * @since New in 1.5. 01545 */ 01546 svn_error_t * 01547 svn_repos_get_file_revs2(svn_repos_t *repos, 01548 const char *path, 01549 svn_revnum_t start, 01550 svn_revnum_t end, 01551 svn_boolean_t include_merged_revisions, 01552 svn_repos_authz_func_t authz_read_func, 01553 void *authz_read_baton, 01554 svn_file_rev_handler_t handler, 01555 void *handler_baton, 01556 apr_pool_t *pool); 01557 01558 /** 01559 * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions 01560 * set to FALSE. 01561 * 01562 * @deprecated Provided for backward compatibility with the 1.4 API. 01563 * @since New in 1.1. 01564 */ 01565 SVN_DEPRECATED 01566 svn_error_t * 01567 svn_repos_get_file_revs(svn_repos_t *repos, 01568 const char *path, 01569 svn_revnum_t start, 01570 svn_revnum_t end, 01571 svn_repos_authz_func_t authz_read_func, 01572 void *authz_read_baton, 01573 svn_repos_file_rev_handler_t handler, 01574 void *handler_baton, 01575 apr_pool_t *pool); 01576 01577 01578 /* ---------------------------------------------------------------*/ 01579 01580 /** 01581 * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \ 01582 * routines. 01583 * @{ 01584 */ 01585 01586 /** Like svn_fs_commit_txn(), but invoke the @a repos's pre- and 01587 * post-commit hooks around the commit. Use @a pool for any necessary 01588 * allocations. 01589 * 01590 * If the pre-commit hook or svn_fs_commit_txn() fails, throw the 01591 * original error to caller. If an error occurs when running the 01592 * post-commit hook, return the original error wrapped with 01593 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. If the caller sees this 01594 * error, it knows that the commit succeeded anyway. 01595 * 01596 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn(). 01597 */ 01598 svn_error_t * 01599 svn_repos_fs_commit_txn(const char **conflict_p, 01600 svn_repos_t *repos, 01601 svn_revnum_t *new_rev, 01602 svn_fs_txn_t *txn, 01603 apr_pool_t *pool); 01604 01605 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping 01606 * <tt>const char *</tt> property names to @c svn_string_t values, to 01607 * set the properties on transaction @a *txn_p. @a repos is the 01608 * repository object which contains the filesystem. @a rev, @a 01609 * *txn_p, and @a pool are as in svn_fs_begin_txn(). 01610 * 01611 * Before a txn is created, the repository's start-commit hooks are 01612 * run; if any of them fail, no txn is created, @a *txn_p is unaffected, 01613 * and @c SVN_ERR_REPOS_HOOK_FAILURE is returned. 01614 * 01615 * @note @a revprop_table may contain an @c SVN_PROP_REVISION_DATE property, 01616 * which will be set on the transaction, but that will be overwritten 01617 * when the transaction is committed. 01618 * 01619 * @since New in 1.5. 01620 */ 01621 svn_error_t * 01622 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p, 01623 svn_repos_t *repos, 01624 svn_revnum_t rev, 01625 apr_hash_t *revprop_table, 01626 apr_pool_t *pool); 01627 01628 01629 /** 01630 * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table 01631 * set to a hash containing @a author and @a log_msg as the 01632 * @c SVN_PROP_REVISION_AUTHOR and @c SVN_PROP_REVISION_LOG properties, 01633 * respectively. @a author and @a log_msg may both be @c NULL. 01634 * 01635 * @deprecated Provided for backward compatibility with the 1.4 API. 01636 */ 01637 SVN_DEPRECATED 01638 svn_error_t * 01639 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p, 01640 svn_repos_t *repos, 01641 svn_revnum_t rev, 01642 const char *author, 01643 const char *log_msg, 01644 apr_pool_t *pool); 01645 01646 01647 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding 01648 * property on transaction @a *txn_p. @a repos is the repository object 01649 * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in 01650 * svn_fs_begin_txn(). 01651 * 01652 * ### Someday: before a txn is created, some kind of read-hook could 01653 * be called here. 01654 */ 01655 svn_error_t * 01656 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p, 01657 svn_repos_t *repos, 01658 svn_revnum_t rev, 01659 const char *author, 01660 apr_pool_t *pool); 01661 01662 01663 /** @defgroup svn_repos_fs_locks Repository lock wrappers 01664 * @{ 01665 * @since New in 1.2. */ 01666 01667 /** Like svn_fs_lock(), but invoke the @a repos's pre- and 01668 * post-lock hooks before and after the locking action. Use @a pool 01669 * for any necessary allocations. 01670 * 01671 * If the pre-lock hook or svn_fs_lock() fails, throw the original 01672 * error to caller. If an error occurs when running the post-lock 01673 * hook, return the original error wrapped with 01674 * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the caller sees this 01675 * error, it knows that the lock succeeded anyway. 01676 * 01677 * The pre-lock hook may cause a different token to be used for the 01678 * lock, instead of @a token; see the pre-lock-hook documentation for 01679 * more. 01680 */ 01681 svn_error_t * 01682 svn_repos_fs_lock(svn_lock_t **lock, 01683 svn_repos_t *repos, 01684 const char *path, 01685 const char *token, 01686 const char *comment, 01687 svn_boolean_t is_dav_comment, 01688 apr_time_t expiration_date, 01689 svn_revnum_t current_rev, 01690 svn_boolean_t steal_lock, 01691 apr_pool_t *pool); 01692 01693 01694 /** Like svn_fs_unlock(), but invoke the @a repos's pre- and 01695 * post-unlock hooks before and after the unlocking action. Use @a 01696 * pool for any necessary allocations. 01697 * 01698 * If the pre-unlock hook or svn_fs_unlock() fails, throw the original 01699 * error to caller. If an error occurs when running the post-unlock 01700 * hook, return the original error wrapped with 01701 * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. If the caller sees this 01702 * error, it knows that the unlock succeeded anyway. 01703 */ 01704 svn_error_t * 01705 svn_repos_fs_unlock(svn_repos_t *repos, 01706 const char *path, 01707 const char *token, 01708 svn_boolean_t break_lock, 01709 apr_pool_t *pool); 01710 01711 01712 01713 /** Look up all the locks in and under @a path in @a repos, setting @a 01714 * *locks to a hash which maps <tt>const char *</tt> paths to the @c 01715 * svn_lock_t locks associated with those paths. Use @a 01716 * authz_read_func and @a authz_read_baton to "screen" all returned 01717 * locks. That is: do not return any locks on any paths that are 01718 * unreadable in HEAD, just silently omit them. 01719 */ 01720 svn_error_t * 01721 svn_repos_fs_get_locks(apr_hash_t **locks, 01722 svn_repos_t *repos, 01723 const char *path, 01724 svn_repos_authz_func_t authz_read_func, 01725 void *authz_read_baton, 01726 apr_pool_t *pool); 01727 01728 /** @} */ 01729 01730 /** 01731 * Like svn_fs_change_rev_prop(), but validate the name and value of the 01732 * property and invoke the @a repos's pre- and post-revprop-change hooks 01733 * around the change as specified by @a use_pre_revprop_change_hook and 01734 * @a use_post_revprop_change_hook (respectively). 01735 * 01736 * @a rev is the revision whose property to change, @a name is the 01737 * name of the propert