00001 /** 00002 * @copyright 00003 * ==================================================================== 00004 * Licensed to the Apache Software Foundation (ASF) under one 00005 * or more contributor license agreements. See the NOTICE file 00006 * distributed with this work for additional information 00007 * regarding copyright ownership. The ASF licenses this file 00008 * to you under the Apache License, Version 2.0 (the 00009 * "License"); you may not use this file except in compliance 00010 * with the License. You may obtain a copy of the License at 00011 * 00012 * http://www.apache.org/licenses/LICENSE-2.0 00013 * 00014 * Unless required by applicable law or agreed to in writing, 00015 * software distributed under the License is distributed on an 00016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00017 * KIND, either express or implied. See the License for the 00018 * specific language governing permissions and limitations 00019 * under the License. 00020 * ==================================================================== 00021 * @endcopyright 00022 * 00023 * @file svn_repos.h 00024 * @brief Tools built on top of the filesystem. 00025 */ 00026 00027 #ifndef SVN_REPOS_H 00028 #define SVN_REPOS_H 00029 00030 #include <apr_pools.h> 00031 #include <apr_hash.h> 00032 #include <apr_tables.h> 00033 #include <apr_time.h> 00034 00035 #include "svn_types.h" 00036 #include "svn_string.h" 00037 #include "svn_delta.h" 00038 #include "svn_fs.h" 00039 #include "svn_io.h" 00040 #include "svn_mergeinfo.h" 00041 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif /* __cplusplus */ 00046 00047 /* ---------------------------------------------------------------*/ 00048 00049 /** 00050 * Get libsvn_repos version information. 00051 * 00052 * @since New in 1.1. 00053 */ 00054 const svn_version_t * 00055 svn_repos_version(void); 00056 00057 00058 /* Some useful enums. They need to be declared here for the notification 00059 system to pick them up. */ 00060 /** The different "actions" attached to nodes in the dumpfile. */ 00061 enum svn_node_action 00062 { 00063 svn_node_action_change, 00064 svn_node_action_add, 00065 svn_node_action_delete, 00066 svn_node_action_replace 00067 }; 00068 00069 00070 /** @defgroup svn_repos_authz_callbacks Repository authorization callbacks 00071 * @{ 00072 */ 00073 00074 /** Callback type for checking authorization on a path. 00075 * 00076 * Set @a *allowed to TRUE to indicate that some operation is 00077 * authorized for @a path in @a root, or set it to FALSE to indicate 00078 * unauthorized (presumably according to state stored in @a baton). 00079 * 00080 * Do not assume @a pool has any lifetime beyond this call. 00081 * 00082 * The exact operation being authorized depends on the callback 00083 * implementation. For read authorization, for example, the caller 00084 * would implement an instance that does read checking, and pass it as 00085 * a parameter named [perhaps] 'authz_read_func'. The receiver of 00086 * that parameter might also take another parameter named 00087 * 'authz_write_func', which although sharing this type, would be a 00088 * different implementation. 00089 * 00090 * @note If someday we want more sophisticated authorization states 00091 * than just yes/no, @a allowed can become an enum type. 00092 */ 00093 typedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed, 00094 svn_fs_root_t *root, 00095 const char *path, 00096 void *baton, 00097 apr_pool_t *pool); 00098 00099 00100 /** An enum defining the kinds of access authz looks up. 00101 * 00102 * @since New in 1.3. 00103 */ 00104 typedef enum svn_repos_authz_access_t 00105 { 00106 /** No access. */ 00107 svn_authz_none = 0, 00108 00109 /** Path can be read. */ 00110 svn_authz_read = 1, 00111 00112 /** Path can be altered. */ 00113 svn_authz_write = 2, 00114 00115 /** The other access credentials are recursive. */ 00116 svn_authz_recursive = 4 00117 } svn_repos_authz_access_t; 00118 00119 00120 /** Callback type for checking authorization on paths produced by 00121 * the repository commit editor. 00122 * 00123 * Set @a *allowed to TRUE to indicate that the @a required access on 00124 * @a path in @a root is authorized, or set it to FALSE to indicate 00125 * unauthorized (presumable according to state stored in @a baton). 00126 * 00127 * If @a path is NULL, the callback should perform a global authz 00128 * lookup for the @a required access. That is, the lookup should 00129 * check if the @a required access is granted for at least one path of 00130 * the repository, and set @a *allowed to TRUE if so. @a root may 00131 * also be NULL if @a path is NULL. 00132 * 00133 * This callback is very similar to svn_repos_authz_func_t, with the 00134 * exception of the addition of the @a required parameter. 00135 * This is due to historical reasons: when authz was first implemented 00136 * for svn_repos_dir_delta2(), it seemed there would need only checks 00137 * for read and write operations, hence the svn_repos_authz_func_t 00138 * callback prototype and usage scenario. But it was then realized 00139 * that lookups due to copying needed to be recursive, and that 00140 * brute-force recursive lookups didn't square with the O(1) 00141 * performances a copy operation should have. 00142 * 00143 * So a special way to ask for a recursive lookup was introduced. The 00144 * commit editor needs this capability to retain acceptable 00145 * performance. Instead of revving the existing callback, causing 00146 * unnecessary revving of functions that don't actually need the 00147 * extended functionality, this second, more complete callback was 00148 * introduced, for use by the commit editor. 00149 * 00150 * Some day, it would be nice to reunite these two callbacks and do 00151 * the necessary revving anyway, but for the time being, this dual 00152 * callback mechanism will do. 00153 */ 00154 typedef svn_error_t *(*svn_repos_authz_callback_t) 00155 (svn_repos_authz_access_t required, 00156 svn_boolean_t *allowed, 00157 svn_fs_root_t *root, 00158 const char *path, 00159 void *baton, 00160 apr_pool_t *pool); 00161 00162 /** @} */ 00163 00164 00165 /** @defgroup svn_repos_notifications Repository notifications 00166 * @{ 00167 */ 00168 00169 /* Notification system. */ 00170 00171 /** The type of action occurring. 00172 * 00173 * @since New in 1.7. 00174 */ 00175 typedef enum svn_repos_notify_action_t 00176 { 00177 /** A warning message is waiting. */ 00178 svn_repos_notify_warning = 0, 00179 00180 /** A revision has finished being dumped. */ 00181 svn_repos_notify_dump_rev_end, 00182 00183 /** A revision has finished being verified. */ 00184 svn_repos_notify_verify_rev_end, 00185 00186 /** All revisions have finished being dumped. */ 00187 svn_repos_notify_dump_end, 00188 00189 /** All revisions have finished being verified. */ 00190 svn_repos_notify_verify_end, 00191 00192 /** packing of an FSFS shard has commenced */ 00193 svn_repos_notify_pack_shard_start, 00194 00195 /** packing of an FSFS shard is completed */ 00196 svn_repos_notify_pack_shard_end, 00197 00198 /** packing of the shard revprops has commenced */ 00199 svn_repos_notify_pack_shard_start_revprop, 00200 00201 /** packing of the shard revprops has completed */ 00202 svn_repos_notify_pack_shard_end_revprop, 00203 00204 /** A revision has begun loading */ 00205 svn_repos_notify_load_txn_start, 00206 00207 /** A revision has finished loading */ 00208 svn_repos_notify_load_txn_committed, 00209 00210 /** A node has begun loading */ 00211 svn_repos_notify_load_node_start, 00212 00213 /** A node has finished loading */ 00214 svn_repos_notify_load_node_done, 00215 00216 /** A copied node has been encountered */ 00217 svn_repos_notify_load_copied_node, 00218 00219 /** Mergeinfo has been normalized */ 00220 svn_repos_notify_load_normalized_mergeinfo, 00221 00222 /** The operation has acquired a mutex for the repo. */ 00223 svn_repos_notify_mutex_acquired, 00224 00225 /** Recover has started. */ 00226 svn_repos_notify_recover_start, 00227 00228 /** Upgrade has started. */ 00229 svn_repos_notify_upgrade_start, 00230 00231 /** A revision was skipped during loading. @since New in 1.8. */ 00232 svn_repos_notify_load_skipped_rev, 00233 00234 /** The structure of a revision is being verified. @since New in 1.8. */ 00235 svn_repos_notify_verify_rev_structure, 00236 00237 /** A revprop shard got packed. @since New in 1.9. */ 00238 svn_repos_notify_pack_revprops, 00239 00240 /** A non-packed revprop shard got removed. @since New in 1.9. */ 00241 svn_repos_notify_cleanup_revprops, 00242 00243 /** The repository format got bumped. @since New in 1.9. */ 00244 svn_repos_notify_format_bumped, 00245 00246 /** A revision range was copied. @since New in 1.9. */ 00247 svn_repos_notify_hotcopy_rev_range, 00248 00249 /** The repository pack did not do anything. @since New in 1.10. */ 00250 svn_repos_notify_pack_noop, 00251 00252 /** The revision properties got set. @since New in 1.10. */ 00253 svn_repos_notify_load_revprop_set 00254 } svn_repos_notify_action_t; 00255 00256 /** The type of warning occurring. 00257 * 00258 * @since New in 1.7. 00259 */ 00260 typedef enum svn_repos_notify_warning_t 00261 { 00262 /** Referencing copy source data from a revision earlier than the 00263 * first revision dumped. */ 00264 svn_repos_notify_warning_found_old_reference, 00265 00266 /** An #SVN_PROP_MERGEINFO property's encoded mergeinfo references a 00267 * revision earlier than the first revision dumped. */ 00268 svn_repos_notify_warning_found_old_mergeinfo, 00269 00270 /** Found an invalid path in the filesystem. 00271 * @see svn_fs.h:"Directory entry names and directory paths" */ 00272 /* ### TODO(doxygen): make that a proper doxygen link */ 00273 /* See svn_fs__path_valid(). */ 00274 svn_repos_notify_warning_invalid_fspath, 00275 00276 /** 00277 * Detected a name collision. Reported when the names of two or more 00278 * entries in the same directory differ only in character 00279 * representation (normalization), but are otherwise identical. 00280 * 00281 * @since New in 1.9. 00282 */ 00283 svn_repos_notify_warning_name_collision, 00284 00285 /** 00286 * Detected a mergeinfo path collision. Reported when the paths in 00287 * two or more entries in the same svn:mergeinfo property differ 00288 * only in character representation (normalization), but are 00289 * otherwise identical. 00290 * 00291 * @since New in 1.9. 00292 */ 00293 svn_repos_notify_warning_mergeinfo_collision, 00294 00295 /** 00296 * Detected invalid mergeinfo. 00297 * 00298 * @since New in 1.9. 00299 */ 00300 svn_repos_notify_warning_invalid_mergeinfo 00301 } svn_repos_notify_warning_t; 00302 00303 /** 00304 * Structure used by #svn_repos_notify_func_t. 00305 * 00306 * The only field guaranteed to be populated is @c action. Other fields are 00307 * dependent upon the @c action. (See individual fields for more information.) 00308 * 00309 * @note Callers of notification functions should use 00310 * svn_repos_notify_create() to create structures of this type to allow for 00311 * future extensibility. 00312 * 00313 * @since New in 1.7. 00314 */ 00315 typedef struct svn_repos_notify_t 00316 { 00317 /** Action that describes what happened in the repository. */ 00318 svn_repos_notify_action_t action; 00319 00320 /** For #svn_repos_notify_dump_rev_end and #svn_repos_notify_verify_rev_end, 00321 * the revision which just completed. 00322 * For #svn_fs_upgrade_format_bumped, the new format version. */ 00323 svn_revnum_t revision; 00324 00325 /** For #svn_repos_notify_warning, the warning message. */ 00326 const char *warning_str; 00327 /** For #svn_repos_notify_warning, the warning type. */ 00328 svn_repos_notify_warning_t warning; 00329 00330 /** For #svn_repos_notify_pack_shard_start, 00331 #svn_repos_notify_pack_shard_end, 00332 #svn_repos_notify_pack_revprops, 00333 #svn_repos_notify_cleanup_revprops 00334 #svn_repos_notify_pack_shard_start_revprop, and 00335 #svn_repos_notify_pack_shard_end_revprop, the shard processed. */ 00336 apr_int64_t shard; 00337 00338 /** For #svn_repos_notify_load_txn_committed, the revision committed. */ 00339 svn_revnum_t new_revision; 00340 00341 /** For #svn_repos_notify_load_txn_committed, the source revision, if 00342 different from @a new_revision, otherwise #SVN_INVALID_REVNUM. 00343 For #svn_repos_notify_load_txn_start and 00344 #svn_repos_notify_load_skipped_rev, the source revision. */ 00345 svn_revnum_t old_revision; 00346 00347 /** For #svn_repos_notify_load_node_start, the action being taken on the 00348 node. */ 00349 enum svn_node_action node_action; 00350 00351 /** For #svn_repos_notify_load_node_start, the path of the node. */ 00352 const char *path; 00353 00354 /** For #svn_repos_notify_hotcopy_rev_range, the start of the copied 00355 revision range. 00356 @since New in 1.9. */ 00357 svn_revnum_t start_revision; 00358 00359 /** For #svn_repos_notify_hotcopy_rev_range, the end of the copied 00360 revision range (might be the same as @a start_revision). 00361 @since New in 1.9. */ 00362 svn_revnum_t end_revision; 00363 00364 /* NOTE: Add new fields at the end to preserve binary compatibility. 00365 Also, if you add fields here, you have to update 00366 svn_repos_notify_create(). */ 00367 } svn_repos_notify_t; 00368 00369 /** Callback for providing notification from the repository. 00370 * Returns @c void. Justification: success of an operation is not dependent 00371 * upon successful notification of that operation. 00372 * 00373 * @since New in 1.7. */ 00374 typedef void (*svn_repos_notify_func_t)(void *baton, 00375 const svn_repos_notify_t *notify, 00376 apr_pool_t *scratch_pool); 00377 00378 /** Callback for filtering repository contents during dump. 00379 * 00380 * Set @a *include to TRUE to indicate that node, identified by path 00381 * @a path in @a root should be included in dump, or set it to @c FALSE 00382 * to indicate that node should be excluded (presumably according to state 00383 * stored in @a baton). 00384 * 00385 * Do not assume @a scratch_pool has any lifetime beyond this call. 00386 * 00387 * @since New in 1.10. 00388 */ 00389 typedef svn_error_t * (*svn_repos_dump_filter_func_t)( 00390 svn_boolean_t *include, 00391 svn_fs_root_t *root, 00392 const char *path, 00393 void *baton, 00394 apr_pool_t *scratch_pool); 00395 00396 /** 00397 * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize 00398 * and return it. 00399 * 00400 * @since New in 1.7. 00401 */ 00402 svn_repos_notify_t * 00403 svn_repos_notify_create(svn_repos_notify_action_t action, 00404 apr_pool_t *result_pool); 00405 00406 /** @} */ 00407 00408 00409 /** The repository object. */ 00410 typedef struct svn_repos_t svn_repos_t; 00411 00412 /* Opening and creating repositories. */ 00413 00414 00415 /** Find the root path of the repository that contains @a path. 00416 * 00417 * If a repository was found, the path to the root of the repository 00418 * is returned, else @c NULL. The pointer to the returned path may be 00419 * equal to @a path. 00420 */ 00421 const char * 00422 svn_repos_find_root_path(const char *path, 00423 apr_pool_t *pool); 00424 00425 /** Set @a *repos_p to a repository object for the repository at @a path. 00426 * 00427 * Allocate @a *repos_p in @a result_pool. 00428 * 00429 * Acquires a shared lock on the repository, and attaches a cleanup 00430 * function to @a result_pool to remove the lock. If no lock can be acquired, 00431 * returns error, with undefined effect on @a *repos_p. If an exclusive 00432 * lock is present, this blocks until it's gone. @a fs_config will be 00433 * passed to the filesystem initialization function and may be @c NULL. 00434 * 00435 * Use @a scratch_pool for temporary allocations. 00436 * 00437 * @since New in 1.9. 00438 */ 00439 svn_error_t * 00440 svn_repos_open3(svn_repos_t **repos_p, 00441 const char *path, 00442 apr_hash_t *fs_config, 00443 apr_pool_t *result_pool, 00444 apr_pool_t *scratch_pool); 00445 00446 /** Similar to svn_repos_open3() but without @a scratch_pool. 00447 * 00448 * @deprecated Provided for backward compatibility with 1.8 API. 00449 * @since New in 1.7. 00450 */ 00451 SVN_DEPRECATED 00452 svn_error_t * 00453 svn_repos_open2(svn_repos_t **repos_p, 00454 const char *path, 00455 apr_hash_t *fs_config, 00456 apr_pool_t *pool); 00457 00458 /** Similar to svn_repos_open2() with @a fs_config set to NULL. 00459 * 00460 * @deprecated Provided for backward compatibility with 1.6 API. 00461 */ 00462 SVN_DEPRECATED 00463 svn_error_t * 00464 svn_repos_open(svn_repos_t **repos_p, 00465 const char *path, 00466 apr_pool_t *pool); 00467 00468 /** Create a new Subversion repository at @a path, building the necessary 00469 * directory structure, creating the filesystem, and so on. 00470 * Return the repository object in @a *repos_p, allocated in @a pool. 00471 * 00472 * @a config is a client configuration hash of #svn_config_t * items 00473 * keyed on config category names, and may be NULL. 00474 * 00475 * @a fs_config is passed to the filesystem, and may be NULL. 00476 * 00477 * @a unused_1 and @a unused_2 are not used and should be NULL. 00478 */ 00479 svn_error_t * 00480 svn_repos_create(svn_repos_t **repos_p, 00481 const char *path, 00482 const char *unused_1, 00483 const char *unused_2, 00484 apr_hash_t *config, 00485 apr_hash_t *fs_config, 00486 apr_pool_t *pool); 00487 00488 /** 00489 * Upgrade the Subversion repository (and its underlying versioned 00490 * filesystem) located in the directory @a path to the latest version 00491 * supported by this library. If the requested upgrade is not 00492 * supported due to the current state of the repository or it 00493 * underlying filesystem, return #SVN_ERR_REPOS_UNSUPPORTED_UPGRADE 00494 * or #SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no 00495 * changes to the repository or filesystem. 00496 * 00497 * Acquires an exclusive lock on the repository, upgrades the 00498 * repository, and releases the lock. If an exclusive lock can't be 00499 * acquired, returns error. 00500 * 00501 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 00502 * returned if the lock is not immediately available. 00503 * 00504 * If @a start_callback is not NULL, it will be called with @a 00505 * start_callback_baton as argument before the upgrade starts, but 00506 * after the exclusive lock has been acquired. 00507 * 00508 * Use @a pool for necessary allocations. 00509 * 00510 * @note This functionality is provided as a convenience for 00511 * administrators wishing to make use of new Subversion functionality 00512 * without a potentially costly full repository dump/load. As such, 00513 * the operation performs only the minimum amount of work needed to 00514 * accomplish this while maintaining the integrity of the repository. 00515 * It does *not* guarantee the most optimized repository state as a 00516 * dump and subsequent load would. 00517 * 00518 * @note On some platforms the exclusive lock does not exclude other 00519 * threads in the same process so this function should only be called 00520 * by a single threaded process, or by a multi-threaded process when 00521 * no other threads are accessing the repository. 00522 * 00523 * @since New in 1.7. 00524 */ 00525 svn_error_t * 00526 svn_repos_upgrade2(const char *path, 00527 svn_boolean_t nonblocking, 00528 svn_repos_notify_func_t notify_func, 00529 void *notify_baton, 00530 apr_pool_t *pool); 00531 00532 /** 00533 * Similar to svn_repos_upgrade2(), but with @a start_callback and baton, 00534 * rather than a notify_callback / baton 00535 * 00536 * @since New in 1.5. 00537 * @deprecated Provided for backward compatibility with the 1.6 API. 00538 */ 00539 SVN_DEPRECATED 00540 svn_error_t * 00541 svn_repos_upgrade(const char *path, 00542 svn_boolean_t nonblocking, 00543 svn_error_t *(*start_callback)(void *baton), 00544 void *start_callback_baton, 00545 apr_pool_t *pool); 00546 00547 /** Destroy the Subversion repository found at @a path, using @a pool for any 00548 * necessary allocations. 00549 */ 00550 svn_error_t * 00551 svn_repos_delete(const char *path, 00552 apr_pool_t *pool); 00553 00554 00555 /** @defgroup svn_repos_capabilities Repository capabilities 00556 * @{ 00557 */ 00558 00559 /** 00560 * Set @a *has to TRUE if @a repos has @a capability (one of the 00561 * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set 00562 * @a *has to FALSE. 00563 * 00564 * If @a capability isn't recognized, throw #SVN_ERR_UNKNOWN_CAPABILITY, 00565 * with the effect on @a *has undefined. 00566 * 00567 * Use @a pool for all allocation. 00568 * 00569 * @since New in 1.5. 00570 */ 00571 svn_error_t * 00572 svn_repos_has_capability(svn_repos_t *repos, 00573 svn_boolean_t *has, 00574 const char *capability, 00575 apr_pool_t *pool); 00576 00577 /** 00578 * Return a set of @a capabilities supported by the running Subversion 00579 * library and by @a repos. (Capabilities supported by this version of 00580 * Subversion but not by @a repos are not listed. This may happen when 00581 * svn_repos_upgrade2() has not been called after a software upgrade.) 00582 * 00583 * The set is represented as a hash whose const char * keys are the set 00584 * members. The values are not defined. 00585 * 00586 * Allocate @a capabilities in @a result_pool and use @a scratch_pool for 00587 * temporary allocations. 00588 * 00589 * @see svn_repos_info_format 00590 * 00591 * @since New in 1.9. 00592 */ 00593 svn_error_t * 00594 svn_repos_capabilities(apr_hash_t **capabilities, 00595 svn_repos_t *repos, 00596 apr_pool_t *result_pool, 00597 apr_pool_t *scratch_pool); 00598 00599 /** 00600 * The capability of doing the right thing with merge-tracking 00601 * information, both storing it and responding to queries about it. 00602 * 00603 * @since New in 1.5. 00604 */ 00605 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo" 00606 /* *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY *** 00607 * 00608 * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to 00609 * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid 00610 * colons for their own reasons. While this RA limitation has no 00611 * direct impact on repository capabilities, there's no reason to be 00612 * gratuitously different either. 00613 * 00614 * If you add a capability, update svn_repos_capabilities(). 00615 */ 00616 00617 /** @} */ 00618 00619 00620 /** 00621 * Store in @a repos the client-reported capabilities @a capabilities, 00622 * which must be allocated in memory at least as long-lived as @a repos. 00623 * 00624 * The elements of @a capabilities are 'const char *', a subset of 00625 * the constants beginning with @c SVN_RA_CAPABILITY_. 00626 * @a capabilities is not copied, so changing it later will affect 00627 * what is remembered by @a repos. 00628 * 00629 * @note The capabilities are passed along to the start-commit hook; 00630 * see that hook's template for details. 00631 * 00632 * @note As of Subversion 1.5, there are no error conditions defined, 00633 * so this always returns SVN_NO_ERROR. In future releases it may 00634 * return error, however, so callers should check. 00635 * 00636 * @since New in 1.5. 00637 */ 00638 svn_error_t * 00639 svn_repos_remember_client_capabilities(svn_repos_t *repos, 00640 const apr_array_header_t *capabilities); 00641 00642 00643 /** Return the filesystem associated with repository object @a repos. */ 00644 svn_fs_t * 00645 svn_repos_fs(svn_repos_t *repos); 00646 00647 /** Return the type of filesystem associated with repository object 00648 * @a repos allocated in @a result_pool. 00649 * 00650 * @see #svn_fs_backend_names 00651 * 00652 * @since New in 1.9. 00653 */ 00654 const char * 00655 svn_repos_fs_type(svn_repos_t *repos, 00656 apr_pool_t *result_pool); 00657 00658 /** Make a hot copy of the Subversion repository found at @a src_path 00659 * to @a dst_path. 00660 * 00661 * Copy a possibly live Subversion repository from @a src_path to 00662 * @a dst_path. If @a clean_logs is @c TRUE, perform cleanup on the 00663 * source filesystem as part of the copy operation; currently, this 00664 * means deleting copied, unused logfiles for a Berkeley DB source 00665 * repository. 00666 * 00667 * If @a incremental is TRUE, make an effort to not re-copy information 00668 * already present in the destination. If incremental hotcopy is not 00669 * implemented by the filesystem backend, raise SVN_ERR_UNSUPPORTED_FEATURE. 00670 * 00671 * For each revision range copied, the @a notify_func function will be 00672 * called with the @a notify_baton and a notification structure containing 00673 * appropriate values in @c start_revision and @c end_revision (both 00674 * inclusive). @c start_revision might be equal to @c end_revision in 00675 * case the copied range consists of a single revision. Currently, this 00676 * notification is not triggered by the BDB backend. @a notify_func 00677 * may be @c NULL if this notification is not required. 00678 * 00679 * The optional @a cancel_func callback will be invoked with 00680 * @a cancel_baton as usual to allow the user to preempt this potentially 00681 * lengthy operation. 00682 * 00683 * Use @a scratch_pool for temporary allocations. 00684 * 00685 * @since New in 1.9. 00686 */ 00687 svn_error_t * 00688 svn_repos_hotcopy3(const char *src_path, 00689 const char *dst_path, 00690 svn_boolean_t clean_logs, 00691 svn_boolean_t incremental, 00692 svn_repos_notify_func_t notify_func, 00693 void *notify_baton, 00694 svn_cancel_func_t cancel_func, 00695 void *cancel_baton, 00696 apr_pool_t *scratch_pool); 00697 00698 /** 00699 * Like svn_repos_hotcopy3(), but with @a notify_func and @a notify_baton 00700 * always passed as @c NULL. 00701 * 00702 * @since New in 1.8. 00703 * @deprecated Provided for backward compatibility with the 1.8 API. 00704 */ 00705 SVN_DEPRECATED 00706 svn_error_t * 00707 svn_repos_hotcopy2(const char *src_path, 00708 const char *dst_path, 00709 svn_boolean_t clean_logs, 00710 svn_boolean_t incremental, 00711 svn_cancel_func_t cancel_func, 00712 void *cancel_baton, 00713 apr_pool_t *pool); 00714 00715 /** 00716 * Like svn_repos_hotcopy2(), but with @a incremental always passed as 00717 * @c FALSE and without cancellation support. 00718 * 00719 * @deprecated Provided for backward compatibility with the 1.6 API. 00720 */ 00721 SVN_DEPRECATED 00722 svn_error_t * 00723 svn_repos_hotcopy(const char *src_path, 00724 const char *dst_path, 00725 svn_boolean_t clean_logs, 00726 apr_pool_t *pool); 00727 00728 00729 /** 00730 * Possibly update the repository, @a repos, to use a more efficient 00731 * filesystem representation. Use @a pool for allocations. 00732 * 00733 * @since New in 1.7. 00734 */ 00735 svn_error_t * 00736 svn_repos_fs_pack2(svn_repos_t *repos, 00737 svn_repos_notify_func_t notify_func, 00738 void *notify_baton, 00739 svn_cancel_func_t cancel_func, 00740 void *cancel_baton, 00741 apr_pool_t *pool); 00742 00743 /** 00744 * Similar to svn_repos_fs_pack2(), but with a #svn_fs_pack_notify_t instead 00745 * of a #svn_repos_notify_t. 00746 * 00747 * @since New in 1.6. 00748 * @deprecated Provided for backward compatibility with the 1.6 API. 00749 */ 00750 SVN_DEPRECATED 00751 svn_error_t * 00752 svn_repos_fs_pack(svn_repos_t *repos, 00753 svn_fs_pack_notify_t notify_func, 00754 void *notify_baton, 00755 svn_cancel_func_t cancel_func, 00756 void *cancel_baton, 00757 apr_pool_t *pool); 00758 00759 /** 00760 * Run database recovery procedures on the repository at @a path, 00761 * returning the database to a consistent state. Use @a pool for all 00762 * allocation. 00763 * 00764 * Acquires an exclusive lock on the repository, recovers the 00765 * database, and releases the lock. If an exclusive lock can't be 00766 * acquired, returns error. 00767 * 00768 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 00769 * returned if the lock is not immediately available. 00770 * 00771 * If @a notify_func is not NULL, it will be called with @a 00772 * notify_baton as argument before the recovery starts, but 00773 * after the exclusive lock has been acquired. 00774 * 00775 * If @a cancel_func is not @c NULL, it is called periodically with 00776 * @a cancel_baton as argument to see if the client wishes to cancel 00777 * the recovery. 00778 * 00779 * @note On some platforms the exclusive lock does not exclude other 00780 * threads in the same process so this function should only be called 00781 * by a single threaded process, or by a multi-threaded process when 00782 * no other threads are accessing the repository. 00783 * 00784 * @since New in 1.7. 00785 */ 00786 svn_error_t * 00787 svn_repos_recover4(const char *path, 00788 svn_boolean_t nonblocking, 00789 svn_repos_notify_func_t notify_func, 00790 void *notify_baton, 00791 svn_cancel_func_t cancel_func, 00792 void * cancel_baton, 00793 apr_pool_t *pool); 00794 00795 /** 00796 * Similar to svn_repos_recover4(), but with @a start callback in place of 00797 * the notify_func / baton. 00798 * 00799 * @since New in 1.5. 00800 * @deprecated Provided for backward compatibility with the 1.6 API. 00801 */ 00802 SVN_DEPRECATED 00803 svn_error_t * 00804 svn_repos_recover3(const char *path, 00805 svn_boolean_t nonblocking, 00806 svn_error_t *(*start_callback)(void *baton), 00807 void *start_callback_baton, 00808 svn_cancel_func_t cancel_func, 00809 void * cancel_baton, 00810 apr_pool_t *pool); 00811 00812 /** 00813 * Similar to svn_repos_recover3(), but without cancellation support. 00814 * 00815 * @deprecated Provided for backward compatibility with the 1.4 API. 00816 */ 00817 SVN_DEPRECATED 00818 svn_error_t * 00819 svn_repos_recover2(const char *path, 00820 svn_boolean_t nonblocking, 00821 svn_error_t *(*start_callback)(void *baton), 00822 void *start_callback_baton, 00823 apr_pool_t *pool); 00824 00825 /** 00826 * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and 00827 * with no callbacks provided. 00828 * 00829 * @deprecated Provided for backward compatibility with the 1.0 API. 00830 */ 00831 SVN_DEPRECATED 00832 svn_error_t * 00833 svn_repos_recover(const char *path, 00834 apr_pool_t *pool); 00835 00836 /** 00837 * Callback for svn_repos_freeze. 00838 * 00839 * @since New in 1.8. 00840 */ 00841 typedef svn_error_t *(*svn_repos_freeze_func_t)(void *baton, apr_pool_t *pool); 00842 00843 /** 00844 * Take an exclusive lock on each of the repositories in @a paths to 00845 * prevent commits and then while holding all the locks invoke @a 00846 * freeze_func passing @a freeze_baton. Each repository may be readable by 00847 * Subversion while frozen, or may be unreadable, depending on which 00848 * FS backend the repository uses. Repositories are locked in the 00849 * order in which they are specified in the array. 00850 * 00851 * @note @a freeze_func must not, directly or indirectly, call any function 00852 * that attempts to take out a lock on the underlying repository. These 00853 * include functions for packing, hotcopying, setting revprops and commits. 00854 * Attempts to do so may result in a deadlock. 00855 * 00856 * @note On some platforms the exclusive lock does not exclude other 00857 * threads in the same process so this function should only be called 00858 * by a single threaded process, or by a multi-threaded process when 00859 * no other threads are accessing the repositories. 00860 * 00861 * @since New in 1.8. 00862 */ 00863 svn_error_t * 00864 svn_repos_freeze(apr_array_header_t *paths, 00865 svn_repos_freeze_func_t freeze_func, 00866 void *freeze_baton, 00867 apr_pool_t *pool); 00868 00869 /** This function is a wrapper around svn_fs_berkeley_logfiles(), 00870 * returning log file paths relative to the root of the repository. 00871 * 00872 * @copydoc svn_fs_berkeley_logfiles() 00873 */ 00874 svn_error_t * 00875 svn_repos_db_logfiles(apr_array_header_t **logfiles, 00876 const char *path, 00877 svn_boolean_t only_unused, 00878 apr_pool_t *pool); 00879 00880 00881 00882 /* Repository Paths */ 00883 00884 /** Return the top-level repository path allocated in @a pool. */ 00885 const char * 00886 svn_repos_path(svn_repos_t *repos, 00887 apr_pool_t *pool); 00888 00889 /** Return the path to @a repos's filesystem directory, allocated in 00890 * @a pool. 00891 */ 00892 const char * 00893 svn_repos_db_env(svn_repos_t *repos, 00894 apr_pool_t *pool); 00895 00896 /** Return path to @a repos's config directory, allocated in @a pool. */ 00897 const char * 00898 svn_repos_conf_dir(svn_repos_t *repos, 00899 apr_pool_t *pool); 00900 00901 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */ 00902 const char * 00903 svn_repos_svnserve_conf(svn_repos_t *repos, 00904 apr_pool_t *pool); 00905 00906 /** Return path to @a repos's lock directory, allocated in @a pool. */ 00907 const char * 00908 svn_repos_lock_dir(svn_repos_t *repos, 00909 apr_pool_t *pool); 00910 00911 /** Return path to @a repos's db lockfile, allocated in @a pool. */ 00912 const char * 00913 svn_repos_db_lockfile(svn_repos_t *repos, 00914 apr_pool_t *pool); 00915 00916 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */ 00917 const char * 00918 svn_repos_db_logs_lockfile(svn_repos_t *repos, 00919 apr_pool_t *pool); 00920 00921 /** Return the path to @a repos's hook directory, allocated in @a pool. */ 00922 const char * 00923 svn_repos_hook_dir(svn_repos_t *repos, 00924 apr_pool_t *pool); 00925 00926 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */ 00927 const char * 00928 svn_repos_start_commit_hook(svn_repos_t *repos, 00929 apr_pool_t *pool); 00930 00931 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */ 00932 const char * 00933 svn_repos_pre_commit_hook(svn_repos_t *repos, 00934 apr_pool_t *pool); 00935 00936 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */ 00937 const char * 00938 svn_repos_post_commit_hook(svn_repos_t *repos, 00939 apr_pool_t *pool); 00940 00941 /** Return the path to @a repos's pre-revprop-change hook, allocated in 00942 * @a pool. 00943 */ 00944 const char * 00945 svn_repos_pre_revprop_change_hook(svn_repos_t *repos, 00946 apr_pool_t *pool); 00947 00948 /** Return the path to @a repos's post-revprop-change hook, allocated in 00949 * @a pool. 00950 */ 00951 const char * 00952 svn_repos_post_revprop_change_hook(svn_repos_t *repos, 00953 apr_pool_t *pool); 00954 00955 00956 /** @defgroup svn_repos_lock_hooks Paths to lock hooks 00957 * @{ 00958 * @since New in 1.2. */ 00959 00960 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */ 00961 const char * 00962 svn_repos_pre_lock_hook(svn_repos_t *repos, 00963 apr_pool_t *pool); 00964 00965 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */ 00966 const char * 00967 svn_repos_post_lock_hook(svn_repos_t *repos, 00968 apr_pool_t *pool); 00969 00970 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */ 00971 const char * 00972 svn_repos_pre_unlock_hook(svn_repos_t *repos, 00973 apr_pool_t *pool); 00974 00975 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */ 00976 const char * 00977 svn_repos_post_unlock_hook(svn_repos_t *repos, 00978 apr_pool_t *pool); 00979 00980 /** Specify that Subversion should consult the configuration file 00981 * located at @a hooks_env_path to determine how to setup the 00982 * environment for hook scripts invoked for the repository @a repos. 00983 * As a special case, if @a hooks_env_path is @c NULL, look for the 00984 * file in its default location within the repository disk structure. 00985 * If @a hooks_env_path is not absolute, it specifies a path relative 00986 * to the parent of the file's default location. 00987 * 00988 * Use @a scratch_pool for temporary allocations. 00989 * 00990 * If this function is not called, or if the specified configuration 00991 * file does not define any environment variables, hooks will run in 00992 * an empty environment. 00993 * 00994 * @since New in 1.8. 00995 */ 00996 svn_error_t * 00997 svn_repos_hooks_setenv(svn_repos_t *repos, 00998 const char *hooks_env_path, 00999 apr_pool_t *scratch_pool); 01000 01001 /** @} */ 01002 01003 /* ---------------------------------------------------------------*/ 01004 01005 /* Reporting the state of a working copy, for updates. */ 01006 01007 01008 /** 01009 * Construct and return a @a report_baton that will be passed to the 01010 * other functions in this section to describe the state of a pre-existing 01011 * tree (typically, a working copy). When the report is finished, 01012 * @a editor/@a edit_baton will be driven in such a way as to transform the 01013 * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the 01014 * reported hierarchy to @a tgt_path. 01015 * 01016 * @a fs_base is the absolute path of the node in the filesystem at which 01017 * the comparison should be rooted. @a target is a single path component, 01018 * used to limit the scope of the report to a single entry of @a fs_base, 01019 * or "" if all of @a fs_base itself is the main subject of the report. 01020 * 01021 * @a tgt_path and @a revnum is the fs path/revision pair that is the 01022 * "target" of the delta. @a tgt_path should be provided only when 01023 * the source and target paths of the report differ. That is, @a tgt_path 01024 * should *only* be specified when specifying that the resultant editor 01025 * drive be one that transforms the reported hierarchy into a pristine tree 01026 * of @a tgt_path at revision @a revnum. A @c NULL value for @a tgt_path 01027 * will indicate that the editor should be driven in such a way as to 01028 * transform the reported hierarchy to revision @a revnum, preserving the 01029 * reported hierarchy. 01030 * 01031 * @a text_deltas instructs the driver of the @a editor to enable 01032 * the generation of text deltas. 01033 * 01034 * @a ignore_ancestry instructs the driver to ignore node ancestry 01035 * when determining how to transmit differences. 01036 * 01037 * @a send_copyfrom_args instructs the driver to send 'copyfrom' 01038 * arguments to the editor's add_file() and add_directory() methods, 01039 * whenever it deems feasible. 01040 * 01041 * Use @a authz_read_func and @a authz_read_baton (if not @c NULL) to 01042 * avoid sending data through @a editor/@a edit_baton which is not 01043 * authorized for transmission. 01044 * 01045 * @a zero_copy_limit controls the maximum size (in bytes) at which 01046 * data blocks may be sent using the zero-copy code path. On that 01047 * path, a number of in-memory copy operations have been eliminated to 01048 * maximize throughput. However, until the whole block has been 01049 * pushed to the network stack, other clients block, so be careful 01050 * when using larger values here. Pass 0 for @a zero_copy_limit to 01051 * disable this optimization altogether. 01052 * 01053 * @note Never activate this optimization if @a editor might access 01054 * any FSFS data structures (and, hence, caches). So, it is basically 01055 * safe for networked editors only. 01056 * 01057 * All allocation for the context and collected state will occur in 01058 * @a pool. 01059 * 01060 * @a depth is the requested depth of the editor drive. 01061 * 01062 * If @a depth is #svn_depth_unknown, the editor will affect only the 01063 * paths reported by the individual calls to svn_repos_set_path3() and 01064 * svn_repos_link_path3(). 01065 * 01066 * For example, if the reported tree is the @c A subdir of the Greek Tree 01067 * (see Subversion's test suite), at depth #svn_depth_empty, but the 01068 * @c A/B subdir is reported at depth #svn_depth_infinity, then 01069 * repository-side changes to @c A/mu, or underneath @c A/C and @c 01070 * A/D, would not be reflected in the editor drive, but changes 01071 * underneath @c A/B would be. 01072 * 01073 * Additionally, the editor driver will call @c add_directory and 01074 * and @c add_file for directories with an appropriate depth. For 01075 * example, a directory reported at #svn_depth_files will receive 01076 * file (but not directory) additions. A directory at #svn_depth_empty 01077 * will receive neither. 01078 * 01079 * If @a depth is #svn_depth_files, #svn_depth_immediates or 01080 * #svn_depth_infinity and @a depth is greater than the reported depth 01081 * of the working copy, then the editor driver will emit editor 01082 * operations so as to upgrade the working copy to this depth. 01083 * 01084 * If @a depth is #svn_depth_empty, #svn_depth_files, 01085 * #svn_depth_immediates and @a depth is lower 01086 * than or equal to the depth of the working copy, then the editor 01087 * operations will affect only paths at or above @a depth. 01088 * 01089 * @since New in 1.8. 01090 */ 01091 svn_error_t * 01092 svn_repos_begin_report3(void **report_baton, 01093 svn_revnum_t revnum, 01094 svn_repos_t *repos, 01095 const char *fs_base, 01096 const char *target, 01097 const char *tgt_path, 01098 svn_boolean_t text_deltas, 01099 svn_depth_t depth, 01100 svn_boolean_t ignore_ancestry, 01101 svn_boolean_t send_copyfrom_args, 01102 const svn_delta_editor_t *editor, 01103 void *edit_baton, 01104 svn_repos_authz_func_t authz_read_func, 01105 void *authz_read_baton, 01106 apr_size_t zero_copy_limit, 01107 apr_pool_t *pool); 01108 01109 /** 01110 * The same as svn_repos_begin_report3(), but with @a zero_copy_limit 01111 * always passed as 0. 01112 * 01113 * @since New in 1.5. 01114 * @deprecated Provided for backward compatibility with the 1.7 API. 01115 */ 01116 SVN_DEPRECATED 01117 svn_error_t * 01118 svn_repos_begin_report2(void **report_baton, 01119 svn_revnum_t revnum, 01120 svn_repos_t *repos, 01121 const char *fs_base, 01122 const char *target, 01123 const char *tgt_path, 01124 svn_boolean_t text_deltas, 01125 svn_depth_t depth, 01126 svn_boolean_t ignore_ancestry, 01127 svn_boolean_t send_copyfrom_args, 01128 const svn_delta_editor_t *editor, 01129 void *edit_baton, 01130 svn_repos_authz_func_t authz_read_func, 01131 void *authz_read_baton, 01132 apr_pool_t *pool); 01133 01134 /** 01135 * The same as svn_repos_begin_report2(), but taking a boolean 01136 * @a recurse flag, and sending FALSE for @a send_copyfrom_args. 01137 * 01138 * If @a recurse is TRUE, the editor driver will drive the editor with 01139 * a depth of #svn_depth_infinity; if FALSE, then with a depth of 01140 * #svn_depth_files. 01141 * 01142 * @note @a username is ignored, and has been removed in a revised 01143 * version of this API. 01144 * 01145 * @deprecated Provided for backward compatibility with the 1.4 API. 01146 */ 01147 SVN_DEPRECATED 01148 svn_error_t * 01149 svn_repos_begin_report(void **report_baton, 01150 svn_revnum_t revnum, 01151 const char *username, 01152 svn_repos_t *repos, 01153 const char *fs_base, 01154 const char *target, 01155 const char *tgt_path, 01156 svn_boolean_t text_deltas, 01157 svn_boolean_t recurse, 01158 svn_boolean_t ignore_ancestry, 01159 const svn_delta_editor_t *editor, 01160 void *edit_baton, 01161 svn_repos_authz_func_t authz_read_func, 01162 void *authz_read_baton, 01163 apr_pool_t *pool); 01164 01165 01166 /** 01167 * Given a @a report_baton constructed by svn_repos_begin_report3(), 01168 * record the presence of @a path, at @a revision with depth @a depth, 01169 * in the current tree. 01170 * 01171 * @a path is relative to the anchor/target used in the creation of the 01172 * @a report_baton. 01173 * 01174 * @a revision may be SVN_INVALID_REVNUM if (for example) @a path 01175 * represents a locally-added path with no revision number, or @a 01176 * depth is #svn_depth_exclude. 01177 * 01178 * @a path may not be underneath a path on which svn_repos_set_path3() 01179 * was previously called with #svn_depth_exclude in this report. 01180 * 01181 * The first call of this in a given report usually passes an empty 01182 * @a path; this is used to set up the correct root revision for the editor 01183 * drive. 01184 * 01185 * A depth of #svn_depth_unknown is not allowed, and results in an 01186 * error. 01187 * 01188 * If @a start_empty is TRUE and @a path is a directory, then require the 01189 * caller to explicitly provide all the children of @a path - do not assume 01190 * that the tree also contains all the children of @a path at @a revision. 01191 * This is for 'low confidence' client reporting. 01192 * 01193 * If the caller has a lock token for @a path, then @a lock_token should 01194 * be set to that token. Else, @a lock_token should be NULL. 01195 * 01196 * All temporary allocations are done in @a pool. 01197 * 01198 * @since New in 1.5. 01199 */ 01200 svn_error_t * 01201 svn_repos_set_path3(void *report_baton, 01202 const char *path, 01203 svn_revnum_t revision, 01204 svn_depth_t depth, 01205 svn_boolean_t start_empty, 01206 const char *lock_token, 01207 apr_pool_t *pool); 01208 01209 /** 01210 * Similar to svn_repos_set_path3(), but with @a depth set to 01211 * #svn_depth_infinity. 01212 * 01213 * @deprecated Provided for backward compatibility with the 1.4 API. 01214 */ 01215 SVN_DEPRECATED 01216 svn_error_t * 01217 svn_repos_set_path2(void *report_baton, 01218 const char *path, 01219 svn_revnum_t revision, 01220 svn_boolean_t start_empty, 01221 const char *lock_token, 01222 apr_pool_t *pool); 01223 01224 /** 01225 * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL. 01226 * 01227 * @deprecated Provided for backward compatibility with the 1.1 API. 01228 */ 01229 SVN_DEPRECATED 01230 svn_error_t * 01231 svn_repos_set_path(void *report_baton, 01232 const char *path, 01233 svn_revnum_t revision, 01234 svn_boolean_t start_empty, 01235 apr_pool_t *pool); 01236 01237 /** 01238 * Given a @a report_baton constructed by svn_repos_begin_report3(), 01239 * record the presence of @a path in the current tree, containing the contents 01240 * of @a link_path at @a revision with depth @a depth. 01241 * 01242 * A depth of #svn_depth_unknown is not allowed, and results in an 01243 * error. 01244 * 01245 * @a path may not be underneath a path on which svn_repos_set_path3() 01246 * was previously called with #svn_depth_exclude in this report. 01247 * 01248 * Note that while @a path is relative to the anchor/target used in the 01249 * creation of the @a report_baton, @a link_path is an absolute filesystem 01250 * path! 01251 * 01252 * If @a start_empty is TRUE and @a path is a directory, then require the 01253 * caller to explicitly provide all the children of @a path - do not assume 01254 * that the tree also contains all the children of @a link_path at 01255 * @a revision. This is for 'low confidence' client reporting. 01256 * 01257 * If the caller has a lock token for @a link_path, then @a lock_token 01258 * should be set to that token. Else, @a lock_token should be NULL. 01259 * 01260 * All temporary allocations are done in @a pool. 01261 * 01262 * @since New in 1.5. 01263 */ 01264 svn_error_t * 01265 svn_repos_link_path3(void *report_baton, 01266 const char *path, 01267 const char *link_path, 01268 svn_revnum_t revision, 01269 svn_depth_t depth, 01270 svn_boolean_t start_empty, 01271 const char *lock_token, 01272 apr_pool_t *pool); 01273 01274 /** 01275 * Similar to svn_repos_link_path3(), but with @a depth set to 01276 * #svn_depth_infinity. 01277 * 01278 * @deprecated Provided for backward compatibility with the 1.4 API. 01279 */ 01280 SVN_DEPRECATED 01281 svn_error_t * 01282 svn_repos_link_path2(void *report_baton, 01283 const char *path, 01284 const char *link_path, 01285 svn_revnum_t revision, 01286 svn_boolean_t start_empty, 01287 const char *lock_token, 01288 apr_pool_t *pool); 01289 01290 /** 01291 * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL. 01292 * 01293 * @deprecated Provided for backward compatibility with the 1.1 API. 01294 */ 01295 SVN_DEPRECATED 01296 svn_error_t * 01297 svn_repos_link_path(void *report_baton, 01298 const char *path, 01299 const char *link_path, 01300 svn_revnum_t revision, 01301 svn_boolean_t start_empty, 01302 apr_pool_t *pool); 01303 01304 /** Given a @a report_baton constructed by svn_repos_begin_report3(), 01305 * record the non-existence of @a path in the current tree. 01306 * 01307 * @a path may not be underneath a path on which svn_repos_set_path3() 01308 * was previously called with #svn_depth_exclude in this report. 01309 * 01310 * (This allows the reporter's driver to describe missing pieces of a 01311 * working copy, so that 'svn up' can recreate them.) 01312 * 01313 * All temporary allocations are done in @a pool. 01314 */ 01315 svn_error_t * 01316 svn_repos_delete_path(void *report_baton, 01317 const char *path, 01318 apr_pool_t *pool); 01319 01320 /** Given a @a report_baton constructed by svn_repos_begin_report3(), 01321 * finish the report and drive the editor as specified when the report 01322 * baton was constructed. 01323 * 01324 * If an error occurs during the driving of the editor, do NOT abort the 01325 * edit; that responsibility belongs to the caller of this function, if 01326 * it happens at all. 01327 * 01328 * After the call to this function, @a report_baton is no longer valid; 01329 * it should not be passed to any other reporting functions, including 01330 * svn_repos_abort_report(), even if this function returns an error. 01331 */ 01332 svn_error_t * 01333 svn_repos_finish_report(void *report_baton, 01334 apr_pool_t *pool); 01335 01336 01337 /** Given a @a report_baton constructed by svn_repos_begin_report3(), 01338 * abort the report. This function can be called anytime before 01339 * svn_repos_finish_report() is called. 01340 * 01341 * After the call to this function, @a report_baton is no longer valid; 01342 * it should not be passed to any other reporting functions. 01343 */ 01344 svn_error_t * 01345 svn_repos_abort_report(void *report_baton, 01346 apr_pool_t *pool); 01347 01348 01349 /* ---------------------------------------------------------------*/ 01350 01351 /* The magical dir_delta update routines. */ 01352 01353 /** Use the provided @a editor and @a edit_baton to describe the changes 01354 * necessary for making a given node (and its descendants, if it is a 01355 * directory) under @a src_root look exactly like @a tgt_path under 01356 * @a tgt_root. @a src_entry is the node to update. If @a src_entry 01357 * is empty, then compute the difference between the entire tree 01358 * anchored at @a src_parent_dir under @a src_root and @a tgt_path 01359 * under @a tgt_root. Else, describe the changes needed to update 01360 * only that entry in @a src_parent_dir. Typically, callers of this 01361 * function will use a @a tgt_path that is the concatenation of @a 01362 * src_parent_dir and @a src_entry. 01363 * 01364 * @a src_root and @a tgt_root can both be either revision or transaction 01365 * roots. If @a tgt_root is a revision, @a editor's set_target_revision() 01366 * will be called with the @a tgt_root's revision number, else it will 01367 * not be called at all. 01368 * 01369 * If @a authz_read_func is non-NULL, invoke it before any call to 01370 * 01371 * @a editor->open_root 01372 * @a editor->add_directory 01373 * @a editor->open_directory 01374 * @a editor->add_file 01375 * @a editor->open_file 01376 * 01377 * passing @a tgt_root, the same path that would be passed to the 01378 * editor function in question, and @a authz_read_baton. If the 01379 * @a *allowed parameter comes back TRUE, then proceed with the planned 01380 * editor call; else if FALSE, then invoke @a editor->absent_file or 01381 * @a editor->absent_directory as appropriate, except if the planned 01382 * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE. 01383 * 01384 * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to 01385 * the window handler returned by @a editor->apply_textdelta(). 01386 * 01387 * If @a depth is #svn_depth_empty, invoke @a editor calls only on 01388 * @a src_entry (or @a src_parent_dir, if @a src_entry is empty). 01389 * If @a depth is #svn_depth_files, also invoke the editor on file 01390 * children, if any; if #svn_depth_immediates, invoke it on 01391 * immediate subdirectories as well as files; if #svn_depth_infinity, 01392 * recurse fully. 01393 * 01394 * If @a entry_props is @c TRUE, accompany each opened/added entry with 01395 * propchange editor calls that relay special "entry props" (this 01396 * is typically used only for working copy updates). 01397 * 01398 * @a ignore_ancestry instructs the function to ignore node ancestry 01399 * when determining how to transmit differences. 01400 * 01401 * Before completing successfully, this function calls @a editor's 01402 * close_edit(), so the caller should expect its @a edit_baton to be 01403 * invalid after its use with this function. 01404 * 01405 * Do any allocation necessary for the delta computation in @a pool. 01406 * This function's maximum memory consumption is at most roughly 01407 * proportional to the greatest depth of the tree under @a tgt_root, not 01408 * the total size of the delta. 01409 * 01410 * ### svn_repos_dir_delta2 is mostly superseded by the reporter 01411 * ### functionality (svn_repos_begin_report3 and friends). 01412 * ### svn_repos_dir_delta2 does allow the roots to be transaction 01413 * ### roots rather than just revision roots, and it has the 01414 * ### entry_props flag. Almost all of Subversion's own code uses the 01415 * ### reporter instead; there are some stray references to the 01416 * ### svn_repos_dir_delta[2] in comments which should probably 01417 * ### actually refer to the reporter. 01418 * 01419 * @since New in 1.5. 01420 */ 01421 svn_error_t * 01422 svn_repos_dir_delta2(svn_fs_root_t *src_root, 01423 const char *src_parent_dir, 01424 const char *src_entry, 01425 svn_fs_root_t *tgt_root, 01426 const char *tgt_path, 01427 const svn_delta_editor_t *editor, 01428 void *edit_baton, 01429 svn_repos_authz_func_t authz_read_func, 01430 void *authz_read_baton, 01431 svn_boolean_t text_deltas, 01432 svn_depth_t depth, 01433 svn_boolean_t entry_props, 01434 svn_boolean_t ignore_ancestry, 01435 apr_pool_t *pool); 01436 01437 /** 01438 * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass 01439 * #svn_depth_infinity for @a depth, and if @a recurse is FALSE, 01440 * pass #svn_depth_files for @a depth. 01441 * 01442 * @deprecated Provided for backward compatibility with the 1.4 API. 01443 */ 01444 SVN_DEPRECATED 01445 svn_error_t * 01446 svn_repos_dir_delta(svn_fs_root_t *src_root, 01447 const char *src_parent_dir, 01448 const char *src_entry, 01449 svn_fs_root_t *tgt_root, 01450 const char *tgt_path, 01451 const svn_delta_editor_t *editor, 01452 void *edit_baton, 01453 svn_repos_authz_func_t authz_read_func, 01454 void *authz_read_baton, 01455 svn_boolean_t text_deltas, 01456 svn_boolean_t recurse, 01457 svn_boolean_t entry_props, 01458 svn_boolean_t ignore_ancestry, 01459 apr_pool_t *pool); 01460 01461 01462 /** Use the provided @a editor and @a edit_baton to describe the 01463 * skeletal changes made in a particular filesystem @a root 01464 * (revision or transaction). 01465 * 01466 * Changes will be limited to those within @a base_dir, and if 01467 * @a low_water_mark is set to something other than #SVN_INVALID_REVNUM 01468 * it is assumed that the client has no knowledge of revisions prior to 01469 * @a low_water_mark. Together, these two arguments define the portion of 01470 * the tree that the client is assumed to have knowledge of, and thus any 01471 * copies of data from outside that part of the tree will be sent in their 01472 * entirety, not as simple copies or deltas against a previous version. 01473 * 01474 * The @a editor passed to this function should be aware of the fact 01475 * that, if @a send_deltas is FALSE, calls to its change_dir_prop(), 01476 * change_file_prop(), and apply_textdelta() functions will not 01477 * contain meaningful data, and merely serve as indications that 01478 * properties or textual contents were changed. 01479 * 01480 * If @a send_deltas is @c TRUE, the text and property deltas for changes 01481 * will be sent, otherwise NULL text deltas and empty prop changes will be 01482 * used. 01483 * 01484 * If @a authz_read_func is non-NULL, it will be used to determine if the 01485 * user has read access to the data being accessed. Data that the user 01486 * cannot access will be skipped. 01487 * 01488 * @note This editor driver passes SVN_INVALID_REVNUM for all 01489 * revision parameters in the editor interface except the copyfrom 01490 * parameter of the add_file() and add_directory() editor functions. 01491 * 01492 * @since New in 1.4. 01493 */ 01494 svn_error_t * 01495 svn_repos_replay2(svn_fs_root_t *root, 01496 const char *base_dir, 01497 svn_revnum_t low_water_mark, 01498 svn_boolean_t send_deltas, 01499 const svn_delta_editor_t *editor, 01500 void *edit_baton, 01501 svn_repos_authz_func_t authz_read_func, 01502 void *authz_read_baton, 01503 apr_pool_t *pool); 01504 01505 /** 01506 * Similar to svn_repos_replay2(), but with @a base_dir set to @c "", 01507 * @a low_water_mark set to #SVN_INVALID_REVNUM, @a send_deltas 01508 * set to @c FALSE, and @a authz_read_func and @a authz_read_baton 01509 * set to @c NULL. 01510 * 01511 * @deprecated Provided for backward compatibility with the 1.3 API. 01512 */ 01513 SVN_DEPRECATED 01514 svn_error_t * 01515 svn_repos_replay(svn_fs_root_t *root, 01516 const svn_delta_editor_t *editor, 01517 void *edit_baton, 01518 apr_pool_t *pool); 01519 01520 /* ---------------------------------------------------------------*/ 01521 01522 /* Making commits. */ 01523 01524 /** 01525 * Return an @a editor and @a edit_baton to commit changes to the 01526 * filesystem of @a repos, beginning at location 'rev:@a base_path', 01527 * where "rev" is the argument given to open_root(). 01528 * 01529 * @a repos is a previously opened repository. @a repos_url_decoded is the 01530 * decoded URL to the base of the repository, and is used to check 01531 * copyfrom paths. @a txn is a filesystem transaction object to use 01532 * during the commit, or @c NULL to indicate that this function should 01533 * create (and fully manage) a new transaction. 01534 * 01535 * Store the contents of @a revprop_table, a hash mapping <tt>const 01536 * char *</tt> property names to #svn_string_t values, as properties 01537 * of the commit transaction, including author and log message if 01538 * present. 01539 * 01540 * @note #SVN_PROP_REVISION_DATE may be present in @a revprop_table, but 01541 * it will be overwritten when the transaction is committed. 01542 * 01543 * Iff @a authz_callback is provided, check read/write authorizations 01544 * on paths accessed by editor operations. An operation which fails 01545 * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or 01546 * SVN_ERR_AUTHZ_UNWRITABLE. 01547 * 01548 * Calling @a (*editor)->close_edit completes the commit. 01549 * 01550 * If @a commit_callback is non-NULL, then before @c close_edit returns (but 01551 * after the commit has succeeded) @c close_edit will invoke 01552 * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton, 01553 * and @a pool or some subpool thereof as arguments. The @c repos_root field 01554 * of the #svn_commit_info_t is @c NULL. If @a commit_callback 01555 * returns an error, that error will be returned from @c close_edit, 01556 * otherwise if there was a post-commit hook failure, then that error 01557 * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. 01558 * (Note that prior to Subversion 1.6, @a commit_callback cannot be @c NULL; 01559 * if you don't need a callback, pass a dummy function.) 01560 * 01561 * Calling @a (*editor)->abort_edit aborts the commit, and will also 01562 * abort the commit transaction unless @a txn was supplied (not @c 01563 * NULL). Callers who supply their own transactions are responsible 01564 * for cleaning them up (either by committing them, or aborting them). 01565 * 01566 * @since New in 1.5. Since 1.6, @a commit_callback can be @c NULL. 01567 * 01568 * @note Yes, @a repos_url_decoded is a <em>decoded</em> URL. We realize 01569 * that's sorta wonky. Sorry about that. 01570 * 01571 * @note Like most commit editors, the returned editor requires that the 01572 * @c copyfrom_path parameter passed to its @c add_file and @c add_directory 01573 * methods is a full, URI-encoded URL, not a relative path. 01574 */ 01575 svn_error_t * 01576 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor, 01577 void **edit_baton, 01578 svn_repos_t *repos, 01579 svn_fs_txn_t *txn, 01580 const char *repos_url_decoded, 01581 const char *base_path, 01582 apr_hash_t *revprop_table, 01583 svn_commit_callback2_t commit_callback, 01584 void *commit_baton, 01585 svn_repos_authz_callback_t authz_callback, 01586 void *authz_baton, 01587 apr_pool_t *pool); 01588 01589 /** 01590 * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table 01591 * set to a hash containing @a user and @a log_msg as the 01592 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties, 01593 * respectively. @a user and @a log_msg may both be @c NULL. 01594 * 01595 * @since New in 1.4. 01596 * 01597 * @deprecated Provided for backward compatibility with the 1.4 API. 01598 */ 01599 SVN_DEPRECATED 01600 svn_error_t * 01601 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor, 01602 void **edit_baton, 01603 svn_repos_t *repos, 01604 svn_fs_txn_t *txn, 01605 const char *repos_url, 01606 const char *base_path, 01607 const char *user, 01608 const char *log_msg, 01609 svn_commit_callback2_t commit_callback, 01610 void *commit_baton, 01611 svn_repos_authz_callback_t authz_callback, 01612 void *authz_baton, 01613 apr_pool_t *pool); 01614 01615 /** 01616 * Similar to svn_repos_get_commit_editor4(), but 01617 * uses the svn_commit_callback_t type. 01618 * 01619 * @since New in 1.3. 01620 * 01621 * @deprecated Provided for backward compatibility with the 1.3 API. 01622 */ 01623 SVN_DEPRECATED 01624 svn_error_t * 01625 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor, 01626 void **edit_baton, 01627 svn_repos_t *repos, 01628 svn_fs_txn_t *txn, 01629 const char *repos_url, 01630 const char *base_path, 01631 const char *user, 01632 const char *log_msg, 01633 svn_commit_callback_t callback, 01634 void *callback_baton, 01635 svn_repos_authz_callback_t authz_callback, 01636 void *authz_baton, 01637 apr_pool_t *pool); 01638 01639 /** 01640 * Similar to svn_repos_get_commit_editor3(), but with @a 01641 * authz_callback and @a authz_baton set to @c NULL. 01642 * 01643 * @deprecated Provided for backward compatibility with the 1.2 API. 01644 */ 01645 SVN_DEPRECATED 01646 svn_error_t * 01647 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor, 01648 void **edit_baton, 01649 svn_repos_t *repos, 01650 svn_fs_txn_t *txn, 01651 const char *repos_url, 01652 const char *base_path, 01653 const char *user, 01654 const char *log_msg, 01655 svn_commit_callback_t callback, 01656 void *callback_baton, 01657 apr_pool_t *pool); 01658 01659 01660 /** 01661 * Similar to svn_repos_get_commit_editor2(), but with @a txn always 01662 * set to @c NULL. 01663 * 01664 * @deprecated Provided for backward compatibility with the 1.1 API. 01665 */ 01666 SVN_DEPRECATED 01667 svn_error_t * 01668 svn_repos_get_commit_editor(const svn_delta_editor_t **editor, 01669 void **edit_baton, 01670 svn_repos_t *repos, 01671 const char *repos_url, 01672 const char *base_path, 01673 const char *user, 01674 const char *log_msg, 01675 svn_commit_callback_t callback, 01676 void *callback_baton, 01677 apr_pool_t *pool); 01678 01679 /* ---------------------------------------------------------------*/ 01680 01681 /* Finding particular revisions. */ 01682 01683 /** Set @a *revision to the revision number in @a repos's filesystem that was 01684 * youngest at time @a tm. 01685 */ 01686 svn_error_t * 01687 svn_repos_dated_revision(svn_revnum_t *revision, 01688 svn_repos_t *repos, 01689 apr_time_t tm, 01690 apr_pool_t *pool); 01691 01692 01693 /** Given a @a root/@a path within some filesystem, return three pieces of 01694 * information allocated in @a pool: 01695 * 01696 * - set @a *committed_rev to the revision in which the object was 01697 * last modified. (In fs parlance, this is the revision in which 01698 * the particular node-rev-id was 'created'.) 01699 * 01700 * - set @a *committed_date to the date of said revision, or @c NULL 01701 * if not available. 01702 * 01703 * - set @a *last_author to the author of said revision, or @c NULL 01704 * if not available. 01705 */ 01706 svn_error_t * 01707 svn_repos_get_committed_info(svn_revnum_t *committed_rev, 01708 const char **committed_date, 01709 const char **last_author, 01710 svn_fs_root_t *root, 01711 const char *path, 01712 apr_pool_t *pool); 01713 01714 01715 /** 01716 * Set @a *dirent to an #svn_dirent_t associated with @a path in @a 01717 * root. If @a path does not exist in @a root, set @a *dirent to 01718 * NULL. Use @a pool for memory allocation. 01719 * 01720 * @since New in 1.2. 01721 */ 01722 svn_error_t * 01723 svn_repos_stat(svn_dirent_t **dirent, 01724 svn_fs_root_t *root, 01725 const char *path, 01726 apr_pool_t *pool); 01727 01728 /** 01729 * Callback type to be used with svn_repos_list(). It will be invoked for 01730 * every directory entry found. 01731 * 01732 * The full path of the entry is given in @a path and @a dirent contains 01733 * various additional information. If svn_repos_list() has been called 01734 * with @a path_info_only set, only the @a kind element of this struct 01735 * will be valid. 01736 * 01737 * @a baton is the user-provided receiver baton. @a scratch_pool may be 01738 * used for temporary allocations. 01739 * 01740 * @since New in 1.10. 01741 */ 01742 typedef svn_error_t *(* svn_repos_dirent_receiver_t)(const char *path, 01743 svn_dirent_t *dirent, 01744 void *baton, 01745 apr_pool_t *scratch_pool); 01746 01747 /** 01748 * Efficiently list everything within a sub-tree. Specify glob patterns 01749 * to search for specific files and folders. 01750 * 01751 * Walk the sub-tree starting at @a path under @a root up to the given 01752 * @a depth. For each directory entry found, @a receiver will be called 01753 * with @a receiver_baton. The starting @a path will be reported as well. 01754 * Because retrieving all elements of a #svn_dirent_t can be expensive, 01755 * you may set @a path_info_only to receive only the path name and the node 01756 * kind. The entries will be reported ordered by their path. 01757 * 01758 * @a patterns is an optional array of <tt>const char *</tt>. If it is 01759 * not @c NULL, only those directory entries will be reported whose last 01760 * path segment matches at least one of these patterns. This feature uses 01761 * apr_fnmatch() for glob matching and requiring '.' to matched by dots 01762 * in the path. 01763 * 01764 * If @a authz_read_func is not @c NULL, this function will neither report 01765 * entries nor recurse into directories that the user has no access to. 01766 * 01767 * Cancellation support is provided in the usual way through the optional 01768 * @a cancel_func and @a cancel_baton. 01769 * 01770 * @a path must point to a directory and @a depth must be at least 01771 * #svn_depth_empty. 01772 * 01773 * Use @a scratch_pool for temporary memory allocation. 01774 * 01775 * @since New in 1.10. 01776 */ 01777 svn_error_t * 01778 svn_repos_list(svn_fs_root_t *root, 01779 const char *path, 01780 const apr_array_header_t *patterns, 01781 svn_depth_t depth, 01782 svn_boolean_t path_info_only, 01783 svn_repos_authz_func_t authz_read_func, 01784 void *authz_read_baton, 01785 svn_repos_dirent_receiver_t receiver, 01786 void *receiver_baton, 01787 svn_cancel_func_t cancel_func, 01788 void *cancel_baton, 01789 apr_pool_t *scratch_pool); 01790 01791 /** 01792 * Given @a path which exists at revision @a start in @a fs, set 01793 * @a *deleted to the revision @a path was first deleted, within the 01794 * inclusive revision range bounded by @a start and @a end. If @a path 01795 * does not exist at revision @a start or was not deleted within the 01796 * specified range, then set @a *deleted to SVN_INVALID_REVNUM. 01797 * Use @a pool for memory allocation. 01798 * 01799 * @since New in 1.5. 01800 */ 01801 svn_error_t * 01802 svn_repos_deleted_rev(svn_fs_t *fs, 01803 const char *path, 01804 svn_revnum_t start, 01805 svn_revnum_t end, 01806 svn_revnum_t *deleted, 01807 apr_pool_t *pool); 01808 01809 01810 /** Callback type for use with svn_repos_history(). @a path and @a 01811 * revision represent interesting history locations in the lifetime 01812 * of the path passed to svn_repos_history(). @a baton is the same 01813 * baton given to svn_repos_history(). @a pool is provided for the 01814 * convenience of the implementor, who should not expect it to live 01815 * longer than a single callback call. 01816 * 01817 * Signal to callback driver to stop processing/invoking this callback 01818 * by returning the #SVN_ERR_CEASE_INVOCATION error code. 01819 * 01820 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 01821 */ 01822 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton, 01823 const char *path, 01824 svn_revnum_t revision, 01825 apr_pool_t *pool); 01826 01827 /** 01828 * Call @a history_func (with @a history_baton) for each interesting 01829 * history location in the lifetime of @a path in @a fs, from the 01830 * youngest of @a end and @a start to the oldest. Stop processing if 01831 * @a history_func returns #SVN_ERR_CEASE_INVOCATION. Only cross 01832 * filesystem copy history if @a cross_copies is @c TRUE. And do all 01833 * of this in @a pool. 01834 * 01835 * If @a authz_read_func is non-NULL, then use it (and @a 01836 * authz_read_baton) to verify that @a path in @a end is readable; if 01837 * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability 01838 * of every ancestral path/revision pair before pushing them at @a 01839 * history_func. If a pair is deemed unreadable, then do not send 01840 * them; instead, immediately stop traversing history and return 01841 * SVN_NO_ERROR. 01842 * 01843 * @since New in 1.1. 01844 * 01845 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 01846 */ 01847 svn_error_t * 01848 svn_repos_history2(svn_fs_t *fs, 01849 const char *path, 01850 svn_repos_history_func_t history_func, 01851 void *history_baton, 01852 svn_repos_authz_func_t authz_read_func, 01853 void *authz_read_baton, 01854 svn_revnum_t start, 01855 svn_revnum_t end, 01856 svn_boolean_t cross_copies, 01857 apr_pool_t *pool); 01858 01859 /** 01860 * Similar to svn_repos_history2(), but with @a authz_read_func 01861 * and @a authz_read_baton always set to NULL. 01862 * 01863 * @deprecated Provided for backward compatibility with the 1.0 API. 01864 */ 01865 SVN_DEPRECATED 01866 svn_error_t * 01867 svn_repos_history(svn_fs_t *fs, 01868 const char *path, 01869 svn_repos_history_func_t history_func, 01870 void *history_baton, 01871 svn_revnum_t start, 01872 svn_revnum_t end, 01873 svn_boolean_t cross_copies, 01874 apr_pool_t *pool); 01875 01876 01877 /** 01878 * Set @a *locations to be a mapping of the revisions to the paths of 01879 * the file @a fs_path present at the repository in revision 01880 * @a peg_revision, where the revisions are taken out of the array 01881 * @a location_revisions. 01882 * 01883 * @a location_revisions is an array of svn_revnum_t's and @a *locations 01884 * maps 'svn_revnum_t *' to 'const char *'. 01885 * 01886 * If optional @a authz_read_func is non-NULL, then use it (and @a 01887 * authz_read_baton) to verify that the peg-object is readable. If not, 01888 * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func 01889 * to check that every path returned in the hash is readable. If an 01890 * unreadable path is encountered, stop tracing and return 01891 * SVN_NO_ERROR. 01892 * 01893 * @a pool is used for all allocations. 01894 * 01895 * @since New in 1.1. 01896 */ 01897 svn_error_t * 01898 svn_repos_trace_node_locations(svn_fs_t *fs, 01899 apr_hash_t **locations, 01900 const char *fs_path, 01901 svn_revnum_t peg_revision, 01902 const apr_array_header_t *location_revisions, 01903 svn_repos_authz_func_t authz_read_func, 01904 void *authz_read_baton, 01905 apr_pool_t *pool); 01906 01907 01908 /** 01909 * Call @a receiver and @a receiver_baton to report successive 01910 * location segments in revisions between @a start_rev and @a end_rev 01911 * (inclusive) for the line of history identified by the peg-object @a 01912 * path in @a peg_revision (and in @a repos). 01913 * 01914 * @a end_rev may be #SVN_INVALID_REVNUM to indicate that you want 01915 * to trace the history of the object to its origin. 01916 * 01917 * @a start_rev may be #SVN_INVALID_REVNUM to indicate "the HEAD 01918 * revision". Otherwise, @a start_rev must be younger than @a end_rev 01919 * (unless @a end_rev is #SVN_INVALID_REVNUM). 01920 * 01921 * @a peg_revision may be #SVN_INVALID_REVNUM to indicate "the HEAD 01922 * revision", and must evaluate to be at least as young as @a start_rev. 01923 * 01924 * If optional @a authz_read_func is not @c NULL, then use it (and @a 01925 * authz_read_baton) to verify that the peg-object is readable. If 01926 * not, return #SVN_ERR_AUTHZ_UNREADABLE. Also use the @a 01927 * authz_read_func to check that every path reported in a location 01928 * segment is readable. If an unreadable path is encountered, report 01929 * a final (possibly truncated) location segment (if any), stop 01930 * tracing history, and return #SVN_NO_ERROR. 01931 * 01932 * @a pool is used for all allocations. 01933 * 01934 * @since New in 1.5. 01935 */ 01936 svn_error_t * 01937 svn_repos_node_location_segments(svn_repos_t *repos, 01938 const char *path, 01939 svn_revnum_t peg_revision, 01940 svn_revnum_t start_rev, 01941 svn_revnum_t end_rev, 01942 svn_location_segment_receiver_t receiver, 01943 void *receiver_baton, 01944 svn_repos_authz_func_t authz_read_func, 01945 void *authz_read_baton, 01946 apr_pool_t *pool); 01947 01948 01949 /* ---------------------------------------------------------------*/ 01950 01951 /* Retrieving log messages. */ 01952 01953 /** Path change descriptor. 01954 * 01955 * @note Identical to #svn_fs_path_change3_t but with all information 01956 * known, i.e. @a node_kind is never #svn_node_unknown and 01957 * @a copyfrom_known is always @c TRUE. 01958 * 01959 * @note To allow for extending this structure in future releases, 01960 * always use svn_repos_path_change_create() to allocate the stucture. 01961 * 01962 * @see svn_fs_path_change3_t 01963 * 01964 * @since New in 1.10. 01965 */ 01966 typedef svn_fs_path_change3_t svn_repos_path_change_t; 01967 01968 /** 01969 * Return an #svn_repos_path_change_t structure, allocated in @a result_pool, 01970 * with all fields initialized to their respective null/none/empty/invalid 01971 * values. 01972 * 01973 * @note To allow for extending the #svn_repos_path_change_t structure in 01974 * future releases, this function should always be used to allocate it. 01975 * 01976 * @since New in 1.10. 01977 */ 01978 svn_repos_path_change_t * 01979 svn_repos_path_change_create(apr_pool_t *result_pool); 01980 01981 /** 01982 * Return a deep copy of @a change, allocated in @a result_pool. 01983 * 01984 * @since New in 1.10. 01985 */ 01986 svn_repos_path_change_t * 01987 svn_repos_path_change_dup(svn_repos_path_change_t *change, 01988 apr_pool_t *result_pool); 01989 01990 /** The callback invoked by log message loopers, such as 01991 * svn_repos_get_logs5(). 01992 * 01993 * This function is invoked once on each changed path, in a potentially 01994 * random order that may even change between invocations for the same 01995 * revisions. 01996 * 01997 * @a baton is what you think it is, and @a change contains relevant 01998 * information for the changed path. Please note that @a change may be 01999 * modified within this callback but it will become invalid as soon as 02000 * the callback returns. 02001 * 02002 * Use @a scratch_pool for temporary allocation. The caller may clear it 02003 * between or after invocations. 02004 * 02005 * @since New in 1.10. 02006 */ 02007 typedef svn_error_t *(*svn_repos_path_change_receiver_t)( 02008 void *baton, 02009 svn_repos_path_change_t *change, 02010 apr_pool_t *scratch_pool); 02011 02012 02013 /** 02014 * A structure to represent all the information about a particular log entry. 02015 * 02016 * @note To allow for extending this structure in future releases, 02017 * always use svn_repos_log_entry_create() to allocate the stucture. 02018 * 02019 * @since New in 1.10. 02020 */ 02021 typedef struct svn_repos_log_entry_t 02022 { 02023 /** The revision of the commit. */ 02024 svn_revnum_t revision; 02025 02026 /** The hash of requested revision properties, which may be NULL if it 02027 * would contain no revprops. Maps (const char *) property name to 02028 * (svn_string_t *) property value. */ 02029 apr_hash_t *revprops; 02030 02031 /** 02032 * Whether or not this message has children. 02033 * 02034 * When a log operation requests additional merge information, extra log 02035 * entries may be returned as a result of this entry. The new entries, are 02036 * considered children of the original entry, and will follow it. When 02037 * the HAS_CHILDREN flag is set, the receiver should increment its stack 02038 * depth, and wait until an entry is provided with SVN_INVALID_REVNUM which 02039 * indicates the end of the children. 02040 * 02041 * For log operations which do not request additional merge information, the 02042 * HAS_CHILDREN flag is always FALSE. 02043 * 02044 * For more information see: 02045 * https://svn.apache.org/repos/asf/subversion/trunk/notes/merge-tracking/design.html#commutative-reporting 02046 */ 02047 svn_boolean_t has_children; 02048 02049 /** 02050 * Whether @a revision should be interpreted as non-inheritable in the 02051 * same sense of #svn_merge_range_t. 02052 * 02053 * Currently always FALSE. 02054 */ 02055 svn_boolean_t non_inheritable; 02056 02057 /** 02058 * Whether @a revision is a merged revision resulting from a reverse merge. 02059 */ 02060 svn_boolean_t subtractive_merge; 02061 02062 /* NOTE: Add new fields at the end to preserve binary compatibility. */ 02063 } svn_repos_log_entry_t; 02064 02065 /** 02066 * Return an #svn_repos_log_entry_t, allocated in @a result_pool, 02067 * with all fields initialized to their respective null/none/empty/invalid 02068 * values. 02069 * 02070 * @note To allow for extending the #svn_repos_log_entry_t structure in 02071 * future releases, this function should always be used to allocate it. 02072 * 02073 * @since New in 1.10. 02074 */ 02075 svn_repos_log_entry_t * 02076 svn_repos_log_entry_create(apr_pool_t *result_pool); 02077 02078 /** Return a deep copy of @a log_entry, allocated in @a result_pool. 02079 * 02080 * @since New in 1.10. 02081 */ 02082 svn_repos_log_entry_t * 02083 svn_repos_log_entry_dup(const svn_repos_log_entry_t *log_entry, 02084 apr_pool_t *result_pool); 02085 02086 02087 /** The callback invoked by log message loopers, such as 02088 * svn_repos_get_logs5(). 02089 * 02090 * This function is invoked once on each log message, in the order 02091 * determined by the caller (see above-mentioned functions). 02092 * 02093 * @a baton is what you think it is, and @a log_entry contains relevant 02094 * information for the log message. 02095 * 02096 * If @a log_entry->has_children is @c TRUE, the message will be followed 02097 * immediately by any number of merged revisions (child messages), which are 02098 * terminated by an invocation with SVN_INVALID_REVNUM. This usage may 02099 * be recursive. 02100 * 02101 * Use @a scratch_pool for temporary allocation. The caller may clear it 02102 * between or after invocations. 02103 * 02104 * @since New in 1.10. 02105 */ 02106 typedef svn_error_t *(*svn_repos_log_entry_receiver_t)( 02107 void *baton, 02108 svn_repos_log_entry_t *log_entry, 02109 apr_pool_t *scratch_pool); 02110 02111 02112 /** 02113 * Invoke @a revision_receiver with @a revision_receiver_baton on each 02114 * revision from @a start to @a end in @a repos's filesystem. @a start may 02115 * be greater or less than @a end; this just controls whether the log is 02116 * processed in descending or ascending revision number order. 02117 * 02118 * If not @c NULL, @a path_change_receiver will be invoked with 02119 * @a path_change_receiver_baton for each changed path in the respective 02120 * revision. These changes will be reported before the @a revision_receiver 02121 * is invoked for that revision. So, for each revision in the log, there 02122 * is a number of calls to @a path_change_receiver followed by a single 02123 * invocation of @a revision_receiver, implicitly marking the end of the 02124 * changes list for that revision. If a revision does not contain any 02125 * changes (or if none are visible due to @a authz_read_func), 02126 * @a path_change_receiver will not be called for that revision. 02127 * 02128 * If @a start or @a end is #SVN_INVALID_REVNUM, it defaults to youngest. 02129 * 02130 * If @a paths is non-NULL and has one or more elements, then only show 02131 * revisions in which at least one of @a paths was changed (i.e., if 02132 * file, text or props changed; if dir, props or entries changed or any node 02133 * changed below it). Each path is a <tt>const char *</tt> representing 02134 * an absolute path in the repository. If @a paths is NULL or empty, 02135 * show all revisions regardless of what paths were changed in those 02136 * revisions. 02137 * 02138 * If @a limit is greater than zero then only invoke @a revision_receiver 02139 * on the first @a limit logs. 02140 * 02141 * If @a strict_node_history is set, copy history (if any exists) will 02142 * not be traversed while harvesting revision logs for each path. 02143 * 02144 * If @a include_merged_revisions is set, log information for revisions 02145 * which have been merged to @a paths will also be returned, unless these 02146 * revisions are already part of @a start to @a end in @a repos's 02147 * filesystem, as limited by @a paths. In the latter case those revisions 02148 * are skipped and @a receiver is not invoked. 02149 * 02150 * If @a revprops is NULL, retrieve all revision properties; else, retrieve 02151 * only the revision properties named by the (const char *) array elements 02152 * (i.e. retrieve none if the array is empty). 02153 * 02154 * If any invocation of @a revision_receiver or @a path_change_receiver 02155 * returnn an error, return that error immediately and without wrapping it. 02156 * 02157 * If @a start or @a end is a non-existent revision, return the error 02158 * #SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a revision_receiver. 02159 * 02160 * If optional @a authz_read_func is non-NULL, then use this function 02161 * (along with optional @a authz_read_baton) to check the readability 02162 * of each changed-path in each revision about to be "pushed" at 02163 * @a path_change_receiver. If a revision has some changed-paths readable 02164 * and others unreadable, unreadable paths are omitted from the 02165 * @a path_change_receiver invocations and only svn:author and svn:date 02166 * will be available in the revprops field in the @a revision_receiver 02167 * callback. If a revision has no changed-paths readable at all, then all 02168 * paths are omitted and no revprops are available. If 02169 * @a path_change_receiver is @c NULL, the same filtering is performed 02170 * just without reporting any path changes. 02171 * 02172 * Use @a scratch_pool for temporary allocations. 02173 * 02174 * @see svn_repos_path_change_receiver_t, svn_repos_log_entry_receiver_t 02175 * 02176 * @since New in 1.10. 02177 */ 02178 svn_error_t * 02179 svn_repos_get_logs5(svn_repos_t *repos, 02180 const apr_array_header_t *paths, 02181 svn_revnum_t start, 02182 svn_revnum_t end, 02183 int limit, 02184 svn_boolean_t strict_node_history, 02185 svn_boolean_t include_merged_revisions, 02186 const apr_array_header_t *revprops, 02187 svn_repos_authz_func_t authz_read_func, 02188 void *authz_read_baton, 02189 svn_repos_path_change_receiver_t path_change_receiver, 02190 void *path_change_receiver_baton, 02191 svn_repos_log_entry_receiver_t revision_receiver, 02192 void *revision_receiver_baton, 02193 apr_pool_t *scratch_pool); 02194 02195 /** 02196 * Similar to svn_repos_get_logs5 but using a #svn_log_entry_receiver_t 02197 * @a receiver to receive revision properties and changed paths through a 02198 * single callback and the @a discover_changed_paths flag to control it. 02199 * 02200 * If @a discover_changed_paths, then each call to @a receiver passes a 02201 * hash mapping paths committed in that revision to information about them 02202 * as the receiver's @a changed_paths argument. 02203 * Otherwise, each call to @a receiver passes NULL for @a changed_paths. 02204 * 02205 * @see svn_log_entry_receiver_t 02206 * 02207 * @since New in 1.5. 02208 * 02209 * @deprecated Provided for backward compatibility with the 1.9 API. 02210 */ 02211 SVN_DEPRECATED 02212 svn_error_t * 02213 svn_repos_get_logs4(svn_repos_t *repos, 02214 const apr_array_header_t *paths, 02215 svn_revnum_t start, 02216 svn_revnum_t end, 02217 int limit, 02218 svn_boolean_t discover_changed_paths, 02219 svn_boolean_t strict_node_history, 02220 svn_boolean_t include_merged_revisions, 02221 const apr_array_header_t *revprops, 02222 svn_repos_authz_func_t authz_read_func, 02223 void *authz_read_baton, 02224 svn_log_entry_receiver_t receiver, 02225 void *receiver_baton, 02226 apr_pool_t *pool); 02227 02228 /** 02229 * Same as svn_repos_get_logs4(), but with @a receiver being 02230 * #svn_log_message_receiver_t instead of #svn_log_entry_receiver_t. 02231 * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is 02232 * svn:author, svn:date, and svn:log. If @a paths is empty, nothing 02233 * is returned. 02234 * 02235 * @since New in 1.2. 02236 * @deprecated Provided for backward compatibility with the 1.4 API. 02237 */ 02238 SVN_DEPRECATED 02239 svn_error_t * 02240 svn_repos_get_logs3(svn_repos_t *repos, 02241 const apr_array_header_t *paths, 02242 svn_revnum_t start, 02243 svn_revnum_t end, 02244 int limit, 02245 svn_boolean_t discover_changed_paths, 02246 svn_boolean_t strict_node_history, 02247 svn_repos_authz_func_t authz_read_func, 02248 void *authz_read_baton, 02249 svn_log_message_receiver_t receiver, 02250 void *receiver_baton, 02251 apr_pool_t *pool); 02252 02253 02254 /** 02255 * Same as svn_repos_get_logs3(), but with @a limit always set to 0. 02256 * 02257 * @deprecated Provided for backward compatibility with the 1.1 API. 02258 */ 02259 SVN_DEPRECATED 02260 svn_error_t * 02261 svn_repos_get_logs2(svn_repos_t *repos, 02262 const apr_array_header_t *paths, 02263 svn_revnum_t start, 02264 svn_revnum_t end, 02265 svn_boolean_t discover_changed_paths, 02266 svn_boolean_t strict_node_history, 02267 svn_repos_authz_func_t authz_read_func, 02268 void *authz_read_baton, 02269 svn_log_message_receiver_t receiver, 02270 void *receiver_baton, 02271 apr_pool_t *pool); 02272 02273 /** 02274 * Same as svn_repos_get_logs2(), but with @a authz_read_func and 02275 * @a authz_read_baton always set to NULL. 02276 * 02277 * @deprecated Provided for backward compatibility with the 1.0 API. 02278 */ 02279 SVN_DEPRECATED 02280 svn_error_t * 02281 svn_repos_get_logs(svn_repos_t *repos, 02282 const apr_array_header_t *paths, 02283 svn_revnum_t start, 02284 svn_revnum_t end, 02285 svn_boolean_t discover_changed_paths, 02286 svn_boolean_t strict_node_history, 02287 svn_log_message_receiver_t receiver, 02288 void *receiver_baton, 02289 apr_pool_t *pool); 02290 02291 02292 02293 /* ---------------------------------------------------------------*/ 02294 02295 /* Retrieving mergeinfo. */ 02296 02297 /** Receives parsed @a mergeinfo for the file system path @a path. 02298 * 02299 * The user-provided @a baton is being passed through by the retrieval 02300 * function and @a scratch_pool will be cleared between invocations. 02301 * 02302 * @since New in 1.10. 02303 */ 02304 typedef svn_fs_mergeinfo_receiver_t svn_repos_mergeinfo_receiver_t; 02305 02306 /** 02307 * For each node found with mergeinfo on it, invoke @a receiver with 02308 * the provided @a receiver_baton. 02309 * 02310 * The paths in @a paths start with '/'. 02311 * 02312 * @a inherit indicates whether explicit, explicit or inherited, or 02313 * only inherited mergeinfo for @a paths is fetched. 02314 * 02315 * If @a revision is #SVN_INVALID_REVNUM, it defaults to youngest. 02316 * 02317 * If @a include_descendants is TRUE, then additionally return the 02318 * mergeinfo for any descendant of any element of @a paths which has 02319 * the #SVN_PROP_MERGEINFO property explicitly set on it. (Note 02320 * that inheritance is only taken into account for the elements in @a 02321 * paths; descendants of the elements in @a paths which get their 02322 * mergeinfo via inheritance are not reported to @a receiver.) 02323 * 02324 * If optional @a authz_read_func is non-NULL, then use this function 02325 * (along with optional @a authz_read_baton) to check the readability 02326 * of each path which mergeinfo was requested for (from @a paths). 02327 * Silently omit unreadable paths from the request for mergeinfo. 02328 * 02329 * Use @a scratch_pool for temporary allocations. 02330 * 02331 * @since New in 1.10. 02332 */ 02333 svn_error_t * 02334 svn_repos_fs_get_mergeinfo2(svn_repos_t *repos, 02335 const apr_array_header_t *paths, 02336 svn_revnum_t revision, 02337 svn_mergeinfo_inheritance_t inherit, 02338 svn_boolean_t include_descendants, 02339 svn_repos_authz_func_t authz_read_func, 02340 void *authz_read_baton, 02341 svn_repos_mergeinfo_receiver_t receiver, 02342 void *receiver_baton, 02343 apr_pool_t *scratch_pool); 02344 02345 /** 02346 * Same as svn_repos_fs_get_mergeinfo2(), but all mergeinfo is being collected 02347 * and returned in @a *catalog. It will never be @c NULL, but may be empty. 02348 * 02349 * @since New in 1.5. 02350 * 02351 * @deprecated Provided for backward compatibility with the 1.9 API. 02352 */ 02353 SVN_DEPRECATED 02354 svn_error_t * 02355 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog, 02356 svn_repos_t *repos, 02357 const apr_array_header_t *paths, 02358 svn_revnum_t revision, 02359 svn_mergeinfo_inheritance_t inherit, 02360 svn_boolean_t include_descendants, 02361 svn_repos_authz_func_t authz_read_func, 02362 void *authz_read_baton, 02363 apr_pool_t *pool); 02364 02365 02366 /* ---------------------------------------------------------------*/ 02367 02368 /* Retrieving multiple revisions of a file. */ 02369 02370 /** 02371 * Retrieve a subset of the interesting revisions of a file @a path in 02372 * @a repos as seen in revision @a end. Invoke @a handler with 02373 * @a handler_baton as its first argument for each such revision. 02374 * @a pool is used for all allocations. See svn_fs_history_prev() for 02375 * a discussion of interesting revisions. 02376 * 02377 * If optional @a authz_read_func is non-NULL, then use this function 02378 * (along with optional @a authz_read_baton) to check the readability 02379 * of the rev-path in each interesting revision encountered. 02380 * 02381 * Revision discovery happens from @a end to @a start, and if an 02382 * unreadable revision is encountered before @a start is reached, then 02383 * revision discovery stops and only the revisions from @a end to the 02384 * oldest readable revision are returned (So it will appear that @a 02385 * path was added without history in the latter revision). 02386 * 02387 * If there is an interesting revision of the file that is less than or 02388 * equal to start, the iteration will start at that revision. Else, the 02389 * iteration will start at the first revision of the file in the repository, 02390 * which has to be less than or equal to end. Note that if the function 02391 * succeeds, @a handler will have been called at least once. 02392 * 02393 * In a series of calls, the file contents for the first interesting revision 02394 * will be provided as a text delta against the empty file. In the following 02395 * calls, the delta will be against the contents for the previous call. 02396 * 02397 * If @a include_merged_revisions is TRUE, revisions which a included as a 02398 * result of a merge between @a start and @a end will be included. 02399 * 02400 * Since Subversion 1.8 this function has been enabled to support reversion 02401 * the revision range for @a include_merged_revision @c FALSE reporting by 02402 * switching @a start with @a end. 02403 * 02404 * @note Prior to Subversion 1.9, this function may request delta handlers 02405 * from @a handler even for empty text deltas. Starting with 1.9, the 02406 * delta handler / baton return arguments passed to @a handler will be 02407 * #NULL unless there is an actual difference in the file contents between 02408 * the current and the previous call. 02409 * 02410 * @since New in 1.5. 02411 */ 02412 svn_error_t * 02413 svn_repos_get_file_revs2(svn_repos_t *repos, 02414 const char *path, 02415 svn_revnum_t start, 02416 svn_revnum_t end, 02417 svn_boolean_t include_merged_revisions, 02418 svn_repos_authz_func_t authz_read_func, 02419 void *authz_read_baton, 02420 svn_file_rev_handler_t handler, 02421 void *handler_baton, 02422 apr_pool_t *pool); 02423 02424 /** 02425 * Similar to #svn_file_rev_handler_t, but without the @a 02426 * result_of_merge parameter. 02427 * 02428 * @deprecated Provided for backward compatibility with 1.4 API. 02429 * @since New in 1.1. 02430 */ 02431 typedef svn_error_t *(*svn_repos_file_rev_handler_t) 02432 (void *baton, 02433 const char *path, 02434 svn_revnum_t rev, 02435 apr_hash_t *rev_props, 02436 svn_txdelta_window_handler_t *delta_handler, 02437 void **delta_baton, 02438 apr_array_header_t *prop_diffs, 02439 apr_pool_t *pool); 02440 02441 /** 02442 * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions 02443 * set to FALSE. 02444 * 02445 * @deprecated Provided for backward compatibility with the 1.4 API. 02446 * @since New in 1.1. 02447 */ 02448 SVN_DEPRECATED 02449 svn_error_t * 02450 svn_repos_get_file_revs(svn_repos_t *repos, 02451 const char *path, 02452 svn_revnum_t start, 02453 svn_revnum_t end, 02454 svn_repos_authz_func_t authz_read_func, 02455 void *authz_read_baton, 02456 svn_repos_file_rev_handler_t handler, 02457 void *handler_baton, 02458 apr_pool_t *pool); 02459 02460 02461 /* ---------------------------------------------------------------*/ 02462 02463 /** 02464 * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \ 02465 * routines. 02466 * @{ 02467 */ 02468 02469 /** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and 02470 * post-commit hooks around the commit. Use @a pool for any necessary 02471 * allocations. 02472 * 02473 * If the pre-commit hook fails, do not attempt to commit the 02474 * transaction and throw the original error to the caller. 02475 * 02476 * A successful commit is indicated by a valid revision value in @a 02477 * *new_rev, not if svn_fs_commit_txn() returns an error, which can 02478 * occur during its post commit FS processing. If the transaction was 02479 * not committed, then return the associated error and do not execute 02480 * the post-commit hook. 02481 * 02482 * If the commit succeeds the post-commit hook is executed. If the 02483 * post-commit hook returns an error, always wrap it with 02484 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to 02485 * find the post-commit hook error in the returned error chain. If 02486 * both svn_fs_commit_txn() and the post-commit hook return errors, 02487 * then svn_fs_commit_txn()'s error is the parent error and the 02488 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child 02489 * error. 02490 * 02491 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn(). 02492 */ 02493 svn_error_t * 02494 svn_repos_fs_commit_txn(const char **conflict_p, 02495 svn_repos_t *repos, 02496 svn_revnum_t *new_rev, 02497 svn_fs_txn_t *txn, 02498 apr_pool_t *pool); 02499 02500 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping 02501 * <tt>const char *</tt> property names to #svn_string_t values, to 02502 * set the properties on transaction @a *txn_p. @a repos is the 02503 * repository object which contains the filesystem. @a rev, @a 02504 * *txn_p, and @a pool are as in svn_fs_begin_txn(). 02505 * 02506 * Before a txn is created, the repository's start-commit hooks are 02507 * run; if any of them fail, no txn is created, @a *txn_p is unaffected, 02508 * and #SVN_ERR_REPOS_HOOK_FAILURE is returned. 02509 * 02510 * @note @a revprop_table may contain an #SVN_PROP_REVISION_DATE property, 02511 * which will be set on the transaction, but that will be overwritten 02512 * when the transaction is committed. 02513 * 02514 * @since New in 1.5. 02515 */ 02516 svn_error_t * 02517 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p, 02518 svn_repos_t *repos, 02519 svn_revnum_t rev, 02520 apr_hash_t *revprop_table, 02521 apr_pool_t *pool); 02522 02523 02524 /** 02525 * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table 02526 * set to a hash containing @a author and @a log_msg as the 02527 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties, 02528 * respectively. @a author and @a log_msg may both be @c NULL. 02529 * 02530 * @deprecated Provided for backward compatibility with the 1.4 API. 02531 */ 02532 SVN_DEPRECATED 02533 svn_error_t * 02534 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p, 02535 svn_repos_t *repos, 02536 svn_revnum_t rev, 02537 const char *author, 02538 const char *log_msg, 02539 apr_pool_t *pool); 02540 02541 02542 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding 02543 * property on transaction @a *txn_p. @a repos is the repository object 02544 * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in 02545 * svn_fs_begin_txn(). 02546 * 02547 * ### Someday: before a txn is created, some kind of read-hook could 02548 * be called here. 02549 * 02550 * @note This function was never fully implemented, nor used. Ignore it. 02551 * @deprecated Provided for backward compatibility with the 1.7 API. 02552 */ 02553 SVN_DEPRECATED 02554 svn_error_t * 02555 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p, 02556 svn_repos_t *repos, 02557 svn_revnum_t rev, 02558 const char *author, 02559 apr_pool_t *pool); 02560 02561 02562 /** @} */ 02563 02564 /** @defgroup svn_repos_fs_locks Repository lock wrappers 02565 * @{ 02566 */ 02567 02568 /** Like svn_fs_lock_many(), but invoke the @a repos's pre- and 02569 * post-lock hooks before and after the locking action. 02570 * 02571 * The pre-lock is run for every path in @a targets. Those targets for 02572 * which the pre-lock is successful are passed to svn_fs_lock_many and 02573 * the post-lock is run for those that are successfully locked. 02574 * Pre-lock hook errors are passed to @a lock_callback. 02575 * 02576 * For each path in @a targets @a lock_callback will be invoked 02577 * passing @a lock_baton and the lock and error that apply to path. 02578 * @a lock_callback can be NULL in which case it is not called and any 02579 * errors that would have been passed to the callback are not reported. 02580 * 02581 * If an error occurs when running the post-lock hook the error is 02582 * returned wrapped with #SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the 02583 * caller sees this error, it knows that some locks succeeded. 02584 * 02585 * The pre-lock hook may cause a different token to be used for the 02586 * lock, instead of the token supplied; see the pre-lock-hook 02587 * documentation for more. 02588 * 02589 * The lock and path passed to @a lock_callback will be allocated in 02590 * @a result_pool. Use @a scratch_pool for temporary allocations. 02591 * 02592 * @note This function is not atomic. If it returns an error, some targets 02593 * may remain unlocked while others may have been locked. 02594 * 02595 * @see svn_fs_lock_many 02596 * 02597 * @since New in 1.9. 02598 */ 02599 svn_error_t * 02600 svn_repos_fs_lock_many(svn_repos_t *repos, 02601 apr_hash_t *lock_targets, 02602 const char *comment, 02603 svn_boolean_t is_dav_comment, 02604 apr_time_t expiration_date, 02605 svn_boolean_t steal_lock, 02606 svn_fs_lock_callback_t lock_callback, 02607 void *lock_baton, 02608 apr_pool_t *result_pool, 02609 apr_pool_t *scratch_pool); 02610 02611 /** Similar to svn_repos_fs_lock_many() but locks only a single path. 02612 * 02613 * @since New in 1.2. 02614 */ 02615 svn_error_t * 02616 svn_repos_fs_lock(svn_lock_t **lock, 02617 svn_repos_t *repos, 02618 const char *path, 02619 const char *token, 02620 const char *comment, 02621 svn_boolean_t is_dav_comment, 02622 apr_time_t expiration_date, 02623 svn_revnum_t current_rev, 02624 svn_boolean_t steal_lock, 02625 apr_pool_t *pool); 02626 02627 02628 /** Like svn_fs_unlock_many(), but invoke the @a repos's pre- and 02629 * post-unlock hooks before and after the unlocking action. 02630 * 02631 * The pre-unlock hook is run for every path in @a targets. Those 02632 * targets for which the pre-unlock is successful are passed to 02633 * svn_fs_unlock_many and the post-unlock is run for those that are 02634 * successfully unlocked. Pre-unlock hook errors are passed to @a 02635 * lock_callback. 02636 * 02637 * For each path in @a targets @a lock_callback will be invoked 02638 * passing @a lock_baton and error that apply to path. The lock 02639 * passed to the callback will be NULL. @a lock_callback can be NULL 02640 * in which case it is not called and any errors that would have been 02641 * passed to the callback are not reported. 02642 * 02643 * If an error occurs when running the post-unlock hook, return the 02644 * original error wrapped with #SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. 02645 * If the caller sees this error, it knows that some unlocks 02646 * succeeded. 02647 * 02648 * The path passed to @a lock_callback will be allocated in @a result_pool. 02649 * Use @a scratch_pool for temporary allocations. 02650 * 02651 * @note This function is not atomic. If it returns an error, some targets 02652 * may remain locked while others may have been unlocked. 02653 * 02654 * @see svn_fs_unlock_many 02655 * 02656 * @since New in 1.9. 02657 */ 02658 svn_error_t * 02659 svn_repos_fs_unlock_many(svn_repos_t *repos, 02660 apr_hash_t *unlock_targets, 02661 svn_boolean_t break_lock, 02662 svn_fs_lock_callback_t lock_callback, 02663 void *lock_baton, 02664 apr_pool_t *result_pool, 02665 apr_pool_t *scratch_pool); 02666 02667 /** Similar to svn_repos_fs_unlock_many() but only unlocks a single path. 02668 * 02669 * @since New in 1.2. 02670 */ 02671 svn_error_t * 02672 svn_repos_fs_unlock(svn_repos_t *repos, 02673 const char *path, 02674 const char *token, 02675 svn_boolean_t break_lock, 02676 apr_pool_t *pool); 02677 02678 02679 02680 /** Look up all the locks in and under @a path in @a repos, setting @a 02681 * *locks to a hash which maps <tt>const char *</tt> paths to the 02682 * #svn_lock_t locks associated with those paths. Use @a 02683 * authz_read_func and @a authz_read_baton to "screen" all returned 02684 * locks. That is: do not return any locks on any paths that are 02685 * unreadable in HEAD, just silently omit them. 02686 * 02687 * @a depth limits the returned locks to those associated with paths 02688 * within the specified depth of @a path, and must be one of the 02689 * following values: #svn_depth_empty, #svn_depth_files, 02690 * #svn_depth_immediates, or #svn_depth_infinity. 02691 * 02692 * @since New in 1.7. 02693 */ 02694 svn_error_t * 02695 svn_repos_fs_get_locks2(apr_hash_t **locks, 02696 svn_repos_t *repos, 02697 const char *path, 02698 svn_depth_t depth, 02699 svn_repos_authz_func_t authz_read_func, 02700 void *authz_read_baton, 02701 apr_pool_t *pool); 02702 02703 /** 02704 * Similar to svn_repos_fs_get_locks2(), but with @a depth always 02705 * passed as svn_depth_infinity. 02706 * 02707 * @since New in 1.2. 02708 * @deprecated Provided for backward compatibility with the 1.6 API. 02709 */ 02710 SVN_DEPRECATED 02711 svn_error_t * 02712 svn_repos_fs_get_locks(apr_hash_t **locks, 02713 svn_repos_t *repos, 02714 const char *path, 02715 svn_repos_authz_func_t authz_read_func, 02716 void *authz_read_baton, 02717 apr_pool_t *pool); 02718 02719 /** @} */ 02720 02721 /** @defgroup svn_repos_properties Versioned and Unversioned Properties 02722 * 02723 * Prop-changing and prop-reading wrappers for libsvn_fs routines. 02724 * @{ 02725 */ 02726 02727 /** 02728 * Like svn_fs_change_rev_prop2(), but validate the name and value of the 02729 * property and invoke the @a repos's pre- and post-revprop-change hooks 02730 * around the change as specified by @a use_pre_revprop_change_hook and 02731 * @a use_post_revprop_change_hook (respectively). 02732 * 02733 * @a rev is the revision whose property to change, @a name is the 02734 * name of the property, and @a new_value is the new value of the 02735 * property. If @a old_value_p is not @c NULL, then @a *old_value_p 02736 * is the expected current (preexisting) value of the property (or @c NULL 02737 * for "unset"). @a author is the authenticated username of the person 02738 * changing the property value, or NULL if not available. 02739 * 02740 * If @a authz_read_func is non-NULL, then use it (with @a 02741 * authz_read_baton) to validate the changed-paths associated with @a 02742 * rev. If the revision contains any unreadable changed paths, then 02743 * return #SVN_ERR_AUTHZ_UNREADABLE. 02744 * 02745 * Validate @a name and @a new_value like the same way 02746 * svn_repos_fs_change_node_prop() does. 02747 * 02748 * Use @a pool for temporary allocations. 02749 * 02750 * @since New in 1.7. 02751 */ 02752 svn_error_t * 02753 svn_repos_fs_change_rev_prop4(svn_repos_t *repos, 02754 svn_revnum_t rev, 02755 const char *author, 02756 const char *name, 02757 const svn_string_t *const *old_value_p, 02758 const svn_string_t *new_value, 02759 svn_boolean_t use_pre_revprop_change_hook, 02760 svn_boolean_t use_post_revprop_change_hook, 02761 svn_repos_authz_func_t authz_read_func, 02762 void *authz_read_baton, 02763 apr_pool_t *pool); 02764 02765 /** 02766 * Similar to svn_repos_fs_change_rev_prop4(), but with @a old_value_p always 02767 * set to @c NULL. (In other words, it is similar to 02768 * svn_fs_change_rev_prop().) 02769 * 02770 * @deprecated Provided for backward compatibility with the 1.6 API. 02771 * @since New in 1.5. 02772 */ 02773 SVN_DEPRECATED 02774 svn_error_t * 02775 svn_repos_fs_change_rev_prop3(svn_repos_t *repos, 02776 svn_revnum_t rev, 02777 const char *author, 02778 const char *name, 02779 const svn_string_t *new_value, 02780 svn_boolean_t use_pre_revprop_change_hook, 02781 svn_boolean_t use_post_revprop_change_hook, 02782 svn_repos_authz_func_t authz_read_func, 02783 void *authz_read_baton, 02784 apr_pool_t *pool); 02785 02786 /** 02787 * Similar to svn_repos_fs_change_rev_prop3(), but with the @a 02788 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook 02789 * always set to @c TRUE. 02790 * 02791 * @deprecated Provided for backward compatibility with the 1.4 API. 02792 */ 02793 SVN_DEPRECATED 02794 svn_error_t * 02795 svn_repos_fs_change_rev_prop2(svn_repos_t *repos, 02796 svn_revnum_t rev, 02797 const char *author, 02798 const char *name, 02799 const svn_string_t *new_value, 02800 svn_repos_authz_func_t authz_read_func, 02801 void *authz_read_baton, 02802 apr_pool_t *pool); 02803 02804 /** 02805 * Similar to svn_repos_fs_change_rev_prop2(), but with the 02806 * @a authz_read_func parameter always NULL. 02807 * 02808 * @deprecated Provided for backward compatibility with the 1.0 API. 02809 */ 02810 SVN_DEPRECATED 02811 svn_error_t * 02812 svn_repos_fs_change_rev_prop(svn_repos_t *repos, 02813 svn_revnum_t rev, 02814 const char *author, 02815 const char *name, 02816 const svn_string_t *new_value, 02817 apr_pool_t *pool); 02818 02819 02820 02821 /** 02822 * Set @a *value_p to the value of the property named @a propname on 02823 * revision @a rev in the filesystem opened in @a repos. If @a rev 02824 * has no property by that name, set @a *value_p to zero. Allocate 02825 * the result in @a pool. 02826 * 02827 * If @a authz_read_func is non-NULL, then use it (with @a 02828 * authz_read_baton) to validate the changed-paths associated with @a 02829 * rev. If the changed-paths are all unreadable, then set @a *value_p 02830 * to zero unconditionally. If only some of the changed-paths are 02831 * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be 02832 * fetched, but return 0 for any other property. 02833 * 02834 * @since New in 1.1. 02835 */ 02836 svn_error_t * 02837 svn_repos_fs_revision_prop(svn_string_t **value_p, 02838 svn_repos_t *repos, 02839 svn_revnum_t rev, 02840 const char *propname, 02841 svn_repos_authz_func_t authz_read_func, 02842 void *authz_read_baton, 02843 apr_pool_t *pool); 02844 02845 02846 /** 02847 * Set @a *table_p to the entire property list of revision @a rev in 02848 * filesystem opened in @a repos, as a hash table allocated in @a 02849 * pool. The table maps <tt>char *</tt> property names to 02850 * #svn_string_t * values; the names and values are allocated in @a 02851 * pool. 02852 * 02853 * If @a authz_read_func is non-NULL, then use it (with @a 02854 * authz_read_baton) to validate the changed-paths associated with @a 02855 * rev. If the changed-paths are all unreadable, then return an empty 02856 * hash. If only some of the changed-paths are unreadable, then return 02857 * an empty hash, except for 'svn:author' and 'svn:date' properties 02858 * (assuming those properties exist). 02859 * 02860 * @since New in 1.1. 02861 */ 02862 svn_error_t * 02863 svn_repos_fs_revision_proplist(apr_hash_t **table_p, 02864 svn_repos_t *repos, 02865 svn_revnum_t rev, 02866 svn_repos_authz_func_t authz_read_func, 02867 void *authz_read_baton, 02868 apr_pool_t *pool); 02869 02870 /** Validating wrapper for svn_fs_change_node_prop() (which see for 02871 * argument descriptions). 02872 * 02873 * If @a name's kind is not #svn_prop_regular_kind, return 02874 * #SVN_ERR_REPOS_BAD_ARGS. If @a name is an "svn:" property, validate its 02875 * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the 02876 * property. 02877 * 02878 * @note Originally, the only properties validated were the "svn:" properties 02879 * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. For the current 02880 * validation rules see the private function svn_repos__validate_prop(). 02881 */ 02882 svn_error_t * 02883 svn_repos_fs_change_node_prop(svn_fs_root_t *root, 02884 const char *path, 02885 const char *name, 02886 const svn_string_t *value, 02887 apr_pool_t *pool); 02888 02889 /** 02890 * Set @a *inherited_values to a depth-first ordered array of 02891 * #svn_prop_inherited_item_t * structures (the path_or_url members of 02892 * which are relative filesystem paths) representing the properties 02893 * inherited by @a path in @a root. If no properties are inherited, 02894 * then set @a *inherited_values to an empty array. 02895 * 02896 * if @a propname is NULL then retrieve all explicit and/or inherited 02897 * properties. Otherwise retrieve only the properties named @a propname. 02898 * 02899 * If optional @a authz_read_func is non-NULL, then use this function 02900 * (along with optional @a authz_read_baton) to check the readability 02901 * of each parent path from which properties are inherited. Silently omit 02902 * properties for unreadable parent paths. 02903 * 02904 * Allocate @a *inherited_props in @a result_pool. Use @a scratch_pool for 02905 * temporary allocations. 02906 * 02907 * @since New in 1.8. 02908 */ 02909 svn_error_t * 02910 svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props, 02911 svn_fs_root_t *root, 02912 const char *path, 02913 const char *propname, 02914 svn_repos_authz_func_t authz_read_func, 02915 void *authz_read_baton, 02916 apr_pool_t *result_pool, 02917 apr_pool_t *scratch_pool); 02918 02919 /** Validating wrapper for svn_fs_change_txn_prop() (which see for 02920 * argument descriptions). See svn_repos_fs_change_txn_props() for more 02921 * information. 02922 */ 02923 svn_error_t * 02924 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn, 02925 const char *name, 02926 const svn_string_t *value, 02927 apr_pool_t *pool); 02928 02929 /** Validating wrapper for svn_fs_change_txn_props() (which see for 02930 * argument descriptions). Validate properties and their values the 02931 * same way svn_repos_fs_change_node_prop() does. 02932 * 02933 * @since New in 1.5. 02934 */ 02935 svn_error_t * 02936 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn, 02937 const apr_array_header_t *props, 02938 apr_pool_t *pool); 02939 02940 /** @} */ 02941 02942 02943 /* ---------------------------------------------------------------*/ 02944 02945 /** 02946 * @defgroup svn_repos_inspection Data structures and editor things for \ 02947 * repository inspection. 02948 * @{ 02949 * 02950 * As it turns out, the svn_repos_replay2(), svn_repos_dir_delta2() and 02951 * svn_repos_begin_report3() interfaces can be extremely useful for 02952 * examining the repository, or more exactly, changes to the repository. 02953 * These drivers allows for differences between two trees to be 02954 * described using an editor. 02955 * 02956 * By using the editor obtained from svn_repos_node_editor() with one of 02957 * the drivers mentioned above, the description of how to transform one 02958 * tree into another can be used to build an in-memory linked-list tree, 02959 * which each node representing a repository node that was changed. 02960 */ 02961 02962 /** A node in the repository. */ 02963 typedef struct svn_repos_node_t 02964 { 02965 /** Node type (file, dir, etc.) */ 02966 svn_node_kind_t kind; 02967 02968 /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */ 02969 char action; 02970 02971 /** Were there any textual mods? (files only) */ 02972 svn_boolean_t text_mod; 02973 02974 /** Where there any property mods? */ 02975 svn_boolean_t prop_mod; 02976 02977 /** The name of this node as it appears in its parent's entries list */ 02978 const char *name; 02979 02980 /** The filesystem revision where this was copied from (if any) */ 02981 svn_revnum_t copyfrom_rev; 02982 02983 /** The filesystem path where this was copied from (if any) */ 02984 const char *copyfrom_path; 02985 02986 /** Pointer to the next sibling of this node */ 02987 struct svn_repos_node_t *sibling; 02988 02989 /** Pointer to the first child of this node */ 02990 struct svn_repos_node_t *child; 02991 02992 /** Pointer to the parent of this node */ 02993 struct svn_repos_node_t *parent; 02994 02995 } svn_repos_node_t; 02996 02997 02998 /** Set @a *editor and @a *edit_baton to an editor that, when driven by 02999 * a driver such as svn_repos_replay2(), builds an <tt>svn_repos_node_t *</tt> 03000 * tree representing the delta from @a base_root to @a root in @a 03001 * repos's filesystem. 03002 * 03003 * The editor can also be driven by svn_repos_dir_delta2() or 03004 * svn_repos_begin_report3(), but unless you have special needs, 03005 * svn_repos_replay2() is preferred. 03006 * 03007 * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root 03008 * node afterwards. 03009 * 03010 * Note that the delta includes "bubbled-up" directories; that is, 03011 * many of the directory nodes will have no prop_mods. 03012 * 03013 * Allocate the tree and its contents in @a node_pool; do all other 03014 * allocation in @a pool. 03015 */ 03016 svn_error_t * 03017 svn_repos_node_editor(const svn_delta_editor_t **editor, 03018 void **edit_baton, 03019 svn_repos_t *repos, 03020 svn_fs_root_t *base_root, 03021 svn_fs_root_t *root, 03022 apr_pool_t *node_pool, 03023 apr_pool_t *pool); 03024 03025 /** Return the root node of the linked-list tree generated by driving the 03026 * editor (associated with @a edit_baton) created by svn_repos_node_editor(). 03027 * This is only really useful if used *after* the editor drive is completed. 03028 */ 03029 svn_repos_node_t * 03030 svn_repos_node_from_baton(void *edit_baton); 03031 03032 /** 03033 * Return repository format information for @a repos. 03034 * 03035 * Set @a *repos_format to the repository format number of @a repos, which is 03036 * an integer that increases when incompatible changes are made (such as 03037 * by #svn_repos_upgrade2). 03038 * 03039 * Set @a *supports_version to the version number of the minimum Subversion 03040 * GA release that can read and write @a repos; allocate it in 03041 * @a result_pool. Use @a scratch_pool for temporary allocations. 03042 * 03043 * @see svn_fs_info_format, svn_repos_capabilities 03044 * 03045 * @since New in 1.9. 03046 */ 03047 svn_error_t * 03048 svn_repos_info_format(int *repos_format, 03049 svn_version_t **supports_version, 03050 svn_repos_t *repos, 03051 apr_pool_t *result_pool, 03052 apr_pool_t *scratch_pool); 03053 03054 /** @} */ 03055 03056 /* ---------------------------------------------------------------*/ 03057 03058 /** 03059 * @defgroup svn_repos_dump_load Dumping, loading and verifying filesystem data 03060 * @{ 03061 * 03062 * The filesystem 'dump' format contains nothing but the abstract 03063 * structure of the filesystem -- independent of any internal node-id 03064 * schema or database back-end. All of the data in the dumpfile is 03065 * acquired by public function calls into svn_fs.h. Similarly, the 03066 * parser which reads the dumpfile is able to reconstruct the 03067 * filesystem using only public svn_fs.h routines. 03068 * 03069 * Thus the dump/load feature's main purpose is for *migrating* data 03070 * from one svn filesystem to another -- presumably two filesystems 03071 * which have different internal implementations. 03072 * 03073 * If you simply want to backup your filesystem, you're probably 03074 * better off using the built-in facilities of the DB backend (using 03075 * Berkeley DB's hot-backup feature, for example.) 03076 * 03077 * For a description of the dumpfile format, see 03078 * /trunk/notes/fs_dumprestore.txt. 03079 */ 03080 03081 /* The RFC822-style headers in our dumpfile format. */ 03082 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER "SVN-fs-dump-format-version" 03083 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION 3 03084 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION_DELTAS 3 03085 #define SVN_REPOS_DUMPFILE_UUID "UUID" 03086 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH "Content-length" 03087 03088 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER "Revision-number" 03089 03090 #define SVN_REPOS_DUMPFILE_NODE_PATH "Node-path" 03091 #define SVN_REPOS_DUMPFILE_NODE_KIND "Node-kind" 03092 #define SVN_REPOS_DUMPFILE_NODE_ACTION "Node-action" 03093 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH "Node-copyfrom-path" 03094 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV "Node-copyfrom-rev" 03095 /** @since New in 1.6. */ 03096 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 "Text-copy-source-md5" 03097 /** @since New in 1.6. */ 03098 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1 "Text-copy-source-sha1" 03099 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \ 03100 SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 03101 /** @since New in 1.6. */ 03102 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 "Text-content-md5" 03103 /** @since New in 1.6. */ 03104 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1 "Text-content-sha1" 03105 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM \ 03106 SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 03107 03108 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH "Prop-content-length" 03109 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH "Text-content-length" 03110 03111 /** @since New in 1.1. */ 03112 #define SVN_REPOS_DUMPFILE_PROP_DELTA "Prop-delta" 03113 /** @since New in 1.1. */ 03114 #define SVN_REPOS_DUMPFILE_TEXT_DELTA "Text-delta" 03115 /** @since New in 1.6. */ 03116 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 "Text-delta-base-md5" 03117 /** @since New in 1.6. */ 03118 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1 "Text-delta-base-sha1" 03119 /** @since New in 1.5. */ 03120 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM \ 03121 SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 03122 03123 /** The different policies for processing the UUID in the dumpfile. */ 03124 enum svn_repos_load_uuid 03125 { 03126 /** only update uuid if the repos has no revisions. */ 03127 svn_repos_load_uuid_default, 03128 /** never update uuid. */ 03129 svn_repos_load_uuid_ignore, 03130 /** always update uuid. */ 03131 svn_repos_load_uuid_force 03132 }; 03133 03134 /** Callback type for use with svn_repos_verify_fs3(). @a revision 03135 * and @a verify_err are the details of a single verification failure 03136 * that occurred during the svn_repos_verify_fs3() call. @a baton is 03137 * the same baton given to svn_repos_verify_fs3(). @a scratch_pool is 03138 * provided for the convenience of the implementor, who should not 03139 * expect it to live longer than a single callback call. 03140 * 03141 * @a verify_err will be cleared and becomes invalid after the callback 03142 * returns, use svn_error_dup() to preserve the error. If a callback uses 03143 * @a verify_err as the return value or as a part of the return value, it 03144 * should also call svn_error_dup() for @a verify_err. Implementors of this 03145 * callback are forbidden to call svn_error_clear() for @a verify_err. 03146 * 03147 * @see svn_repos_verify_fs3 03148 * 03149 * @since New in 1.9. 03150 */ 03151 typedef svn_error_t *(*svn_repos_verify_callback_t)(void *baton, 03152 svn_revnum_t revision, 03153 svn_error_t *verify_err, 03154 apr_pool_t *scratch_pool); 03155 03156 /** 03157 * Verify the contents of the file system in @a repos. 03158 * 03159 * Verify the revisions from @a start_rev to @a end_rev inclusive. If 03160 * @a start_rev is #SVN_INVALID_REVNUM, start at revision 0; if @a end_rev 03161 * is #SVN_INVALID_REVNUM, end at the head revision. @a start_rev must be 03162 * older than or equal to @a end_rev. If revision 0 is included in the 03163 * range, then also verify "global invariants" of the repository, as 03164 * described in svn_fs_verify(). 03165 * 03166 * If @a check_normalization is @c TRUE, report any name collisions 03167 * within the same directory or svn:mergeinfo property where the names 03168 * differ only in character representation, but are otherwise 03169 * identical. 03170 * 03171 * If @a metadata_only is @c TRUE, backends that have a concept of separate 03172 * metadata verification will only perform that and skip the more expensive 03173 * file context reconstruction and verification. For FSFS format 7+ and 03174 * FSX, this allows for a very fast check against external corruption. 03175 * 03176 * If @a verify_callback is not @c NULL, call it with @a verify_baton upon 03177 * receiving an FS-specific structure failure or a revision verification 03178 * failure. Set @c revision callback argument to #SVN_INVALID_REVNUM or 03179 * to the revision number respectively. Set @c verify_err to svn_error_t 03180 * describing the reason of the failure. @c verify_err will be cleared 03181 * after the callback returns, use svn_error_dup() to preserve the error. 03182 * If @a verify_callback returns an error different from #SVN_NO_ERROR, 03183 * stop verifying the repository and immediately return the error from 03184 * @a verify_callback. 03185 * 03186 * If @a verify_callback is @c NULL, this function returns the first 03187 * encountered verification error or #SVN_NO_ERROR if there were no failures 03188 * during the verification. Errors that prevent the verification process 03189 * from continuing, such as #SVN_ERR_CANCELLED, are returned immediately 03190 * and do not trigger an invocation of @a verify_callback. 03191 * 03192 * If @a notify_func is not null, then call it with @a notify_baton and 03193 * with a notification structure in which the fields are set as follows. 03194 * (For a warning that does not apply to a specific revision, the revision 03195 * number is #SVN_INVALID_REVNUM.) 03196 * 03197 * For each FS-specific structure warning: 03198 * @c action = svn_repos_notify_verify_rev_structure 03199 * @c revision = the revision or #SVN_INVALID_REVNUM 03200 * 03201 * For each revision verification warning: 03202 * @c action = #svn_repos_notify_warning 03203 * @c warning and @c warning_str fields set accordingly 03204 * ### TODO: Set @c revision = the revision? 03205 * 03206 * For each successfully verified revision: 03207 * @c action = #svn_repos_notify_verify_rev_end 03208 * @c revision = the revision 03209 * 03210 * At the end: 03211 * @c action = svn_repos_notify_verify_end 03212 * ### Do we really need a callback to tell us the function we 03213 * called has reached its end and is about to return? 03214 * ### Not sent, currently, if a FS structure error is found. 03215 * 03216 * If @a cancel_func is not @c NULL, call it periodically with @a 03217 * cancel_baton as argument to see if the caller wishes to cancel the 03218 * verification. 03219 * 03220 * Use @a scratch_pool for temporary allocation. 03221 * 03222 * @see svn_repos_verify_callback_t 03223 * 03224 * @since New in 1.9. 03225 */ 03226 svn_error_t * 03227 svn_repos_verify_fs3(svn_repos_t *repos, 03228 svn_revnum_t start_rev, 03229 svn_revnum_t end_rev, 03230 svn_boolean_t check_normalization, 03231 svn_boolean_t metadata_only, 03232 svn_repos_notify_func_t notify_func, 03233 void *notify_baton, 03234 svn_repos_verify_callback_t verify_callback, 03235 void *verify_baton, 03236 svn_cancel_func_t cancel, 03237 void *cancel_baton, 03238 apr_pool_t *scratch_pool); 03239 03240 /** 03241 * Like svn_repos_verify_fs3(), but with @a verify_callback and 03242 * @a verify_baton set to @c NULL and with @a check_normalization 03243 * and @a metadata_only set to @c FALSE. 03244 * 03245 * @since New in 1.7. 03246 * @deprecated Provided for backward compatibility with the 1.8 API. 03247 */ 03248 SVN_DEPRECATED 03249 svn_error_t * 03250 svn_repos_verify_fs2(svn_repos_t *repos, 03251 svn_revnum_t start_rev, 03252 svn_revnum_t end_rev, 03253 svn_repos_notify_func_t notify_func, 03254 void *notify_baton, 03255 svn_cancel_func_t cancel, 03256 void *cancel_baton, 03257 apr_pool_t *scratch_pool); 03258 03259 /** 03260 * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of 03261 * handling feedback via the notify_func handler. 03262 * 03263 * If @a feedback_stream is not @c NULL, write feedback to it (lines of 03264 * the form "* Verified revision %ld\n"). 03265 * 03266 * @since New in 1.5. 03267 * @deprecated Provided for backward compatibility with the 1.6 API. 03268 */ 03269 SVN_DEPRECATED 03270 svn_error_t * 03271 svn_repos_verify_fs(svn_repos_t *repos, 03272 svn_stream_t *feedback_stream, 03273 svn_revnum_t start_rev, 03274 svn_revnum_t end_rev, 03275 svn_cancel_func_t cancel_func, 03276 void *cancel_baton, 03277 apr_pool_t *pool); 03278 03279 /** 03280 * Dump the contents of the filesystem within already-open @a repos into 03281 * writable @a dumpstream. If @a dumpstream is 03282 * @c NULL, this is effectively a primitive verify. It is not complete, 03283 * however; see instead svn_repos_verify_fs3(). 03284 * 03285 * Begin at revision @a start_rev, and dump every revision up through 03286 * @a end_rev. If @a start_rev is #SVN_INVALID_REVNUM, start at revision 03287 * 0. If @a end_rev is #SVN_INVALID_REVNUM, end at the head revision. 03288 * 03289 * If @a incremental is @c TRUE, the first revision dumped will be a diff 03290 * against the previous revision (usually it looks like a full dump of 03291 * the tree). 03292 * 03293 * If @a use_deltas is @c TRUE, output only node properties which have 03294 * changed relative to the previous contents, and output text contents 03295 * as svndiff data against the previous contents. Regardless of how 03296 * this flag is set, the first revision of a non-incremental dump will 03297 * be done with full plain text. A dump with @a use_deltas set cannot 03298 * be loaded by Subversion 1.0.x. 03299 * 03300 * If @a include_revprops is @c TRUE, output the revision properties as 03301 * well, otherwise omit them. 03302 * 03303 * If @a include_changes is @c TRUE, output the revision contents, i.e. 03304 * tree and node changes. 03305 * 03306 * If @a notify_func is not null, then call it with @a notify_baton and 03307 * with a notification structure in which the fields are set as follows. 03308 * (For a warning or error notification that does not apply to a specific 03309 * revision, the revision number is #SVN_INVALID_REVNUM.) 03310 * 03311 * For each warning: 03312 * @c action = #svn_repos_notify_warning 03313 * @c warning and @c warning_str fields set accordingly 03314 * ### TODO: Set @c revision = the revision or #SVN_INVALID_REVNUM? 03315 * 03316 * For each successfully dumped revision: 03317 * @c action = #svn_repos_notify_dump_rev_end 03318 * @c revision = the revision 03319 * 03320 * At the end: 03321 * @c action = svn_repos_notify_verify_end 03322 * ### Do we really need a callback to tell us the function we 03323 * called has reached its end and is about to return? 03324 * 03325 * At the end, if there were certain warnings previously: 03326 * @c action = #svn_repos_notify_warning 03327 * @c warning and @c warning_str fields set accordingly, 03328 * reiterating the existence of previous warnings 03329 * ### This is a presentation issue. Caller could do this itself. 03330 * 03331 * If @a filter_func is not @c NULL, it is called for each node being 03332 * dumped, allowing the caller to exclude it from dump. 03333 * 03334 * If @a cancel_func is not @c NULL, it is called periodically with 03335 * @a cancel_baton as argument to see if the client wishes to cancel 03336 * the dump. 03337 * 03338 * Use @a scratch_pool for temporary allocation. 03339 * 03340 * @since New in 1.10. 03341 */ 03342 svn_error_t * 03343 svn_repos_dump_fs4(svn_repos_t *repos, 03344 svn_stream_t *stream, 03345 svn_revnum_t start_rev, 03346 svn_revnum_t end_rev, 03347 svn_boolean_t incremental, 03348 svn_boolean_t use_deltas, 03349 svn_boolean_t include_revprops, 03350 svn_boolean_t include_changes, 03351 svn_repos_notify_func_t notify_func, 03352 void *notify_baton, 03353 svn_repos_dump_filter_func_t filter_func, 03354 void *filter_baton, 03355 svn_cancel_func_t cancel_func, 03356 void *cancel_baton, 03357 apr_pool_t *pool); 03358 03359 /** 03360 * Similar to svn_repos_dump_fs4(), but with @a include_revprops and 03361 * @a include_changes both set to @c TRUE and @a filter_func and 03362 * @a filter_baton set to @c NULL. 03363 * 03364 * @since New in 1.7. 03365 * @deprecated Provided for backward compatibility with the 1.9 API. 03366 */ 03367 SVN_DEPRECATED 03368 svn_error_t * 03369 svn_repos_dump_fs3(svn_repos_t *repos, 03370 svn_stream_t *dumpstream, 03371 svn_revnum_t start_rev, 03372 svn_revnum_t end_rev, 03373 svn_boolean_t incremental, 03374 svn_boolean_t use_deltas, 03375 svn_repos_notify_func_t notify_func, 03376 void *notify_baton, 03377 svn_cancel_func_t cancel_func, 03378 void *cancel_baton, 03379 apr_pool_t *scratch_pool); 03380 03381 /** 03382 * Similar to svn_repos_dump_fs3(), but with a feedback_stream instead of 03383 * handling feedback via the notify_func handler 03384 * 03385 * @since New in 1.1. 03386 * @deprecated Provided for backward compatibility with the 1.6 API. 03387 */ 03388 SVN_DEPRECATED 03389 svn_error_t * 03390 svn_repos_dump_fs2(svn_repos_t *repos, 03391 svn_stream_t *dumpstream, 03392 svn_stream_t *feedback_stream, 03393 svn_revnum_t start_rev, 03394 svn_revnum_t end_rev, 03395 svn_boolean_t incremental, 03396 svn_boolean_t use_deltas, 03397 svn_cancel_func_t cancel_func, 03398 void *cancel_baton, 03399 apr_pool_t *pool); 03400 03401 /** 03402 * Similar to svn_repos_dump_fs2(), but with the @a use_deltas 03403 * parameter always set to @c FALSE. 03404 * 03405 * @deprecated Provided for backward compatibility with the 1.0 API. 03406 */ 03407 SVN_DEPRECATED 03408 svn_error_t * 03409 svn_repos_dump_fs(svn_repos_t *repos, 03410 svn_stream_t *dumpstream, 03411 svn_stream_t *feedback_stream, 03412 svn_revnum_t start_rev, 03413 svn_revnum_t end_rev, 03414 svn_boolean_t incremental, 03415 svn_cancel_func_t cancel_func, 03416 void *cancel_baton, 03417 apr_pool_t *pool); 03418 03419 03420 /** 03421 * Read and parse dumpfile-formatted @a dumpstream, reconstructing 03422 * filesystem revisions in already-open @a repos, handling uuids in 03423 * accordance with @a uuid_action. Use @a pool for all allocation. 03424 * 03425 * If the dumpstream contains copy history that is unavailable in the 03426 * repository, an error will be thrown. 03427 * 03428 * The repository's UUID will be updated iff 03429 * the dumpstream contains a UUID and 03430 * @a uuid_action is not equal to #svn_repos_load_uuid_ignore and 03431 * either the repository contains no revisions or 03432 * @a uuid_action is equal to #svn_repos_load_uuid_force. 03433 * 03434 * If the dumpstream contains no UUID, then @a uuid_action is 03435 * ignored and the repository UUID is not touched. 03436 * 03437 * @a start_rev and @a end_rev act as filters, the lower and upper 03438 * (inclusive) range values of revisions in @a dumpstream which will 03439 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 03440 * which case no revision-based filtering occurs at all), or both are 03441 * valid revisions (where @a start_rev is older than or equivalent to 03442 * @a end_rev). 03443 * 03444 * If @a parent_dir is not NULL, then the parser will reparent all the 03445 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 03446 * must be an existing directory in the repository. 03447 * 03448 * If @a use_pre_commit_hook is set, call the repository's pre-commit 03449 * hook before committing each loaded revision. 03450 * 03451 * If @a use_post_commit_hook is set, call the repository's 03452 * post-commit hook after committing each loaded revision. 03453 * 03454 * If @a validate_props is set, then validate Subversion revision and 03455 * node properties (those in the svn: namespace) against established 03456 * rules for those things. 03457 * 03458 * If @a ignore_dates is set, ignore any revision datestamps found in 03459 * @a dumpstream, allowing the revisions created by the load process 03460 * to be stamped as if they were newly created via the normal commit 03461 * process. 03462 * 03463 * If @a normalize_props is set, attempt to normalize invalid Subversion 03464 * revision and node properties (those in the svn: namespace) so that 03465 * their values would follow the established rules for them. For example, 03466 * for such properties, typically the value must be in UTF-8 with LF 03467 * line endings. 03468 * 03469 * @note The details or the performed normalizations are deliberately 03470 * left unspecified and may change in the future. 03471 * 03472 * If non-NULL, use @a notify_func and @a notify_baton to send notification 03473 * of events to the caller. 03474 * 03475 * If @a cancel_func is not @c NULL, it is called periodically with 03476 * @a cancel_baton as argument to see if the client wishes to cancel 03477 * the load. 03478 * 03479 * @since New in 1.10. 03480 */ 03481 svn_error_t * 03482 svn_repos_load_fs6(svn_repos_t *repos, 03483 svn_stream_t *dumpstream, 03484 svn_revnum_t start_rev, 03485 svn_revnum_t end_rev, 03486 enum svn_repos_load_uuid uuid_action, 03487 const char *parent_dir, 03488 svn_boolean_t use_pre_commit_hook, 03489 svn_boolean_t use_post_commit_hook, 03490 svn_boolean_t validate_props, 03491 svn_boolean_t ignore_dates, 03492 svn_boolean_t normalize_props, 03493 svn_repos_notify_func_t notify_func, 03494 void *notify_baton, 03495 svn_cancel_func_t cancel_func, 03496 void *cancel_baton, 03497 apr_pool_t *pool); 03498 03499 /** 03500 * Similar to svn_repos_load_fs6(), but with the @a normalize_props 03501 * parameter always set to @c FALSE. 03502 * 03503 * @since New in 1.9. 03504 * @deprecated Provided for backward compatibility with the 1.9 API. 03505 */ 03506 SVN_DEPRECATED 03507 svn_error_t * 03508 svn_repos_load_fs5(svn_repos_t *repos, 03509 svn_stream_t *dumpstream, 03510 svn_revnum_t start_rev, 03511 svn_revnum_t end_rev, 03512 enum svn_repos_load_uuid uuid_action, 03513 const char *parent_dir, 03514 svn_boolean_t use_pre_commit_hook, 03515 svn_boolean_t use_post_commit_hook, 03516 svn_boolean_t validate_props, 03517 svn_boolean_t ignore_dates, 03518 svn_repos_notify_func_t notify_func, 03519 void *notify_baton, 03520 svn_cancel_func_t cancel_func, 03521 void *cancel_baton, 03522 apr_pool_t *pool); 03523 03524 /** Similar to svn_repos_load_fs5(), but with @a ignore_dates 03525 * always passed as FALSE. 03526 * 03527 * @since New in 1.8. 03528 * @deprecated Provided for backward compatibility with the 1.8 API. 03529 */ 03530 SVN_DEPRECATED 03531 svn_error_t * 03532 svn_repos_load_fs4(svn_repos_t *repos, 03533 svn_stream_t *dumpstream, 03534 svn_revnum_t start_rev, 03535 svn_revnum_t end_rev, 03536 enum svn_repos_load_uuid uuid_action, 03537 const char *parent_dir, 03538 svn_boolean_t use_pre_commit_hook, 03539 svn_boolean_t use_post_commit_hook, 03540 svn_boolean_t validate_props, 03541 svn_repos_notify_func_t notify_func, 03542 void *notify_baton, 03543 svn_cancel_func_t cancel_func, 03544 void *cancel_baton, 03545 apr_pool_t *pool); 03546 03547 /** Similar to svn_repos_load_fs4(), but with @a start_rev and @a 03548 * end_rev always passed as #SVN_INVALID_REVNUM. 03549 * 03550 * @since New in 1.7. 03551 * @deprecated Provided for backward compatibility with the 1.7 API. 03552 */ 03553 SVN_DEPRECATED 03554 svn_error_t * 03555 svn_repos_load_fs3(svn_repos_t *repos, 03556 svn_stream_t *dumpstream, 03557 enum svn_repos_load_uuid uuid_action, 03558 const char *parent_dir, 03559 svn_boolean_t use_pre_commit_hook, 03560 svn_boolean_t use_post_commit_hook, 03561 svn_boolean_t validate_props, 03562 svn_repos_notify_func_t notify_func, 03563 void *notify_baton, 03564 svn_cancel_func_t cancel_func, 03565 void *cancel_baton, 03566 apr_pool_t *pool); 03567 03568 /** 03569 * Similar to svn_repos_load_fs3(), but with @a feedback_stream in 03570 * place of the #svn_repos_notify_func_t and baton and with 03571 * @a validate_props always FALSE. 03572 * 03573 * @since New in 1.2. 03574 * @deprecated Provided for backward compatibility with the 1.6 API. 03575 */ 03576 SVN_DEPRECATED 03577 svn_error_t * 03578 svn_repos_load_fs2(svn_repos_t *repos, 03579 svn_stream_t *dumpstream, 03580 svn_stream_t *feedback_stream, 03581 enum svn_repos_load_uuid uuid_action, 03582 const char *parent_dir, 03583 svn_boolean_t use_pre_commit_hook, 03584 svn_boolean_t use_post_commit_hook, 03585 svn_cancel_func_t cancel_func, 03586 void *cancel_baton, 03587 apr_pool_t *pool); 03588 03589 /** 03590 * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and 03591 * @a use_post_commit_hook always @c FALSE. 03592 * 03593 * @deprecated Provided for backward compatibility with the 1.1 API. 03594 */ 03595 SVN_DEPRECATED 03596 svn_error_t * 03597 svn_repos_load_fs(svn_repos_t *repos, 03598 svn_stream_t *dumpstream, 03599 svn_stream_t *feedback_stream, 03600 enum svn_repos_load_uuid uuid_action, 03601 const char *parent_dir, 03602 svn_cancel_func_t cancel_func, 03603 void *cancel_baton, 03604 apr_pool_t *pool); 03605 03606 /** 03607 * Read and parse dumpfile-formatted @a dumpstream, extracting the 03608 * revision properties from it and apply them to the already-open 03609 * @a repos. Use @a scratch_pool for temporary allocations. 03610 * 03611 * If, after filtering by the @a start_rev and @a end_rev, the dumpstream 03612 * contains revisions missing in @a repos, an error will be thrown. 03613 * 03614 * @a start_rev and @a end_rev act as filters, the lower and upper 03615 * (inclusive) range values of revisions in @a dumpstream which will 03616 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 03617 * which case no revision-based filtering occurs at all), or both are 03618 * valid revisions (where @a start_rev is older than or equivalent to 03619 * @a end_rev). 03620 * 03621 * If @a validate_props is set, then validate Subversion revision 03622 * properties (those in the svn: namespace) against established 03623 * rules for those things. 03624 * 03625 * If @a ignore_dates is set, ignore any revision datestamps found in 03626 * @a dumpstream, keeping whatever timestamps the revisions currently 03627 * have. 03628 * 03629 * If @a normalize_props is set, attempt to normalize invalid Subversion 03630 * revision and node properties (those in the svn: namespace) so that 03631 * their values would follow the established rules for them. For example, 03632 * for such properties, typically the value must be in UTF-8 with LF 03633 * line endings. 03634 * 03635 * @note The details or the performed normalizations are deliberately 03636 * left unspecified and may change in the future. 03637 * 03638 * If non-NULL, use @a notify_func and @a notify_baton to send notification 03639 * of events to the caller. 03640 * 03641 * If @a cancel_func is not @c NULL, it is called periodically with 03642 * @a cancel_baton as argument to see if the client wishes to cancel 03643 * the load. 03644 * 03645 * @remark No repository hooks will be triggered. 03646 * 03647 * @since New in 1.10. 03648 */ 03649 svn_error_t * 03650 svn_repos_load_fs_revprops(svn_repos_t *repos, 03651 svn_stream_t *dumpstream, 03652 svn_revnum_t start_rev, 03653 svn_revnum_t end_rev, 03654 svn_boolean_t validate_props, 03655 svn_boolean_t ignore_dates, 03656 svn_boolean_t normalize_props, 03657 svn_repos_notify_func_t notify_func, 03658 void *notify_baton, 03659 svn_cancel_func_t cancel_func, 03660 void *cancel_baton, 03661 apr_pool_t *scratch_pool); 03662 03663 /** 03664 * A vtable that is driven by svn_repos_parse_dumpstream3(). 03665 * 03666 * @since New in 1.8. 03667 */ 03668 typedef struct svn_repos_parse_fns3_t 03669 { 03670 /** The parser has discovered a new "magic header" record within the 03671 * parsing session represented by @a parse_baton. The dump-format 03672 * version number is @a version. 03673 */ 03674 svn_error_t *(*magic_header_record)(int version, 03675 void *parse_baton, 03676 apr_pool_t *pool); 03677 03678 /** The parser has discovered a new uuid record within the parsing 03679 * session represented by @a parse_baton. The uuid's value is 03680 * @a uuid, and it is allocated in @a pool. 03681 */ 03682 svn_error_t *(*uuid_record)(const char *uuid, 03683 void *parse_baton, 03684 apr_pool_t *pool); 03685 03686 /** The parser has discovered a new revision record within the 03687 * parsing session represented by @a parse_baton. All the headers are 03688 * placed in @a headers (allocated in @a pool), which maps <tt>const 03689 * char *</tt> header-name ==> <tt>const char *</tt> header-value. 03690 * The @a revision_baton received back (also allocated in @a pool) 03691 * represents the revision. 03692 */ 03693 svn_error_t *(*new_revision_record)(void **revision_baton, 03694 apr_hash_t *headers, 03695 void *parse_baton, 03696 apr_pool_t *pool); 03697 03698 /** The parser has discovered a new node record within the current 03699 * revision represented by @a revision_baton. All the headers are 03700 * placed in @a headers (as with @c new_revision_record), allocated in 03701 * @a pool. The @a node_baton received back is allocated in @a pool 03702 * and represents the node. 03703 */ 03704 svn_error_t *(*new_node_record)(void **node_baton, 03705 apr_hash_t *headers, 03706 void *revision_baton, 03707 apr_pool_t *pool); 03708 03709 /** For a given @a revision_baton, set a property @a name to @a value. */ 03710 svn_error_t *(*set_revision_property)(void *revision_baton, 03711 const char *name, 03712 const svn_string_t *value); 03713 03714 /** For a given @a node_baton, set a property @a name to @a value. */ 03715 svn_error_t *(*set_node_property)(void *node_baton, 03716 const char *name, 03717 const svn_string_t *value); 03718 03719 /** For a given @a node_baton, delete property @a name. */ 03720 svn_error_t *(*delete_node_property)(void *node_baton, const char *name); 03721 03722 /** For a given @a node_baton, remove all properties. */ 03723 svn_error_t *(*remove_node_props)(void *node_baton); 03724 03725 /** For a given @a node_baton, set @a stream to a writable stream 03726 * capable of receiving the node's fulltext. The parser will write 03727 * the fulltext to the stream and then close the stream to signal 03728 * completion. 03729 * 03730 * If a @c NULL is returned instead of a stream, the vtable is 03731 * indicating that no text is desired, and the parser will not 03732 * attempt to send it. 03733 */ 03734 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 03735 void *node_baton); 03736 03737 /** For a given @a node_baton, set @a handler and @a handler_baton 03738 * to a window handler and baton capable of receiving a delta 03739 * against the node's previous contents. The parser will send all 03740 * the windows of data to this handler, and will then send a NULL 03741 * window to signal completion. 03742 * 03743 * If a @c NULL is returned instead of a handler, the vtable is 03744 * indicating that no delta is desired, and the parser will not 03745 * attempt to send it. 03746 */ 03747 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler, 03748 void **handler_baton, 03749 void *node_baton); 03750 03751 /** The parser has reached the end of the current node represented by 03752 * @a node_baton, it can be freed. 03753 */ 03754 svn_error_t *(*close_node)(void *node_baton); 03755 03756 /** The parser has reached the end of the current revision 03757 * represented by @a revision_baton. In other words, there are no more 03758 * changed nodes within the revision. The baton can be freed. 03759 */ 03760 svn_error_t *(*close_revision)(void *revision_baton); 03761 03762 } svn_repos_parse_fns3_t; 03763 03764 03765 /** 03766 * Read and parse dumpfile-formatted @a stream, calling callbacks in 03767 * @a parse_fns/@a parse_baton, and using @a pool for allocations. 03768 * 03769 * If @a deltas_are_text is @c TRUE, handle text-deltas with the @a 03770 * set_fulltext callback. This is useful when manipulating a dump 03771 * stream without loading it. Otherwise handle text-deltas with the 03772 * @a apply_textdelta callback. 03773 * 03774 * If @a cancel_func is not @c NULL, it is called periodically with 03775 * @a cancel_baton as argument to see if the client wishes to cancel 03776 * the dump. 03777 * 03778 * This parser has built-in knowledge of the dumpfile format, but only 03779 * in a limited sense: 03780 * 03781 * * it recognizes the "magic" format-version header. 03782 * 03783 * * it recognizes the UUID header. 03784 * 03785 * * it recognizes revision and node records by looking for either 03786 * a REVISION_NUMBER or NODE_PATH headers. 03787 * 03788 * * it recognizes the CONTENT-LENGTH headers, so it knows if and 03789 * how to suck up the content body. 03790 * 03791 * * it knows how to parse a content body into two parts: props 03792 * and text, and pass the pieces to the vtable. 03793 * 03794 * This is enough knowledge to make it easy on vtable implementors, 03795 * but still allow expansion of the format: most headers do not have 03796 * to be handled explicitly. 03797 * 03798 * ### [JAF] Wouldn't it be more efficient to support a start/end rev 03799 * range here than only supporting it in receivers such as 03800 * svn_repos_get_fs_build_parser4()? This parser could then skip over 03801 * chunks of the input stream before the oldest required rev, and 03802 * could stop reading entirely after the youngest required rev. 03803 * 03804 * @since New in 1.8. 03805 03806 * @since Starting in 1.10, @a parse_fns may contain #NULL pointers for 03807 * those callbacks that the caller is not interested in. 03808 */ 03809 svn_error_t * 03810 svn_repos_parse_dumpstream3(svn_stream_t *stream, 03811 const svn_repos_parse_fns3_t *parse_fns, 03812 void *parse_baton, 03813 svn_boolean_t deltas_are_text, 03814 svn_cancel_func_t cancel_func, 03815 void *cancel_baton, 03816 apr_pool_t *pool); 03817 03818 03819 /** 03820 * Set @a *parser and @a *parse_baton to a vtable parser which commits new 03821 * revisions to the fs in @a repos. The constructed parser will treat 03822 * UUID records in a manner consistent with @a uuid_action. Use @a pool 03823 * to operate on the fs. 03824 * 03825 * @a start_rev and @a end_rev act as filters, the lower and upper 03826 * (inclusive) range values of revisions which will 03827 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 03828 * which case no revision-based filtering occurs at all), or both are 03829 * valid revisions (where @a start_rev is older than or equivalent to 03830 * @a end_rev). They refer to dump stream revision numbers rather than 03831 * committed revision numbers. 03832 * 03833 * If @a use_history is true, then when the parser encounters a node that 03834 * is added-with-history, it will require 'copy-from' history to exist in 03835 * the repository at the relative (adjusted) copy-from revision and path. 03836 * It will perform a copy from that source location, and will fail if no 03837 * suitable source exists there. If @a use_history is false, then it will 03838 * instead convert every copy to a plain add. 03839 * 03840 * ### The 'use_history=FALSE' case is unused and untested in Subversion. 03841 * It seems to me it would not work with a deltas dumpfile (a driver 03842 * that calls the @c apply_textdelta method), as it would not have 03843 * access to the delta base text. 03844 * 03845 * If @a use_pre_commit_hook is set, call the repository's pre-commit 03846 * hook before committing each loaded revision. 03847 * 03848 * If @a use_post_commit_hook is set, call the repository's 03849 * post-commit hook after committing each loaded revision. 03850 * 03851 * If @a validate_props is set, then validate Subversion revision and 03852 * node properties (those in the svn: namespace) against established 03853 * rules for those things. 03854 * 03855 * If @a ignore_dates is set, ignore any revision datestamps found in 03856 * @a dumpstream, allowing the revisions created by the load process 03857 * to be stamped as if they were newly created via the normal commit 03858 * process. 03859 * 03860 * If @a normalize_props is set, attempt to normalize invalid Subversion 03861 * revision and node properties (those in the svn: namespace) so that 03862 * their values would follow the established rules for them. For example, 03863 * for such properties, typically the value must be in UTF-8 with LF 03864 * line endings. 03865 * 03866 * @note The details or the performed normalizations are deliberately 03867 * left unspecified and may change in the future. 03868 * 03869 * If @a parent_dir is not NULL, then the parser will reparent all the 03870 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 03871 * must be an existing directory in the repository. 03872 * 03873 * @since New in 1.10. 03874 */ 03875 svn_error_t * 03876 svn_repos_get_fs_build_parser6(const svn_repos_parse_fns3_t **parser, 03877 void **parse_baton, 03878 svn_repos_t *repos, 03879 svn_revnum_t start_rev, 03880 svn_revnum_t end_rev, 03881 svn_boolean_t use_history, 03882 svn_boolean_t validate_props, 03883 enum svn_repos_load_uuid uuid_action, 03884 const char *parent_dir, 03885 svn_boolean_t use_pre_commit_hook, 03886 svn_boolean_t use_post_commit_hook, 03887 svn_boolean_t ignore_dates, 03888 svn_boolean_t normalize_props, 03889 svn_repos_notify_func_t notify_func, 03890 void *notify_baton, 03891 apr_pool_t *pool); 03892 03893 /** 03894 * Similar to svn_repos_get_fs_build_parser6(), but with the 03895 * @a normalize_props parameter always set to @c FALSE. 03896 * 03897 * @since New in 1.9. 03898 * @deprecated Provided for backward compatibility with the 1.9 API. 03899 */ 03900 SVN_DEPRECATED 03901 svn_error_t * 03902 svn_repos_get_fs_build_parser5(const svn_repos_parse_fns3_t **parser, 03903 void **parse_baton, 03904 svn_repos_t *repos, 03905 svn_revnum_t start_rev, 03906 svn_revnum_t end_rev, 03907 svn_boolean_t use_history, 03908 svn_boolean_t validate_props, 03909 enum svn_repos_load_uuid uuid_action, 03910 const char *parent_dir, 03911 svn_boolean_t use_pre_commit_hook, 03912 svn_boolean_t use_post_commit_hook, 03913 svn_boolean_t ignore_dates, 03914 svn_repos_notify_func_t notify_func, 03915 void *notify_baton, 03916 apr_pool_t *pool); 03917 03918 /** 03919 * Similar to svn_repos_get_fs_build_parser5(), but with the 03920 * @c use_pre_commit_hook, @c use_post_commit_hook and @c ignore_dates 03921 * arguments all false. 03922 * 03923 * @since New in 1.8. 03924 * @deprecated Provided for backward compatibility with the 1.8 API. 03925 */ 03926 SVN_DEPRECATED 03927 svn_error_t * 03928 svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser, 03929 void **parse_baton, 03930 svn_repos_t *repos, 03931 svn_revnum_t start_rev, 03932 svn_revnum_t end_rev, 03933 svn_boolean_t use_history, 03934 svn_boolean_t validate_props, 03935 enum svn_repos_load_uuid uuid_action, 03936 const char *parent_dir, 03937 svn_repos_notify_func_t notify_func, 03938 void *notify_baton, 03939 apr_pool_t *pool); 03940 03941 03942 03943 /** 03944 * A vtable that is driven by svn_repos_parse_dumpstream2(). 03945 * Similar to #svn_repos_parse_fns3_t except that it lacks 03946 * the magic_header_record callback. 03947 * 03948 * @deprecated Provided for backward compatibility with the 1.7 API. 03949 */ 03950 typedef struct svn_repos_parse_fns2_t 03951 { 03952 /** Same as #svn_repos_parse_fns3_t.new_revision_record. */ 03953 svn_error_t *(*new_revision_record)(void **revision_baton, 03954 apr_hash_t *headers, 03955 void *parse_baton, 03956 apr_pool_t *pool); 03957 /** Same as #svn_repos_parse_fns3_t.uuid_record. */ 03958 svn_error_t *(*uuid_record)(const char *uuid, 03959 void *parse_baton, 03960 apr_pool_t *pool); 03961 /** Same as #svn_repos_parse_fns3_t.new_node_record. */ 03962 svn_error_t *(*new_node_record)(void **node_baton, 03963 apr_hash_t *headers, 03964 void *revision_baton, 03965 apr_pool_t *pool); 03966 /** Same as #svn_repos_parse_fns3_t.set_revision_property. */ 03967 svn_error_t *(*set_revision_property)(void *revision_baton, 03968 const char *name, 03969 const svn_string_t *value); 03970 /** Same as #svn_repos_parse_fns3_t.set_node_property. */ 03971 svn_error_t *(*set_node_property)(void *node_baton, 03972 const char *name, 03973 const svn_string_t *value); 03974 /** Same as #svn_repos_parse_fns3_t.delete_node_property. */ 03975 svn_error_t *(*delete_node_property)(void *node_baton, 03976 const char *name); 03977 /** Same as #svn_repos_parse_fns3_t.remove_node_props. */ 03978 svn_error_t *(*remove_node_props)(void *node_baton); 03979 /** Same as #svn_repos_parse_fns3_t.set_fulltext. */ 03980 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 03981 void *node_baton); 03982 /** Same as #svn_repos_parse_fns3_t.apply_textdelta. */ 03983 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler, 03984 void **handler_baton, 03985 void *node_baton); 03986 /** Same as #svn_repos_parse_fns3_t.close_node. */ 03987 svn_error_t *(*close_node)(void *node_baton); 03988 /** Same as #svn_repos_parse_fns3_t.close_revision. */ 03989 svn_error_t *(*close_revision)(void *revision_baton); 03990 } svn_repos_parse_fns2_t; 03991 03992 /** @deprecated Provided for backward compatibility with the 1.7 API. */ 03993 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t; 03994 03995 03996 /** 03997 * A vtable that is driven by svn_repos_parse_dumpstream(). 03998 * Similar to #svn_repos_parse_fns2_t except that it lacks 03999 * the delete_node_property and apply_textdelta callbacks. 04000 * 04001 * @deprecated Provided for backward compatibility with the 1.0 API. 04002 */ 04003 typedef struct svn_repos_parse_fns_t 04004 { 04005 /** Same as #svn_repos_parse_fns2_t.new_revision_record. */ 04006 svn_error_t *(*new_revision_record)(void **revision_baton, 04007 apr_hash_t *headers, 04008 void *parse_baton, 04009 apr_pool_t *pool); 04010 /** Same as #svn_repos_parse_fns2_t.uuid_record. */ 04011 svn_error_t *(*uuid_record)(const char *uuid, 04012 void *parse_baton, 04013 apr_pool_t *pool); 04014 /** Same as #svn_repos_parse_fns2_t.new_node_record. */ 04015 svn_error_t *(*new_node_record)(void **node_baton, 04016 apr_hash_t *headers, 04017 void *revision_baton, 04018 apr_pool_t *pool); 04019 /** Same as #svn_repos_parse_fns2_t.set_revision_property. */ 04020 svn_error_t *(*set_revision_property)(void *revision_baton, 04021 const char *name, 04022 const svn_string_t *value); 04023 /** Same as #svn_repos_parse_fns2_t.set_node_property. */ 04024 svn_error_t *(*set_node_property)(void *node_baton, 04025 const char *name, 04026 const svn_string_t *value); 04027 /** Same as #svn_repos_parse_fns2_t.remove_node_props. */ 04028 svn_error_t *(*remove_node_props)(void *node_baton); 04029 /** Same as #svn_repos_parse_fns2_t.set_fulltext. */ 04030 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 04031 void *node_baton); 04032 /** Same as #svn_repos_parse_fns2_t.close_node. */ 04033 svn_error_t *(*close_node)(void *node_baton); 04034 /** Same as #svn_repos_parse_fns2_t.close_revision. */ 04035 svn_error_t *(*close_revision)(void *revision_baton); 04036 } svn_repos_parser_fns_t; 04037 04038 04039 /** 04040 * Similar to svn_repos_parse_dumpstream3(), but uses the more limited 04041 * #svn_repos_parser_fns2_t vtable type. 04042 * 04043 * @deprecated Provided for backward compatibility with the 1.7 API. 04044 */ 04045 SVN_DEPRECATED 04046 svn_error_t * 04047 svn_repos_parse_dumpstream2(svn_stream_t *stream, 04048 const svn_repos_parser_fns2_t *parse_fns, 04049 void *parse_baton, 04050 svn_cancel_func_t cancel_func, 04051 void *cancel_baton, 04052 apr_pool_t *pool); 04053 04054 /** 04055 * Similar to svn_repos_parse_dumpstream2(), but uses the more limited 04056 * #svn_repos_parser_fns_t vtable type. 04057 * 04058 * @deprecated Provided for backward compatibility with the 1.0 API. 04059 */ 04060 SVN_DEPRECATED 04061 svn_error_t * 04062 svn_repos_parse_dumpstream(svn_stream_t *stream, 04063 const svn_repos_parser_fns_t *parse_fns, 04064 void *parse_baton, 04065 svn_cancel_func_t cancel_func, 04066 void *cancel_baton, 04067 apr_pool_t *pool); 04068 04069 /** 04070 * Similar to svn_repos_get_fs_build_parser4(), but with @a start_rev 04071 * and @a end_rev always passed as #SVN_INVALID_REVNUM, and yielding 04072 * the more limited svn_repos_parse_fns2_t. 04073 * 04074 * @since New in 1.7. 04075 * @deprecated Provided for backward compatibility with the 1.7 API. 04076 */ 04077 SVN_DEPRECATED 04078 svn_error_t * 04079 svn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **parser, 04080 void **parse_baton, 04081 svn_repos_t *repos, 04082 svn_boolean_t use_history, 04083 svn_boolean_t validate_props, 04084 enum svn_repos_load_uuid uuid_action, 04085 const char *parent_dir, 04086 svn_repos_notify_func_t notify_func, 04087 void *notify_baton, 04088 apr_pool_t *pool); 04089 04090 /** 04091 * Similar to svn_repos_get_fs_build_parser3(), but with @a outstream 04092 * in place if a #svn_repos_notify_func_t and baton and with 04093 * @a validate_props always FALSE. 04094 * 04095 * @since New in 1.1. 04096 * @deprecated Provided for backward compatibility with the 1.6 API. 04097 */ 04098 SVN_DEPRECATED 04099 svn_error_t * 04100 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser, 04101 void **parse_baton, 04102 svn_repos_t *repos, 04103 svn_boolean_t use_history, 04104 enum svn_repos_load_uuid uuid_action, 04105 svn_stream_t *outstream, 04106 const char *parent_dir, 04107 apr_pool_t *pool); 04108 04109 /** 04110 * Similar to svn_repos_get_fs_build_parser2(), but yields the more 04111 * limited svn_repos_parser_fns_t vtable type. 04112 * 04113 * @deprecated Provided for backward compatibility with the 1.0 API. 04114 */ 04115 SVN_DEPRECATED 04116 svn_error_t * 04117 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser, 04118 void **parse_baton, 04119 svn_repos_t *repos, 04120 svn_boolean_t use_history, 04121 enum svn_repos_load_uuid uuid_action, 04122 svn_stream_t *outstream, 04123 const char *parent_dir, 04124 apr_pool_t *pool); 04125 04126 04127 /** @} */ 04128 04129 /** A data type which stores the authz information. 04130 * 04131 * @since New in 1.3. 04132 */ 04133 typedef struct svn_authz_t svn_authz_t; 04134 04135 /** 04136 * This should be called before any other authz function. 04137 * 04138 * @a pool must support multi-threaded access if the application will use 04139 * authz from multiple threads. 04140 * 04141 * @since New in 1.10. 04142 */ 04143 svn_error_t * 04144 svn_repos_authz_initialize(apr_pool_t *pool); 04145 04146 /** 04147 * Read authz configuration data from @a path (a dirent, an absolute file url 04148 * or a registry path) into @a *authz_p, allocated in @a pool. 04149 * 04150 * If @a groups_path (a dirent, an absolute file url, or a registry path) is 04151 * set, use the global groups parsed from it. 04152 * 04153 * If @a path or @a groups_path is not a valid authz rule file, then return 04154 * #SVN_ERR_AUTHZ_INVALID_CONFIG. The contents of @a *authz_p is then 04155 * undefined. If @a must_exist is TRUE, a missing authz or groups file 04156 * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error 04157 * depends on the access type). 04158 * 04159 * For efficient access of in-repository authz, you may provide @a repos_hint 04160 * which will be tried first and may remove the need to open a temporary 04161 * repository instance. Otherwise, set it to NULL and the repositories will 04162 * be opened as needed. 04163 * 04164 * @since New in 1.10. 04165 */ 04166 svn_error_t * 04167 svn_repos_authz_read3(svn_authz_t **authz_p, 04168 const char *path, 04169 const char *groups_path, 04170 svn_boolean_t must_exist, 04171 svn_repos_t *repos_hint, 04172 apr_pool_t *result_pool, 04173 apr_pool_t *scratch_pool); 04174 04175 /** 04176 * Similar to svn_repos_authz_read3(), but with @a repos_hint set to @c NULL. 04177 * 04178 * @since New in 1.8. 04179 * @deprecated Provided for backward compatibility with the 1.9 API. 04180 */ 04181 SVN_DEPRECATED 04182 svn_error_t * 04183 svn_repos_authz_read2(svn_authz_t **authz_p, 04184 const char *path, 04185 const char *groups_path, 04186 svn_boolean_t must_exist, 04187 apr_pool_t *pool); 04188 04189 04190 /** 04191 * Similar to svn_repos_authz_read2(), but with @a groups_path and @a 04192 * repos_root always passed as @c NULL. 04193 * 04194 * @since New in 1.3. 04195 * @deprecated Provided for backward compatibility with the 1.7 API. 04196 */ 04197 SVN_DEPRECATED 04198 svn_error_t * 04199 svn_repos_authz_read(svn_authz_t **authz_p, 04200 const char *file, 04201 svn_boolean_t must_exist, 04202 apr_pool_t *pool); 04203 04204 /** 04205 * Read authz configuration data from @a stream into @a *authz_p, 04206 * allocated in @a pool. 04207 * 04208 * If @a groups_stream is set, use the global groups parsed from it. 04209 * 04210 * @since New in 1.8. 04211 */ 04212 svn_error_t * 04213 svn_repos_authz_parse(svn_authz_t **authz_p, 04214 svn_stream_t *stream, 04215 svn_stream_t *groups_stream, 04216 apr_pool_t *pool); 04217 04218 /** 04219 * Check whether @a user can access @a path in the repository @a 04220 * repos_name with the @a required_access. @a authz lists the ACLs to 04221 * check against. Set @a *access_granted to indicate if the requested 04222 * access is granted. 04223 * 04224 * If @a path is NULL, then check whether @a user has the @a 04225 * required_access anywhere in the repository. Set @a *access_granted 04226 * to TRUE if at least one path is accessible with the @a 04227 * required_access. 04228 * 04229 * For compatibility with 1.6, and earlier, @a repos_name can be NULL 04230 * in which case it is equivalent to a @a repos_name of "". 04231 * 04232 * @note Presently, @a repos_name must byte-for-byte match the repos_name 04233 * specified in the authz file; it is treated as an opaque string, and not 04234 * as a dirent. 04235 * 04236 * @since New in 1.3. 04237 */ 04238 svn_error_t * 04239 svn_repos_authz_check_access(svn_authz_t *authz, 04240 const char *repos_name, 04241 const char *path, 04242 const char *user, 04243 svn_repos_authz_access_t required_access, 04244 svn_boolean_t *access_granted, 04245 apr_pool_t *pool); 04246 04247 04248 04249 /** Revision Access Levels 04250 * 04251 * Like most version control systems, access to versioned objects in 04252 * Subversion is determined on primarily path-based system. Users either 04253 * do or don't have the ability to read a given path. 04254 * 04255 * However, unlike many version control systems where versioned objects 04256 * maintain their own distinct version information (revision numbers, 04257 * authors, log messages, change timestamps, etc.), Subversion binds 04258 * multiple paths changed as part of a single commit operation into a 04259 * set, calls the whole thing a revision, and hangs commit metadata 04260 * (author, date, log message, etc.) off of that revision. So, commit 04261 * metadata is shared across all the paths changed as part of a given 04262 * commit operation. 04263 * 04264 * It is common (or, at least, we hope it is) for log messages to give 04265 * detailed information about changes made in the commit to which the log 04266 * message is attached. Such information might include a mention of all 04267 * the files changed, what was changed in them, and so on. But this 04268 * causes a problem when presenting information to readers who aren't 04269 * authorized to read every path in the repository. Simply knowing that 04270 * a given path exists may be a security leak, even if the user can't see 04271 * the contents of the data located at that path. 04272 * 04273 * So Subversion does what it reasonably can to prevent the leak of this 04274 * information, and does so via a staged revision access policy. A 04275 * reader can be said to have one of three levels of access to a given 04276 * revision's metadata, based solely on the reader's access rights to the 04277 * paths changed or copied in that revision: 04278 * 04279 * 'full access' -- Granted when the reader has access to all paths 04280 * changed or copied in the revision, or when no paths were 04281 * changed in the revision at all, this access level permits 04282 * full visibility of all revision property names and values, 04283 * and the full changed-paths information. 04284 * 04285 * 'no access' -- Granted when the reader does not have access to any 04286 * paths changed or copied in the revision, this access level 04287 * denies the reader access to all revision properties and all 04288 * changed-paths information. 04289 * 04290 * 'partial access' -- Granted when the reader has access to at least 04291 * one, but not all, of the paths changed or copied in the revision, 04292 * this access level permits visibility of the svn:date and 04293 * svn:author revision properties and only the paths of the 04294 * changed-paths information to which the reader has access. 04295 * 04296 */ 04297 04298 04299 /** An enum defining levels of revision access. 04300 * 04301 * @since New in 1.5. 04302 */ 04303 typedef enum svn_repos_revision_access_level_t 04304 { 04305 /** no access allowed to the revision properties and all changed-paths 04306 * information. */ 04307 svn_repos_revision_access_none, 04308 /** access granted to some (svn:date and svn:author) revision properties and 04309 * changed-paths information on paths the read has access to. */ 04310 svn_repos_revision_access_partial, 04311 /** access granted to all revision properites and changed-paths 04312 * information. */ 04313 svn_repos_revision_access_full 04314 } 04315 svn_repos_revision_access_level_t; 04316 04317 04318 /** 04319 * Set @a access to the access level granted for @a revision in @a 04320 * repos, as determined by consulting the @a authz_read_func callback 04321 * function and its associated @a authz_read_baton. 04322 * 04323 * @a authz_read_func may be @c NULL, in which case @a access will be 04324 * set to #svn_repos_revision_access_full. 04325 * 04326 * @since New in 1.5. 04327 */ 04328 svn_error_t * 04329 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level, 04330 svn_repos_t *repos, 04331 svn_revnum_t revision, 04332 svn_repos_authz_func_t authz_read_func, 04333 void *authz_read_baton, 04334 apr_pool_t *pool); 04335 04336 04337 #ifdef __cplusplus 04338 } 04339 #endif /* __cplusplus */ 04340 04341 #endif /* SVN_REPOS_H */
1.6.1