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 *svn_repos_version(void); 00047 00048 00049 00050 /** Callback type for checking authorization on paths produced by (at 00051 * least) svn_repos_dir_delta2(). 00052 * 00053 * Set @a *allowed to TRUE to indicate that some operation is 00054 * authorized for @a path in @a root, or set it to FALSE to indicate 00055 * unauthorized (presumably according to state stored in @a baton). 00056 * 00057 * Do not assume @a pool has any lifetime beyond this call. 00058 * 00059 * The exact operation being authorized depends on the callback 00060 * implementation. For read authorization, for example, the caller 00061 * would implement an instance that does read checking, and pass it as 00062 * a parameter named [perhaps] 'authz_read_func'. The receiver of 00063 * that parameter might also take another parameter named 00064 * 'authz_write_func', which although sharing this type, would be a 00065 * different implementation. 00066 * 00067 * @note If someday we want more sophisticated authorization states 00068 * than just yes/no, @a allowed can become an enum type. 00069 */ 00070 typedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed, 00071 svn_fs_root_t *root, 00072 const char *path, 00073 void *baton, 00074 apr_pool_t *pool); 00075 00076 00077 /** An enum defining the kinds of access authz looks up. 00078 * 00079 * @since New in 1.3. 00080 */ 00081 typedef enum 00082 { 00083 /** No access. */ 00084 svn_authz_none = 0, 00085 00086 /** Path can be read. */ 00087 svn_authz_read = 1, 00088 00089 /** Path can be altered. */ 00090 svn_authz_write = 2, 00091 00092 /** The other access credentials are recursive. */ 00093 svn_authz_recursive = 4 00094 } svn_repos_authz_access_t; 00095 00096 00097 /** Callback type for checking authorization on paths produced by 00098 * the repository commit editor. 00099 * 00100 * Set @a *allowed to TRUE to indicate that the @a required access on 00101 * @a path in @a root is authorized, or set it to FALSE to indicate 00102 * unauthorized (presumable according to state stored in @a baton). 00103 * 00104 * If @a path is NULL, the callback should perform a global authz 00105 * lookup for the @a required access. That is, the lookup should 00106 * check if the @a required access is granted for at least one path of 00107 * the repository, and set @a *allowed to TRUE if so. @a root may 00108 * also be NULL if @a path is NULL. 00109 * 00110 * This callback is very similar to svn_repos_authz_func_t, with the 00111 * exception of the addition of the @a required parameter. 00112 * This is due to historical reasons: when authz was first implemented 00113 * for svn_repos_dir_delta2(), it seemed there would need only checks 00114 * for read and write operations, hence the svn_repos_authz_func_t 00115 * callback prototype and usage scenario. But it was then realized 00116 * that lookups due to copying needed to be recursive, and that 00117 * brute-force recursive lookups didn't square with the O(1) 00118 * performances a copy operation should have. 00119 * 00120 * So a special way to ask for a recursive lookup was introduced. The 00121 * commit editor needs this capability to retain acceptable 00122 * performance. Instead of revving the existing callback, causing 00123 * unnecessary revving of functions that don't actually need the 00124 * extended functionality, this second, more complete callback was 00125 * introduced, for use by the commit editor. 00126 * 00127 * Some day, it would be nice to reunite these two callbacks and do 00128 * the necessary revving anyway, but for the time being, this dual 00129 * callback mechanism will do. 00130 */ 00131 typedef svn_error_t *(*svn_repos_authz_callback_t) 00132 (svn_repos_authz_access_t required, 00133 svn_boolean_t *allowed, 00134 svn_fs_root_t *root, 00135 const char *path, 00136 void *baton, 00137 apr_pool_t *pool); 00138 00139 /** 00140 * Similar to @c svn_file_rev_handler_t, but without the @a 00141 * result_of_merge parameter. 00142 * 00143 * @deprecated Provided for backward compatibility with 1.4 API. 00144 * @since New in 1.1. 00145 */ 00146 typedef svn_error_t *(*svn_repos_file_rev_handler_t) 00147 (void *baton, 00148 const char *path, 00149 svn_revnum_t rev, 00150 apr_hash_t *rev_props, 00151 svn_txdelta_window_handler_t *delta_handler, 00152 void **delta_baton, 00153 apr_array_header_t *prop_diffs, 00154 apr_pool_t *pool); 00155 00156 00157 /** The repository object. */ 00158 typedef struct svn_repos_t svn_repos_t; 00159 00160 /* Opening and creating repositories. */ 00161 00162 00163 /** Find the root path of the repository that contains @a path. 00164 * 00165 * If a repository was found, the path to the root of the repository 00166 * is returned, else @c NULL. The pointer to the returned path may be 00167 * equal to @a path. 00168 */ 00169 const char * 00170 svn_repos_find_root_path(const char *path, 00171 apr_pool_t *pool); 00172 00173 /** Set @a *repos_p to a repository object for the repository at @a path. 00174 * 00175 * Allocate @a *repos_p in @a pool. 00176 * 00177 * Acquires a shared lock on the repository, and attaches a cleanup 00178 * function to @a pool to remove the lock. If no lock can be acquired, 00179 * returns error, with undefined effect on @a *repos_p. If an exclusive 00180 * lock is present, this blocks until it's gone. 00181 */ 00182 svn_error_t * 00183 svn_repos_open(svn_repos_t **repos_p, 00184 const char *path, 00185 apr_pool_t *pool); 00186 00187 /** Create a new Subversion repository at @a path, building the necessary 00188 * directory structure, creating the filesystem, and so on. 00189 * Return the repository object in @a *repos_p, allocated in @a pool. 00190 * 00191 * @a config is a client configuration hash of @c svn_config_t * items 00192 * keyed on config category names, and may be NULL. 00193 * 00194 * @a fs_config is passed to the filesystem, and may be NULL. 00195 * 00196 * @a unused_1 and @a unused_2 are not used and should be NULL. 00197 */ 00198 svn_error_t * 00199 svn_repos_create(svn_repos_t **repos_p, 00200 const char *path, 00201 const char *unused_1, 00202 const char *unused_2, 00203 apr_hash_t *config, 00204 apr_hash_t *fs_config, 00205 apr_pool_t *pool); 00206 00207 /** 00208 * Upgrade the Subversion repository (and its underlying versioned 00209 * filesystem) located in the directory @a path to the latest version 00210 * supported by this library. If the requested upgrade is not 00211 * supported due to the current state of the repository or it 00212 * underlying filesystem, return @c SVN_ERR_REPOS_UNSUPPORTED_UPGRADE 00213 * or @c SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no 00214 * changes to the repository or filesystem. 00215 * 00216 * Acquires an exclusive lock on the repository, upgrades the 00217 * repository, and releases the lock. If an exclusive lock can't be 00218 * acquired, returns error. 00219 * 00220 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 00221 * returned if the lock is not immediately available. 00222 * 00223 * If @a start_callback is not NULL, it will be called with @a 00224 * start_callback_baton as argument before the upgrade starts, but 00225 * after the exclusive lock has been acquired. 00226 * 00227 * Use @a pool for necessary allocations. 00228 * 00229 * @note This functionality is provided as a convenience for 00230 * administrators wishing to make use of new Subversion functionality 00231 * without a potentially costly full repository dump/load. As such, 00232 * the operation performs only the minimum amount of work needed to 00233 * accomplish this while maintaining the integrity of the repository. 00234 * It does *not* guarantee the most optimized repository state as a 00235 * dump and subsequent load would. 00236 * 00237 * @since New in 1.5. 00238 */ 00239 svn_error_t * 00240 svn_repos_upgrade(const char *path, 00241 svn_boolean_t nonblocking, 00242 svn_error_t *(*start_callback)(void *baton), 00243 void *start_callback_baton, 00244 apr_pool_t *pool); 00245 00246 /** Destroy the Subversion repository found at @a path, using @a pool for any 00247 * necessary allocations. 00248 */ 00249 svn_error_t *svn_repos_delete(const char *path, apr_pool_t *pool); 00250 00251 /** 00252 * Set @a *has to TRUE if @a repos has @a capability (one of the 00253 * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set 00254 * @a *has to FALSE. 00255 * 00256 * If @a capability isn't recognized, throw @c SVN_ERR_UNKNOWN_CAPABILITY, 00257 * with the effect on @a *has undefined. 00258 * 00259 * Use @a pool for all allocation. 00260 * 00261 * @since New in 1.5. 00262 */ 00263 svn_error_t * 00264 svn_repos_has_capability(svn_repos_t *repos, 00265 svn_boolean_t *has, 00266 const char *capability, 00267 apr_pool_t *pool); 00268 00269 /** 00270 * The capability of doing the right thing with merge-tracking 00271 * information, both storing it and responding to queries about it. 00272 * 00273 * @since New in 1.5. 00274 */ 00275 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo" 00276 /* *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY *** 00277 * 00278 * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to 00279 * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid 00280 * colons for their own reasons. While this RA limitation has no 00281 * direct impact on repository capabilities, there's no reason to be 00282 * gratuitously different either. 00283 */ 00284 00285 00286 /** Return the filesystem associated with repository object @a repos. */ 00287 svn_fs_t *svn_repos_fs(svn_repos_t *repos); 00288 00289 00290 /** Make a hot copy of the Subversion repository found at @a src_path 00291 * to @a dst_path. 00292 * 00293 * Copy a possibly live Subversion repository from @a src_path to 00294 * @a dst_path. If @a clean_logs is @c TRUE, perform cleanup on the 00295 * source filesystem as part of the copy operation; currently, this 00296 * means deleting copied, unused logfiles for a Berkeley DB source 00297 * repository. 00298 */ 00299 svn_error_t * 00300 svn_repos_hotcopy(const char *src_path, 00301 const char *dst_path, 00302 svn_boolean_t clean_logs, 00303 apr_pool_t *pool); 00304 00305 /** 00306 * Run database recovery procedures on the repository at @a path, 00307 * returning the database to a consistent state. Use @a pool for all 00308 * allocation. 00309 * 00310 * Acquires an exclusive lock on the repository, recovers the 00311 * database, and releases the lock. If an exclusive lock can't be 00312 * acquired, returns error. 00313 * 00314 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 00315 * returned if the lock is not immediately available. 00316 * 00317 * If @a start_callback is not NULL, it will be called with @a 00318 * start_callback_baton as argument before the recovery starts, but 00319 * after the exclusive lock has been acquired. 00320 * 00321 * If @a cancel_func is not @c NULL, it is called periodically with 00322 * @a cancel_baton as argument to see if the client wishes to cancel 00323 * the recovery. 00324 * 00325 * @note On some platforms the exclusive lock does not exclude other 00326 * threads in the same process so this function should only be called 00327 * by a single threaded process, or by a multi-threaded process when 00328 * no other threads are accessing the repository. 00329 * 00330 * @since New in 1.5. 00331 */ 00332 svn_error_t * 00333 svn_repos_recover3(const char *path, 00334 svn_boolean_t nonblocking, 00335 svn_error_t *(*start_callback)(void *baton), 00336 void *start_callback_baton, 00337 svn_cancel_func_t cancel_func, 00338 void * cancel_baton, 00339 apr_pool_t *pool); 00340 00341 /** 00342 * Similar to svn_repos_recover3(), but without cancellation support. 00343 * 00344 * @deprecated Provided for backward compatibility with the 1.4 API. 00345 */ 00346 svn_error_t * 00347 svn_repos_recover2(const char *path, 00348 svn_boolean_t nonblocking, 00349 svn_error_t *(*start_callback)(void *baton), 00350 void *start_callback_baton, 00351 apr_pool_t *pool); 00352 00353 /** 00354 * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and 00355 * with no callbacks provided. 00356 * 00357 * @deprecated Provided for backward compatibility with the 1.0 API. 00358 */ 00359 svn_error_t *svn_repos_recover(const char *path, apr_pool_t *pool); 00360 00361 /** This function is a wrapper around svn_fs_berkeley_logfiles(), 00362 * returning log file paths relative to the root of the repository. 00363 * 00364 * @copydoc svn_fs_berkeley_logfiles() 00365 */ 00366 svn_error_t * 00367 svn_repos_db_logfiles(apr_array_header_t **logfiles, 00368 const char *path, 00369 svn_boolean_t only_unused, 00370 apr_pool_t *pool); 00371 00372 00373 00374 /* Repository Paths */ 00375 00376 /** Return the top-level repository path allocated in @a pool. */ 00377 const char *svn_repos_path(svn_repos_t *repos, apr_pool_t *pool); 00378 00379 /** Return the path to @a repos's filesystem directory, allocated in 00380 * @a pool. 00381 */ 00382 const char *svn_repos_db_env(svn_repos_t *repos, apr_pool_t *pool); 00383 00384 /** Return path to @a repos's config directory, allocated in @a pool. */ 00385 const char *svn_repos_conf_dir(svn_repos_t *repos, apr_pool_t *pool); 00386 00387 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */ 00388 const char *svn_repos_svnserve_conf(svn_repos_t *repos, apr_pool_t *pool); 00389 00390 /** Return path to @a repos's lock directory, allocated in @a pool. */ 00391 const char *svn_repos_lock_dir(svn_repos_t *repos, apr_pool_t *pool); 00392 00393 /** Return path to @a repos's db lockfile, allocated in @a pool. */ 00394 const char *svn_repos_db_lockfile(svn_repos_t *repos, apr_pool_t *pool); 00395 00396 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */ 00397 const char *svn_repos_db_logs_lockfile(svn_repos_t *repos, apr_pool_t *pool); 00398 00399 /** Return the path to @a repos's hook directory, allocated in @a pool. */ 00400 const char *svn_repos_hook_dir(svn_repos_t *repos, apr_pool_t *pool); 00401 00402 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */ 00403 const char *svn_repos_start_commit_hook(svn_repos_t *repos, apr_pool_t *pool); 00404 00405 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */ 00406 const char *svn_repos_pre_commit_hook(svn_repos_t *repos, apr_pool_t *pool); 00407 00408 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */ 00409 const char *svn_repos_post_commit_hook(svn_repos_t *repos, apr_pool_t *pool); 00410 00411 /** Return the path to @a repos's pre-revprop-change hook, allocated in 00412 * @a pool. 00413 */ 00414 const char * 00415 svn_repos_pre_revprop_change_hook(svn_repos_t *repos, 00416 apr_pool_t *pool); 00417 00418 /** Return the path to @a repos's post-revprop-change hook, allocated in 00419 * @a pool. 00420 */ 00421 const char * 00422 svn_repos_post_revprop_change_hook(svn_repos_t *repos, 00423 apr_pool_t *pool); 00424 00425 00426 /** @defgroup svn_repos_lock_hooks Paths to lock hooks 00427 * @{ 00428 * @since New in 1.2. */ 00429 00430 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */ 00431 const char *svn_repos_pre_lock_hook(svn_repos_t *repos, apr_pool_t *pool); 00432 00433 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */ 00434 const char *svn_repos_post_lock_hook(svn_repos_t *repos, apr_pool_t *pool); 00435 00436 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */ 00437 const char *svn_repos_pre_unlock_hook(svn_repos_t *repos, apr_pool_t *pool); 00438 00439 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */ 00440 const char *svn_repos_post_unlock_hook(svn_repos_t *repos, apr_pool_t *pool); 00441 00442 /** @} */ 00443 00444 /* ---------------------------------------------------------------*/ 00445 00446 /* Reporting the state of a working copy, for updates. */ 00447 00448 00449 /** 00450 * Construct and return a @a report_baton that will be passed to the 00451 * other functions in this section to describe the state of a pre-existing 00452 * tree (typically, a working copy). When the report is finished, 00453 * @a editor/@a edit_baton will be driven in such a way as to transform the 00454 * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the 00455 * reported hierarchy to @a tgt_path. 00456 * 00457 * @a fs_base is the absolute path of the node in the filesystem at which 00458 * the comparison should be rooted. @a target is a single path component, 00459 * used to limit the scope of the report to a single entry of @a fs_base, 00460 * or "" if all of @a fs_base itself is the main subject of the report. 00461 * 00462 * @a tgt_path and @a revnum is the fs path/revision pair that is the 00463 * "target" of the delta. @a tgt_path should be provided only when 00464 * the source and target paths of the report differ. That is, @a tgt_path 00465 * should *only* be specified when specifying that the resultant editor 00466 * drive be one that transforms the reported hierarchy into a pristine tree 00467 * of @a tgt_path at revision @a revnum. A @c NULL value for @a tgt_path 00468 * will indicate that the editor should be driven in such a way as to 00469 * transform the reported hierarchy to revision @a revnum, preserving the 00470 * reported hierarchy. 00471 * 00472 * @a text_deltas instructs the driver of the @a editor to enable 00473 * the generation of text deltas. 00474 * 00475 * @a ignore_ancestry instructs the driver to ignore node ancestry 00476 * when determining how to transmit differences. 00477 * 00478 * @a send_copyfrom_args instructs the driver to send 'copyfrom' 00479 * arguments to the editor's add_file() and add_directory() methods, 00480 * whenever it deems feasible. 00481 * 00482 * The @a authz_read_func and @a authz_read_baton are passed along to 00483 * svn_repos_dir_delta2(); see that function for how they are used. 00484 * 00485 * All allocation for the context and collected state will occur in 00486 * @a pool. 00487 * 00488 * @a depth is the requested depth of the editor drive. 00489 * 00490 * If @a depth is @c svn_depth_unknown, the editor will affect only the 00491 * paths reported by the individual calls to @c svn_repos_set_path3 and 00492 * @c svn_repos_link_path3. 00493 * 00494 * For example, if the reported tree is the @c A subdir of the Greek Tree 00495 * (see Subversion's test suite), at depth @c svn_depth_empty, but the 00496 * @c A/B subdir is reported at depth @c svn_depth_infinity, then 00497 * repository-side changes to @c A/mu, or underneath @c A/C and @c 00498 * A/D, would not be reflected in the editor drive, but changes 00499 * underneath @c A/B would be. 00500 * 00501 * Additionally, the editor driver will call @c add_directory and 00502 * and @c add_file for directories with an appropriate depth. For 00503 * example, a directory reported at @c svn_depth_files will receive 00504 * file (but not directory) additions. A directory at @c svn_depth_empty 00505 * will receive neither. 00506 * 00507 * If @a depth is @c svn_depth_files, @c svn_depth_immediates or 00508 * @c svn_depth_infinity and @a depth is greater than the reported depth 00509 * of the working copy, then the editor driver will emit editor 00510 * operations so as to upgrade the working copy to this depth. 00511 * 00512 * If @a depth is @c svn_depth_empty, @c svn_depth_files, 00513 * @c svn_depth_immediates and @a depth is lower 00514 * than or equal to the depth of the working copy, then the editor 00515 * operations will affect only paths at or above @a depth. 00516 * 00517 * @since New in 1.5. 00518 */ 00519 svn_error_t * 00520 svn_repos_begin_report2(void **report_baton, 00521 svn_revnum_t revnum, 00522 svn_repos_t *repos, 00523 const char *fs_base, 00524 const char *target, 00525 const char *tgt_path, 00526 svn_boolean_t text_deltas, 00527 svn_depth_t depth, 00528 svn_boolean_t ignore_ancestry, 00529 svn_boolean_t send_copyfrom_args, 00530 const svn_delta_editor_t *editor, 00531 void *edit_baton, 00532 svn_repos_authz_func_t authz_read_func, 00533 void *authz_read_baton, 00534 apr_pool_t *pool); 00535 00536 /** 00537 * The same as svn_repos_begin_report2(), but taking a boolean 00538 * @a recurse flag, and sending FALSE for @a send_copyfrom_args. 00539 * 00540 * If @a recurse is TRUE, the editor driver will drive the editor with 00541 * a depth of @c svn_depth_infinity; if FALSE, then with a depth of 00542 * @c svn_depth_files. 00543 * 00544 * @note @a username is ignored, and has been removed in a revised 00545 * version of this API. 00546 * 00547 * @deprecated Provided for backward compatibility with the 1.4 API. 00548 */ 00549 svn_error_t * 00550 svn_repos_begin_report(void **report_baton, 00551 svn_revnum_t revnum, 00552 const char *username, 00553 svn_repos_t *repos, 00554 const char *fs_base, 00555 const char *target, 00556 const char *tgt_path, 00557 svn_boolean_t text_deltas, 00558 svn_boolean_t recurse, 00559 svn_boolean_t ignore_ancestry, 00560 const svn_delta_editor_t *editor, 00561 void *edit_baton, 00562 svn_repos_authz_func_t authz_read_func, 00563 void *authz_read_baton, 00564 apr_pool_t *pool); 00565 00566 00567 /** 00568 * Given a @a report_baton constructed by svn_repos_begin_report2(), 00569 * record the presence of @a path, at @a revision with depth @a depth, 00570 * in the current tree. 00571 * 00572 * @a path is relative to the anchor/target used in the creation of the 00573 * @a report_baton. 00574 * 00575 * @a revision may be SVN_INVALID_REVNUM if (for example) @a path 00576 * represents a locally-added path with no revision number, or @a 00577 * depth is @c svn_depth_exclude. 00578 * 00579 * @a path may not be underneath a path on which svn_repos_set_path3() 00580 * was previously called with @c svn_depth_exclude in this report. 00581 * 00582 * The first call of this in a given report usually passes an empty 00583 * @a path; this is used to set up the correct root revision for the editor 00584 * drive. 00585 * 00586 * A depth of @c svn_depth_unknown is not allowed, and results in an 00587 * error. 00588 * 00589 * If @a start_empty is TRUE and @a path is a directory, then require the 00590 * caller to explicitly provide all the children of @a path - do not assume 00591 * that the tree also contains all the children of @a path at @a revision. 00592 * This is for 'low confidence' client reporting. 00593 * 00594 * If the caller has a lock token for @a path, then @a lock_token should 00595 * be set to that token. Else, @a lock_token should be NULL. 00596 * 00597 * All temporary allocations are done in @a pool. 00598 * 00599 * @since New in 1.5. 00600 */ 00601 svn_error_t * 00602 svn_repos_set_path3(void *report_baton, 00603 const char *path, 00604 svn_revnum_t revision, 00605 svn_depth_t depth, 00606 svn_boolean_t start_empty, 00607 const char *lock_token, 00608 apr_pool_t *pool); 00609 00610 /** 00611 * Similar to svn_repos_set_path3(), but with @a depth set to 00612 * @c svn_depth_infinity. 00613 * 00614 * @deprecated Provided for backward compatibility with the 1.4 API. 00615 */ 00616 svn_error_t * 00617 svn_repos_set_path2(void *report_baton, 00618 const char *path, 00619 svn_revnum_t revision, 00620 svn_boolean_t start_empty, 00621 const char *lock_token, 00622 apr_pool_t *pool); 00623 00624 /** 00625 * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL. 00626 * 00627 * @deprecated Provided for backward compatibility with the 1.1 API. 00628 */ 00629 svn_error_t * 00630 svn_repos_set_path(void *report_baton, 00631 const char *path, 00632 svn_revnum_t revision, 00633 svn_boolean_t start_empty, 00634 apr_pool_t *pool); 00635 00636 /** 00637 * Given a @a report_baton constructed by svn_repos_begin_report2(), 00638 * record the presence of @a path in the current tree, containing the contents 00639 * of @a link_path at @a revision with depth @a depth. 00640 * 00641 * A depth of @c svn_depth_unknown is not allowed, and results in an 00642 * error. 00643 * 00644 * @a path may not be underneath a path on which svn_repos_set_path3() 00645 * was previously called with @c svn_depth_exclude in this report. 00646 * 00647 * Note that while @a path is relative to the anchor/target used in the 00648 * creation of the @a report_baton, @a link_path is an absolute filesystem 00649 * path! 00650 * 00651 * If @a start_empty is TRUE and @a path is a directory, then require the 00652 * caller to explicitly provide all the children of @a path - do not assume 00653 * that the tree also contains all the children of @a link_path at 00654 * @a revision. This is for 'low confidence' client reporting. 00655 * 00656 * If the caller has a lock token for @a link_path, then @a lock_token 00657 * should be set to that token. Else, @a lock_token should be NULL. 00658 * 00659 * All temporary allocations are done in @a pool. 00660 * 00661 * @since New in 1.5. 00662 */ 00663 svn_error_t * 00664 svn_repos_link_path3(void *report_baton, 00665 const char *path, 00666 const char *link_path, 00667 svn_revnum_t revision, 00668 svn_depth_t depth, 00669 svn_boolean_t start_empty, 00670 const char *lock_token, 00671 apr_pool_t *pool); 00672 00673 /** 00674 * Similar to svn_repos_link_path3(), but with @a depth set to 00675 * @c svn_depth_infinity. 00676 * 00677 * @deprecated Provided for backward compatibility with the 1.4 API. 00678 */ 00679 svn_error_t * 00680 svn_repos_link_path2(void *report_baton, 00681 const char *path, 00682 const char *link_path, 00683 svn_revnum_t revision, 00684 svn_boolean_t start_empty, 00685 const char *lock_token, 00686 apr_pool_t *pool); 00687 00688 /** 00689 * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL. 00690 * 00691 * @deprecated Provided for backward compatibility with the 1.1 API. 00692 */ 00693 svn_error_t * 00694 svn_repos_link_path(void *report_baton, 00695 const char *path, 00696 const char *link_path, 00697 svn_revnum_t revision, 00698 svn_boolean_t start_empty, 00699 apr_pool_t *pool); 00700 00701 /** Given a @a report_baton constructed by svn_repos_begin_report2(), 00702 * record the non-existence of @a path in the current tree. 00703 * 00704 * @a path may not be underneath a path on which svn_repos_set_path3() 00705 * was previously called with @c svn_depth_exclude in this report. 00706 * 00707 * (This allows the reporter's driver to describe missing pieces of a 00708 * working copy, so that 'svn up' can recreate them.) 00709 * 00710 * All temporary allocations are done in @a pool. 00711 */ 00712 svn_error_t * 00713 svn_repos_delete_path(void *report_baton, 00714 const char *path, 00715 apr_pool_t *pool); 00716 00717 /** Given a @a report_baton constructed by svn_repos_begin_report2(), 00718 * finish the report and drive the editor as specified when the report 00719 * baton was constructed. 00720 * 00721 * If an error occurs during the driving of the editor, do NOT abort the 00722 * edit; that responsibility belongs to the caller of this function, if 00723 * it happens at all. 00724 * 00725 * After the call to this function, @a report_baton is no longer valid; 00726 * it should not be passed to any other reporting functions, including 00727 * svn_repos_abort_report(). 00728 */ 00729 svn_error_t * 00730 svn_repos_finish_report(void *report_baton, 00731 apr_pool_t *pool); 00732 00733 00734 /** Given a @a report_baton constructed by svn_repos_begin_report2(), 00735 * abort the report. This function can be called anytime before 00736 * svn_repos_finish_report() is called. 00737 * 00738 * After the call to this function, @a report_baton is no longer valid; 00739 * it should not be passed to any other reporting functions. 00740 */ 00741 svn_error_t * 00742 svn_repos_abort_report(void *report_baton, 00743 apr_pool_t *pool); 00744 00745 00746 /* ---------------------------------------------------------------*/ 00747 00748 /* The magical dir_delta update routines. */ 00749 00750 /** Use the provided @a editor and @a edit_baton to describe the changes 00751 * necessary for making a given node (and its descendants, if it is a 00752 * directory) under @a src_root look exactly like @a tgt_path under 00753 * @a tgt_root. @a src_entry is the node to update. If @a src_entry 00754 * is empty, then compute the difference between the entire tree 00755 * anchored at @a src_parent_dir under @a src_root and @a tgt_path 00756 * under @a tgt_root. Else, describe the changes needed to update 00757 * only that entry in @a src_parent_dir. Typically, callers of this 00758 * function will use a @a tgt_path that is the concatenation of @a 00759 * src_parent_dir and @a src_entry. 00760 * 00761 * @a src_root and @a tgt_root can both be either revision or transaction 00762 * roots. If @a tgt_root is a revision, @a editor's set_target_revision() 00763 * will be called with the @a tgt_root's revision number, else it will 00764 * not be called at all. 00765 * 00766 * If @a authz_read_func is non-NULL, invoke it before any call to 00767 * 00768 * @a editor->open_root 00769 * @a editor->add_directory 00770 * @a editor->open_directory 00771 * @a editor->add_file 00772 * @a editor->open_file 00773 * 00774 * passing @a tgt_root, the same path that would be passed to the 00775 * editor function in question, and @a authz_read_baton. If the 00776 * @a *allowed parameter comes back TRUE, then proceed with the planned 00777 * editor call; else if FALSE, then invoke @a editor->absent_file or 00778 * @a editor->absent_directory as appropriate, except if the planned 00779 * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE. 00780 * 00781 * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to 00782 * the window handler returned by @a editor->apply_textdelta(). 00783 * 00784 * If @a depth is @c svn_depth_empty, invoke @a editor calls only on 00785 * @a src_entry (or @a src_parent_dir, if @a src_entry is empty). 00786 * If @a depth is @c svn_depth_files, also invoke the editor on file 00787 * children, if any; if @c svn_depth_immediates, invoke it on 00788 * immediate subdirectories as well as files; if @c svn_depth_infinity, 00789 * recurse fully. 00790 * 00791 * If @a entry_props is @c TRUE, accompany each opened/added entry with 00792 * propchange editor calls that relay special "entry props" (this 00793 * is typically used only for working copy updates). 00794 * 00795 * @a ignore_ancestry instructs the function to ignore node ancestry 00796 * when determining how to transmit differences. 00797 * 00798 * Before completing successfully, this function calls @a editor's 00799 * close_edit(), so the caller should expect its @a edit_baton to be 00800 * invalid after its use with this function. 00801 * 00802 * Do any allocation necessary for the delta computation in @a pool. 00803 * This function's maximum memory consumption is at most roughly 00804 * proportional to the greatest depth of the tree under @a tgt_root, not 00805 * the total size of the delta. 00806 * 00807 * ### svn_repos_dir_delta2 is mostly superceded by the reporter 00808 * ### functionality (svn_repos_begin_report2 and friends). 00809 * ### svn_repos_dir_delta2 does allow the roots to be transaction 00810 * ### roots rather than just revision roots, and it has the 00811 * ### entry_props flag. Almost all of Subversion's own code uses the 00812 * ### reporter instead; there are some stray references to the 00813 * ### svn_repos_dir_delta[2] in comments which should probably 00814 * ### actually refer to the reporter. 00815 */ 00816 svn_error_t * 00817 svn_repos_dir_delta2(svn_fs_root_t *src_root, 00818 const char *src_parent_dir, 00819 const char *src_entry, 00820 svn_fs_root_t *tgt_root, 00821 const char *tgt_path, 00822 const svn_delta_editor_t *editor, 00823 void *edit_baton, 00824 svn_repos_authz_func_t authz_read_func, 00825 void *authz_read_baton, 00826 svn_boolean_t text_deltas, 00827 svn_depth_t depth, 00828 svn_boolean_t entry_props, 00829 svn_boolean_t ignore_ancestry, 00830 apr_pool_t *pool); 00831 00832 /** 00833 * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass 00834 * @c svn_depth_infinity for @a depth, and if @a recurse is FALSE, 00835 * pass @c svn_depth_files for @a depth. 00836 * 00837 * @deprecated Provided for backward compatibility with the 1.4 API. 00838 */ 00839 svn_error_t * 00840 svn_repos_dir_delta(svn_fs_root_t *src_root, 00841 const char *src_parent_dir, 00842 const char *src_entry, 00843 svn_fs_root_t *tgt_root, 00844 const char *tgt_path, 00845 const svn_delta_editor_t *editor, 00846 void *edit_baton, 00847 svn_repos_authz_func_t authz_read_func, 00848 void *authz_read_baton, 00849 svn_boolean_t text_deltas, 00850 svn_boolean_t recurse, 00851 svn_boolean_t entry_props, 00852 svn_boolean_t ignore_ancestry, 00853 apr_pool_t *pool); 00854 00855 00856 /** Use the provided @a editor and @a edit_baton to describe the 00857 * skeletal changes made in a particular filesystem @a root 00858 * (revision or transaction). 00859 * 00860 * Changes will be limited to those within @a base_dir, and if 00861 * @a low_water_mark is set to something other than @c SVN_INVALID_REVNUM 00862 * it is assumed that the client has no knowledge of revisions prior to 00863 * @a low_water_mark. Together, these two arguments define the portion of 00864 * the tree that the client is assumed to have knowledge of, and thus any 00865 * copies of data from outside that part of the tree will be sent in their 00866 * entirety, not as simple copies or deltas against a previous version. 00867 * 00868 * The @a editor passed to this function should be aware of the fact 00869 * that, if @a send_deltas is FALSE, calls to its change_dir_prop(), 00870 * change_file_prop(), and apply_textdelta() functions will not 00871 * contain meaningful data, and merely serve as indications that 00872 * properties or textual contents were changed. 00873 * 00874 * If @a send_deltas is @c TRUE, the text and property deltas for changes 00875 * will be sent, otherwise NULL text deltas and empty prop changes will be 00876 * used. 00877 * 00878 * If @a authz_read_func is non-NULL, it will be used to determine if the 00879 * user has read access to the data being accessed. Data that the user 00880 * cannot access will be skipped. 00881 * 00882 * @note This editor driver passes SVN_INVALID_REVNUM for all 00883 * revision parameters in the editor interface except the copyfrom 00884 * parameter of the add_file() and add_directory() editor functions. 00885 * 00886 * @since New in 1.4. 00887 */ 00888 svn_error_t * 00889 svn_repos_replay2(svn_fs_root_t *root, 00890 const char *base_dir, 00891 svn_revnum_t low_water_mark, 00892 svn_boolean_t send_deltas, 00893 const svn_delta_editor_t *editor, 00894 void *edit_baton, 00895 svn_repos_authz_func_t authz_read_func, 00896 void *authz_read_baton, 00897 apr_pool_t *pool); 00898 00899 /** 00900 * Similar to svn_repos_replay2(), but with @a base_dir set to @c "", 00901 * @a low_water_mark set to @c SVN_INVALID_REVNUM, @a send_deltas 00902 * set to @c FALSE, and @a authz_read_func and @a authz_read_baton 00903 * set to @c NULL. 00904 * 00905 * @deprecated Provided for backward compatibility with the 1.3 API. 00906 */ 00907 svn_error_t * 00908 svn_repos_replay(svn_fs_root_t *root, 00909 const svn_delta_editor_t *editor, 00910 void *edit_baton, 00911 apr_pool_t *pool); 00912 00913 /* ---------------------------------------------------------------*/ 00914 00915 /* Making commits. */ 00916 00917 /** 00918 * Return an @a editor and @a edit_baton to commit changes to the 00919 * filesystem of @a repos, beginning at location 'rev:@a base_path', 00920 * where "rev" is the argument given to open_root(). 00921 * 00922 * @a repos is a previously opened repository. @a repos_url is the 00923 * decoded URL to the base of the repository, and is used to check 00924 * copyfrom paths. @a txn is a filesystem transaction object to use 00925 * during the commit, or @c NULL to indicate that this function should 00926 * create (and fully manage) a new transaction. 00927 * 00928 * Store the contents of @a revprop_table, a hash mapping <tt>const 00929 * char *</tt> property names to @c svn_string_t values, as properties 00930 * of the commit transaction, including author and log message if 00931 * present. 00932 * 00933 * @note @c SVN_PROP_REVISION_DATE may be present in @a revprop_table, but 00934 * it will be overwritten when the transaction is committed. 00935 * 00936 * Iff @a authz_callback is provided, check read/write authorizations 00937 * on paths accessed by editor operations. An operation which fails 00938 * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or 00939 * SVN_ERR_AUTHZ_UNWRITABLE. 00940 * 00941 * Calling @a (*editor)->close_edit completes the commit. Before 00942 * @c close_edit returns, but after the commit has succeeded, it will 00943 * invoke @a callback with the new revision number, the commit date (as a 00944 * <tt>const char *</tt>), commit author (as a <tt>const char *</tt>), and 00945 * @a callback_baton as arguments. If @a callback returns an error, that 00946 * error will be returned from @c close_edit, otherwise if there was a 00947 * post-commit hook failure, then that error will be returned and will 00948 * have code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. 00949 * 00950 * Calling @a (*editor)->abort_edit aborts the commit, and will also 00951 * abort the commit transaction unless @a txn was supplied (not @c 00952 * NULL). Callers who supply their own transactions are responsible 00953 * for cleaning them up (either by committing them, or aborting them). 00954 * 00955 * @since New in 1.5. 00956 */ 00957 svn_error_t * 00958 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor, 00959 void **edit_baton, 00960 svn_repos_t *repos, 00961 svn_fs_txn_t *txn, 00962 const char *repos_url, 00963 const char *base_path, 00964 apr_hash_t *revprop_table, 00965 svn_commit_callback2_t callback, 00966 void *callback_baton, 00967 svn_repos_authz_callback_t authz_callback, 00968 void *authz_baton, 00969 apr_pool_t *pool); 00970 00971 /** 00972 * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table 00973 * set to a hash containing @a user and @a log_msg as the 00974 * @c SVN_PROP_REVISION_AUTHOR and @c SVN_PROP_REVISION_LOG properties, 00975 * respectively. @a user and @a log_msg may both be @c NULL. 00976 * 00977 * @since New in 1.4. 00978 * 00979 * @deprecated Provided for backward compatibility with the 1.4 API. 00980 */ 00981 svn_error_t * 00982 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor, 00983 void **edit_baton, 00984 svn_repos_t *repos, 00985 svn_fs_txn_t *txn, 00986 const char *repos_url, 00987 const char *base_path, 00988 const char *user, 00989 const char *log_msg, 00990 svn_commit_callback2_t callback, 00991 void *callback_baton, 00992 svn_repos_authz_callback_t authz_callback, 00993 void *authz_baton, 00994 apr_pool_t *pool); 00995 00996 /** 00997 * Similar to svn_repos_get_commit_editor4(), but 00998 * uses the svn_commit_callback_t type. 00999 * 01000 * @since New in 1.3. 01001 * 01002 * @deprecated Provided for backward compatibility with the 1.3 API. 01003 */ 01004 svn_error_t * 01005 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor, 01006 void **edit_baton, 01007 svn_repos_t *repos, 01008 svn_fs_txn_t *txn, 01009 const char *repos_url, 01010 const char *base_path, 01011 const char *user, 01012 const char *log_msg, 01013 svn_commit_callback_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_editor3(), but with @a 01021 * authz_callback and @a authz_baton set to @c NULL. 01022 * 01023 * @deprecated Provided for backward compatibility with the 1.2 API. 01024 */ 01025 svn_error_t * 01026 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor, 01027 void **edit_baton, 01028 svn_repos_t *repos, 01029 svn_fs_txn_t *txn, 01030 const char *repos_url, 01031 const char *base_path, 01032 const char *user, 01033 const char *log_msg, 01034 svn_commit_callback_t callback, 01035 void *callback_baton, 01036 apr_pool_t *pool); 01037 01038 01039 /** 01040 * Similar to svn_repos_get_commit_editor2(), but with @a txn always 01041 * set to @c NULL. 01042 * 01043 * @deprecated Provided for backward compatibility with the 1.1 API. 01044 */ 01045 svn_error_t * 01046 svn_repos_get_commit_editor(const svn_delta_editor_t **editor, 01047 void **edit_baton, 01048 svn_repos_t *repos, 01049 const char *repos_url, 01050 const char *base_path, 01051 const char *user, 01052 const char *log_msg, 01053 svn_commit_callback_t callback, 01054 void *callback_baton, 01055 apr_pool_t *pool); 01056 01057 /* ---------------------------------------------------------------*/ 01058 01059 /* Finding particular revisions. */ 01060 01061 /** Set @a *revision to the revision number in @a repos's filesystem that was 01062 * youngest at time @a tm. 01063 */ 01064 svn_error_t * 01065 svn_repos_dated_revision(svn_revnum_t *revision, 01066 svn_repos_t *repos, 01067 apr_time_t tm, 01068 apr_pool_t *pool); 01069 01070 01071 /** Given a @a root/@a path within some filesystem, return three pieces of 01072 * information allocated in @a pool: 01073 * 01074 * - set @a *committed_rev to the revision in which the object was 01075 * last modified. (In fs parlance, this is the revision in which 01076 * the particular node-rev-id was 'created'.) 01077 * 01078 * - set @a *committed_date to the date of said revision, or @c NULL 01079 * if not available. 01080 * 01081 * - set @a *last_author to the author of said revision, or @c NULL 01082 * if not available. 01083 */ 01084 svn_error_t * 01085 svn_repos_get_committed_info(svn_revnum_t *committed_rev, 01086 const char **committed_date, 01087 const char **last_author, 01088 svn_fs_root_t *root, 01089 const char *path, 01090 apr_pool_t *pool); 01091 01092 01093 /** 01094 * Set @a *dirent to an @c svn_dirent_t associated with @a path in @a 01095 * root. If @a path does not exist in @a root, set @a *dirent to 01096 * NULL. Use @a pool for memory allocation. 01097 * 01098 * @since New in 1.2. 01099 */ 01100 svn_error_t * 01101 svn_repos_stat(svn_dirent_t **dirent, 01102 svn_fs_root_t *root, 01103 const char *path, 01104 apr_pool_t *pool); 01105 01106 01107 /** 01108 * Given @a path which exists at revision @a start in @a fs, set 01109 * @a *deleted to the revision @a path was first deleted, within the 01110 * inclusive revision range set by @a start and @a end. If @a path 01111 * does not exist at revision @a start or was not deleted within the 01112 * specified range, then set @a *deleted to SVN_INVALID_REVNUM. 01113 * Use @a pool for memory allocation. 01114 * 01115 * @since New in 1.5. 01116 */ 01117 svn_error_t * 01118 svn_repos_deleted_rev(svn_fs_t *fs, 01119 const char *path, 01120 svn_revnum_t start, 01121 svn_revnum_t end, 01122 svn_revnum_t *deleted, 01123 apr_pool_t *pool); 01124 01125 01126 /** Callback type for use with svn_repos_history(). @a path and @a 01127 * revision represent interesting history locations in the lifetime 01128 * of the path passed to svn_repos_history(). @a baton is the same 01129 * baton given to svn_repos_history(). @a pool is provided for the 01130 * convenience of the implementor, who should not expect it to live 01131 * longer than a single callback call. 01132 * 01133 * Signal to callback driver to stop processing/invoking this callback 01134 * by returning the @c SVN_ERR_CEASE_INVOCATION error code. 01135 * 01136 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 01137 */ 01138 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton, 01139 const char *path, 01140 svn_revnum_t revision, 01141 apr_pool_t *pool); 01142 01143 /** 01144 * Call @a history_func (with @a history_baton) for each interesting 01145 * history location in the lifetime of @a path in @a fs, from the 01146 * youngest of @a end and @a start to the oldest. Stop processing if 01147 * @a history_func returns @c SVN_ERR_CEASE_INVOCATION. Only cross 01148 * filesystem copy history if @a cross_copies is @c TRUE. And do all 01149 * of this in @a pool. 01150 * 01151 * If @a authz_read_func is non-NULL, then use it (and @a 01152 * authz_read_baton) to verify that @a path in @a end is readable; if 01153 * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability 01154 * of every ancestral path/revision pair before pushing them at @a 01155 * history_func. If a pair is deemed unreadable, then do not send 01156 * them; instead, immediately stop traversing history and return 01157 * SVN_NO_ERROR. 01158 * 01159 * @since New in 1.1. 01160 * 01161 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 01162 */ 01163 svn_error_t * 01164 svn_repos_history2(svn_fs_t *fs, 01165 const char *path, 01166 svn_repos_history_func_t history_func, 01167 void *history_baton, 01168 svn_repos_authz_func_t authz_read_func, 01169 void *authz_read_baton, 01170 svn_revnum_t start, 01171 svn_revnum_t end, 01172 svn_boolean_t cross_copies, 01173 apr_pool_t *pool); 01174 01175 /** 01176 * Similar to svn_repos_history2(), but with @a authz_read_func 01177 * and @a authz_read_baton always set to NULL. 01178 * 01179 * @deprecated Provided for backward compatibility with the 1.0 API. 01180 */ 01181 svn_error_t * 01182 svn_repos_history(svn_fs_t *fs, 01183 const char *path, 01184 svn_repos_history_func_t history_func, 01185 void *history_baton, 01186 svn_revnum_t start, 01187 svn_revnum_t end, 01188 svn_boolean_t cross_copies, 01189 apr_pool_t *pool); 01190 01191 01192 /** 01193 * Set @a *locations to be a mapping of the revisions to the paths of 01194 * the file @a fs_path present at the repository in revision 01195 * @a peg_revision, where the revisions are taken out of the array 01196 * @a location_revisions. 01197 * 01198 * @a location_revisions is an array of svn_revnum_t's and @a *locations 01199 * maps 'svn_revnum_t *' to 'const char *'. 01200 * 01201 * If optional @a authz_read_func is non-NULL, then use it (and @a 01202 * authz_read_baton) to verify that the peg-object is readable. If not, 01203 * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func 01204 * to check that every path returned in the hash is readable. If an 01205 * unreadable path is encountered, stop tracing and return 01206 * SVN_NO_ERROR. 01207 * 01208 * @a pool is used for all allocations. 01209 * 01210 * @since New in 1.1. 01211 */ 01212 svn_error_t * 01213 svn_repos_trace_node_locations(svn_fs_t *fs, 01214 apr_hash_t **locations, 01215 const char *fs_path, 01216 svn_revnum_t peg_revision, 01217 apr_array_header_t *location_revisions, 01218 svn_repos_authz_func_t authz_read_func, 01219 void *authz_read_baton, 01220 apr_pool_t *pool); 01221 01222 01223 /** 01224 * Call @a receiver and @a receiver_baton to report successive 01225 * location segments in revisions between @a start_rev and @a end_rev 01226 * (inclusive) for the line of history identified by the peg-object @a 01227 * path in @a peg_revision (and in @a repos). 01228 * 01229 * @a end_rev may be @c SVN_INVALID_REVNUM to indicate that you want 01230 * to trace the history of the object to its origin. 01231 * 01232 * @a start_rev may be @c SVN_INVALID_REVNUM to indicate "the HEAD 01233 * revision". Otherwise, @a start_rev must be younger than @a end_rev 01234 * (unless @a end_rev is @c SVN_INVALID_REVNUM). 01235 * 01236 * @a peg_revision may be @c SVN_INVALID_REVNUM to indicate "the HEAD 01237 * revision", and must evaluate to be at least as young as @a start_rev. 01238 * 01239 * If optional @a authz_read_func is not @c NULL, then use it (and @a 01240 * authz_read_baton) to verify that the peg-object is readable. If 01241 * not, return @c SVN_ERR_AUTHZ_UNREADABLE. Also use the @a 01242 * authz_read_func to check that every path reported in a location 01243 * segment is readable. If an unreadable path is encountered, report 01244 * a final (possibly truncated) location segment (if any), stop 01245 * tracing history, and return @c SVN_NO_ERROR. 01246 * 01247 * @a pool is used for all allocations. 01248 * 01249 * @since New in 1.5. 01250 */ 01251 svn_error_t * 01252 svn_repos_node_location_segments(svn_repos_t *repos, 01253 const char *path, 01254 svn_revnum_t peg_revision, 01255 svn_revnum_t start_rev, 01256 svn_revnum_t end_rev, 01257 svn_location_segment_receiver_t receiver, 01258 void *receiver_baton, 01259 svn_repos_authz_func_t authz_read_func, 01260 void *authz_read_baton, 01261 apr_pool_t *pool); 01262 01263 01264 /* ### other queries we can do someday -- 01265 01266 * fetch the last revision created by <user> 01267 (once usernames become revision properties!) 01268 * fetch the last revision where <path> was modified 01269 01270 */ 01271 01272 01273 01274 /* ---------------------------------------------------------------*/ 01275 01276 /* Retrieving log messages. */ 01277 01278 01279 /** 01280 * Invoke @a receiver with @a receiver_baton on each log message from 01281 * @a start to @a end in @a repos's filesystem. @a start may be greater 01282 * or less than @a end; this just controls whether the log messages are 01283 * processed in descending or ascending revision number order. 01284 * 01285 * If @a start or @a end is @c SVN_INVALID_REVNUM, it defaults to youngest. 01286 * 01287 * If @a paths is non-NULL and has one or more elements, then only show 01288 * revisions in which at least one of @a paths was changed (i.e., if 01289 * file, text or props changed; if dir, props or entries changed or any node 01290 * changed below it). Each path is a <tt>const char *</tt> representing 01291 * an absolute path in the repository. 01292 * 01293 * If @a limit is non-zero then only invoke @a receiver on the first 01294 * @a limit logs. 01295 * 01296 * If @a discover_changed_paths, then each call to @a receiver passes a 01297 * hash mapping paths committed in that revision to information about them 01298 * as the receiver's @a changed_paths argument. 01299 * Otherwise, each call to @a receiver passes NULL for @a changed_paths. 01300 * 01301 * If @a strict_node_history is set, copy history (if any exists) will 01302 * not be traversed while harvesting revision logs for each path. 01303 * 01304 * If @a include_merged_revisions is set, log information for revisions 01305 * which have been merged to @a targets will also be returned. 01306 * 01307 * If @a revprops is NULL, retrieve all revprops; else, retrieve only the 01308 * revprops named in the array (i.e. retrieve none if the array is empty). 01309 * 01310 * If any invocation of @a receiver returns error, return that error 01311 * immediately and without wrapping it. 01312 * 01313 * If @a start or @a end is a non-existent revision, return the error 01314 * @c SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver. 01315 * 01316 * If optional @a authz_read_func is non-NULL, then use this function 01317 * (along with optional @a authz_read_baton) to check the readability 01318 * of each changed-path in each revision about to be "pushed" at 01319 * @a receiver. If a revision has some changed-paths readable and 01320 * others unreadable, unreadable paths are omitted from the 01321 * changed_paths field and only svn:author and svn:date will be 01322 * available in the revprops field. If a revision has no 01323 * changed-paths readable at all, then all paths are omitted and no 01324 * revprops are available. 01325 * 01326 * See also the documentation for @c svn_log_entry_receiver_t. 01327 * 01328 * Use @a pool for temporary allocations. 01329 * 01330 * @since New in 1.5. 01331 */ 01332 svn_error_t * 01333 svn_repos_get_logs4(svn_repos_t *repos, 01334 const apr_array_header_t *paths, 01335 svn_revnum_t start, 01336 svn_revnum_t end, 01337 int limit, 01338 svn_boolean_t discover_changed_paths, 01339 svn_boolean_t strict_node_history, 01340 svn_boolean_t include_merged_revisions, 01341 const apr_array_header_t *revprops, 01342 svn_repos_authz_func_t authz_read_func, 01343 void *authz_read_baton, 01344 svn_log_entry_receiver_t receiver, 01345 void *receiver_baton, 01346 apr_pool_t *pool); 01347 01348 /** 01349 * Same as svn_repos_get_logs4(), but with @a receiver being @c 01350 * svn_log_message_receiver_t instead of @c svn_log_entry_receiver_t. 01351 * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is 01352 * svn:author, svn:date, and svn:log. 01353 * 01354 * @since New in 1.2. 01355 * @deprecated Provided for backward compatibility with the 1.4 API. 01356 */ 01357 svn_error_t * 01358 svn_repos_get_logs3(svn_repos_t *repos, 01359 const apr_array_header_t *paths, 01360 svn_revnum_t start, 01361 svn_revnum_t end, 01362 int limit, 01363 svn_boolean_t discover_changed_paths, 01364 svn_boolean_t strict_node_history, 01365 svn_repos_authz_func_t authz_read_func, 01366 void *authz_read_baton, 01367 svn_log_message_receiver_t receiver, 01368 void *receiver_baton, 01369 apr_pool_t *pool); 01370 01371 01372 /** 01373 * Same as svn_repos_get_logs3(), but with @a limit always set to 0. 01374 * 01375 * @deprecated Provided for backward compatibility with the 1.1 API. 01376 */ 01377 svn_error_t * 01378 svn_repos_get_logs2(svn_repos_t *repos, 01379 const apr_array_header_t *paths, 01380 svn_revnum_t start, 01381 svn_revnum_t end, 01382 svn_boolean_t discover_changed_paths, 01383 svn_boolean_t strict_node_history, 01384 svn_repos_authz_func_t authz_read_func, 01385 void *authz_read_baton, 01386 svn_log_message_receiver_t receiver, 01387 void *receiver_baton, 01388 apr_pool_t *pool); 01389 01390 /** 01391 * Same as svn_repos_get_logs2(), but with @a authz_read_func and 01392 * @a authz_read_baton always set to NULL. 01393 * 01394 * @deprecated Provided for backward compatibility with the 1.0 API. 01395 */ 01396 svn_error_t * 01397 svn_repos_get_logs(svn_repos_t *repos, 01398 const apr_array_header_t *paths, 01399 svn_revnum_t start, 01400 svn_revnum_t end, 01401 svn_boolean_t discover_changed_paths, 01402 svn_boolean_t strict_node_history, 01403 svn_log_message_receiver_t receiver, 01404 void *receiver_baton, 01405 apr_pool_t *pool); 01406 01407 01408 01409 /* ---------------------------------------------------------------*/ 01410 01411 /* Retrieving mergeinfo. */ 01412 01413 /** 01414 * Fetch the mergeinfo for @a paths at @a rev, and save it to @a 01415 * *catalog. It will never be @c NULL but may be empty. 01416 * 01417 * @a inherit indicates whether explicit, explicit or inherited, or 01418 * only inherited mergeinfo for @a paths is fetched. 01419 * 01420 * If @a revision is @c SVN_INVALID_REVNUM, it defaults to youngest. 01421 * 01422 * If @a include_descendants is TRUE, then additionally return the 01423 * mergeinfo for any descendant of any element of @a paths which has 01424 * the @c SVN_PROP_MERGEINFO property explicitly set on it. (Note 01425 * that inheritance is only taken into account for the elements in @a 01426 * paths; descendants of the elements in @a paths which get their 01427 * mergeinfo via inheritance are not included in @a *mergeoutput.) 01428 * 01429 * If optional @a authz_read_func is non-NULL, then use this function 01430 * (along with optional @a authz_read_baton) to check the readability 01431 * of each path which mergeinfo was requested for (from @a paths). 01432 * Silently omit unreadable paths from the request for mergeinfo. 01433 * 01434 * Use @a pool for temporary allocations. 01435 * 01436 * @since New in 1.5. 01437 */ 01438 svn_error_t * 01439 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog, 01440 svn_repos_t *repos, 01441 const apr_array_header_t *paths, 01442 svn_revnum_t revision, 01443 svn_mergeinfo_inheritance_t inherit, 01444 svn_boolean_t include_descendants, 01445 svn_repos_authz_func_t authz_read_func, 01446 void *authz_read_baton, 01447 apr_pool_t *pool); 01448 01449 01450 /* ---------------------------------------------------------------*/ 01451 01452 /* Retrieving multiple revisions of a file. */ 01453 01454 /** 01455 * Retrieve a subset of the interesting revisions of a file @a path in 01456 * @a repos as seen in revision @a end. Invoke @a handler with 01457 * @a handler_baton as its first argument for each such revision. 01458 * @a pool is used for all allocations. See svn_fs_history_prev() for 01459 * a discussion of interesting revisions. 01460 * 01461 * If optional @a authz_read_func is non-NULL, then use this function 01462 * (along with optional @a authz_read_baton) to check the readability 01463 * of the rev-path in each interesting revision encountered. 01464 * 01465 * Revision discovery happens from @a end to @a start, and if an 01466 * unreadable revision is encountered before @a start is reached, then 01467 * revision discovery stops and only the revisions from @a end to the 01468 * oldest readable revision are returned (So it will appear that @a 01469 * path was added without history in the latter revision). 01470 * 01471 * If there is an interesting revision of the file that is less than or 01472 * equal to start, the iteration will start at that revision. Else, the 01473 * iteration will start at the first revision of the file in the repository, 01474 * which has to be less than or equal to end. Note that if the function 01475 * succeeds, @a handler will have been called at least once. 01476 * 01477 * In a series of calls, the file contents for the first interesting revision 01478 * will be provided as a text delta against the empty file. In the following 01479 * calls, the delta will be against the contents for the previous call. 01480 * 01481 * If @a include_merged_revisions is TRUE, revisions which a included as a 01482 * result of a merge between @a start and @a end will be included. 01483 * 01484 * @since New in 1.5. 01485 */ 01486 svn_error_t * 01487 svn_repos_get_file_revs2(svn_repos_t *repos, 01488 const char *path, 01489 svn_revnum_t start, 01490 svn_revnum_t end, 01491 svn_boolean_t include_merged_revisions, 01492 svn_repos_authz_func_t authz_read_func, 01493 void *authz_read_baton, 01494 svn_file_rev_handler_t handler, 01495 void *handler_baton, 01496 apr_pool_t *pool); 01497 01498 /** 01499 * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions 01500 * set to FALSE. 01501 * 01502 * @deprecated Provided for backward compatibility with the 1.4 API. 01503 * @since New in 1.1. 01504 */ 01505 svn_error_t * 01506 svn_repos_get_file_revs(svn_repos_t *repos, 01507 const char *path, 01508 svn_revnum_t start, 01509 svn_revnum_t end, 01510 svn_repos_authz_func_t authz_read_func, 01511 void *authz_read_baton, 01512 svn_repos_file_rev_handler_t handler, 01513 void *handler_baton, 01514 apr_pool_t *pool); 01515 01516 01517 /* ---------------------------------------------------------------*/ 01518 01519 /** 01520 * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \ 01521 * routines. 01522 * @{ 01523 */ 01524 01525 /** Like svn_fs_commit_txn(), but invoke the @a repos's pre- and 01526 * post-commit hooks around the commit. Use @a pool for any necessary 01527 * allocations. 01528 * 01529 * If the pre-commit hook or svn_fs_commit_txn() fails, throw the 01530 * original error to caller. If an error occurs when running the 01531 * post-commit hook, return the original error wrapped with 01532 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. If the caller sees this 01533 * error, it knows that the commit succeeded anyway. 01534 * 01535 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn(). 01536 */ 01537 svn_error_t * 01538 svn_repos_fs_commit_txn(const char **conflict_p, 01539 svn_repos_t *repos, 01540 svn_revnum_t *new_rev, 01541 svn_fs_txn_t *txn, 01542 apr_pool_t *pool); 01543 01544 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping 01545 * <tt>const char *</tt> property names to @c svn_string_t values, to 01546 * set the properties on transaction @a *txn_p. @a repos is the 01547 * repository object which contains the filesystem. @a rev, @a 01548 * *txn_p, and @a pool are as in svn_fs_begin_txn(). 01549 * 01550 * Before a txn is created, the repository's start-commit hooks are 01551 * run; if any of them fail, no txn is created, @a *txn_p is unaffected, 01552 * and @c SVN_ERR_REPOS_HOOK_FAILURE is returned. 01553 * 01554 * @note @a revprop_table may contain an @c SVN_PROP_REVISION_DATE property, 01555 * which will be set on the transaction, but that will be overwritten 01556 * when the transaction is committed. 01557 * 01558 * @since New in 1.5. 01559 */ 01560 svn_error_t * 01561 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p, 01562 svn_repos_t *repos, 01563 svn_revnum_t rev, 01564 apr_hash_t *revprop_table, 01565 apr_pool_t *pool); 01566 01567 01568 /** 01569 * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table 01570 * set to a hash containing @a author and @a log_msg as the 01571 * @c SVN_PROP_REVISION_AUTHOR and @c SVN_PROP_REVISION_LOG properties, 01572 * respectively. @a author and @a log_msg may both be @c NULL. 01573 * 01574 * @deprecated Provided for backward compatibility with the 1.4 API. 01575 */ 01576 svn_error_t * 01577 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p, 01578 svn_repos_t *repos, 01579 svn_revnum_t rev, 01580 const char *author, 01581 const char *log_msg, 01582 apr_pool_t *pool); 01583 01584 01585 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding 01586 * property on transaction @a *txn_p. @a repos is the repository object 01587 * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in 01588 * svn_fs_begin_txn(). 01589 * 01590 * ### Someday: before a txn is created, some kind of read-hook could 01591 * be called here. 01592 */ 01593 svn_error_t * 01594 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p, 01595 svn_repos_t *repos, 01596 svn_revnum_t rev, 01597 const char *author, 01598 apr_pool_t *pool); 01599 01600 01601 /** @defgroup svn_repos_fs_locks Repository lock wrappers 01602 * @{ 01603 * @since New in 1.2. */ 01604 01605 /** Like svn_fs_lock(), but invoke the @a repos's pre- and 01606 * post-lock hooks before and after the locking action. Use @a pool 01607 * for any necessary allocations. 01608 * 01609 * If the pre-lock hook or svn_fs_lock() fails, throw the original 01610 * error to caller. If an error occurs when running the post-lock 01611 * hook, return the original error wrapped with 01612 * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the caller sees this 01613 * error, it knows that the lock succeeded anyway. 01614 */ 01615 svn_error_t * 01616 svn_repos_fs_lock(svn_lock_t **lock, 01617 svn_repos_t *repos, 01618 const char *path, 01619 const char *token, 01620 const char *comment, 01621 svn_boolean_t is_dav_comment, 01622 apr_time_t expiration_date, 01623 svn_revnum_t current_rev, 01624 svn_boolean_t steal_lock, 01625 apr_pool_t *pool); 01626 01627 01628 /** Like svn_fs_unlock(), but invoke the @a repos's pre- and 01629 * post-unlock hooks before and after the unlocking action. Use @a 01630 * pool for any necessary allocations. 01631 * 01632 * If the pre-unlock hook or svn_fs_unlock() fails, throw the original 01633 * error to caller. If an error occurs when running the post-unlock 01634 * hook, return the original error wrapped with 01635 * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. If the caller sees this 01636 * error, it knows that the unlock succeeded anyway. 01637 */ 01638 svn_error_t * 01639 svn_repos_fs_unlock(svn_repos_t *repos, 01640 const char *path, 01641 const char *token, 01642 svn_boolean_t break_lock, 01643 apr_pool_t *pool); 01644 01645 01646 01647 /** Look up all the locks in and under @a path in @a repos, setting @a 01648 * *locks to a hash which maps <tt>const char *</tt> paths to the @c 01649 * svn_lock_t locks associated with those paths. Use @a 01650 * authz_read_func and @a authz_read_baton to "screen" all returned 01651 * locks. That is: do not return any locks on any paths that are 01652 * unreadable in HEAD, just silently omit them. 01653 */ 01654 svn_error_t * 01655 svn_repos_fs_get_locks(apr_hash_t **locks, 01656 svn_repos_t *repos, 01657 const char *path, 01658 svn_repos_authz_func_t authz_read_func, 01659 void *authz_read_baton, 01660 apr_pool_t *pool); 01661 01662 /** @} */ 01663 01664 /** 01665 * Like svn_fs_change_rev_prop(), but validate the name and value of the 01666 * property and invoke the @a repos's pre- and post-revprop-change hooks 01667 * around the change as specified by @a use_pre_revprop_change_hook and 01668 * @a use_post_revprop_change_hook (respectively). 01669 * 01670 * @a rev is the revision whose property to change, @a name is the 01671 * name of the property, and @a new_value is the new value of the 01672 * property. @a author is the authenticated username of the person 01673 * changing the property value, or NULL if not available. 01674 * 01675 * If @a authz_read_func is non-NULL, then use it (with @a 01676 * authz_read_baton) to validate the changed-paths associated with @a 01677 * rev. If the revision contains any unreadable changed paths, then 01678 * return SVN_ERR_AUTHZ_UNREADABLE. 01679 * 01680 * Validate @a name and @a new_value like the same way 01681 * svn_repos_fs_change_node_prop() does. 01682 * 01683 * Use @a pool for temporary allocations. 01684 * 01685 * @since New in 1.5. 01686 */ 01687 svn_error_t * 01688 svn_repos_fs_change_rev_prop3(svn_repos_t *repos, 01689 svn_revnum_t rev, 01690 const char *author, 01691 const char *name, 01692 const svn_string_t *new_value, 01693 svn_boolean_t 01694 use_pre_revprop_change_hook, 01695 svn_boolean_t 01696 use_post_revprop_change_hook, 01697 svn_repos_authz_func_t 01698 authz_read_func, 01699 void *authz_read_baton, 01700 apr_pool_t *pool); 01701 01702 /** 01703 * Similar to svn_repos_fs_change_rev_prop3(), but with the @a 01704 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook 01705 * always set to @c TRUE. 01706 * 01707 * @deprecated Provided for backward compatibility with the 1.4 API. 01708 */ 01709 svn_error_t * 01710 svn_repos_fs_change_rev_prop2(svn_repos_t *repos, 01711 svn_revnum_t rev, 01712 const char *author, 01713 const char *name, 01714 const svn_string_t *new_value, 01715 svn_repos_authz_func_t 01716 authz_read_func, 01717 void *authz_read_baton, 01718 apr_pool_t *pool); 01719 01720 /** 01721 * Similar to svn_repos_fs_change_rev_prop2(), but with the 01722 * @a authz_read_func parameter always NULL. 01723 * 01724 * @deprecated Provided for backward compatibility with the 1.0 API. 01725 */ 01726 svn_error_t * 01727 svn_repos_fs_change_rev_prop(svn_repos_t *repos, 01728 svn_revnum_t rev, 01729 const char *author, 01730 const char *name, 01731 const svn_string_t *new_value, 01732 apr_pool_t *pool); 01733 01734 01735 01736 /** 01737 * Set @a *value_p to the value of the property named @a propname on 01738 * revision @a rev in the filesystem opened in @a repos. If @a rev 01739 * has no property by that name, set @a *value_p to zero. Allocate 01740 * the result in @a pool. 01741 * 01742 * If @a authz_read_func is non-NULL, then use it (with @a 01743 * authz_read_baton) to validate the changed-paths associated with @a 01744 * rev. If the changed-paths are all unreadable, then set @a *value_p 01745 * to zero unconditionally. If only some of the changed-paths are 01746 * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be 01747 * fetched, but return 0 for any other property. 01748 * 01749 * @since New in 1.1. 01750 */ 01751 svn_error_t * 01752 svn_repos_fs_revision_prop(svn_string_t **value_p, 01753 svn_repos_t *repos, 01754 svn_revnum_t rev, 01755 const char *propname, 01756 svn_repos_authz_func_t 01757 authz_read_func, 01758 void *authz_read_baton, 01759 apr_pool_t *pool); 01760 01761 01762 /** 01763 * Set @a *table_p to the entire property list of revision @a rev in 01764 * filesystem opened in @a repos, as a hash table allocated in @a 01765 * pool. The table maps <tt>char *</tt> property names to @c 01766 * svn_string_t * values; the names and values are allocated in @a 01767 * pool. 01768 * 01769 * If @a authz_read_func is non-NULL, then use it (with @a 01770 * authz_read_baton) to validate the changed-paths associated with @a 01771 * rev. If the changed-paths are all unreadable, then return an empty 01772 * hash. If only some of the changed-paths are unreadable, then return 01773 * an empty hash, except for 'svn:author' and 'svn:date' properties 01774 * (assuming those properties exist). 01775 * 01776 * @since New in 1.1. 01777 */ 01778 svn_error_t * 01779 svn_repos_fs_revision_proplist(apr_hash_t **table_p, 01780 svn_repos_t *repos, 01781 svn_revnum_t rev, 01782 svn_repos_authz_func_t 01783 authz_read_func, 01784 void *authz_read_baton, 01785 apr_pool_t *pool); 01786 01787 01788 01789 /* ---------------------------------------------------------------*/ 01790 01791 /* Prop-changing wrappers for libsvn_fs routines. */ 01792 01793 /* NOTE: svn_repos_fs_change_rev_prop() also exists, but is located 01794 above with the hook-related functions. */ 01795 01796 01797 /** Validating wrapper for svn_fs_change_node_prop() (which see for 01798 * argument descriptions). 01799 * 01800 * If @a name's kind is not @c svn_prop_regular_kind, return @c 01801 * SVN_ERR_REPOS_BAD_ARGS. If @a name is an "svn:" property, validate its 01802 * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the 01803 * property. 01804 * 01805 * @note Currently, the only "svn:" property validated is @c 01806 * SVN_PROP_REVISION_DATE. This may change in a future release. 01807 */ 01808 svn_error_t * 01809 svn_repos_fs_change_node_prop(svn_fs_root_t *root, 01810 const char *path, 01811 const char *name, 01812 const svn_string_t *value, 01813 apr_pool_t *pool); 01814 01815 /** Validating wrapper for svn_fs_change_txn_prop() (which see for 01816 * argument descriptions). See svn_repos_fs_change_txn_props() for more 01817 * information. 01818 */ 01819 svn_error_t * 01820 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn, 01821 const char *name, 01822 const svn_string_t *value, 01823 apr_pool_t *pool); 01824 01825 /** Validating wrapper for svn_fs_change_txn_props() (which see for 01826 * argument descriptions). Validate properties and their values the 01827 * same way svn_repos_fs_change_node_prop() does. 01828 * 01829 * @since New in 1.5. 01830 */ 01831 svn_error_t * 01832 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn, 01833 apr_array_header_t *props, 01834 apr_pool_t *pool); 01835 01836 /** @} */ 01837 01838 /* ---------------------------------------------------------------*/ 01839 01840 /** 01841 * @defgroup svn_repos_inspection Data structures and editor things for 01842 * repository inspection. 01843 * @{ 01844 * 01845 * As it turns out, the svn_repos_dir_delta2() interface can be 01846 * extremely useful for examining the repository, or more exactly, 01847 * changes to the repository. svn_repos_dir_delta2() allows for 01848 * differences between two trees to be described using an editor. 01849 * 01850 * By using the editor obtained from svn_repos_node_editor() with 01851 * svn_repos_dir_delta2(), the description of how to transform one tree 01852 * into another can be used to build an in-memory linked-list tree, 01853 * which each node representing a repository node that was changed as a 01854 * result of having svn_repos_dir_delta2() drive that editor. 01855 */ 01856 01857 /** A node in the repository. */ 01858 typedef struct svn_repos_node_t 01859 { 01860 /** Node type (file, dir, etc.) */ 01861 svn_node_kind_t kind; 01862 01863 /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */ 01864 char action; 01865 01866 /** Were there any textual mods? (files only) */ 01867 svn_boolean_t text_mod; 01868 01869 /** Where there any property mods? */ 01870 svn_boolean_t prop_mod; 01871 01872 /** The name of this node as it appears in its parent's entries list */ 01873 const char *name; 01874 01875 /** The filesystem revision where this was copied from (if any) */ 01876 svn_revnum_t copyfrom_rev; 01877 01878 /** The filesystem path where this was copied from (if any) */ 01879 const char *copyfrom_path; 01880 01881 /** Pointer to the next sibling of this node */ 01882 struct svn_repos_node_t *sibling; 01883 01884 /** Pointer to the first child of this node */ 01885 struct svn_repos_node_t *child; 01886 01887 /** Pointer to the parent of this node */ 01888 struct svn_repos_node_t *parent; 01889 01890 } svn_repos_node_t; 01891 01892 01893 /** Set @a *editor and @a *edit_baton to an editor that, when driven by 01894 * svn_repos_dir_delta2(), builds an <tt>svn_repos_node_t *</tt> tree 01895 * representing the delta from @a base_root to @a root in @a repos's 01896 * filesystem. 01897 * 01898 * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root 01899 * node afterwards. 01900 * 01901 * Note that the delta includes "bubbled-up" directories; that is, 01902 * many of the directory nodes will have no prop_mods. 01903 * 01904 * Allocate the tree and its contents in @a node_pool; do all other 01905 * allocation in @a pool. 01906 */ 01907 svn_error_t * 01908 svn_repos_node_editor(const svn_delta_editor_t **editor, 01909 void **edit_baton, 01910 svn_repos_t *repos, 01911 svn_fs_root_t *base_root, 01912 svn_fs_root_t *root, 01913 apr_pool_t *node_pool, 01914 apr_pool_t *pool); 01915 01916 /** Return the root node of the linked-list tree generated by driving 01917 * the editor created by svn_repos_node_editor() with 01918 * svn_repos_dir_delta2(), which is stored in @a edit_baton. This is 01919 * only really useful if used *after* the editor drive is completed. 01920 */ 01921 svn_repos_node_t *svn_repos_node_from_baton(void *edit_baton); 01922 01923 /** @} */ 01924 01925 /* ---------------------------------------------------------------*/ 01926 01927 /** 01928 * @defgroup svn_repos_dump_load Dumping and loading filesystem data 01929 * @{ 01930 * 01931 * The filesystem 'dump' format contains nothing but the abstract 01932 * structure of the filesystem -- independent of any internal node-id 01933 * schema or database back-end. All of the data in the dumpfile is 01934 * acquired by public function calls into svn_fs.h. Similarly, the 01935 * parser which reads the dumpfile is able to reconstruct the 01936 * filesystem using only public svn_fs.h routines. 01937 * 01938 * Thus the dump/load feature's main purpose is for *migrating* data 01939 * from one svn filesystem to another -- presumably two filesystems 01940 * which have different internal implementations. 01941 * 01942 * If you simply want to backup your filesystem, you're probably 01943 * better off using the built-in facilities of the DB backend (using 01944 * Berkeley DB's hot-backup feature, for example.) 01945 * 01946 * For a description of the dumpfile format, see 01947 * /trunk/notes/fs_dumprestore.txt. 01948 */ 01949 01950 /* The RFC822-style headers in our dumpfile format. */ 01951 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER "SVN-fs-dump-format-version" 01952 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION 3 01953 #define SVN_REPOS_DUMPFILE_UUID "UUID" 01954 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH "Content-length" 01955 01956 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER "Revision-number" 01957 01958 #define SVN_REPOS_DUMPFILE_NODE_PATH "Node-path" 01959 #define SVN_REPOS_DUMPFILE_NODE_KIND "Node-kind" 01960 #define SVN_REPOS_DUMPFILE_NODE_ACTION "Node-action" 01961 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH "Node-copyfrom-path" 01962 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV "Node-copyfrom-rev" 01963 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM "Text-copy-source-md5" 01964 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM "Text-content-md5" 01965 01966 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH "Prop-content-length" 01967 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH "Text-content-length" 01968 01969 /* @since New in 1.1. */ 01970 #define SVN_REPOS_DUMPFILE_PROP_DELTA "Prop-delta" 01971 /* @since New in 1.1. */ 01972 #define SVN_REPOS_DUMPFILE_TEXT_DELTA "Text-delta" 01973 /* @since New in 1.5. */ 01974 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM "Text-delta-base-md5" 01975 01976 /** The different "actions" attached to nodes in the dumpfile. */ 01977 enum svn_node_action 01978 { 01979 svn_node_action_change, 01980 svn_node_action_add, 01981 svn_node_action_delete, 01982 svn_node_action_replace 01983 }; 01984 01985 /** The different policies for processing the UUID in the dumpfile. */ 01986 enum svn_repos_load_uuid 01987 { 01988 svn_repos_load_uuid_default, 01989 svn_repos_load_uuid_ignore, 01990 svn_repos_load_uuid_force 01991 }; 01992 01993 01994 /** 01995 * Verify the contents of the file system in @a repos. 01996 * 01997 * If @a feedback_stream is not @c NULL, write feedback to it (lines of 01998 * the form "* Verified revision %ld\n"). 01999 * 02000 * If @a start_rev is @c SVN_INVALID_REVNUM, then start verifying at 02001 * revision 0. If @a end_rev is @c SVN_INVALID_REVNUM, then verify 02002 * through the @c HEAD revision. 02003 * 02004 * If @a cancel_func is not @c NULL, call it periodically with @a 02005 * cancel_baton as argument to see if the caller wishes to cancel the 02006 * verification. 02007 * 02008 * @since New in 1.5. 02009 */ 02010 svn_error_t * 02011 svn_repos_verify_fs(svn_repos_t *repos, 02012 svn_stream_t *feedback_stream, 02013 svn_revnum_t start_rev, 02014 svn_revnum_t end_rev, 02015 svn_cancel_func_t cancel_func, 02016 void *cancel_baton, 02017 apr_pool_t *pool); 02018 02019 02020 /** 02021 * Dump the contents of the filesystem within already-open @a repos into 02022 * writable @a dumpstream. Begin at revision @a start_rev, and dump every 02023 * revision up through @a end_rev. Use @a pool for all allocation. If 02024 * non-@c NULL, send feedback to @a feedback_stream. If @a dumpstream is 02025 * @c NULL, this is effectively a primitive verify. It is not complete, 02026 * however; see svn_fs_verify instead. 02027 * 02028 * If @a start_rev is @c SVN_INVALID_REVNUM, then start dumping at revision 02029 * 0. If @a end_rev is @c SVN_INVALID_REVNUM, then dump through the @c HEAD 02030 * revision. 02031 * 02032 * If @a incremental is @c TRUE, the first revision dumped will be a diff 02033 * against the previous revision (usually it looks like a full dump of 02034 * the tree). 02035 * 02036 * If @a use_deltas is @c TRUE, output only node properties which have 02037 * changed relative to the previous contents, and output text contents 02038 * as svndiff data against the previous contents. Regardless of how 02039 * this flag is set, the first revision of a non-incremental dump will 02040 * be done with full plain text. A dump with @a use_deltas set cannot 02041 * be loaded by Subversion 1.0.x. 02042 * 02043 * If @a cancel_func is not @c NULL, it is called periodically with 02044 * @a cancel_baton as argument to see if the client wishes to cancel 02045 * the dump. 02046 * 02047 * @since New in 1.1. 02048 */ 02049 svn_error_t * 02050 svn_repos_dump_fs2(svn_repos_t *repos, 02051 svn_stream_t *dumpstream, 02052 svn_stream_t *feedback_stream, 02053 svn_revnum_t start_rev, 02054 svn_revnum_t end_rev, 02055 svn_boolean_t incremental, 02056 svn_boolean_t use_deltas, 02057 svn_cancel_func_t cancel_func, 02058 void *cancel_baton, 02059 apr_pool_t *pool); 02060 02061 02062 /** 02063 * Similar to svn_repos_dump_fs2(), but with the @a use_deltas 02064 * parameter always set to @c FALSE. 02065 * 02066 * @deprecated Provided for backward compatibility with the 1.0 API. 02067 */ 02068 svn_error_t * 02069 svn_repos_dump_fs(svn_repos_t *repos, 02070 svn_stream_t *dumpstream, 02071 svn_stream_t *feedback_stream, 02072 svn_revnum_t start_rev, 02073 svn_revnum_t end_rev, 02074 svn_boolean_t incremental, 02075 svn_cancel_func_t cancel_func, 02076 void *cancel_baton, 02077 apr_pool_t *pool); 02078 02079 02080 /** 02081 * Read and parse dumpfile-formatted @a dumpstream, reconstructing 02082 * filesystem revisions in already-open @a repos, handling uuids 02083 * in accordance with @a uuid_action. 02084 * 02085 * Read and parse dumpfile-formatted @a dumpstream, reconstructing 02086 * filesystem revisions in already-open @a repos. Use @a pool for all 02087 * allocation. If non-@c NULL, send feedback to @a feedback_stream. 02088 * 02089 * If the dumpstream contains copy history that is unavailable in the 02090 * repository, an error will be thrown. 02091 * 02092 * The repository's UUID will be updated iff 02093 * the dumpstream contains a UUID and 02094 * @a uuid_action is not equal to @c svn_repos_load_uuid_ignore and 02095 * either the repository contains no revisions or 02096 * @a uuid_action is equal to @c svn_repos_load_uuid_force. 02097 * 02098 * If the dumpstream contains no UUID, then @a uuid_action is 02099 * ignored and the repository UUID is not touched. 02100 * 02101 * If @a parent_dir is not NULL, then the parser will reparent all the 02102 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 02103 * must be an existing directory in the repository. 02104 * 02105 * If @a use_pre_commit_hook is set, call the repository's pre-commit 02106 * hook before committing each loaded revision. 02107 * 02108 * If @a use_post_commit_hook is set, call the repository's 02109 * post-commit hook after committing each loaded revision. 02110 * 02111 * If @a cancel_func is not @c NULL, it is called periodically with 02112 * @a cancel_baton as argument to see if the client wishes to cancel 02113 * the load. 02114 * 02115 * @since New in 1.2. 02116 */ 02117 svn_error_t * 02118 svn_repos_load_fs2(svn_repos_t *repos, 02119 svn_stream_t *dumpstream, 02120 svn_stream_t *feedback_stream, 02121 enum svn_repos_load_uuid uuid_action, 02122 const char *parent_dir, 02123 svn_boolean_t use_pre_commit_hook, 02124 svn_boolean_t use_post_commit_hook, 02125 svn_cancel_func_t cancel_func, 02126 void *cancel_baton, 02127 apr_pool_t *pool); 02128 02129 /** 02130 * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and 02131 * @a use_post_commit_hook always @c FALSE. 02132 * 02133 * @deprecated Provided for backward compatibility with the 1.0 API. 02134 */ 02135 svn_error_t * 02136 svn_repos_load_fs(svn_repos_t *repos, 02137 svn_stream_t *dumpstream, 02138 svn_stream_t *feedback_stream, 02139 enum svn_repos_load_uuid uuid_action, 02140 const char *parent_dir, 02141 svn_cancel_func_t cancel_func, 02142 void *cancel_baton, 02143 apr_pool_t *pool); 02144 02145 02146 /** 02147 * A vtable that is driven by svn_repos_parse_dumpstream2(). 02148 * 02149 * @since New in 1.1. 02150 */ 02151 typedef struct svn_repos_parse_fns2_t 02152 { 02153 /** The parser has discovered a new revision record within the 02154 * parsing session represented by @a parse_baton. All the headers are 02155 * placed in @a headers (allocated in @a pool), which maps <tt>const 02156 * char *</tt> header-name ==> <tt>const char *</tt> header-value. 02157 * The @a revision_baton received back (also allocated in @a pool) 02158 * represents the revision. 02159 */ 02160 svn_error_t *(*new_revision_record)(void **revision_baton, 02161 apr_hash_t *headers, 02162 void *parse_baton, 02163 apr_pool_t *pool); 02164 02165 /** The parser has discovered a new uuid record within the parsing 02166 * session represented by @a parse_baton. The uuid's value is 02167 * @a uuid, and it is allocated in @a pool. 02168 */ 02169 svn_error_t *(*uuid_record)(const char *uuid, 02170 void *parse_baton, 02171 apr_pool_t *pool); 02172 02173 /** The parser has discovered a new node record within the current 02174 * revision represented by @a revision_baton. All the headers are 02175 * placed in @a headers (as with @c new_revision_record), allocated in 02176 * @a pool. The @a node_baton received back is allocated in @a pool 02177 * and represents the node. 02178 */ 02179 svn_error_t *(*new_node_record)(void **node_baton, 02180 apr_hash_t *headers, 02181 void *revision_baton, 02182 apr_pool_t *pool); 02183 02184 /** For a given @a revision_baton, set a property @a name to @a value. */ 02185 svn_error_t *(*set_revision_property)(void *revision_baton, 02186 const char *name, 02187 const svn_string_t *value); 02188 02189 /** For a given @a node_baton, set a property @a name to @a value. */ 02190 svn_error_t *(*set_node_property)(void *node_baton, 02191 const char *name, 02192 const svn_string_t *value); 02193 02194 /** For a given @a node_baton, delete property @a name. */ 02195 svn_error_t *(*delete_node_property)(void *node_baton, const char *name); 02196 02197 /** For a given @a node_baton, remove all properties. */ 02198 svn_error_t *(*remove_node_props)(void *node_baton); 02199 02200 /** For a given @a node_baton, receive a writable @a stream capable of 02201 * receiving the node's fulltext. After writing the fulltext, call 02202 * the stream's close() function. 02203 * 02204 * If a @c NULL is returned instead of a stream, the vtable is 02205 * indicating that no text is desired, and the parser will not 02206 * attempt to send it. 02207 */ 02208 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 02209 void *node_baton); 02210 02211 /** For a given @a node_baton, set @a handler and @a handler_baton 02212 * to a window handler and baton capable of receiving a delta 02213 * against the node's previous contents. A NULL window will be 02214 * sent to the handler after all the windows are sent. 02215 * 02216 * If a @c NULL is returned instead of a handler, the vtable is 02217 * indicating that no delta is desired, and the parser will not 02218 * attempt to send it. 02219 */ 02220 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler, 02221 void **handler_baton, 02222 void *node_baton); 02223 02224 /** The parser has reached the end of the current node represented by 02225 * @a node_baton, it can be freed. 02226 */ 02227 svn_error_t *(*close_node)(void *node_baton); 02228 02229 /** The parser has reached the end of the current revision 02230 * represented by @a revision_baton. In other words, there are no more 02231 * changed nodes within the revision. The baton can be freed. 02232 */ 02233 svn_error_t *(*close_revision)(void *revision_baton); 02234 02235 } svn_repos_parse_fns2_t; 02236 02237 /** @deprecated Provided for backward compatibility with the 1.2 API. */ 02238 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t; 02239 02240 02241 /** 02242 * Read and parse dumpfile-formatted @a stream, calling callbacks in 02243 * @a parse_fns/@a parse_baton, and using @a pool for allocations. 02244 * 02245 * If @a cancel_func is not @c NULL, it is called periodically with 02246 * @a cancel_baton as argument to see if the client wishes to cancel 02247 * the dump. 02248 * 02249 * This parser has built-in knowledge of the dumpfile format, but only 02250 * in a general sense: 02251 * 02252 * * it recognizes revision and node records by looking for either 02253 * a REVISION_NUMBER or NODE_PATH headers. 02254 * 02255 * * it recognizes the CONTENT-LENGTH headers, so it knows if and 02256 * how to suck up the content body. 02257 * 02258 * * it knows how to parse a content body into two parts: props 02259 * and text, and pass the pieces to the vtable. 02260 * 02261 * This is enough knowledge to make it easy on vtable implementors, 02262 * but still allow expansion of the format: most headers are ignored. 02263 * 02264 * @since New in 1.1. 02265 */ 02266 svn_error_t * 02267 svn_repos_parse_dumpstream2(svn_stream_t *stream, 02268 const svn_repos_parse_fns2_t *parse_fns, 02269 void *parse_baton, 02270 svn_cancel_func_t cancel_func, 02271 void *cancel_baton, 02272 apr_pool_t *pool); 02273 02274 02275 /** 02276 * Set @a *parser and @a *parse_baton to a vtable parser which commits new 02277 * revisions to the fs in @a repos. The constructed parser will treat 02278 * UUID records in a manner consistent with @a uuid_action. Use @a pool 02279 * to operate on the fs. 02280 * 02281 * If @a use_history is set, then the parser will require relative 02282 * 'copyfrom' history to exist in the repository when it encounters 02283 * nodes that are added-with-history. 02284 * 02285 * If @a parent_dir is not NULL, then the parser will reparent all the 02286 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 02287 * must be an existing directory in the repository. 02288 * 02289 * Print all parsing feedback to @a outstream (if non-@c NULL). 02290 * 02291 * 02292 * @since New in 1.1. 02293 */ 02294 svn_error_t * 02295 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser, 02296 void **parse_baton, 02297 svn_repos_t *repos, 02298 svn_boolean_t use_history, 02299 enum svn_repos_load_uuid uuid_action, 02300 svn_stream_t *outstream, 02301 const char *parent_dir, 02302 apr_pool_t *pool); 02303 02304 02305 /** 02306 * A vtable that is driven by svn_repos_parse_dumpstream(). 02307 * Similar to @c svn_repos_parse_fns2_t except that it lacks 02308 * the delete_node_property and apply_textdelta callbacks. 02309 * 02310 * @deprecated Provided for backward compatibility with the 1.0 API. 02311 */ 02312 typedef struct svn_repos_parse_fns_t 02313 { 02314 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */ 02315 svn_error_t *(*new_revision_record)(void **revision_baton, 02316 apr_hash_t *headers, 02317 void *parse_baton, 02318 apr_pool_t *pool); 02319 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */ 02320 svn_error_t *(*uuid_record)(const char *uuid, 02321 void *parse_baton, 02322 apr_pool_t *pool); 02323 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */ 02324 svn_error_t *(*new_node_record)(void **node_baton, 02325 apr_hash_t *headers, 02326 void *revision_baton, 02327 apr_pool_t *pool); 02328 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */ 02329 svn_error_t *(*set_revision_property)(void *revision_baton, 02330 const char *name, 02331 const svn_string_t *value); 02332 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */ 02333 svn_error_t *(*set_node_property)(void *node_baton, 02334 const char *name, 02335 const svn_string_t *value); 02336 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */ 02337 svn_error_t *(*remove_node_props)(void *node_baton); 02338 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */ 02339 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 02340 void *node_baton); 02341 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */ 02342 svn_error_t *(*close_node)(void *node_baton); 02343 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */ 02344 svn_error_t *(*close_revision)(void *revision_baton); 02345 } svn_repos_parser_fns_t; 02346 02347 02348 /** 02349 * Similar to svn_repos_parse_dumpstream2(), but uses the more limited 02350 * @c svn_repos_parser_fns_t vtable type. 02351 * 02352 * @deprecated Provided for backward compatibility with the 1.0 API. 02353 */ 02354 svn_error_t * 02355 svn_repos_parse_dumpstream(svn_stream_t *stream, 02356 const svn_repos_parser_fns_t *parse_fns, 02357 void *parse_baton, 02358 svn_cancel_func_t cancel_func, 02359 void *cancel_baton, 02360 apr_pool_t *pool); 02361 02362 02363 /** 02364 * Similar to svn_repos_get_fs_build_parser2(), but yields the more 02365 * limited svn_repos_parser_fns_t vtable type. 02366 * 02367 * @deprecated Provided for backward compatibility with the 1.0 API. 02368 */ 02369 svn_error_t * 02370 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser, 02371 void **parse_baton, 02372 svn_repos_t *repos, 02373 svn_boolean_t use_history, 02374 enum svn_repos_load_uuid uuid_action, 02375 svn_stream_t *outstream, 02376 const char *parent_dir, 02377 apr_pool_t *pool); 02378 02379 02380 /** @} */ 02381 02382 /** A data type which stores the authz information. 02383 * 02384 * @since New in 1.3. 02385 */ 02386 typedef struct svn_authz_t svn_authz_t; 02387 02388 /** Read authz configuration data from @a file (a file or registry 02389 * path) into @a *authz_p, allocated in @a pool. 02390 * 02391 * If @a file is not a valid authz rule file, then return 02392 * SVN_AUTHZ_INVALID_CONFIG. The contents of @a *authz_p is then 02393 * undefined. If @a must_exist is TRUE, a missing authz file is also 02394 * an error. 02395 * 02396 * @since New in 1.3. 02397 */ 02398 svn_error_t * 02399 svn_repos_authz_read(svn_authz_t **authz_p, 02400 const char *file, 02401 svn_boolean_t must_exist, 02402 apr_pool_t *pool); 02403 02404 /** 02405 * Check whether @a user can access @a path in the repository @a 02406 * repos_name with the @a required_access. @a authz lists the ACLs to 02407 * check against. Set @a *access_granted to indicate if the requested 02408 * access is granted. 02409 * 02410 * If @a path is NULL, then check whether @a user has the @a 02411 * required_access anywhere in the repository. Set @a *access_granted 02412 * to TRUE if at least one path is accessible with the @a 02413 * required_access. 02414 * 02415 * @since New in 1.3. 02416 */ 02417 svn_error_t * 02418 svn_repos_authz_check_access(svn_authz_t *authz, 02419 const char *repos_name, 02420 const char *path, 02421 const char *user, 02422 svn_repos_authz_access_t required_access, 02423 svn_boolean_t *access_granted, 02424 apr_pool_t *pool); 02425 02426 02427 02428 /** Revision Access Levels 02429 * 02430 * Like most version control systems, access to versioned objects in 02431 * Subversion is determined on primarily path-based system. Users either 02432 * do or don't have the ability to read a given path. 02433 * 02434 * However, unlike many version control systems where versioned objects 02435 * maintain their own distinct version information (revision numbers, 02436 * authors, log messages, change timestamps, etc.), Subversion binds 02437 * multiple paths changed as part of a single commit operation into a 02438 * set, calls the whole thing a revision, and hangs commit metadata 02439 * (author, date, log message, etc.) off of that revision. So, commit 02440 * metadata is shared across all the paths changed as part of a given 02441 * commit operation. 02442 * 02443 * It is common (or, at least, we hope it is) for log messages to give 02444 * detailed information about changes made in the commit to which the log 02445 * message is attached. Such information might include a mention of all 02446 * the files changed, what was changed in them, and so on. But this 02447 * causes a problem when presenting information to readers who aren't 02448 * authorized to read every path in the repository. Simply knowing that 02449 * a given path exists may be a security leak, even if the user can't see 02450 * the contents of the data located at that path. 02451 * 02452 * So Subversion does what it reasonably can to prevent the leak of this 02453 * information, and does so via a staged revision access policy. A 02454 * reader can be said to have one of three levels of access to a given 02455 * revision's metadata, based solely on the reader's access rights to the 02456 * paths changed or copied in that revision: 02457 * 02458 * 'full access' -- Granted when the reader has access to all paths 02459 * changed or copied in the revision, or when no paths were 02460 * changed in the revision at all, this access level permits 02461 * full visibility of all revision property names and values, 02462 * and the full changed-paths information. 02463 * 02464 * 'no access' -- Granted when the reader does not have access to any 02465 * paths changed or copied in the revision, this access level 02466 * denies the reader access to all revision properties and all 02467 * changed-paths information. 02468 * 02469 * 'partial access' -- Granted when the reader has access to at least 02470 * one, but not all, of the paths changed or copied in the revision, 02471 * this access level permits visibility of the svn:date and 02472 * svn:author revision properties and only the paths of the 02473 * changed-paths information to which the reader has access. 02474 * 02475 */ 02476 02477 02478 /** An enum defining levels of revision access. 02479 * 02480 * @since New in 1.5. 02481 */ 02482 typedef enum 02483 { 02484 svn_repos_revision_access_none, 02485 svn_repos_revision_access_partial, 02486 svn_repos_revision_access_full 02487 } 02488 svn_repos_revision_access_level_t; 02489 02490 02491 /** 02492 * Set @a access to the access level granted for @a revision in @a 02493 * repos, as determined by consulting the @a authz_read_func callback 02494 * function and its associated @a authz_read_baton. 02495 * 02496 * @a authz_read_func may be @c NULL, in which case @a access will be 02497 * set to @c svn_repos_revision_access_full. 02498 * 02499 * @since New in 1.5. 02500 */ 02501 svn_error_t * 02502 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level, 02503 svn_repos_t *repos, 02504 svn_revnum_t revision, 02505 svn_repos_authz_func_t authz_read_func, 02506 void *authz_read_baton, 02507 apr_pool_t *pool); 02508 02509 02510 02511 /** Capabilities **/ 02512 02513 /** 02514 * Store in @a repos the client-reported capabilities @a capabilities, 02515 * which must be allocated in memory at least as long-lived as @a repos. 02516 * 02517 * The elements of @a capabilities are 'const char *', a subset of 02518 * the constants beginning with @c SVN_RA_CAPABILITY_. 02519 * @a capabilities is not copied, so changing it later will affect 02520 * what is remembered by @a repos. 02521 * 02522 * @note The capabilities are passed along to the start-commit hook; 02523 * see that hook's template for details. 02524 * 02525 * @note As of Subversion 1.5, there are no error conditions defined, 02526 * so this always returns SVN_NO_ERROR. In future releases it may 02527 * return error, however, so callers should check. 02528 * 02529 * @since New in 1.5. 02530 */ 02531 svn_error_t * 02532 svn_repos_remember_client_capabilities(svn_repos_t *repos, 02533 apr_array_header_t *capabilities); 02534 02535 02536 02537 #ifdef __cplusplus 02538 } 02539 #endif /* __cplusplus */ 02540 02541 #endif /* SVN_REPOS_H */