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(const 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 * and therefore to send their content as deltas against the copy source, 01040 * whenever it deems feasible. The implementation only does so for 01041 * add_file(), and only when the file itself is the copy root (not when 01042 * the file is part of a copied subtree). 01043 * 01044 * Use @a authz_read_func and @a authz_read_baton (if not @c NULL) to 01045 * avoid sending data through @a editor/@a edit_baton which is not 01046 * authorized for transmission. 01047 * 01048 * @a zero_copy_limit controls the maximum size (in bytes) at which 01049 * data blocks may be sent using the zero-copy code path. On that 01050 * path, a number of in-memory copy operations have been eliminated to 01051 * maximize throughput. However, until the whole block has been 01052 * pushed to the network stack, other clients block, so be careful 01053 * when using larger values here. Pass 0 for @a zero_copy_limit to 01054 * disable this optimization altogether. 01055 * 01056 * @note Never activate this optimization if @a editor might access 01057 * any FSFS data structures (and, hence, caches). So, it is basically 01058 * safe for networked editors only. 01059 * 01060 * All allocation for the context and collected state will occur in 01061 * @a pool. 01062 * 01063 * @a depth is the requested depth of the editor drive. 01064 * 01065 * If @a depth is #svn_depth_unknown, the editor will affect only the 01066 * paths reported by the individual calls to svn_repos_set_path3() and 01067 * svn_repos_link_path3(). 01068 * 01069 * For example, if the reported tree is the @c A subdir of the Greek Tree 01070 * (see Subversion's test suite), at depth #svn_depth_empty, but the 01071 * @c A/B subdir is reported at depth #svn_depth_infinity, then 01072 * repository-side changes to @c A/mu, or underneath @c A/C and @c 01073 * A/D, would not be reflected in the editor drive, but changes 01074 * underneath @c A/B would be. 01075 * 01076 * Additionally, the editor driver will call @c add_directory and 01077 * and @c add_file for directories with an appropriate depth. For 01078 * example, a directory reported at #svn_depth_files will receive 01079 * file (but not directory) additions. A directory at #svn_depth_empty 01080 * will receive neither. 01081 * 01082 * If @a depth is #svn_depth_files, #svn_depth_immediates or 01083 * #svn_depth_infinity and @a depth is greater than the reported depth 01084 * of the working copy, then the editor driver will emit editor 01085 * operations so as to upgrade the working copy to this depth. 01086 * 01087 * If @a depth is #svn_depth_empty, #svn_depth_files, 01088 * #svn_depth_immediates and @a depth is lower 01089 * than or equal to the depth of the working copy, then the editor 01090 * operations will affect only paths at or above @a depth. 01091 * 01092 * @since New in 1.8. 01093 */ 01094 svn_error_t * 01095 svn_repos_begin_report3(void **report_baton, 01096 svn_revnum_t revnum, 01097 svn_repos_t *repos, 01098 const char *fs_base, 01099 const char *target, 01100 const char *tgt_path, 01101 svn_boolean_t text_deltas, 01102 svn_depth_t depth, 01103 svn_boolean_t ignore_ancestry, 01104 svn_boolean_t send_copyfrom_args, 01105 const svn_delta_editor_t *editor, 01106 void *edit_baton, 01107 svn_repos_authz_func_t authz_read_func, 01108 void *authz_read_baton, 01109 apr_size_t zero_copy_limit, 01110 apr_pool_t *pool); 01111 01112 /** 01113 * The same as svn_repos_begin_report3(), but with @a zero_copy_limit 01114 * always passed as 0. 01115 * 01116 * @since New in 1.5. 01117 * @deprecated Provided for backward compatibility with the 1.7 API. 01118 */ 01119 SVN_DEPRECATED 01120 svn_error_t * 01121 svn_repos_begin_report2(void **report_baton, 01122 svn_revnum_t revnum, 01123 svn_repos_t *repos, 01124 const char *fs_base, 01125 const char *target, 01126 const char *tgt_path, 01127 svn_boolean_t text_deltas, 01128 svn_depth_t depth, 01129 svn_boolean_t ignore_ancestry, 01130 svn_boolean_t send_copyfrom_args, 01131 const svn_delta_editor_t *editor, 01132 void *edit_baton, 01133 svn_repos_authz_func_t authz_read_func, 01134 void *authz_read_baton, 01135 apr_pool_t *pool); 01136 01137 /** 01138 * The same as svn_repos_begin_report2(), but taking a boolean 01139 * @a recurse flag, and sending FALSE for @a send_copyfrom_args. 01140 * 01141 * If @a recurse is TRUE, the editor driver will drive the editor with 01142 * a depth of #svn_depth_infinity; if FALSE, then with a depth of 01143 * #svn_depth_files. 01144 * 01145 * @note @a username is ignored, and has been removed in a revised 01146 * version of this API. 01147 * 01148 * @deprecated Provided for backward compatibility with the 1.4 API. 01149 */ 01150 SVN_DEPRECATED 01151 svn_error_t * 01152 svn_repos_begin_report(void **report_baton, 01153 svn_revnum_t revnum, 01154 const char *username, 01155 svn_repos_t *repos, 01156 const char *fs_base, 01157 const char *target, 01158 const char *tgt_path, 01159 svn_boolean_t text_deltas, 01160 svn_boolean_t recurse, 01161 svn_boolean_t ignore_ancestry, 01162 const svn_delta_editor_t *editor, 01163 void *edit_baton, 01164 svn_repos_authz_func_t authz_read_func, 01165 void *authz_read_baton, 01166 apr_pool_t *pool); 01167 01168 01169 /** 01170 * Given a @a report_baton constructed by svn_repos_begin_report3(), 01171 * record the presence of @a path, at @a revision with depth @a depth, 01172 * in the current tree. 01173 * 01174 * @a path is relative to the anchor/target used in the creation of the 01175 * @a report_baton. 01176 * 01177 * @a revision may be SVN_INVALID_REVNUM if (for example) @a path 01178 * represents a locally-added path with no revision number, or @a 01179 * depth is #svn_depth_exclude. 01180 * 01181 * @a path may not be underneath a path on which svn_repos_set_path3() 01182 * was previously called with #svn_depth_exclude in this report. 01183 * 01184 * The first call of this in a given report usually passes an empty 01185 * @a path; this is used to set up the correct root revision for the editor 01186 * drive. 01187 * 01188 * A depth of #svn_depth_unknown is not allowed, and results in an 01189 * error. 01190 * 01191 * If @a start_empty is TRUE and @a path is a directory, then require the 01192 * caller to explicitly provide all the children of @a path - do not assume 01193 * that the tree also contains all the children of @a path at @a revision. 01194 * This is for 'low confidence' client reporting. 01195 * 01196 * If the caller has a lock token for @a path, then @a lock_token should 01197 * be set to that token. Else, @a lock_token should be NULL. 01198 * 01199 * All temporary allocations are done in @a pool. 01200 * 01201 * @since New in 1.5. 01202 */ 01203 svn_error_t * 01204 svn_repos_set_path3(void *report_baton, 01205 const char *path, 01206 svn_revnum_t revision, 01207 svn_depth_t depth, 01208 svn_boolean_t start_empty, 01209 const char *lock_token, 01210 apr_pool_t *pool); 01211 01212 /** 01213 * Similar to svn_repos_set_path3(), but with @a depth set to 01214 * #svn_depth_infinity. 01215 * 01216 * @deprecated Provided for backward compatibility with the 1.4 API. 01217 */ 01218 SVN_DEPRECATED 01219 svn_error_t * 01220 svn_repos_set_path2(void *report_baton, 01221 const char *path, 01222 svn_revnum_t revision, 01223 svn_boolean_t start_empty, 01224 const char *lock_token, 01225 apr_pool_t *pool); 01226 01227 /** 01228 * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL. 01229 * 01230 * @deprecated Provided for backward compatibility with the 1.1 API. 01231 */ 01232 SVN_DEPRECATED 01233 svn_error_t * 01234 svn_repos_set_path(void *report_baton, 01235 const char *path, 01236 svn_revnum_t revision, 01237 svn_boolean_t start_empty, 01238 apr_pool_t *pool); 01239 01240 /** 01241 * Given a @a report_baton constructed by svn_repos_begin_report3(), 01242 * record the presence of @a path in the current tree, containing the contents 01243 * of @a link_path at @a revision with depth @a depth. 01244 * 01245 * A depth of #svn_depth_unknown is not allowed, and results in an 01246 * error. 01247 * 01248 * @a path may not be underneath a path on which svn_repos_set_path3() 01249 * was previously called with #svn_depth_exclude in this report. 01250 * 01251 * Note that while @a path is relative to the anchor/target used in the 01252 * creation of the @a report_baton, @a link_path is an absolute filesystem 01253 * path! 01254 * 01255 * If @a start_empty is TRUE and @a path is a directory, then require the 01256 * caller to explicitly provide all the children of @a path - do not assume 01257 * that the tree also contains all the children of @a link_path at 01258 * @a revision. This is for 'low confidence' client reporting. 01259 * 01260 * If the caller has a lock token for @a link_path, then @a lock_token 01261 * should be set to that token. Else, @a lock_token should be NULL. 01262 * 01263 * All temporary allocations are done in @a pool. 01264 * 01265 * @since New in 1.5. 01266 */ 01267 svn_error_t * 01268 svn_repos_link_path3(void *report_baton, 01269 const char *path, 01270 const char *link_path, 01271 svn_revnum_t revision, 01272 svn_depth_t depth, 01273 svn_boolean_t start_empty, 01274 const char *lock_token, 01275 apr_pool_t *pool); 01276 01277 /** 01278 * Similar to svn_repos_link_path3(), but with @a depth set to 01279 * #svn_depth_infinity. 01280 * 01281 * @deprecated Provided for backward compatibility with the 1.4 API. 01282 */ 01283 SVN_DEPRECATED 01284 svn_error_t * 01285 svn_repos_link_path2(void *report_baton, 01286 const char *path, 01287 const char *link_path, 01288 svn_revnum_t revision, 01289 svn_boolean_t start_empty, 01290 const char *lock_token, 01291 apr_pool_t *pool); 01292 01293 /** 01294 * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL. 01295 * 01296 * @deprecated Provided for backward compatibility with the 1.1 API. 01297 */ 01298 SVN_DEPRECATED 01299 svn_error_t * 01300 svn_repos_link_path(void *report_baton, 01301 const char *path, 01302 const char *link_path, 01303 svn_revnum_t revision, 01304 svn_boolean_t start_empty, 01305 apr_pool_t *pool); 01306 01307 /** Given a @a report_baton constructed by svn_repos_begin_report3(), 01308 * record the non-existence of @a path in the current tree. 01309 * 01310 * @a path may not be underneath a path on which svn_repos_set_path3() 01311 * was previously called with #svn_depth_exclude in this report. 01312 * 01313 * (This allows the reporter's driver to describe missing pieces of a 01314 * working copy, so that 'svn up' can recreate them.) 01315 * 01316 * All temporary allocations are done in @a pool. 01317 */ 01318 svn_error_t * 01319 svn_repos_delete_path(void *report_baton, 01320 const char *path, 01321 apr_pool_t *pool); 01322 01323 /** Given a @a report_baton constructed by svn_repos_begin_report3(), 01324 * finish the report and drive the editor as specified when the report 01325 * baton was constructed. 01326 * 01327 * If an error occurs during the driving of the editor, do NOT abort the 01328 * edit; that responsibility belongs to the caller of this function, if 01329 * it happens at all. 01330 * 01331 * After the call to this function, @a report_baton is no longer valid; 01332 * it should not be passed to any other reporting functions, including 01333 * svn_repos_abort_report(), even if this function returns an error. 01334 */ 01335 svn_error_t * 01336 svn_repos_finish_report(void *report_baton, 01337 apr_pool_t *pool); 01338 01339 01340 /** Given a @a report_baton constructed by svn_repos_begin_report3(), 01341 * abort the report. This function can be called anytime before 01342 * svn_repos_finish_report() is called. 01343 * 01344 * After the call to this function, @a report_baton is no longer valid; 01345 * it should not be passed to any other reporting functions. 01346 */ 01347 svn_error_t * 01348 svn_repos_abort_report(void *report_baton, 01349 apr_pool_t *pool); 01350 01351 01352 /* ---------------------------------------------------------------*/ 01353 01354 /* The magical dir_delta update routines. */ 01355 01356 /** Use the provided @a editor and @a edit_baton to describe the changes 01357 * necessary for making a given node (and its descendants, if it is a 01358 * directory) under @a src_root look exactly like @a tgt_path under 01359 * @a tgt_root. @a src_entry is the node to update. If @a src_entry 01360 * is empty, then compute the difference between the entire tree 01361 * anchored at @a src_parent_dir under @a src_root and @a tgt_path 01362 * under @a tgt_root. Else, describe the changes needed to update 01363 * only that entry in @a src_parent_dir. Typically, callers of this 01364 * function will use a @a tgt_path that is the concatenation of @a 01365 * src_parent_dir and @a src_entry. 01366 * 01367 * @a src_root and @a tgt_root can both be either revision or transaction 01368 * roots. If @a tgt_root is a revision, @a editor's set_target_revision() 01369 * will be called with the @a tgt_root's revision number, else it will 01370 * not be called at all. 01371 * 01372 * If @a authz_read_func is non-NULL, invoke it before any call to 01373 * 01374 * @a editor->open_root 01375 * @a editor->add_directory 01376 * @a editor->open_directory 01377 * @a editor->add_file 01378 * @a editor->open_file 01379 * 01380 * passing @a tgt_root, the same path that would be passed to the 01381 * editor function in question, and @a authz_read_baton. If the 01382 * @a *allowed parameter comes back TRUE, then proceed with the planned 01383 * editor call; else if FALSE, then invoke @a editor->absent_file or 01384 * @a editor->absent_directory as appropriate, except if the planned 01385 * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE. 01386 * 01387 * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to 01388 * the window handler returned by @a editor->apply_textdelta(). 01389 * 01390 * If @a depth is #svn_depth_empty, invoke @a editor calls only on 01391 * @a src_entry (or @a src_parent_dir, if @a src_entry is empty). 01392 * If @a depth is #svn_depth_files, also invoke the editor on file 01393 * children, if any; if #svn_depth_immediates, invoke it on 01394 * immediate subdirectories as well as files; if #svn_depth_infinity, 01395 * recurse fully. 01396 * 01397 * If @a entry_props is @c TRUE, accompany each opened/added entry with 01398 * propchange editor calls that relay special "entry props" (this 01399 * is typically used only for working copy updates). 01400 * 01401 * @a ignore_ancestry instructs the function to ignore node ancestry 01402 * when determining how to transmit differences. 01403 * 01404 * Before completing successfully, this function calls @a editor's 01405 * close_edit(), so the caller should expect its @a edit_baton to be 01406 * invalid after its use with this function. 01407 * 01408 * Do any allocation necessary for the delta computation in @a pool. 01409 * This function's maximum memory consumption is at most roughly 01410 * proportional to the greatest depth of the tree under @a tgt_root, not 01411 * the total size of the delta. 01412 * 01413 * ### svn_repos_dir_delta2 is mostly superseded by the reporter 01414 * ### functionality (svn_repos_begin_report3 and friends). 01415 * ### svn_repos_dir_delta2 does allow the roots to be transaction 01416 * ### roots rather than just revision roots, and it has the 01417 * ### entry_props flag. Almost all of Subversion's own code uses the 01418 * ### reporter instead; there are some stray references to the 01419 * ### svn_repos_dir_delta[2] in comments which should probably 01420 * ### actually refer to the reporter. 01421 * 01422 * @since New in 1.5. 01423 */ 01424 svn_error_t * 01425 svn_repos_dir_delta2(svn_fs_root_t *src_root, 01426 const char *src_parent_dir, 01427 const char *src_entry, 01428 svn_fs_root_t *tgt_root, 01429 const char *tgt_path, 01430 const svn_delta_editor_t *editor, 01431 void *edit_baton, 01432 svn_repos_authz_func_t authz_read_func, 01433 void *authz_read_baton, 01434 svn_boolean_t text_deltas, 01435 svn_depth_t depth, 01436 svn_boolean_t entry_props, 01437 svn_boolean_t ignore_ancestry, 01438 apr_pool_t *pool); 01439 01440 /** 01441 * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass 01442 * #svn_depth_infinity for @a depth, and if @a recurse is FALSE, 01443 * pass #svn_depth_files for @a depth. 01444 * 01445 * @deprecated Provided for backward compatibility with the 1.4 API. 01446 */ 01447 SVN_DEPRECATED 01448 svn_error_t * 01449 svn_repos_dir_delta(svn_fs_root_t *src_root, 01450 const char *src_parent_dir, 01451 const char *src_entry, 01452 svn_fs_root_t *tgt_root, 01453 const char *tgt_path, 01454 const svn_delta_editor_t *editor, 01455 void *edit_baton, 01456 svn_repos_authz_func_t authz_read_func, 01457 void *authz_read_baton, 01458 svn_boolean_t text_deltas, 01459 svn_boolean_t recurse, 01460 svn_boolean_t entry_props, 01461 svn_boolean_t ignore_ancestry, 01462 apr_pool_t *pool); 01463 01464 01465 /** Use the provided @a editor and @a edit_baton to describe the 01466 * skeletal changes made in a particular filesystem @a root 01467 * (revision or transaction). 01468 * 01469 * Changes will be limited to those within @a base_dir, and if 01470 * @a low_water_mark is set to something other than #SVN_INVALID_REVNUM 01471 * it is assumed that the client has no knowledge of revisions prior to 01472 * @a low_water_mark. Together, these two arguments define the portion of 01473 * the tree that the client is assumed to have knowledge of, and thus any 01474 * copies of data from outside that part of the tree will be sent in their 01475 * entirety, not as simple copies or deltas against a previous version. 01476 * 01477 * The @a editor passed to this function should be aware of the fact 01478 * that, if @a send_deltas is FALSE, calls to its change_dir_prop(), 01479 * change_file_prop(), and apply_textdelta() functions will not 01480 * contain meaningful data, and merely serve as indications that 01481 * properties or textual contents were changed. 01482 * 01483 * If @a send_deltas is @c TRUE, the text and property deltas for changes 01484 * will be sent, otherwise NULL text deltas and empty prop changes will be 01485 * used. 01486 * 01487 * If @a authz_read_func is non-NULL, it will be used to determine if the 01488 * user has read access to the data being accessed. Data that the user 01489 * cannot access will be skipped. 01490 * 01491 * @note This editor driver passes SVN_INVALID_REVNUM for all 01492 * revision parameters in the editor interface except the copyfrom 01493 * parameter of the add_file() and add_directory() editor functions. 01494 * 01495 * @since New in 1.4. 01496 */ 01497 svn_error_t * 01498 svn_repos_replay2(svn_fs_root_t *root, 01499 const char *base_dir, 01500 svn_revnum_t low_water_mark, 01501 svn_boolean_t send_deltas, 01502 const svn_delta_editor_t *editor, 01503 void *edit_baton, 01504 svn_repos_authz_func_t authz_read_func, 01505 void *authz_read_baton, 01506 apr_pool_t *pool); 01507 01508 /** 01509 * Similar to svn_repos_replay2(), but with @a base_dir set to @c "", 01510 * @a low_water_mark set to #SVN_INVALID_REVNUM, @a send_deltas 01511 * set to @c FALSE, and @a authz_read_func and @a authz_read_baton 01512 * set to @c NULL. 01513 * 01514 * @deprecated Provided for backward compatibility with the 1.3 API. 01515 */ 01516 SVN_DEPRECATED 01517 svn_error_t * 01518 svn_repos_replay(svn_fs_root_t *root, 01519 const svn_delta_editor_t *editor, 01520 void *edit_baton, 01521 apr_pool_t *pool); 01522 01523 /* ---------------------------------------------------------------*/ 01524 01525 /* Making commits. */ 01526 01527 /** 01528 * Return an @a editor and @a edit_baton to commit changes to the 01529 * filesystem of @a repos, beginning at location 'rev:@a base_path', 01530 * where "rev" is the argument given to open_root(). 01531 * 01532 * @a repos is a previously opened repository. @a repos_url_decoded is the 01533 * decoded URL to the base of the repository, and is used to check 01534 * copyfrom paths. @a txn is a filesystem transaction object to use 01535 * during the commit, or @c NULL to indicate that this function should 01536 * create (and fully manage) a new transaction. 01537 * 01538 * Store the contents of @a revprop_table, a hash mapping <tt>const 01539 * char *</tt> property names to #svn_string_t values, as properties 01540 * of the commit transaction, including author and log message if 01541 * present. 01542 * 01543 * @note #SVN_PROP_REVISION_DATE may be present in @a revprop_table, but 01544 * it will be overwritten when the transaction is committed. 01545 * 01546 * Iff @a authz_callback is provided, check read/write authorizations 01547 * on paths accessed by editor operations. An operation which fails 01548 * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or 01549 * SVN_ERR_AUTHZ_UNWRITABLE. 01550 * 01551 * Calling @a (*editor)->close_edit completes the commit. 01552 * 01553 * If @a commit_callback is non-NULL, then before @c close_edit returns (but 01554 * after the commit has succeeded) @c close_edit will invoke 01555 * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton, 01556 * and @a pool or some subpool thereof as arguments. The @c repos_root field 01557 * of the #svn_commit_info_t is @c NULL. If @a commit_callback 01558 * returns an error, that error will be returned from @c close_edit, 01559 * otherwise if there was a post-commit hook failure, then that error 01560 * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. 01561 * (Note that prior to Subversion 1.6, @a commit_callback cannot be @c NULL; 01562 * if you don't need a callback, pass a dummy function.) 01563 * 01564 * Calling @a (*editor)->abort_edit aborts the commit, and will also 01565 * abort the commit transaction unless @a txn was supplied (not @c 01566 * NULL). Callers who supply their own transactions are responsible 01567 * for cleaning them up (either by committing them, or aborting them). 01568 * 01569 * @since New in 1.5. Since 1.6, @a commit_callback can be @c NULL. 01570 * 01571 * @note Yes, @a repos_url_decoded is a <em>decoded</em> URL. We realize 01572 * that's sorta wonky. Sorry about that. 01573 * 01574 * @note Like most commit editors, the returned editor requires that the 01575 * @c copyfrom_path parameter passed to its @c add_file and @c add_directory 01576 * methods is a full, URI-encoded URL, not a relative path. 01577 */ 01578 svn_error_t * 01579 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor, 01580 void **edit_baton, 01581 svn_repos_t *repos, 01582 svn_fs_txn_t *txn, 01583 const char *repos_url_decoded, 01584 const char *base_path, 01585 apr_hash_t *revprop_table, 01586 svn_commit_callback2_t commit_callback, 01587 void *commit_baton, 01588 svn_repos_authz_callback_t authz_callback, 01589 void *authz_baton, 01590 apr_pool_t *pool); 01591 01592 /** 01593 * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table 01594 * set to a hash containing @a user and @a log_msg as the 01595 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties, 01596 * respectively. @a user and @a log_msg may both be @c NULL. 01597 * 01598 * @since New in 1.4. 01599 * 01600 * @deprecated Provided for backward compatibility with the 1.4 API. 01601 */ 01602 SVN_DEPRECATED 01603 svn_error_t * 01604 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor, 01605 void **edit_baton, 01606 svn_repos_t *repos, 01607 svn_fs_txn_t *txn, 01608 const char *repos_url, 01609 const char *base_path, 01610 const char *user, 01611 const char *log_msg, 01612 svn_commit_callback2_t commit_callback, 01613 void *commit_baton, 01614 svn_repos_authz_callback_t authz_callback, 01615 void *authz_baton, 01616 apr_pool_t *pool); 01617 01618 /** 01619 * Similar to svn_repos_get_commit_editor4(), but 01620 * uses the svn_commit_callback_t type. 01621 * 01622 * @since New in 1.3. 01623 * 01624 * @deprecated Provided for backward compatibility with the 1.3 API. 01625 */ 01626 SVN_DEPRECATED 01627 svn_error_t * 01628 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor, 01629 void **edit_baton, 01630 svn_repos_t *repos, 01631 svn_fs_txn_t *txn, 01632 const char *repos_url, 01633 const char *base_path, 01634 const char *user, 01635 const char *log_msg, 01636 svn_commit_callback_t callback, 01637 void *callback_baton, 01638 svn_repos_authz_callback_t authz_callback, 01639 void *authz_baton, 01640 apr_pool_t *pool); 01641 01642 /** 01643 * Similar to svn_repos_get_commit_editor3(), but with @a 01644 * authz_callback and @a authz_baton set to @c NULL. 01645 * 01646 * @deprecated Provided for backward compatibility with the 1.2 API. 01647 */ 01648 SVN_DEPRECATED 01649 svn_error_t * 01650 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor, 01651 void **edit_baton, 01652 svn_repos_t *repos, 01653 svn_fs_txn_t *txn, 01654 const char *repos_url, 01655 const char *base_path, 01656 const char *user, 01657 const char *log_msg, 01658 svn_commit_callback_t callback, 01659 void *callback_baton, 01660 apr_pool_t *pool); 01661 01662 01663 /** 01664 * Similar to svn_repos_get_commit_editor2(), but with @a txn always 01665 * set to @c NULL. 01666 * 01667 * @deprecated Provided for backward compatibility with the 1.1 API. 01668 */ 01669 SVN_DEPRECATED 01670 svn_error_t * 01671 svn_repos_get_commit_editor(const svn_delta_editor_t **editor, 01672 void **edit_baton, 01673 svn_repos_t *repos, 01674 const char *repos_url, 01675 const char *base_path, 01676 const char *user, 01677 const char *log_msg, 01678 svn_commit_callback_t callback, 01679 void *callback_baton, 01680 apr_pool_t *pool); 01681 01682 /* ---------------------------------------------------------------*/ 01683 01684 /* Finding particular revisions. */ 01685 01686 /** Set @a *revision to the revision number in @a repos's filesystem that was 01687 * youngest at time @a tm. 01688 */ 01689 svn_error_t * 01690 svn_repos_dated_revision(svn_revnum_t *revision, 01691 svn_repos_t *repos, 01692 apr_time_t tm, 01693 apr_pool_t *pool); 01694 01695 01696 /** Given a @a root/@a path within some filesystem, return three pieces of 01697 * information allocated in @a pool: 01698 * 01699 * - set @a *committed_rev to the revision in which the object was 01700 * last modified. (In fs parlance, this is the revision in which 01701 * the particular node-rev-id was 'created'.) 01702 * 01703 * - set @a *committed_date to the date of said revision, or @c NULL 01704 * if not available. 01705 * 01706 * - set @a *last_author to the author of said revision, or @c NULL 01707 * if not available. 01708 */ 01709 svn_error_t * 01710 svn_repos_get_committed_info(svn_revnum_t *committed_rev, 01711 const char **committed_date, 01712 const char **last_author, 01713 svn_fs_root_t *root, 01714 const char *path, 01715 apr_pool_t *pool); 01716 01717 01718 /** 01719 * Set @a *dirent to an #svn_dirent_t associated with @a path in @a 01720 * root. If @a path does not exist in @a root, set @a *dirent to 01721 * NULL. Use @a pool for memory allocation. 01722 * 01723 * @since New in 1.2. 01724 */ 01725 svn_error_t * 01726 svn_repos_stat(svn_dirent_t **dirent, 01727 svn_fs_root_t *root, 01728 const char *path, 01729 apr_pool_t *pool); 01730 01731 /** 01732 * Callback type to be used with svn_repos_list(). It will be invoked for 01733 * every directory entry found. 01734 * 01735 * The full path of the entry is given in @a path and @a dirent contains 01736 * various additional information. If svn_repos_list() has been called 01737 * with @a path_info_only set, only the @a kind element of this struct 01738 * will be valid. 01739 * 01740 * @a baton is the user-provided receiver baton. @a scratch_pool may be 01741 * used for temporary allocations. 01742 * 01743 * @since New in 1.10. 01744 */ 01745 typedef svn_error_t *(* svn_repos_dirent_receiver_t)(const char *path, 01746 svn_dirent_t *dirent, 01747 void *baton, 01748 apr_pool_t *scratch_pool); 01749 01750 /** 01751 * Efficiently list everything within a sub-tree. Specify glob patterns 01752 * to search for specific files and folders. 01753 * 01754 * Walk the sub-tree starting at @a path under @a root up to the given 01755 * @a depth. For each directory entry found, @a receiver will be called 01756 * with @a receiver_baton. The starting @a path will be reported as well. 01757 * Because retrieving all elements of a #svn_dirent_t can be expensive, 01758 * you may set @a path_info_only to receive only the path name and the node 01759 * kind. The entries will be reported ordered by their path. 01760 * 01761 * @a patterns is an optional array of <tt>const char *</tt>. If it is 01762 * not @c NULL, only those directory entries will be reported whose last 01763 * path segment matches at least one of these patterns. This feature uses 01764 * apr_fnmatch() for glob matching and requiring '.' to matched by dots 01765 * in the path. 01766 * 01767 * If @a authz_read_func is not @c NULL, this function will neither report 01768 * entries nor recurse into directories that the user has no access to. 01769 * 01770 * Cancellation support is provided in the usual way through the optional 01771 * @a cancel_func and @a cancel_baton. 01772 * 01773 * @a path must point to a directory and @a depth must be at least 01774 * #svn_depth_empty. 01775 * 01776 * Use @a scratch_pool for temporary memory allocation. 01777 * 01778 * @since New in 1.10. 01779 */ 01780 svn_error_t * 01781 svn_repos_list(svn_fs_root_t *root, 01782 const char *path, 01783 const apr_array_header_t *patterns, 01784 svn_depth_t depth, 01785 svn_boolean_t path_info_only, 01786 svn_repos_authz_func_t authz_read_func, 01787 void *authz_read_baton, 01788 svn_repos_dirent_receiver_t receiver, 01789 void *receiver_baton, 01790 svn_cancel_func_t cancel_func, 01791 void *cancel_baton, 01792 apr_pool_t *scratch_pool); 01793 01794 /** 01795 * Given @a path which exists at revision @a start in @a fs, set 01796 * @a *deleted to the revision @a path was first deleted, within the 01797 * inclusive revision range bounded by @a start and @a end. If @a path 01798 * does not exist at revision @a start or was not deleted within the 01799 * specified range, then set @a *deleted to SVN_INVALID_REVNUM. 01800 * Use @a pool for memory allocation. 01801 * 01802 * @since New in 1.5. 01803 */ 01804 svn_error_t * 01805 svn_repos_deleted_rev(svn_fs_t *fs, 01806 const char *path, 01807 svn_revnum_t start, 01808 svn_revnum_t end, 01809 svn_revnum_t *deleted, 01810 apr_pool_t *pool); 01811 01812 01813 /** Callback type for use with svn_repos_history(). @a path and @a 01814 * revision represent interesting history locations in the lifetime 01815 * of the path passed to svn_repos_history(). @a baton is the same 01816 * baton given to svn_repos_history(). @a pool is provided for the 01817 * convenience of the implementor, who should not expect it to live 01818 * longer than a single callback call. 01819 * 01820 * Signal to callback driver to stop processing/invoking this callback 01821 * by returning the #SVN_ERR_CEASE_INVOCATION error code. 01822 * 01823 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 01824 */ 01825 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton, 01826 const char *path, 01827 svn_revnum_t revision, 01828 apr_pool_t *pool); 01829 01830 /** 01831 * Call @a history_func (with @a history_baton) for each interesting 01832 * history location in the lifetime of @a path in @a fs, from the 01833 * youngest of @a end and @a start to the oldest. Stop processing if 01834 * @a history_func returns #SVN_ERR_CEASE_INVOCATION. Only cross 01835 * filesystem copy history if @a cross_copies is @c TRUE. And do all 01836 * of this in @a pool. 01837 * 01838 * If @a authz_read_func is non-NULL, then use it (and @a 01839 * authz_read_baton) to verify that @a path in @a end is readable; if 01840 * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability 01841 * of every ancestral path/revision pair before pushing them at @a 01842 * history_func. If a pair is deemed unreadable, then do not send 01843 * them; instead, immediately stop traversing history and return 01844 * SVN_NO_ERROR. 01845 * 01846 * @since New in 1.1. 01847 * 01848 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 01849 */ 01850 svn_error_t * 01851 svn_repos_history2(svn_fs_t *fs, 01852 const char *path, 01853 svn_repos_history_func_t history_func, 01854 void *history_baton, 01855 svn_repos_authz_func_t authz_read_func, 01856 void *authz_read_baton, 01857 svn_revnum_t start, 01858 svn_revnum_t end, 01859 svn_boolean_t cross_copies, 01860 apr_pool_t *pool); 01861 01862 /** 01863 * Similar to svn_repos_history2(), but with @a authz_read_func 01864 * and @a authz_read_baton always set to NULL. 01865 * 01866 * @deprecated Provided for backward compatibility with the 1.0 API. 01867 */ 01868 SVN_DEPRECATED 01869 svn_error_t * 01870 svn_repos_history(svn_fs_t *fs, 01871 const char *path, 01872 svn_repos_history_func_t history_func, 01873 void *history_baton, 01874 svn_revnum_t start, 01875 svn_revnum_t end, 01876 svn_boolean_t cross_copies, 01877 apr_pool_t *pool); 01878 01879 01880 /** 01881 * Set @a *locations to be a mapping of the revisions to the paths of 01882 * the file @a fs_path present at the repository in revision 01883 * @a peg_revision, where the revisions are taken out of the array 01884 * @a location_revisions. 01885 * 01886 * @a location_revisions is an array of svn_revnum_t's and @a *locations 01887 * maps 'svn_revnum_t *' to 'const char *'. 01888 * 01889 * If optional @a authz_read_func is non-NULL, then use it (and @a 01890 * authz_read_baton) to verify that the peg-object is readable. If not, 01891 * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func 01892 * to check that every path returned in the hash is readable. If an 01893 * unreadable path is encountered, stop tracing and return 01894 * SVN_NO_ERROR. 01895 * 01896 * @a pool is used for all allocations. 01897 * 01898 * @since New in 1.1. 01899 */ 01900 svn_error_t * 01901 svn_repos_trace_node_locations(svn_fs_t *fs, 01902 apr_hash_t **locations, 01903 const char *fs_path, 01904 svn_revnum_t peg_revision, 01905 const apr_array_header_t *location_revisions, 01906 svn_repos_authz_func_t authz_read_func, 01907 void *authz_read_baton, 01908 apr_pool_t *pool); 01909 01910 01911 /** 01912 * Call @a receiver and @a receiver_baton to report successive 01913 * location segments in revisions between @a start_rev and @a end_rev 01914 * (inclusive) for the line of history identified by the peg-object @a 01915 * path in @a peg_revision (and in @a repos). 01916 * 01917 * @a end_rev may be #SVN_INVALID_REVNUM to indicate that you want 01918 * to trace the history of the object to its origin. 01919 * 01920 * @a start_rev may be #SVN_INVALID_REVNUM to indicate "the HEAD 01921 * revision". Otherwise, @a start_rev must be younger than @a end_rev 01922 * (unless @a end_rev is #SVN_INVALID_REVNUM). 01923 * 01924 * @a peg_revision may be #SVN_INVALID_REVNUM to indicate "the HEAD 01925 * revision", and must evaluate to be at least as young as @a start_rev. 01926 * 01927 * If optional @a authz_read_func is not @c NULL, then use it (and @a 01928 * authz_read_baton) to verify that the peg-object is readable. If 01929 * not, return #SVN_ERR_AUTHZ_UNREADABLE. Also use the @a 01930 * authz_read_func to check that every path reported in a location 01931 * segment is readable. If an unreadable path is encountered, report 01932 * a final (possibly truncated) location segment (if any), stop 01933 * tracing history, and return #SVN_NO_ERROR. 01934 * 01935 * @a pool is used for all allocations. 01936 * 01937 * @since New in 1.5. 01938 */ 01939 svn_error_t * 01940 svn_repos_node_location_segments(svn_repos_t *repos, 01941 const char *path, 01942 svn_revnum_t peg_revision, 01943 svn_revnum_t start_rev, 01944 svn_revnum_t end_rev, 01945 svn_location_segment_receiver_t receiver, 01946 void *receiver_baton, 01947 svn_repos_authz_func_t authz_read_func, 01948 void *authz_read_baton, 01949 apr_pool_t *pool); 01950 01951 01952 /* ---------------------------------------------------------------*/ 01953 01954 /* Retrieving log messages. */ 01955 01956 /** Path change descriptor. 01957 * 01958 * @note Identical to #svn_fs_path_change3_t but with all information 01959 * known, i.e. @a node_kind is never #svn_node_unknown and 01960 * @a copyfrom_known is always @c TRUE. 01961 * 01962 * @note To allow for extending this structure in future releases, 01963 * always use svn_repos_path_change_create() to allocate the stucture. 01964 * 01965 * @see svn_fs_path_change3_t 01966 * 01967 * @since New in 1.10. 01968 */ 01969 typedef svn_fs_path_change3_t svn_repos_path_change_t; 01970 01971 /** 01972 * Return an #svn_repos_path_change_t structure, allocated in @a result_pool, 01973 * with all fields initialized to their respective null/none/empty/invalid 01974 * values. 01975 * 01976 * @note To allow for extending the #svn_repos_path_change_t structure in 01977 * future releases, this function should always be used to allocate it. 01978 * 01979 * @since New in 1.10. 01980 */ 01981 svn_repos_path_change_t * 01982 svn_repos_path_change_create(apr_pool_t *result_pool); 01983 01984 /** 01985 * Return a deep copy of @a change, allocated in @a result_pool. 01986 * 01987 * @since New in 1.10. 01988 */ 01989 svn_repos_path_change_t * 01990 svn_repos_path_change_dup(svn_repos_path_change_t *change, 01991 apr_pool_t *result_pool); 01992 01993 /** The callback invoked by log message loopers, such as 01994 * svn_repos_get_logs5(). 01995 * 01996 * This function is invoked once on each changed path, in a potentially 01997 * random order that may even change between invocations for the same 01998 * revisions. 01999 * 02000 * @a baton is what you think it is, and @a change contains relevant 02001 * information for the changed path. Please note that @a change may be 02002 * modified within this callback but it will become invalid as soon as 02003 * the callback returns. 02004 * 02005 * Use @a scratch_pool for temporary allocation. The caller may clear it 02006 * between or after invocations. 02007 * 02008 * @since New in 1.10. 02009 */ 02010 typedef svn_error_t *(*svn_repos_path_change_receiver_t)( 02011 void *baton, 02012 svn_repos_path_change_t *change, 02013 apr_pool_t *scratch_pool); 02014 02015 02016 /** 02017 * A structure to represent all the information about a particular log entry. 02018 * 02019 * @note To allow for extending this structure in future releases, 02020 * always use svn_repos_log_entry_create() to allocate the stucture. 02021 * 02022 * @since New in 1.10. 02023 */ 02024 typedef struct svn_repos_log_entry_t 02025 { 02026 /** The revision of the commit. */ 02027 svn_revnum_t revision; 02028 02029 /** The hash of requested revision properties, which may be NULL if it 02030 * would contain no revprops. Maps (const char *) property name to 02031 * (svn_string_t *) property value. */ 02032 apr_hash_t *revprops; 02033 02034 /** 02035 * Whether or not this message has children. 02036 * 02037 * When a log operation requests additional merge information, extra log 02038 * entries may be returned as a result of this entry. The new entries, are 02039 * considered children of the original entry, and will follow it. When 02040 * the HAS_CHILDREN flag is set, the receiver should increment its stack 02041 * depth, and wait until an entry is provided with SVN_INVALID_REVNUM which 02042 * indicates the end of the children. 02043 * 02044 * For log operations which do not request additional merge information, the 02045 * HAS_CHILDREN flag is always FALSE. 02046 * 02047 * For more information see: 02048 * https://svn.apache.org/repos/asf/subversion/trunk/notes/merge-tracking/design.html#commutative-reporting 02049 */ 02050 svn_boolean_t has_children; 02051 02052 /** 02053 * Whether @a revision should be interpreted as non-inheritable in the 02054 * same sense of #svn_merge_range_t. 02055 * 02056 * Currently always FALSE. 02057 */ 02058 svn_boolean_t non_inheritable; 02059 02060 /** 02061 * Whether @a revision is a merged revision resulting from a reverse merge. 02062 */ 02063 svn_boolean_t subtractive_merge; 02064 02065 /* NOTE: Add new fields at the end to preserve binary compatibility. */ 02066 } svn_repos_log_entry_t; 02067 02068 /** 02069 * Return an #svn_repos_log_entry_t, allocated in @a result_pool, 02070 * with all fields initialized to their respective null/none/empty/invalid 02071 * values. 02072 * 02073 * @note To allow for extending the #svn_repos_log_entry_t structure in 02074 * future releases, this function should always be used to allocate it. 02075 * 02076 * @since New in 1.10. 02077 */ 02078 svn_repos_log_entry_t * 02079 svn_repos_log_entry_create(apr_pool_t *result_pool); 02080 02081 /** Return a deep copy of @a log_entry, allocated in @a result_pool. 02082 * 02083 * @since New in 1.10. 02084 */ 02085 svn_repos_log_entry_t * 02086 svn_repos_log_entry_dup(const svn_repos_log_entry_t *log_entry, 02087 apr_pool_t *result_pool); 02088 02089 02090 /** The callback invoked by log message loopers, such as 02091 * svn_repos_get_logs5(). 02092 * 02093 * This function is invoked once on each log message, in the order 02094 * determined by the caller (see above-mentioned functions). 02095 * 02096 * @a baton is what you think it is, and @a log_entry contains relevant 02097 * information for the log message. 02098 * 02099 * If @a log_entry->has_children is @c TRUE, the message will be followed 02100 * immediately by any number of merged revisions (child messages), which are 02101 * terminated by an invocation with SVN_INVALID_REVNUM. This usage may 02102 * be recursive. 02103 * 02104 * Use @a scratch_pool for temporary allocation. The caller may clear it 02105 * between or after invocations. 02106 * 02107 * @since New in 1.10. 02108 */ 02109 typedef svn_error_t *(*svn_repos_log_entry_receiver_t)( 02110 void *baton, 02111 svn_repos_log_entry_t *log_entry, 02112 apr_pool_t *scratch_pool); 02113 02114 02115 /** 02116 * Invoke @a revision_receiver with @a revision_receiver_baton on each 02117 * revision from @a start to @a end in @a repos's filesystem. @a start may 02118 * be greater or less than @a end; this just controls whether the log is 02119 * processed in descending or ascending revision number order. 02120 * 02121 * If not @c NULL, @a path_change_receiver will be invoked with 02122 * @a path_change_receiver_baton for each changed path in the respective 02123 * revision. These changes will be reported before the @a revision_receiver 02124 * is invoked for that revision. So, for each revision in the log, there 02125 * is a number of calls to @a path_change_receiver followed by a single 02126 * invocation of @a revision_receiver, implicitly marking the end of the 02127 * changes list for that revision. If a revision does not contain any 02128 * changes (or if none are visible due to @a authz_read_func), 02129 * @a path_change_receiver will not be called for that revision. 02130 * 02131 * If @a start or @a end is #SVN_INVALID_REVNUM, it defaults to youngest. 02132 * 02133 * If @a paths is non-NULL and has one or more elements, then only show 02134 * revisions in which at least one of @a paths was changed (i.e., if 02135 * file, text or props changed; if dir, props or entries changed or any node 02136 * changed below it). Each path is a <tt>const char *</tt> representing 02137 * an absolute path in the repository. If @a paths is NULL or empty, 02138 * show all revisions regardless of what paths were changed in those 02139 * revisions. 02140 * 02141 * If @a limit is greater than zero then only invoke @a revision_receiver 02142 * on the first @a limit logs. 02143 * 02144 * If @a strict_node_history is set, copy history (if any exists) will 02145 * not be traversed while harvesting revision logs for each path. 02146 * 02147 * If @a include_merged_revisions is set, log information for revisions 02148 * which have been merged to @a paths will also be returned, unless these 02149 * revisions are already part of @a start to @a end in @a repos's 02150 * filesystem, as limited by @a paths. In the latter case those revisions 02151 * are skipped and @a receiver is not invoked. 02152 * 02153 * If @a revprops is NULL, retrieve all revision properties; else, retrieve 02154 * only the revision properties named by the (const char *) array elements 02155 * (i.e. retrieve none if the array is empty). 02156 * 02157 * If any invocation of @a revision_receiver or @a path_change_receiver 02158 * returnn an error, return that error immediately and without wrapping it. 02159 * 02160 * If @a start or @a end is a non-existent revision, return the error 02161 * #SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a revision_receiver. 02162 * 02163 * If optional @a authz_read_func is non-NULL, then use this function 02164 * (along with optional @a authz_read_baton) to check the readability 02165 * of each changed-path in each revision about to be "pushed" at 02166 * @a path_change_receiver. If a revision has some changed-paths readable 02167 * and others unreadable, unreadable paths are omitted from the 02168 * @a path_change_receiver invocations and only svn:author and svn:date 02169 * will be available in the revprops field in the @a revision_receiver 02170 * callback. If a revision has no changed-paths readable at all, then all 02171 * paths are omitted and no revprops are available. If 02172 * @a path_change_receiver is @c NULL, the same filtering is performed 02173 * just without reporting any path changes. 02174 * 02175 * Use @a scratch_pool for temporary allocations. 02176 * 02177 * @see svn_repos_path_change_receiver_t, svn_repos_log_entry_receiver_t 02178 * 02179 * @since New in 1.10. 02180 */ 02181 svn_error_t * 02182 svn_repos_get_logs5(svn_repos_t *repos, 02183 const apr_array_header_t *paths, 02184 svn_revnum_t start, 02185 svn_revnum_t end, 02186 int limit, 02187 svn_boolean_t strict_node_history, 02188 svn_boolean_t include_merged_revisions, 02189 const apr_array_header_t *revprops, 02190 svn_repos_authz_func_t authz_read_func, 02191 void *authz_read_baton, 02192 svn_repos_path_change_receiver_t path_change_receiver, 02193 void *path_change_receiver_baton, 02194 svn_repos_log_entry_receiver_t revision_receiver, 02195 void *revision_receiver_baton, 02196 apr_pool_t *scratch_pool); 02197 02198 /** 02199 * Similar to svn_repos_get_logs5 but using a #svn_log_entry_receiver_t 02200 * @a receiver to receive revision properties and changed paths through a 02201 * single callback and the @a discover_changed_paths flag to control it. 02202 * 02203 * If @a discover_changed_paths, then each call to @a receiver passes a 02204 * hash mapping paths committed in that revision to information about them 02205 * as the receiver's @a changed_paths argument. 02206 * Otherwise, each call to @a receiver passes NULL for @a changed_paths. 02207 * 02208 * @see svn_log_entry_receiver_t 02209 * 02210 * @since New in 1.5. 02211 * 02212 * @deprecated Provided for backward compatibility with the 1.9 API. 02213 */ 02214 SVN_DEPRECATED 02215 svn_error_t * 02216 svn_repos_get_logs4(svn_repos_t *repos, 02217 const apr_array_header_t *paths, 02218 svn_revnum_t start, 02219 svn_revnum_t end, 02220 int limit, 02221 svn_boolean_t discover_changed_paths, 02222 svn_boolean_t strict_node_history, 02223 svn_boolean_t include_merged_revisions, 02224 const apr_array_header_t *revprops, 02225 svn_repos_authz_func_t authz_read_func, 02226 void *authz_read_baton, 02227 svn_log_entry_receiver_t receiver, 02228 void *receiver_baton, 02229 apr_pool_t *pool); 02230 02231 /** 02232 * Same as svn_repos_get_logs4(), but with @a receiver being 02233 * #svn_log_message_receiver_t instead of #svn_log_entry_receiver_t. 02234 * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is 02235 * svn:author, svn:date, and svn:log. If @a paths is empty, nothing 02236 * is returned. 02237 * 02238 * @since New in 1.2. 02239 * @deprecated Provided for backward compatibility with the 1.4 API. 02240 */ 02241 SVN_DEPRECATED 02242 svn_error_t * 02243 svn_repos_get_logs3(svn_repos_t *repos, 02244 const apr_array_header_t *paths, 02245 svn_revnum_t start, 02246 svn_revnum_t end, 02247 int limit, 02248 svn_boolean_t discover_changed_paths, 02249 svn_boolean_t strict_node_history, 02250 svn_repos_authz_func_t authz_read_func, 02251 void *authz_read_baton, 02252 svn_log_message_receiver_t receiver, 02253 void *receiver_baton, 02254 apr_pool_t *pool); 02255 02256 02257 /** 02258 * Same as svn_repos_get_logs3(), but with @a limit always set to 0. 02259 * 02260 * @deprecated Provided for backward compatibility with the 1.1 API. 02261 */ 02262 SVN_DEPRECATED 02263 svn_error_t * 02264 svn_repos_get_logs2(svn_repos_t *repos, 02265 const apr_array_header_t *paths, 02266 svn_revnum_t start, 02267 svn_revnum_t end, 02268 svn_boolean_t discover_changed_paths, 02269 svn_boolean_t strict_node_history, 02270 svn_repos_authz_func_t authz_read_func, 02271 void *authz_read_baton, 02272 svn_log_message_receiver_t receiver, 02273 void *receiver_baton, 02274 apr_pool_t *pool); 02275 02276 /** 02277 * Same as svn_repos_get_logs2(), but with @a authz_read_func and 02278 * @a authz_read_baton always set to NULL. 02279 * 02280 * @deprecated Provided for backward compatibility with the 1.0 API. 02281 */ 02282 SVN_DEPRECATED 02283 svn_error_t * 02284 svn_repos_get_logs(svn_repos_t *repos, 02285 const apr_array_header_t *paths, 02286 svn_revnum_t start, 02287 svn_revnum_t end, 02288 svn_boolean_t discover_changed_paths, 02289 svn_boolean_t strict_node_history, 02290 svn_log_message_receiver_t receiver, 02291 void *receiver_baton, 02292 apr_pool_t *pool); 02293 02294 02295 02296 /* ---------------------------------------------------------------*/ 02297 02298 /* Retrieving mergeinfo. */ 02299 02300 /** Receives parsed @a mergeinfo for the file system path @a path. 02301 * 02302 * The user-provided @a baton is being passed through by the retrieval 02303 * function and @a scratch_pool will be cleared between invocations. 02304 * 02305 * @since New in 1.10. 02306 */ 02307 typedef svn_fs_mergeinfo_receiver_t svn_repos_mergeinfo_receiver_t; 02308 02309 /** 02310 * For each node found with mergeinfo on it, invoke @a receiver with 02311 * the provided @a receiver_baton. 02312 * 02313 * The paths in @a paths start with '/'. 02314 * 02315 * @a inherit indicates whether explicit, explicit or inherited, or 02316 * only inherited mergeinfo for @a paths is fetched. 02317 * 02318 * If @a revision is #SVN_INVALID_REVNUM, it defaults to youngest. 02319 * 02320 * If @a include_descendants is TRUE, then additionally return the 02321 * mergeinfo for any descendant of any element of @a paths which has 02322 * the #SVN_PROP_MERGEINFO property explicitly set on it. (Note 02323 * that inheritance is only taken into account for the elements in @a 02324 * paths; descendants of the elements in @a paths which get their 02325 * mergeinfo via inheritance are not reported to @a receiver.) 02326 * 02327 * If optional @a authz_read_func is non-NULL, then use this function 02328 * (along with optional @a authz_read_baton) to check the readability 02329 * of each path which mergeinfo was requested for (from @a paths). 02330 * Silently omit unreadable paths from the request for mergeinfo. 02331 * 02332 * Use @a scratch_pool for temporary allocations. 02333 * 02334 * @since New in 1.10. 02335 */ 02336 svn_error_t * 02337 svn_repos_fs_get_mergeinfo2(svn_repos_t *repos, 02338 const apr_array_header_t *paths, 02339 svn_revnum_t revision, 02340 svn_mergeinfo_inheritance_t inherit, 02341 svn_boolean_t include_descendants, 02342 svn_repos_authz_func_t authz_read_func, 02343 void *authz_read_baton, 02344 svn_repos_mergeinfo_receiver_t receiver, 02345 void *receiver_baton, 02346 apr_pool_t *scratch_pool); 02347 02348 /** 02349 * Same as svn_repos_fs_get_mergeinfo2(), but all mergeinfo is being collected 02350 * and returned in @a *catalog. It will never be @c NULL, but may be empty. 02351 * 02352 * @since New in 1.5. 02353 * 02354 * @deprecated Provided for backward compatibility with the 1.9 API. 02355 */ 02356 SVN_DEPRECATED 02357 svn_error_t * 02358 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog, 02359 svn_repos_t *repos, 02360 const apr_array_header_t *paths, 02361 svn_revnum_t revision, 02362 svn_mergeinfo_inheritance_t inherit, 02363 svn_boolean_t include_descendants, 02364 svn_repos_authz_func_t authz_read_func, 02365 void *authz_read_baton, 02366 apr_pool_t *pool); 02367 02368 02369 /* ---------------------------------------------------------------*/ 02370 02371 /* Retrieving multiple revisions of a file. */ 02372 02373 /** 02374 * Retrieve a subset of the interesting revisions of a file @a path in 02375 * @a repos as seen in revision @a end. Invoke @a handler with 02376 * @a handler_baton as its first argument for each such revision. 02377 * @a pool is used for all allocations. See svn_fs_history_prev() for 02378 * a discussion of interesting revisions. 02379 * 02380 * If optional @a authz_read_func is non-NULL, then use this function 02381 * (along with optional @a authz_read_baton) to check the readability 02382 * of the rev-path in each interesting revision encountered. 02383 * 02384 * Revision discovery happens from @a end to @a start, and if an 02385 * unreadable revision is encountered before @a start is reached, then 02386 * revision discovery stops and only the revisions from @a end to the 02387 * oldest readable revision are returned (So it will appear that @a 02388 * path was added without history in the latter revision). 02389 * 02390 * If there is an interesting revision of the file that is less than or 02391 * equal to start, the iteration will start at that revision. Else, the 02392 * iteration will start at the first revision of the file in the repository, 02393 * which has to be less than or equal to end. Note that if the function 02394 * succeeds, @a handler will have been called at least once. 02395 * 02396 * In a series of calls, the file contents for the first interesting revision 02397 * will be provided as a text delta against the empty file. In the following 02398 * calls, the delta will be against the contents for the previous call. 02399 * 02400 * If @a include_merged_revisions is TRUE, revisions which a included as a 02401 * result of a merge between @a start and @a end will be included. 02402 * 02403 * Since Subversion 1.8 this function has been enabled to support reversion 02404 * the revision range for @a include_merged_revision @c FALSE reporting by 02405 * switching @a start with @a end. 02406 * 02407 * @note Prior to Subversion 1.9, this function may request delta handlers 02408 * from @a handler even for empty text deltas. Starting with 1.9, the 02409 * delta handler / baton return arguments passed to @a handler will be 02410 * NULL unless there is an actual difference in the file contents between 02411 * the current and the previous call. 02412 * 02413 * @since New in 1.5. 02414 */ 02415 svn_error_t * 02416 svn_repos_get_file_revs2(svn_repos_t *repos, 02417 const char *path, 02418 svn_revnum_t start, 02419 svn_revnum_t end, 02420 svn_boolean_t include_merged_revisions, 02421 svn_repos_authz_func_t authz_read_func, 02422 void *authz_read_baton, 02423 svn_file_rev_handler_t handler, 02424 void *handler_baton, 02425 apr_pool_t *pool); 02426 02427 /** 02428 * Similar to #svn_file_rev_handler_t, but without the @a 02429 * result_of_merge parameter. 02430 * 02431 * @deprecated Provided for backward compatibility with 1.4 API. 02432 * @since New in 1.1. 02433 */ 02434 typedef svn_error_t *(*svn_repos_file_rev_handler_t) 02435 (void *baton, 02436 const char *path, 02437 svn_revnum_t rev, 02438 apr_hash_t *rev_props, 02439 svn_txdelta_window_handler_t *delta_handler, 02440 void **delta_baton, 02441 apr_array_header_t *prop_diffs, 02442 apr_pool_t *pool); 02443 02444 /** 02445 * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions 02446 * set to FALSE. 02447 * 02448 * @deprecated Provided for backward compatibility with the 1.4 API. 02449 * @since New in 1.1. 02450 */ 02451 SVN_DEPRECATED 02452 svn_error_t * 02453 svn_repos_get_file_revs(svn_repos_t *repos, 02454 const char *path, 02455 svn_revnum_t start, 02456 svn_revnum_t end, 02457 svn_repos_authz_func_t authz_read_func, 02458 void *authz_read_baton, 02459 svn_repos_file_rev_handler_t handler, 02460 void *handler_baton, 02461 apr_pool_t *pool); 02462 02463 02464 /* ---------------------------------------------------------------*/ 02465 02466 /** 02467 * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \ 02468 * routines. 02469 * @{ 02470 */ 02471 02472 /** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and 02473 * post-commit hooks around the commit. Use @a pool for any necessary 02474 * allocations. 02475 * 02476 * If the pre-commit hook fails, do not attempt to commit the 02477 * transaction and throw the original error to the caller. 02478 * 02479 * A successful commit is indicated by a valid revision value in @a 02480 * *new_rev, not if svn_fs_commit_txn() returns an error, which can 02481 * occur during its post commit FS processing. If the transaction was 02482 * not committed, then return the associated error and do not execute 02483 * the post-commit hook. 02484 * 02485 * If the commit succeeds the post-commit hook is executed. If the 02486 * post-commit hook returns an error, always wrap it with 02487 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to 02488 * find the post-commit hook error in the returned error chain. If 02489 * both svn_fs_commit_txn() and the post-commit hook return errors, 02490 * then svn_fs_commit_txn()'s error is the parent error and the 02491 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child 02492 * error. 02493 * 02494 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn(). 02495 */ 02496 svn_error_t * 02497 svn_repos_fs_commit_txn(const char **conflict_p, 02498 svn_repos_t *repos, 02499 svn_revnum_t *new_rev, 02500 svn_fs_txn_t *txn, 02501 apr_pool_t *pool); 02502 02503 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping 02504 * <tt>const char *</tt> property names to #svn_string_t values, to 02505 * set the properties on transaction @a *txn_p. @a repos is the 02506 * repository object which contains the filesystem. @a rev, @a 02507 * *txn_p, and @a pool are as in svn_fs_begin_txn(). 02508 * 02509 * Before a txn is created, the repository's start-commit hooks are 02510 * run; if any of them fail, no txn is created, @a *txn_p is unaffected, 02511 * and #SVN_ERR_REPOS_HOOK_FAILURE is returned. 02512 * 02513 * @note @a revprop_table may contain an #SVN_PROP_REVISION_DATE property, 02514 * which will be set on the transaction, but that will be overwritten 02515 * when the transaction is committed. 02516 * 02517 * @since New in 1.5. 02518 */ 02519 svn_error_t * 02520 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p, 02521 svn_repos_t *repos, 02522 svn_revnum_t rev, 02523 apr_hash_t *revprop_table, 02524 apr_pool_t *pool); 02525 02526 02527 /** 02528 * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table 02529 * set to a hash containing @a author and @a log_msg as the 02530 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties, 02531 * respectively. @a author and @a log_msg may both be @c NULL. 02532 * 02533 * @deprecated Provided for backward compatibility with the 1.4 API. 02534 */ 02535 SVN_DEPRECATED 02536 svn_error_t * 02537 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p, 02538 svn_repos_t *repos, 02539 svn_revnum_t rev, 02540 const char *author, 02541 const char *log_msg, 02542 apr_pool_t *pool); 02543 02544 02545 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding 02546 * property on transaction @a *txn_p. @a repos is the repository object 02547 * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in 02548 * svn_fs_begin_txn(). 02549 * 02550 * ### Someday: before a txn is created, some kind of read-hook could 02551 * be called here. 02552 * 02553 * @note This function was never fully implemented, nor used. Ignore it. 02554 * @deprecated Provided for backward compatibility with the 1.7 API. 02555 */ 02556 SVN_DEPRECATED 02557 svn_error_t * 02558 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p, 02559 svn_repos_t *repos, 02560 svn_revnum_t rev, 02561 const char *author, 02562 apr_pool_t *pool); 02563 02564 02565 /** @} */ 02566 02567 /** @defgroup svn_repos_fs_locks Repository lock wrappers 02568 * @{ 02569 */ 02570 02571 /** Like svn_fs_lock_many(), but invoke the @a repos's pre- and 02572 * post-lock hooks before and after the locking action. 02573 * 02574 * The pre-lock is run for every path in @a targets. Those targets for 02575 * which the pre-lock is successful are passed to svn_fs_lock_many and 02576 * the post-lock is run for those that are successfully locked. 02577 * Pre-lock hook errors are passed to @a lock_callback. 02578 * 02579 * For each path in @a targets @a lock_callback will be invoked 02580 * passing @a lock_baton and the lock and error that apply to path. 02581 * @a lock_callback can be NULL in which case it is not called and any 02582 * errors that would have been passed to the callback are not reported. 02583 * 02584 * If an error occurs when running the post-lock hook the error is 02585 * returned wrapped with #SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the 02586 * caller sees this error, it knows that some locks succeeded. 02587 * 02588 * The pre-lock hook may cause a different token to be used for the 02589 * lock, instead of the token supplied; see the pre-lock-hook 02590 * documentation for more. 02591 * 02592 * The lock and path passed to @a lock_callback will be allocated in 02593 * @a result_pool. Use @a scratch_pool for temporary allocations. 02594 * 02595 * @note This function is not atomic. If it returns an error, some targets 02596 * may remain unlocked while others may have been locked. 02597 * 02598 * @see svn_fs_lock_many 02599 * 02600 * @since New in 1.9. 02601 */ 02602 svn_error_t * 02603 svn_repos_fs_lock_many(svn_repos_t *repos, 02604 apr_hash_t *lock_targets, 02605 const char *comment, 02606 svn_boolean_t is_dav_comment, 02607 apr_time_t expiration_date, 02608 svn_boolean_t steal_lock, 02609 svn_fs_lock_callback_t lock_callback, 02610 void *lock_baton, 02611 apr_pool_t *result_pool, 02612 apr_pool_t *scratch_pool); 02613 02614 /** Similar to svn_repos_fs_lock_many() but locks only a single path. 02615 * 02616 * @since New in 1.2. 02617 */ 02618 svn_error_t * 02619 svn_repos_fs_lock(svn_lock_t **lock, 02620 svn_repos_t *repos, 02621 const char *path, 02622 const char *token, 02623 const char *comment, 02624 svn_boolean_t is_dav_comment, 02625 apr_time_t expiration_date, 02626 svn_revnum_t current_rev, 02627 svn_boolean_t steal_lock, 02628 apr_pool_t *pool); 02629 02630 02631 /** Like svn_fs_unlock_many(), but invoke the @a repos's pre- and 02632 * post-unlock hooks before and after the unlocking action. 02633 * 02634 * The pre-unlock hook is run for every path in @a targets. Those 02635 * targets for which the pre-unlock is successful are passed to 02636 * svn_fs_unlock_many and the post-unlock is run for those that are 02637 * successfully unlocked. Pre-unlock hook errors are passed to @a 02638 * lock_callback. 02639 * 02640 * For each path in @a targets @a lock_callback will be invoked 02641 * passing @a lock_baton and error that apply to path. The lock 02642 * passed to the callback will be NULL. @a lock_callback can be NULL 02643 * in which case it is not called and any errors that would have been 02644 * passed to the callback are not reported. 02645 * 02646 * If an error occurs when running the post-unlock hook, return the 02647 * original error wrapped with #SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. 02648 * If the caller sees this error, it knows that some unlocks 02649 * succeeded. 02650 * 02651 * The path passed to @a lock_callback will be allocated in @a result_pool. 02652 * Use @a scratch_pool for temporary allocations. 02653 * 02654 * @note This function is not atomic. If it returns an error, some targets 02655 * may remain locked while others may have been unlocked. 02656 * 02657 * @see svn_fs_unlock_many 02658 * 02659 * @since New in 1.9. 02660 */ 02661 svn_error_t * 02662 svn_repos_fs_unlock_many(svn_repos_t *repos, 02663 apr_hash_t *unlock_targets, 02664 svn_boolean_t break_lock, 02665 svn_fs_lock_callback_t lock_callback, 02666 void *lock_baton, 02667 apr_pool_t *result_pool, 02668 apr_pool_t *scratch_pool); 02669 02670 /** Similar to svn_repos_fs_unlock_many() but only unlocks a single path. 02671 * 02672 * @since New in 1.2. 02673 */ 02674 svn_error_t * 02675 svn_repos_fs_unlock(svn_repos_t *repos, 02676 const char *path, 02677 const char *token, 02678 svn_boolean_t break_lock, 02679 apr_pool_t *pool); 02680 02681 02682 02683 /** Look up all the locks in and under @a path in @a repos, setting @a 02684 * *locks to a hash which maps <tt>const char *</tt> paths to the 02685 * #svn_lock_t locks associated with those paths. Use @a 02686 * authz_read_func and @a authz_read_baton to "screen" all returned 02687 * locks. That is: do not return any locks on any paths that are 02688 * unreadable in HEAD, just silently omit them. 02689 * 02690 * @a depth limits the returned locks to those associated with paths 02691 * within the specified depth of @a path, and must be one of the 02692 * following values: #svn_depth_empty, #svn_depth_files, 02693 * #svn_depth_immediates, or #svn_depth_infinity. 02694 * 02695 * @since New in 1.7. 02696 */ 02697 svn_error_t * 02698 svn_repos_fs_get_locks2(apr_hash_t **locks, 02699 svn_repos_t *repos, 02700 const char *path, 02701 svn_depth_t depth, 02702 svn_repos_authz_func_t authz_read_func, 02703 void *authz_read_baton, 02704 apr_pool_t *pool); 02705 02706 /** 02707 * Similar to svn_repos_fs_get_locks2(), but with @a depth always 02708 * passed as svn_depth_infinity. 02709 * 02710 * @since New in 1.2. 02711 * @deprecated Provided for backward compatibility with the 1.6 API. 02712 */ 02713 SVN_DEPRECATED 02714 svn_error_t * 02715 svn_repos_fs_get_locks(apr_hash_t **locks, 02716 svn_repos_t *repos, 02717 const char *path, 02718 svn_repos_authz_func_t authz_read_func, 02719 void *authz_read_baton, 02720 apr_pool_t *pool); 02721 02722 /** @} */ 02723 02724 /** @defgroup svn_repos_properties Versioned and Unversioned Properties 02725 * 02726 * Prop-changing and prop-reading wrappers for libsvn_fs routines. 02727 * @{ 02728 */ 02729 02730 /** 02731 * Like svn_fs_change_rev_prop2(), but validate the name and value of the 02732 * property and invoke the @a repos's pre- and post-revprop-change hooks 02733 * around the change as specified by @a use_pre_revprop_change_hook and 02734 * @a use_post_revprop_change_hook (respectively). 02735 * 02736 * @a rev is the revision whose property to change, @a name is the 02737 * name of the property, and @a new_value is the new value of the 02738 * property. If @a old_value_p is not @c NULL, then @a *old_value_p 02739 * is the expected current (preexisting) value of the property (or @c NULL 02740 * for "unset"). @a author is the authenticated username of the person 02741 * changing the property value, or NULL if not available. 02742 * 02743 * If @a authz_read_func is non-NULL, then use it (with @a 02744 * authz_read_baton) to validate the changed-paths associated with @a 02745 * rev. If the revision contains any unreadable changed paths, then 02746 * return #SVN_ERR_AUTHZ_UNREADABLE. 02747 * 02748 * Validate @a name and @a new_value like the same way 02749 * svn_repos_fs_change_node_prop() does. 02750 * 02751 * Use @a pool for temporary allocations. 02752 * 02753 * @since New in 1.7. 02754 */ 02755 svn_error_t * 02756 svn_repos_fs_change_rev_prop4(svn_repos_t *repos, 02757 svn_revnum_t rev, 02758 const char *author, 02759 const char *name, 02760 const svn_string_t *const *old_value_p, 02761 const svn_string_t *new_value, 02762 svn_boolean_t use_pre_revprop_change_hook, 02763 svn_boolean_t use_post_revprop_change_hook, 02764 svn_repos_authz_func_t authz_read_func, 02765 void *authz_read_baton, 02766 apr_pool_t *pool); 02767 02768 /** 02769 * Similar to svn_repos_fs_change_rev_prop4(), but with @a old_value_p always 02770 * set to @c NULL. (In other words, it is similar to 02771 * svn_fs_change_rev_prop().) 02772 * 02773 * @deprecated Provided for backward compatibility with the 1.6 API. 02774 * @since New in 1.5. 02775 */ 02776 SVN_DEPRECATED 02777 svn_error_t * 02778 svn_repos_fs_change_rev_prop3(svn_repos_t *repos, 02779 svn_revnum_t rev, 02780 const char *author, 02781 const char *name, 02782 const svn_string_t *new_value, 02783 svn_boolean_t use_pre_revprop_change_hook, 02784 svn_boolean_t use_post_revprop_change_hook, 02785 svn_repos_authz_func_t authz_read_func, 02786 void *authz_read_baton, 02787 apr_pool_t *pool); 02788 02789 /** 02790 * Similar to svn_repos_fs_change_rev_prop3(), but with the @a 02791 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook 02792 * always set to @c TRUE. 02793 * 02794 * @deprecated Provided for backward compatibility with the 1.4 API. 02795 */ 02796 SVN_DEPRECATED 02797 svn_error_t * 02798 svn_repos_fs_change_rev_prop2(svn_repos_t *repos, 02799 svn_revnum_t rev, 02800 const char *author, 02801 const char *name, 02802 const svn_string_t *new_value, 02803 svn_repos_authz_func_t authz_read_func, 02804 void *authz_read_baton, 02805 apr_pool_t *pool); 02806 02807 /** 02808 * Similar to svn_repos_fs_change_rev_prop2(), but with the 02809 * @a authz_read_func parameter always NULL. 02810 * 02811 * @deprecated Provided for backward compatibility with the 1.0 API. 02812 */ 02813 SVN_DEPRECATED 02814 svn_error_t * 02815 svn_repos_fs_change_rev_prop(svn_repos_t *repos, 02816 svn_revnum_t rev, 02817 const char *author, 02818 const char *name, 02819 const svn_string_t *new_value, 02820 apr_pool_t *pool); 02821 02822 02823 02824 /** 02825 * Set @a *value_p to the value of the property named @a propname on 02826 * revision @a rev in the filesystem opened in @a repos. If @a rev 02827 * has no property by that name, set @a *value_p to zero. Allocate 02828 * the result in @a pool. 02829 * 02830 * If @a authz_read_func is non-NULL, then use it (with @a 02831 * authz_read_baton) to validate the changed-paths associated with @a 02832 * rev. If the changed-paths are all unreadable, then set @a *value_p 02833 * to zero unconditionally. If only some of the changed-paths are 02834 * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be 02835 * fetched, but return 0 for any other property. 02836 * 02837 * @since New in 1.1. 02838 */ 02839 svn_error_t * 02840 svn_repos_fs_revision_prop(svn_string_t **value_p, 02841 svn_repos_t *repos, 02842 svn_revnum_t rev, 02843 const char *propname, 02844 svn_repos_authz_func_t authz_read_func, 02845 void *authz_read_baton, 02846 apr_pool_t *pool); 02847 02848 02849 /** 02850 * Set @a *table_p to the entire property list of revision @a rev in 02851 * filesystem opened in @a repos, as a hash table allocated in @a 02852 * pool. The table maps <tt>char *</tt> property names to 02853 * #svn_string_t * values; the names and values are allocated in @a 02854 * pool. 02855 * 02856 * If @a authz_read_func is non-NULL, then use it (with @a 02857 * authz_read_baton) to validate the changed-paths associated with @a 02858 * rev. If the changed-paths are all unreadable, then return an empty 02859 * hash. If only some of the changed-paths are unreadable, then return 02860 * an empty hash, except for 'svn:author' and 'svn:date' properties 02861 * (assuming those properties exist). 02862 * 02863 * @since New in 1.1. 02864 */ 02865 svn_error_t * 02866 svn_repos_fs_revision_proplist(apr_hash_t **table_p, 02867 svn_repos_t *repos, 02868 svn_revnum_t rev, 02869 svn_repos_authz_func_t authz_read_func, 02870 void *authz_read_baton, 02871 apr_pool_t *pool); 02872 02873 /** Validating wrapper for svn_fs_change_node_prop() (which see for 02874 * argument descriptions). 02875 * 02876 * If @a name's kind is not #svn_prop_regular_kind, return 02877 * #SVN_ERR_REPOS_BAD_ARGS. If @a name is an "svn:" property, validate its 02878 * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the 02879 * property. 02880 * 02881 * @note Originally, the only properties validated were the "svn:" properties 02882 * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. For the current 02883 * validation rules see the private function svn_repos__validate_prop(). 02884 */ 02885 svn_error_t * 02886 svn_repos_fs_change_node_prop(svn_fs_root_t *root, 02887 const char *path, 02888 const char *name, 02889 const svn_string_t *value, 02890 apr_pool_t *pool); 02891 02892 /** 02893 * Set @a *inherited_values to a depth-first ordered array of 02894 * #svn_prop_inherited_item_t * structures (the path_or_url members of 02895 * which are relative filesystem paths) representing the properties 02896 * inherited by @a path in @a root. If no properties are inherited, 02897 * then set @a *inherited_values to an empty array. 02898 * 02899 * if @a propname is NULL then retrieve all explicit and/or inherited 02900 * properties. Otherwise retrieve only the properties named @a propname. 02901 * 02902 * If optional @a authz_read_func is non-NULL, then use this function 02903 * (along with optional @a authz_read_baton) to check the readability 02904 * of each parent path from which properties are inherited. Silently omit 02905 * properties for unreadable parent paths. 02906 * 02907 * Allocate @a *inherited_props in @a result_pool. Use @a scratch_pool for 02908 * temporary allocations. 02909 * 02910 * @since New in 1.8. 02911 */ 02912 svn_error_t * 02913 svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props, 02914 svn_fs_root_t *root, 02915 const char *path, 02916 const char *propname, 02917 svn_repos_authz_func_t authz_read_func, 02918 void *authz_read_baton, 02919 apr_pool_t *result_pool, 02920 apr_pool_t *scratch_pool); 02921 02922 /** Validating wrapper for svn_fs_change_txn_prop() (which see for 02923 * argument descriptions). See svn_repos_fs_change_txn_props() for more 02924 * information. 02925 */ 02926 svn_error_t * 02927 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn, 02928 const char *name, 02929 const svn_string_t *value, 02930 apr_pool_t *pool); 02931 02932 /** Validating wrapper for svn_fs_change_txn_props() (which see for 02933 * argument descriptions). Validate properties and their values the 02934 * same way svn_repos_fs_change_node_prop() does. 02935 * 02936 * @since New in 1.5. 02937 */ 02938 svn_error_t * 02939 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn, 02940 const apr_array_header_t *props, 02941 apr_pool_t *pool); 02942 02943 /** @} */ 02944 02945 02946 /* ---------------------------------------------------------------*/ 02947 02948 /** 02949 * @defgroup svn_repos_inspection Data structures and editor things for \ 02950 * repository inspection. 02951 * @{ 02952 * 02953 * As it turns out, the svn_repos_replay2(), svn_repos_dir_delta2() and 02954 * svn_repos_begin_report3() interfaces can be extremely useful for 02955 * examining the repository, or more exactly, changes to the repository. 02956 * These drivers allows for differences between two trees to be 02957 * described using an editor. 02958 * 02959 * By using the editor obtained from svn_repos_node_editor() with one of 02960 * the drivers mentioned above, the description of how to transform one 02961 * tree into another can be used to build an in-memory linked-list tree, 02962 * which each node representing a repository node that was changed. 02963 */ 02964 02965 /** A node in the repository. */ 02966 typedef struct svn_repos_node_t 02967 { 02968 /** Node type (file, dir, etc.) */ 02969 svn_node_kind_t kind; 02970 02971 /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */ 02972 char action; 02973 02974 /** Were there any textual mods? (files only) */ 02975 svn_boolean_t text_mod; 02976 02977 /** Where there any property mods? */ 02978 svn_boolean_t prop_mod; 02979 02980 /** The name of this node as it appears in its parent's entries list */ 02981 const char *name; 02982 02983 /** The filesystem revision where this was copied from (if any) */ 02984 svn_revnum_t copyfrom_rev; 02985 02986 /** The filesystem path where this was copied from (if any) */ 02987 const char *copyfrom_path; 02988 02989 /** Pointer to the next sibling of this node */ 02990 struct svn_repos_node_t *sibling; 02991 02992 /** Pointer to the first child of this node */ 02993 struct svn_repos_node_t *child; 02994 02995 /** Pointer to the parent of this node */ 02996 struct svn_repos_node_t *parent; 02997 02998 } svn_repos_node_t; 02999 03000 03001 /** Set @a *editor and @a *edit_baton to an editor that, when driven by 03002 * a driver such as svn_repos_replay2(), builds an <tt>svn_repos_node_t *</tt> 03003 * tree representing the delta from @a base_root to @a root in @a 03004 * repos's filesystem. 03005 * 03006 * The editor can also be driven by svn_repos_dir_delta2() or 03007 * svn_repos_begin_report3(), but unless you have special needs, 03008 * svn_repos_replay2() is preferred. 03009 * 03010 * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root 03011 * node afterwards. 03012 * 03013 * Note that the delta includes "bubbled-up" directories; that is, 03014 * many of the directory nodes will have no prop_mods. 03015 * 03016 * Allocate the tree and its contents in @a node_pool; do all other 03017 * allocation in @a pool. 03018 */ 03019 svn_error_t * 03020 svn_repos_node_editor(const svn_delta_editor_t **editor, 03021 void **edit_baton, 03022 svn_repos_t *repos, 03023 svn_fs_root_t *base_root, 03024 svn_fs_root_t *root, 03025 apr_pool_t *node_pool, 03026 apr_pool_t *pool); 03027 03028 /** Return the root node of the linked-list tree generated by driving the 03029 * editor (associated with @a edit_baton) created by svn_repos_node_editor(). 03030 * This is only really useful if used *after* the editor drive is completed. 03031 */ 03032 svn_repos_node_t * 03033 svn_repos_node_from_baton(void *edit_baton); 03034 03035 /** 03036 * Return repository format information for @a repos. 03037 * 03038 * Set @a *repos_format to the repository format number of @a repos, which is 03039 * an integer that increases when incompatible changes are made (such as 03040 * by #svn_repos_upgrade2). 03041 * 03042 * Set @a *supports_version to the version number of the minimum Subversion 03043 * GA release that can read and write @a repos; allocate it in 03044 * @a result_pool. Use @a scratch_pool for temporary allocations. 03045 * 03046 * @see svn_fs_info_format, svn_repos_capabilities 03047 * 03048 * @since New in 1.9. 03049 */ 03050 svn_error_t * 03051 svn_repos_info_format(int *repos_format, 03052 svn_version_t **supports_version, 03053 svn_repos_t *repos, 03054 apr_pool_t *result_pool, 03055 apr_pool_t *scratch_pool); 03056 03057 /** @} */ 03058 03059 /* ---------------------------------------------------------------*/ 03060 03061 /** 03062 * @defgroup svn_repos_dump_load Dumping, loading and verifying filesystem data 03063 * @{ 03064 * 03065 * The filesystem 'dump' format contains nothing but the abstract 03066 * structure of the filesystem -- independent of any internal node-id 03067 * schema or database back-end. All of the data in the dumpfile is 03068 * acquired by public function calls into svn_fs.h. Similarly, the 03069 * parser which reads the dumpfile is able to reconstruct the 03070 * filesystem using only public svn_fs.h routines. 03071 * 03072 * Thus the dump/load feature's main purpose is for *migrating* data 03073 * from one svn filesystem to another -- presumably two filesystems 03074 * which have different internal implementations. 03075 * 03076 * If you simply want to backup your filesystem, you're probably 03077 * better off using the built-in facilities of the DB backend (using 03078 * Berkeley DB's hot-backup feature, for example.) 03079 * 03080 * For a description of the dumpfile format, see 03081 * /trunk/notes/fs_dumprestore.txt. 03082 */ 03083 03084 /* The RFC822-style headers in our dumpfile format. */ 03085 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER "SVN-fs-dump-format-version" 03086 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION 3 03087 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION_DELTAS 3 03088 #define SVN_REPOS_DUMPFILE_UUID "UUID" 03089 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH "Content-length" 03090 03091 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER "Revision-number" 03092 03093 #define SVN_REPOS_DUMPFILE_NODE_PATH "Node-path" 03094 #define SVN_REPOS_DUMPFILE_NODE_KIND "Node-kind" 03095 #define SVN_REPOS_DUMPFILE_NODE_ACTION "Node-action" 03096 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH "Node-copyfrom-path" 03097 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV "Node-copyfrom-rev" 03098 /** @since New in 1.6. */ 03099 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 "Text-copy-source-md5" 03100 /** @since New in 1.6. */ 03101 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1 "Text-copy-source-sha1" 03102 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \ 03103 SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 03104 /** @since New in 1.6. */ 03105 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 "Text-content-md5" 03106 /** @since New in 1.6. */ 03107 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1 "Text-content-sha1" 03108 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM \ 03109 SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 03110 03111 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH "Prop-content-length" 03112 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH "Text-content-length" 03113 03114 /** @since New in 1.1. */ 03115 #define SVN_REPOS_DUMPFILE_PROP_DELTA "Prop-delta" 03116 /** @since New in 1.1. */ 03117 #define SVN_REPOS_DUMPFILE_TEXT_DELTA "Text-delta" 03118 /** @since New in 1.6. */ 03119 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 "Text-delta-base-md5" 03120 /** @since New in 1.6. */ 03121 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1 "Text-delta-base-sha1" 03122 /** @since New in 1.5. */ 03123 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM \ 03124 SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 03125 03126 /** The different policies for processing the UUID in the dumpfile. */ 03127 enum svn_repos_load_uuid 03128 { 03129 /** only update uuid if the repos has no revisions. */ 03130 svn_repos_load_uuid_default, 03131 /** never update uuid. */ 03132 svn_repos_load_uuid_ignore, 03133 /** always update uuid. */ 03134 svn_repos_load_uuid_force 03135 }; 03136 03137 /** Callback type for use with svn_repos_verify_fs3(). @a revision 03138 * and @a verify_err are the details of a single verification failure 03139 * that occurred during the svn_repos_verify_fs3() call. @a baton is 03140 * the same baton given to svn_repos_verify_fs3(). @a scratch_pool is 03141 * provided for the convenience of the implementor, who should not 03142 * expect it to live longer than a single callback call. 03143 * 03144 * @a verify_err will be cleared and becomes invalid after the callback 03145 * returns, use svn_error_dup() to preserve the error. If a callback uses 03146 * @a verify_err as the return value or as a part of the return value, it 03147 * should also call svn_error_dup() for @a verify_err. Implementors of this 03148 * callback are forbidden to call svn_error_clear() for @a verify_err. 03149 * 03150 * @see svn_repos_verify_fs3 03151 * 03152 * @since New in 1.9. 03153 */ 03154 typedef svn_error_t *(*svn_repos_verify_callback_t)(void *baton, 03155 svn_revnum_t revision, 03156 svn_error_t *verify_err, 03157 apr_pool_t *scratch_pool); 03158 03159 /** 03160 * Verify the contents of the file system in @a repos. 03161 * 03162 * Verify the revisions from @a start_rev to @a end_rev inclusive. If 03163 * @a start_rev is #SVN_INVALID_REVNUM, start at revision 0; if @a end_rev 03164 * is #SVN_INVALID_REVNUM, end at the head revision. @a start_rev must be 03165 * older than or equal to @a end_rev. If revision 0 is included in the 03166 * range, then also verify "global invariants" of the repository, as 03167 * described in svn_fs_verify(). 03168 * 03169 * If @a check_normalization is @c TRUE, report any name collisions 03170 * within the same directory or svn:mergeinfo property where the names 03171 * differ only in character representation, but are otherwise 03172 * identical. 03173 * 03174 * If @a metadata_only is @c TRUE, backends that have a concept of separate 03175 * metadata verification will only perform that and skip the more expensive 03176 * file context reconstruction and verification. For FSFS format 7+ and 03177 * FSX, this allows for a very fast check against external corruption. 03178 * 03179 * If @a verify_callback is not @c NULL, call it with @a verify_baton upon 03180 * receiving an FS-specific structure failure or a revision verification 03181 * failure. Set @c revision callback argument to #SVN_INVALID_REVNUM or 03182 * to the revision number respectively. Set @c verify_err to svn_error_t 03183 * describing the reason of the failure. @c verify_err will be cleared 03184 * after the callback returns, use svn_error_dup() to preserve the error. 03185 * If @a verify_callback returns an error different from #SVN_NO_ERROR, 03186 * stop verifying the repository and immediately return the error from 03187 * @a verify_callback. 03188 * 03189 * If @a verify_callback is @c NULL, this function returns the first 03190 * encountered verification error or #SVN_NO_ERROR if there were no failures 03191 * during the verification. Errors that prevent the verification process 03192 * from continuing, such as #SVN_ERR_CANCELLED, are returned immediately 03193 * and do not trigger an invocation of @a verify_callback. 03194 * 03195 * If @a notify_func is not null, then call it with @a notify_baton and 03196 * with a notification structure in which the fields are set as follows. 03197 * (For a warning that does not apply to a specific revision, the revision 03198 * number is #SVN_INVALID_REVNUM.) 03199 * 03200 * For each FS-specific structure warning: 03201 * @c action = svn_repos_notify_verify_rev_structure 03202 * @c revision = the revision or #SVN_INVALID_REVNUM 03203 * 03204 * For each revision verification warning: 03205 * @c action = #svn_repos_notify_warning 03206 * @c warning and @c warning_str fields set accordingly 03207 * ### TODO: Set @c revision = the revision? 03208 * 03209 * For each successfully verified revision: 03210 * @c action = #svn_repos_notify_verify_rev_end 03211 * @c revision = the revision 03212 * 03213 * At the end: 03214 * @c action = svn_repos_notify_verify_end 03215 * ### Do we really need a callback to tell us the function we 03216 * called has reached its end and is about to return? 03217 * ### Not sent, currently, if a FS structure error is found. 03218 * 03219 * If @a cancel_func is not @c NULL, call it periodically with @a 03220 * cancel_baton as argument to see if the caller wishes to cancel the 03221 * verification. 03222 * 03223 * Use @a scratch_pool for temporary allocation. 03224 * 03225 * @see svn_repos_verify_callback_t 03226 * 03227 * @since New in 1.9. 03228 */ 03229 svn_error_t * 03230 svn_repos_verify_fs3(svn_repos_t *repos, 03231 svn_revnum_t start_rev, 03232 svn_revnum_t end_rev, 03233 svn_boolean_t check_normalization, 03234 svn_boolean_t metadata_only, 03235 svn_repos_notify_func_t notify_func, 03236 void *notify_baton, 03237 svn_repos_verify_callback_t verify_callback, 03238 void *verify_baton, 03239 svn_cancel_func_t cancel, 03240 void *cancel_baton, 03241 apr_pool_t *scratch_pool); 03242 03243 /** 03244 * Like svn_repos_verify_fs3(), but with @a verify_callback and 03245 * @a verify_baton set to @c NULL and with @a check_normalization 03246 * and @a metadata_only set to @c FALSE. 03247 * 03248 * @since New in 1.7. 03249 * @deprecated Provided for backward compatibility with the 1.8 API. 03250 */ 03251 SVN_DEPRECATED 03252 svn_error_t * 03253 svn_repos_verify_fs2(svn_repos_t *repos, 03254 svn_revnum_t start_rev, 03255 svn_revnum_t end_rev, 03256 svn_repos_notify_func_t notify_func, 03257 void *notify_baton, 03258 svn_cancel_func_t cancel, 03259 void *cancel_baton, 03260 apr_pool_t *scratch_pool); 03261 03262 /** 03263 * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of 03264 * handling feedback via the notify_func handler. 03265 * 03266 * If @a feedback_stream is not @c NULL, write feedback to it (lines of 03267 * the form "* Verified revision %ld\n"). 03268 * 03269 * @since New in 1.5. 03270 * @deprecated Provided for backward compatibility with the 1.6 API. 03271 */ 03272 SVN_DEPRECATED 03273 svn_error_t * 03274 svn_repos_verify_fs(svn_repos_t *repos, 03275 svn_stream_t *feedback_stream, 03276 svn_revnum_t start_rev, 03277 svn_revnum_t end_rev, 03278 svn_cancel_func_t cancel_func, 03279 void *cancel_baton, 03280 apr_pool_t *pool); 03281 03282 /** 03283 * Dump the contents of the filesystem within already-open @a repos into 03284 * writable @a dumpstream. If @a dumpstream is 03285 * @c NULL, this is effectively a primitive verify. It is not complete, 03286 * however; see instead svn_repos_verify_fs3(). 03287 * 03288 * Begin at revision @a start_rev, and dump every revision up through 03289 * @a end_rev. If @a start_rev is #SVN_INVALID_REVNUM, start at revision 03290 * 0. If @a end_rev is #SVN_INVALID_REVNUM, end at the head revision. 03291 * 03292 * If @a incremental is @c TRUE, the first revision dumped will be a diff 03293 * against the previous revision (usually it looks like a full dump of 03294 * the tree). 03295 * 03296 * If @a use_deltas is @c TRUE, output only node properties which have 03297 * changed relative to the previous contents, and output text contents 03298 * as svndiff data against the previous contents. Regardless of how 03299 * this flag is set, the first revision of a non-incremental dump will 03300 * be done with full plain text. A dump with @a use_deltas set cannot 03301 * be loaded by Subversion 1.0.x. 03302 * 03303 * If @a include_revprops is @c TRUE, output the revision properties as 03304 * well, otherwise omit them. 03305 * 03306 * If @a include_changes is @c TRUE, output the revision contents, i.e. 03307 * tree and node changes. 03308 * 03309 * If @a notify_func is not null, then call it with @a notify_baton and 03310 * with a notification structure in which the fields are set as follows. 03311 * (For a warning or error notification that does not apply to a specific 03312 * revision, the revision number is #SVN_INVALID_REVNUM.) 03313 * 03314 * For each warning: 03315 * @c action = #svn_repos_notify_warning 03316 * @c warning and @c warning_str fields set accordingly 03317 * ### TODO: Set @c revision = the revision or #SVN_INVALID_REVNUM? 03318 * 03319 * For each successfully dumped revision: 03320 * @c action = #svn_repos_notify_dump_rev_end 03321 * @c revision = the revision 03322 * 03323 * At the end: 03324 * @c action = svn_repos_notify_verify_end 03325 * ### Do we really need a callback to tell us the function we 03326 * called has reached its end and is about to return? 03327 * 03328 * At the end, if there were certain warnings previously: 03329 * @c action = #svn_repos_notify_warning 03330 * @c warning and @c warning_str fields set accordingly, 03331 * reiterating the existence of previous warnings 03332 * ### This is a presentation issue. Caller could do this itself. 03333 * 03334 * If @a filter_func is not @c NULL, it is called for each node being 03335 * dumped, allowing the caller to exclude it from dump. 03336 * 03337 * If @a cancel_func is not @c NULL, it is called periodically with 03338 * @a cancel_baton as argument to see if the client wishes to cancel 03339 * the dump. 03340 * 03341 * Use @a scratch_pool for temporary allocation. 03342 * 03343 * @since New in 1.10. 03344 */ 03345 svn_error_t * 03346 svn_repos_dump_fs4(svn_repos_t *repos, 03347 svn_stream_t *stream, 03348 svn_revnum_t start_rev, 03349 svn_revnum_t end_rev, 03350 svn_boolean_t incremental, 03351 svn_boolean_t use_deltas, 03352 svn_boolean_t include_revprops, 03353 svn_boolean_t include_changes, 03354 svn_repos_notify_func_t notify_func, 03355 void *notify_baton, 03356 svn_repos_dump_filter_func_t filter_func, 03357 void *filter_baton, 03358 svn_cancel_func_t cancel_func, 03359 void *cancel_baton, 03360 apr_pool_t *pool); 03361 03362 /** 03363 * Similar to svn_repos_dump_fs4(), but with @a include_revprops and 03364 * @a include_changes both set to @c TRUE and @a filter_func and 03365 * @a filter_baton set to @c NULL. 03366 * 03367 * @since New in 1.7. 03368 * @deprecated Provided for backward compatibility with the 1.9 API. 03369 */ 03370 SVN_DEPRECATED 03371 svn_error_t * 03372 svn_repos_dump_fs3(svn_repos_t *repos, 03373 svn_stream_t *dumpstream, 03374 svn_revnum_t start_rev, 03375 svn_revnum_t end_rev, 03376 svn_boolean_t incremental, 03377 svn_boolean_t use_deltas, 03378 svn_repos_notify_func_t notify_func, 03379 void *notify_baton, 03380 svn_cancel_func_t cancel_func, 03381 void *cancel_baton, 03382 apr_pool_t *scratch_pool); 03383 03384 /** 03385 * Similar to svn_repos_dump_fs3(), but with a feedback_stream instead of 03386 * handling feedback via the notify_func handler 03387 * 03388 * @since New in 1.1. 03389 * @deprecated Provided for backward compatibility with the 1.6 API. 03390 */ 03391 SVN_DEPRECATED 03392 svn_error_t * 03393 svn_repos_dump_fs2(svn_repos_t *repos, 03394 svn_stream_t *dumpstream, 03395 svn_stream_t *feedback_stream, 03396 svn_revnum_t start_rev, 03397 svn_revnum_t end_rev, 03398 svn_boolean_t incremental, 03399 svn_boolean_t use_deltas, 03400 svn_cancel_func_t cancel_func, 03401 void *cancel_baton, 03402 apr_pool_t *pool); 03403 03404 /** 03405 * Similar to svn_repos_dump_fs2(), but with the @a use_deltas 03406 * parameter always set to @c FALSE. 03407 * 03408 * @deprecated Provided for backward compatibility with the 1.0 API. 03409 */ 03410 SVN_DEPRECATED 03411 svn_error_t * 03412 svn_repos_dump_fs(svn_repos_t *repos, 03413 svn_stream_t *dumpstream, 03414 svn_stream_t *feedback_stream, 03415 svn_revnum_t start_rev, 03416 svn_revnum_t end_rev, 03417 svn_boolean_t incremental, 03418 svn_cancel_func_t cancel_func, 03419 void *cancel_baton, 03420 apr_pool_t *pool); 03421 03422 03423 /** 03424 * Read and parse dumpfile-formatted @a dumpstream, reconstructing 03425 * filesystem revisions in already-open @a repos, handling uuids in 03426 * accordance with @a uuid_action. Use @a pool for all allocation. 03427 * 03428 * If the dumpstream contains copy history that is unavailable in the 03429 * repository, an error will be thrown. 03430 * 03431 * The repository's UUID will be updated iff 03432 * the dumpstream contains a UUID and 03433 * @a uuid_action is not equal to #svn_repos_load_uuid_ignore and 03434 * either the repository contains no revisions or 03435 * @a uuid_action is equal to #svn_repos_load_uuid_force. 03436 * 03437 * If the dumpstream contains no UUID, then @a uuid_action is 03438 * ignored and the repository UUID is not touched. 03439 * 03440 * @a start_rev and @a end_rev act as filters, the lower and upper 03441 * (inclusive) range values of revisions in @a dumpstream which will 03442 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 03443 * which case no revision-based filtering occurs at all), or both are 03444 * valid revisions (where @a start_rev is older than or equivalent to 03445 * @a end_rev). 03446 * 03447 * If @a parent_dir is not NULL, then the parser will reparent all the 03448 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 03449 * must be an existing directory in the repository. 03450 * 03451 * If @a use_pre_commit_hook is set, call the repository's pre-commit 03452 * hook before committing each loaded revision. 03453 * 03454 * If @a use_post_commit_hook is set, call the repository's 03455 * post-commit hook after committing each loaded revision. 03456 * 03457 * If @a validate_props is set, then validate Subversion revision and 03458 * node properties (those in the svn: namespace) against established 03459 * rules for those things. 03460 * 03461 * If @a ignore_dates is set, ignore any revision datestamps found in 03462 * @a dumpstream, allowing the revisions created by the load process 03463 * to be stamped as if they were newly created via the normal commit 03464 * process. 03465 * 03466 * If @a normalize_props is set, attempt to normalize invalid Subversion 03467 * revision and node properties (those in the svn: namespace) so that 03468 * their values would follow the established rules for them. For example, 03469 * for such properties, typically the value must be in UTF-8 with LF 03470 * line endings. 03471 * 03472 * @note The details or the performed normalizations are deliberately 03473 * left unspecified and may change in the future. 03474 * 03475 * If non-NULL, use @a notify_func and @a notify_baton to send notification 03476 * of events to the caller. 03477 * 03478 * If @a cancel_func is not @c NULL, it is called periodically with 03479 * @a cancel_baton as argument to see if the client wishes to cancel 03480 * the load. 03481 * 03482 * @since New in 1.10. 03483 */ 03484 svn_error_t * 03485 svn_repos_load_fs6(svn_repos_t *repos, 03486 svn_stream_t *dumpstream, 03487 svn_revnum_t start_rev, 03488 svn_revnum_t end_rev, 03489 enum svn_repos_load_uuid uuid_action, 03490 const char *parent_dir, 03491 svn_boolean_t use_pre_commit_hook, 03492 svn_boolean_t use_post_commit_hook, 03493 svn_boolean_t validate_props, 03494 svn_boolean_t ignore_dates, 03495 svn_boolean_t normalize_props, 03496 svn_repos_notify_func_t notify_func, 03497 void *notify_baton, 03498 svn_cancel_func_t cancel_func, 03499 void *cancel_baton, 03500 apr_pool_t *pool); 03501 03502 /** 03503 * Similar to svn_repos_load_fs6(), but with the @a normalize_props 03504 * parameter always set to @c FALSE. 03505 * 03506 * @since New in 1.9. 03507 * @deprecated Provided for backward compatibility with the 1.9 API. 03508 */ 03509 SVN_DEPRECATED 03510 svn_error_t * 03511 svn_repos_load_fs5(svn_repos_t *repos, 03512 svn_stream_t *dumpstream, 03513 svn_revnum_t start_rev, 03514 svn_revnum_t end_rev, 03515 enum svn_repos_load_uuid uuid_action, 03516 const char *parent_dir, 03517 svn_boolean_t use_pre_commit_hook, 03518 svn_boolean_t use_post_commit_hook, 03519 svn_boolean_t validate_props, 03520 svn_boolean_t ignore_dates, 03521 svn_repos_notify_func_t notify_func, 03522 void *notify_baton, 03523 svn_cancel_func_t cancel_func, 03524 void *cancel_baton, 03525 apr_pool_t *pool); 03526 03527 /** Similar to svn_repos_load_fs5(), but with @a ignore_dates 03528 * always passed as FALSE. 03529 * 03530 * @since New in 1.8. 03531 * @deprecated Provided for backward compatibility with the 1.8 API. 03532 */ 03533 SVN_DEPRECATED 03534 svn_error_t * 03535 svn_repos_load_fs4(svn_repos_t *repos, 03536 svn_stream_t *dumpstream, 03537 svn_revnum_t start_rev, 03538 svn_revnum_t end_rev, 03539 enum svn_repos_load_uuid uuid_action, 03540 const char *parent_dir, 03541 svn_boolean_t use_pre_commit_hook, 03542 svn_boolean_t use_post_commit_hook, 03543 svn_boolean_t validate_props, 03544 svn_repos_notify_func_t notify_func, 03545 void *notify_baton, 03546 svn_cancel_func_t cancel_func, 03547 void *cancel_baton, 03548 apr_pool_t *pool); 03549 03550 /** Similar to svn_repos_load_fs4(), but with @a start_rev and @a 03551 * end_rev always passed as #SVN_INVALID_REVNUM. 03552 * 03553 * @since New in 1.7. 03554 * @deprecated Provided for backward compatibility with the 1.7 API. 03555 */ 03556 SVN_DEPRECATED 03557 svn_error_t * 03558 svn_repos_load_fs3(svn_repos_t *repos, 03559 svn_stream_t *dumpstream, 03560 enum svn_repos_load_uuid uuid_action, 03561 const char *parent_dir, 03562 svn_boolean_t use_pre_commit_hook, 03563 svn_boolean_t use_post_commit_hook, 03564 svn_boolean_t validate_props, 03565 svn_repos_notify_func_t notify_func, 03566 void *notify_baton, 03567 svn_cancel_func_t cancel_func, 03568 void *cancel_baton, 03569 apr_pool_t *pool); 03570 03571 /** 03572 * Similar to svn_repos_load_fs3(), but with @a feedback_stream in 03573 * place of the #svn_repos_notify_func_t and baton and with 03574 * @a validate_props always FALSE. 03575 * 03576 * @since New in 1.2. 03577 * @deprecated Provided for backward compatibility with the 1.6 API. 03578 */ 03579 SVN_DEPRECATED 03580 svn_error_t * 03581 svn_repos_load_fs2(svn_repos_t *repos, 03582 svn_stream_t *dumpstream, 03583 svn_stream_t *feedback_stream, 03584 enum svn_repos_load_uuid uuid_action, 03585 const char *parent_dir, 03586 svn_boolean_t use_pre_commit_hook, 03587 svn_boolean_t use_post_commit_hook, 03588 svn_cancel_func_t cancel_func, 03589 void *cancel_baton, 03590 apr_pool_t *pool); 03591 03592 /** 03593 * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and 03594 * @a use_post_commit_hook always @c FALSE. 03595 * 03596 * @deprecated Provided for backward compatibility with the 1.1 API. 03597 */ 03598 SVN_DEPRECATED 03599 svn_error_t * 03600 svn_repos_load_fs(svn_repos_t *repos, 03601 svn_stream_t *dumpstream, 03602 svn_stream_t *feedback_stream, 03603 enum svn_repos_load_uuid uuid_action, 03604 const char *parent_dir, 03605 svn_cancel_func_t cancel_func, 03606 void *cancel_baton, 03607 apr_pool_t *pool); 03608 03609 /** 03610 * Read and parse dumpfile-formatted @a dumpstream, extracting the 03611 * revision properties from it and apply them to the already-open 03612 * @a repos. Use @a scratch_pool for temporary allocations. 03613 * 03614 * If, after filtering by the @a start_rev and @a end_rev, the dumpstream 03615 * contains revisions missing in @a repos, an error will be thrown. 03616 * 03617 * @a start_rev and @a end_rev act as filters, the lower and upper 03618 * (inclusive) range values of revisions in @a dumpstream which will 03619 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 03620 * which case no revision-based filtering occurs at all), or both are 03621 * valid revisions (where @a start_rev is older than or equivalent to 03622 * @a end_rev). 03623 * 03624 * If @a validate_props is set, then validate Subversion revision 03625 * properties (those in the svn: namespace) against established 03626 * rules for those things. 03627 * 03628 * If @a ignore_dates is set, ignore any revision datestamps found in 03629 * @a dumpstream, keeping whatever timestamps the revisions currently 03630 * have. 03631 * 03632 * If @a normalize_props is set, attempt to normalize invalid Subversion 03633 * revision and node properties (those in the svn: namespace) so that 03634 * their values would follow the established rules for them. For example, 03635 * for such properties, typically the value must be in UTF-8 with LF 03636 * line endings. 03637 * 03638 * @note The details or the performed normalizations are deliberately 03639 * left unspecified and may change in the future. 03640 * 03641 * If non-NULL, use @a notify_func and @a notify_baton to send notification 03642 * of events to the caller. 03643 * 03644 * If @a cancel_func is not @c NULL, it is called periodically with 03645 * @a cancel_baton as argument to see if the client wishes to cancel 03646 * the load. 03647 * 03648 * @remark No repository hooks will be triggered. 03649 * 03650 * @since New in 1.10. 03651 */ 03652 svn_error_t * 03653 svn_repos_load_fs_revprops(svn_repos_t *repos, 03654 svn_stream_t *dumpstream, 03655 svn_revnum_t start_rev, 03656 svn_revnum_t end_rev, 03657 svn_boolean_t validate_props, 03658 svn_boolean_t ignore_dates, 03659 svn_boolean_t normalize_props, 03660 svn_repos_notify_func_t notify_func, 03661 void *notify_baton, 03662 svn_cancel_func_t cancel_func, 03663 void *cancel_baton, 03664 apr_pool_t *scratch_pool); 03665 03666 /** 03667 * A vtable that is driven by svn_repos_parse_dumpstream3(). 03668 * 03669 * @since New in 1.8. 03670 */ 03671 typedef struct svn_repos_parse_fns3_t 03672 { 03673 /** The parser has discovered a new "magic header" record within the 03674 * parsing session represented by @a parse_baton. The dump-format 03675 * version number is @a version. 03676 */ 03677 svn_error_t *(*magic_header_record)(int version, 03678 void *parse_baton, 03679 apr_pool_t *pool); 03680 03681 /** The parser has discovered a new uuid record within the parsing 03682 * session represented by @a parse_baton. The uuid's value is 03683 * @a uuid, and it is allocated in @a pool. 03684 */ 03685 svn_error_t *(*uuid_record)(const char *uuid, 03686 void *parse_baton, 03687 apr_pool_t *pool); 03688 03689 /** The parser has discovered a new revision record within the 03690 * parsing session represented by @a parse_baton. All the headers are 03691 * placed in @a headers (allocated in @a pool), which maps <tt>const 03692 * char *</tt> header-name ==> <tt>const char *</tt> header-value. 03693 * The @a revision_baton received back (also allocated in @a pool) 03694 * represents the revision. 03695 */ 03696 svn_error_t *(*new_revision_record)(void **revision_baton, 03697 apr_hash_t *headers, 03698 void *parse_baton, 03699 apr_pool_t *pool); 03700 03701 /** The parser has discovered a new node record within the current 03702 * revision represented by @a revision_baton. All the headers are 03703 * placed in @a headers (as with @c new_revision_record), allocated in 03704 * @a pool. The @a node_baton received back is allocated in @a pool 03705 * and represents the node. 03706 */ 03707 svn_error_t *(*new_node_record)(void **node_baton, 03708 apr_hash_t *headers, 03709 void *revision_baton, 03710 apr_pool_t *pool); 03711 03712 /** For a given @a revision_baton, set a property @a name to @a value. */ 03713 svn_error_t *(*set_revision_property)(void *revision_baton, 03714 const char *name, 03715 const svn_string_t *value); 03716 03717 /** For a given @a node_baton, set a property @a name to @a value. */ 03718 svn_error_t *(*set_node_property)(void *node_baton, 03719 const char *name, 03720 const svn_string_t *value); 03721 03722 /** For a given @a node_baton, delete property @a name. */ 03723 svn_error_t *(*delete_node_property)(void *node_baton, const char *name); 03724 03725 /** For a given @a node_baton, remove all properties. */ 03726 svn_error_t *(*remove_node_props)(void *node_baton); 03727 03728 /** For a given @a node_baton, set @a stream to a writable stream 03729 * capable of receiving the node's fulltext. The parser will write 03730 * the fulltext to the stream and then close the stream to signal 03731 * completion. 03732 * 03733 * If a @c NULL is returned instead of a stream, the vtable is 03734 * indicating that no text is desired, and the parser will not 03735 * attempt to send it. 03736 */ 03737 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 03738 void *node_baton); 03739 03740 /** For a given @a node_baton, set @a handler and @a handler_baton 03741 * to a window handler and baton capable of receiving a delta 03742 * against the node's previous contents. The parser will send all 03743 * the windows of data to this handler, and will then send a NULL 03744 * window to signal completion. 03745 * 03746 * If a @c NULL is returned instead of a handler, the vtable is 03747 * indicating that no delta is desired, and the parser will not 03748 * attempt to send it. 03749 */ 03750 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler, 03751 void **handler_baton, 03752 void *node_baton); 03753 03754 /** The parser has reached the end of the current node represented by 03755 * @a node_baton, it can be freed. 03756 */ 03757 svn_error_t *(*close_node)(void *node_baton); 03758 03759 /** The parser has reached the end of the current revision 03760 * represented by @a revision_baton. In other words, there are no more 03761 * changed nodes within the revision. The baton can be freed. 03762 */ 03763 svn_error_t *(*close_revision)(void *revision_baton); 03764 03765 } svn_repos_parse_fns3_t; 03766 03767 03768 /** 03769 * Read and parse dumpfile-formatted @a stream, calling callbacks in 03770 * @a parse_fns/@a parse_baton, and using @a pool for allocations. 03771 * 03772 * If @a deltas_are_text is @c TRUE, handle text-deltas with the @a 03773 * set_fulltext callback. This is useful when manipulating a dump 03774 * stream without loading it. Otherwise handle text-deltas with the 03775 * @a apply_textdelta callback. 03776 * 03777 * If @a cancel_func is not @c NULL, it is called periodically with 03778 * @a cancel_baton as argument to see if the client wishes to cancel 03779 * the dump. 03780 * 03781 * This parser has built-in knowledge of the dumpfile format, but only 03782 * in a limited sense: 03783 * 03784 * * it recognizes the "magic" format-version header. 03785 * 03786 * * it recognizes the UUID header. 03787 * 03788 * * it recognizes revision and node records by looking for either 03789 * a REVISION_NUMBER or NODE_PATH headers. 03790 * 03791 * * it recognizes the CONTENT-LENGTH headers, so it knows if and 03792 * how to suck up the content body. 03793 * 03794 * * it knows how to parse a content body into two parts: props 03795 * and text, and pass the pieces to the vtable. 03796 * 03797 * This is enough knowledge to make it easy on vtable implementors, 03798 * but still allow expansion of the format: most headers do not have 03799 * to be handled explicitly. 03800 * 03801 * ### [JAF] Wouldn't it be more efficient to support a start/end rev 03802 * range here than only supporting it in receivers such as 03803 * svn_repos_get_fs_build_parser4()? This parser could then skip over 03804 * chunks of the input stream before the oldest required rev, and 03805 * could stop reading entirely after the youngest required rev. 03806 * 03807 * @since New in 1.8. 03808 03809 * @since Starting in 1.10, @a parse_fns may contain NULL pointers for 03810 * those callbacks that the caller is not interested in. 03811 */ 03812 svn_error_t * 03813 svn_repos_parse_dumpstream3(svn_stream_t *stream, 03814 const svn_repos_parse_fns3_t *parse_fns, 03815 void *parse_baton, 03816 svn_boolean_t deltas_are_text, 03817 svn_cancel_func_t cancel_func, 03818 void *cancel_baton, 03819 apr_pool_t *pool); 03820 03821 03822 /** 03823 * Set @a *parser and @a *parse_baton to a vtable parser which commits new 03824 * revisions to the fs in @a repos. The constructed parser will treat 03825 * UUID records in a manner consistent with @a uuid_action. Use @a pool 03826 * to operate on the fs. 03827 * 03828 * @a start_rev and @a end_rev act as filters, the lower and upper 03829 * (inclusive) range values of revisions which will 03830 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 03831 * which case no revision-based filtering occurs at all), or both are 03832 * valid revisions (where @a start_rev is older than or equivalent to 03833 * @a end_rev). They refer to dump stream revision numbers rather than 03834 * committed revision numbers. 03835 * 03836 * If @a use_history is true, then when the parser encounters a node that 03837 * is added-with-history, it will require 'copy-from' history to exist in 03838 * the repository at the relative (adjusted) copy-from revision and path. 03839 * It will perform a copy from that source location, and will fail if no 03840 * suitable source exists there. If @a use_history is false, then it will 03841 * instead convert every copy to a plain add. 03842 * 03843 * ### The 'use_history=FALSE' case is unused and untested in Subversion. 03844 * It seems to me it would not work with a deltas dumpfile (a driver 03845 * that calls the @c apply_textdelta method), as it would not have 03846 * access to the delta base text. 03847 * 03848 * If @a use_pre_commit_hook is set, call the repository's pre-commit 03849 * hook before committing each loaded revision. 03850 * 03851 * If @a use_post_commit_hook is set, call the repository's 03852 * post-commit hook after committing each loaded revision. 03853 * 03854 * If @a validate_props is set, then validate Subversion revision and 03855 * node properties (those in the svn: namespace) against established 03856 * rules for those things. 03857 * 03858 * If @a ignore_dates is set, ignore any revision datestamps found in 03859 * @a dumpstream, allowing the revisions created by the load process 03860 * to be stamped as if they were newly created via the normal commit 03861 * process. 03862 * 03863 * If @a normalize_props is set, attempt to normalize invalid Subversion 03864 * revision and node properties (those in the svn: namespace) so that 03865 * their values would follow the established rules for them. For example, 03866 * for such properties, typically the value must be in UTF-8 with LF 03867 * line endings. 03868 * 03869 * @note The details or the performed normalizations are deliberately 03870 * left unspecified and may change in the future. 03871 * 03872 * If @a parent_dir is not NULL, then the parser will reparent all the 03873 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 03874 * must be an existing directory in the repository. 03875 * 03876 * @since New in 1.10. 03877 */ 03878 svn_error_t * 03879 svn_repos_get_fs_build_parser6(const svn_repos_parse_fns3_t **parser, 03880 void **parse_baton, 03881 svn_repos_t *repos, 03882 svn_revnum_t start_rev, 03883 svn_revnum_t end_rev, 03884 svn_boolean_t use_history, 03885 svn_boolean_t validate_props, 03886 enum svn_repos_load_uuid uuid_action, 03887 const char *parent_dir, 03888 svn_boolean_t use_pre_commit_hook, 03889 svn_boolean_t use_post_commit_hook, 03890 svn_boolean_t ignore_dates, 03891 svn_boolean_t normalize_props, 03892 svn_repos_notify_func_t notify_func, 03893 void *notify_baton, 03894 apr_pool_t *pool); 03895 03896 /** 03897 * Similar to svn_repos_get_fs_build_parser6(), but with the 03898 * @a normalize_props parameter always set to @c FALSE. 03899 * 03900 * @since New in 1.9. 03901 * @deprecated Provided for backward compatibility with the 1.9 API. 03902 */ 03903 SVN_DEPRECATED 03904 svn_error_t * 03905 svn_repos_get_fs_build_parser5(const svn_repos_parse_fns3_t **parser, 03906 void **parse_baton, 03907 svn_repos_t *repos, 03908 svn_revnum_t start_rev, 03909 svn_revnum_t end_rev, 03910 svn_boolean_t use_history, 03911 svn_boolean_t validate_props, 03912 enum svn_repos_load_uuid uuid_action, 03913 const char *parent_dir, 03914 svn_boolean_t use_pre_commit_hook, 03915 svn_boolean_t use_post_commit_hook, 03916 svn_boolean_t ignore_dates, 03917 svn_repos_notify_func_t notify_func, 03918 void *notify_baton, 03919 apr_pool_t *pool); 03920 03921 /** 03922 * Similar to svn_repos_get_fs_build_parser5(), but with the 03923 * @c use_pre_commit_hook, @c use_post_commit_hook and @c ignore_dates 03924 * arguments all false. 03925 * 03926 * @since New in 1.8. 03927 * @deprecated Provided for backward compatibility with the 1.8 API. 03928 */ 03929 SVN_DEPRECATED 03930 svn_error_t * 03931 svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser, 03932 void **parse_baton, 03933 svn_repos_t *repos, 03934 svn_revnum_t start_rev, 03935 svn_revnum_t end_rev, 03936 svn_boolean_t use_history, 03937 svn_boolean_t validate_props, 03938 enum svn_repos_load_uuid uuid_action, 03939 const char *parent_dir, 03940 svn_repos_notify_func_t notify_func, 03941 void *notify_baton, 03942 apr_pool_t *pool); 03943 03944 03945 03946 /** 03947 * A vtable that is driven by svn_repos_parse_dumpstream2(). 03948 * Similar to #svn_repos_parse_fns3_t except that it lacks 03949 * the magic_header_record callback. 03950 * 03951 * @deprecated Provided for backward compatibility with the 1.7 API. 03952 */ 03953 typedef struct svn_repos_parse_fns2_t 03954 { 03955 /** Same as #svn_repos_parse_fns3_t.new_revision_record. */ 03956 svn_error_t *(*new_revision_record)(void **revision_baton, 03957 apr_hash_t *headers, 03958 void *parse_baton, 03959 apr_pool_t *pool); 03960 /** Same as #svn_repos_parse_fns3_t.uuid_record. */ 03961 svn_error_t *(*uuid_record)(const char *uuid, 03962 void *parse_baton, 03963 apr_pool_t *pool); 03964 /** Same as #svn_repos_parse_fns3_t.new_node_record. */ 03965 svn_error_t *(*new_node_record)(void **node_baton, 03966 apr_hash_t *headers, 03967 void *revision_baton, 03968 apr_pool_t *pool); 03969 /** Same as #svn_repos_parse_fns3_t.set_revision_property. */ 03970 svn_error_t *(*set_revision_property)(void *revision_baton, 03971 const char *name, 03972 const svn_string_t *value); 03973 /** Same as #svn_repos_parse_fns3_t.set_node_property. */ 03974 svn_error_t *(*set_node_property)(void *node_baton, 03975 const char *name, 03976 const svn_string_t *value); 03977 /** Same as #svn_repos_parse_fns3_t.delete_node_property. */ 03978 svn_error_t *(*delete_node_property)(void *node_baton, 03979 const char *name); 03980 /** Same as #svn_repos_parse_fns3_t.remove_node_props. */ 03981 svn_error_t *(*remove_node_props)(void *node_baton); 03982 /** Same as #svn_repos_parse_fns3_t.set_fulltext. */ 03983 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 03984 void *node_baton); 03985 /** Same as #svn_repos_parse_fns3_t.apply_textdelta. */ 03986 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler, 03987 void **handler_baton, 03988 void *node_baton); 03989 /** Same as #svn_repos_parse_fns3_t.close_node. */ 03990 svn_error_t *(*close_node)(void *node_baton); 03991 /** Same as #svn_repos_parse_fns3_t.close_revision. */ 03992 svn_error_t *(*close_revision)(void *revision_baton); 03993 } svn_repos_parse_fns2_t; 03994 03995 /** @deprecated Provided for backward compatibility with the 1.7 API. */ 03996 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t; 03997 03998 03999 /** 04000 * A vtable that is driven by svn_repos_parse_dumpstream(). 04001 * Similar to #svn_repos_parse_fns2_t except that it lacks 04002 * the delete_node_property and apply_textdelta callbacks. 04003 * 04004 * @deprecated Provided for backward compatibility with the 1.0 API. 04005 */ 04006 typedef struct svn_repos_parse_fns_t 04007 { 04008 /** Same as #svn_repos_parse_fns2_t.new_revision_record. */ 04009 svn_error_t *(*new_revision_record)(void **revision_baton, 04010 apr_hash_t *headers, 04011 void *parse_baton, 04012 apr_pool_t *pool); 04013 /** Same as #svn_repos_parse_fns2_t.uuid_record. */ 04014 svn_error_t *(*uuid_record)(const char *uuid, 04015 void *parse_baton, 04016 apr_pool_t *pool); 04017 /** Same as #svn_repos_parse_fns2_t.new_node_record. */ 04018 svn_error_t *(*new_node_record)(void **node_baton, 04019 apr_hash_t *headers, 04020 void *revision_baton, 04021 apr_pool_t *pool); 04022 /** Same as #svn_repos_parse_fns2_t.set_revision_property. */ 04023 svn_error_t *(*set_revision_property)(void *revision_baton, 04024 const char *name, 04025 const svn_string_t *value); 04026 /** Same as #svn_repos_parse_fns2_t.set_node_property. */ 04027 svn_error_t *(*set_node_property)(void *node_baton, 04028 const char *name, 04029 const svn_string_t *value); 04030 /** Same as #svn_repos_parse_fns2_t.remove_node_props. */ 04031 svn_error_t *(*remove_node_props)(void *node_baton); 04032 /** Same as #svn_repos_parse_fns2_t.set_fulltext. */ 04033 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 04034 void *node_baton); 04035 /** Same as #svn_repos_parse_fns2_t.close_node. */ 04036 svn_error_t *(*close_node)(void *node_baton); 04037 /** Same as #svn_repos_parse_fns2_t.close_revision. */ 04038 svn_error_t *(*close_revision)(void *revision_baton); 04039 } svn_repos_parser_fns_t; 04040 04041 04042 /** 04043 * Similar to svn_repos_parse_dumpstream3(), but uses the more limited 04044 * #svn_repos_parser_fns2_t vtable type. 04045 * 04046 * @deprecated Provided for backward compatibility with the 1.7 API. 04047 */ 04048 SVN_DEPRECATED 04049 svn_error_t * 04050 svn_repos_parse_dumpstream2(svn_stream_t *stream, 04051 const svn_repos_parser_fns2_t *parse_fns, 04052 void *parse_baton, 04053 svn_cancel_func_t cancel_func, 04054 void *cancel_baton, 04055 apr_pool_t *pool); 04056 04057 /** 04058 * Similar to svn_repos_parse_dumpstream2(), but uses the more limited 04059 * #svn_repos_parser_fns_t vtable type. 04060 * 04061 * @deprecated Provided for backward compatibility with the 1.0 API. 04062 */ 04063 SVN_DEPRECATED 04064 svn_error_t * 04065 svn_repos_parse_dumpstream(svn_stream_t *stream, 04066 const svn_repos_parser_fns_t *parse_fns, 04067 void *parse_baton, 04068 svn_cancel_func_t cancel_func, 04069 void *cancel_baton, 04070 apr_pool_t *pool); 04071 04072 /** 04073 * Similar to svn_repos_get_fs_build_parser4(), but with @a start_rev 04074 * and @a end_rev always passed as #SVN_INVALID_REVNUM, and yielding 04075 * the more limited svn_repos_parse_fns2_t. 04076 * 04077 * @since New in 1.7. 04078 * @deprecated Provided for backward compatibility with the 1.7 API. 04079 */ 04080 SVN_DEPRECATED 04081 svn_error_t * 04082 svn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **parser, 04083 void **parse_baton, 04084 svn_repos_t *repos, 04085 svn_boolean_t use_history, 04086 svn_boolean_t validate_props, 04087 enum svn_repos_load_uuid uuid_action, 04088 const char *parent_dir, 04089 svn_repos_notify_func_t notify_func, 04090 void *notify_baton, 04091 apr_pool_t *pool); 04092 04093 /** 04094 * Similar to svn_repos_get_fs_build_parser3(), but with @a outstream 04095 * in place if a #svn_repos_notify_func_t and baton and with 04096 * @a validate_props always FALSE. 04097 * 04098 * @since New in 1.1. 04099 * @deprecated Provided for backward compatibility with the 1.6 API. 04100 */ 04101 SVN_DEPRECATED 04102 svn_error_t * 04103 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser, 04104 void **parse_baton, 04105 svn_repos_t *repos, 04106 svn_boolean_t use_history, 04107 enum svn_repos_load_uuid uuid_action, 04108 svn_stream_t *outstream, 04109 const char *parent_dir, 04110 apr_pool_t *pool); 04111 04112 /** 04113 * Similar to svn_repos_get_fs_build_parser2(), but yields the more 04114 * limited svn_repos_parser_fns_t vtable type. 04115 * 04116 * @deprecated Provided for backward compatibility with the 1.0 API. 04117 */ 04118 SVN_DEPRECATED 04119 svn_error_t * 04120 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser, 04121 void **parse_baton, 04122 svn_repos_t *repos, 04123 svn_boolean_t use_history, 04124 enum svn_repos_load_uuid uuid_action, 04125 svn_stream_t *outstream, 04126 const char *parent_dir, 04127 apr_pool_t *pool); 04128 04129 04130 /** @} */ 04131 04132 /** A data type which stores the authz information. 04133 * 04134 * @since New in 1.3. 04135 */ 04136 typedef struct svn_authz_t svn_authz_t; 04137 04138 /** 04139 * This should be called before any other authz function. 04140 * 04141 * @a pool must support multi-threaded access if the application will use 04142 * authz from multiple threads. 04143 * 04144 * @since New in 1.10. 04145 */ 04146 svn_error_t * 04147 svn_repos_authz_initialize(apr_pool_t *pool); 04148 04149 /** 04150 * Read authz configuration data from @a path (a dirent, an absolute file url 04151 * or a registry path) into @a *authz_p, allocated in @a pool. 04152 * 04153 * If @a groups_path (a dirent, an absolute file url, or a registry path) is 04154 * set, use the global groups parsed from it. 04155 * 04156 * If @a path or @a groups_path is not a valid authz rule file, then return 04157 * #SVN_ERR_AUTHZ_INVALID_CONFIG. The contents of @a *authz_p is then 04158 * undefined. If @a must_exist is TRUE, a missing authz or groups file 04159 * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error 04160 * depends on the access type). 04161 * 04162 * For efficient access of in-repository authz, you may provide @a repos_hint 04163 * which will be tried first and may remove the need to open a temporary 04164 * repository instance. Otherwise, set it to NULL and the repositories will 04165 * be opened as needed. 04166 * 04167 * @since New in 1.10. 04168 */ 04169 svn_error_t * 04170 svn_repos_authz_read3(svn_authz_t **authz_p, 04171 const char *path, 04172 const char *groups_path, 04173 svn_boolean_t must_exist, 04174 svn_repos_t *repos_hint, 04175 apr_pool_t *result_pool, 04176 apr_pool_t *scratch_pool); 04177 04178 /** 04179 * Similar to svn_repos_authz_read3(), but with @a repos_hint set to @c NULL. 04180 * 04181 * @since New in 1.8. 04182 * @deprecated Provided for backward compatibility with the 1.9 API. 04183 */ 04184 SVN_DEPRECATED 04185 svn_error_t * 04186 svn_repos_authz_read2(svn_authz_t **authz_p, 04187 const char *path, 04188 const char *groups_path, 04189 svn_boolean_t must_exist, 04190 apr_pool_t *pool); 04191 04192 04193 /** 04194 * Similar to svn_repos_authz_read2(), but with @a groups_path and @a 04195 * repos_root always passed as @c NULL. 04196 * 04197 * @since New in 1.3. 04198 * @deprecated Provided for backward compatibility with the 1.7 API. 04199 */ 04200 SVN_DEPRECATED 04201 svn_error_t * 04202 svn_repos_authz_read(svn_authz_t **authz_p, 04203 const char *file, 04204 svn_boolean_t must_exist, 04205 apr_pool_t *pool); 04206 04207 /** 04208 * Read authz configuration data from @a stream into @a *authz_p, 04209 * allocated in @a pool. 04210 * 04211 * If @a groups_stream is set, use the global groups parsed from it. 04212 * 04213 * @since New in 1.8. 04214 */ 04215 svn_error_t * 04216 svn_repos_authz_parse(svn_authz_t **authz_p, 04217 svn_stream_t *stream, 04218 svn_stream_t *groups_stream, 04219 apr_pool_t *pool); 04220 04221 /** 04222 * Check whether @a user can access @a path in the repository @a 04223 * repos_name with the @a required_access. @a authz lists the ACLs to 04224 * check against. Set @a *access_granted to indicate if the requested 04225 * access is granted. 04226 * 04227 * If @a path is NULL, then check whether @a user has the @a 04228 * required_access anywhere in the repository. Set @a *access_granted 04229 * to TRUE if at least one path is accessible with the @a 04230 * required_access. 04231 * 04232 * For compatibility with 1.6, and earlier, @a repos_name can be NULL 04233 * in which case it is equivalent to a @a repos_name of "". 04234 * 04235 * @note Presently, @a repos_name must byte-for-byte match the repos_name 04236 * specified in the authz file; it is treated as an opaque string, and not 04237 * as a dirent. 04238 * 04239 * @since New in 1.3. 04240 */ 04241 svn_error_t * 04242 svn_repos_authz_check_access(svn_authz_t *authz, 04243 const char *repos_name, 04244 const char *path, 04245 const char *user, 04246 svn_repos_authz_access_t required_access, 04247 svn_boolean_t *access_granted, 04248 apr_pool_t *pool); 04249 04250 04251 04252 /** Revision Access Levels 04253 * 04254 * Like most version control systems, access to versioned objects in 04255 * Subversion is determined on primarily path-based system. Users either 04256 * do or don't have the ability to read a given path. 04257 * 04258 * However, unlike many version control systems where versioned objects 04259 * maintain their own distinct version information (revision numbers, 04260 * authors, log messages, change timestamps, etc.), Subversion binds 04261 * multiple paths changed as part of a single commit operation into a 04262 * set, calls the whole thing a revision, and hangs commit metadata 04263 * (author, date, log message, etc.) off of that revision. So, commit 04264 * metadata is shared across all the paths changed as part of a given 04265 * commit operation. 04266 * 04267 * It is common (or, at least, we hope it is) for log messages to give 04268 * detailed information about changes made in the commit to which the log 04269 * message is attached. Such information might include a mention of all 04270 * the files changed, what was changed in them, and so on. But this 04271 * causes a problem when presenting information to readers who aren't 04272 * authorized to read every path in the repository. Simply knowing that 04273 * a given path exists may be a security leak, even if the user can't see 04274 * the contents of the data located at that path. 04275 * 04276 * So Subversion does what it reasonably can to prevent the leak of this 04277 * information, and does so via a staged revision access policy. A 04278 * reader can be said to have one of three levels of access to a given 04279 * revision's metadata, based solely on the reader's access rights to the 04280 * paths changed or copied in that revision: 04281 * 04282 * 'full access' -- Granted when the reader has access to all paths 04283 * changed or copied in the revision, or when no paths were 04284 * changed in the revision at all, this access level permits 04285 * full visibility of all revision property names and values, 04286 * and the full changed-paths information. 04287 * 04288 * 'no access' -- Granted when the reader does not have access to any 04289 * paths changed or copied in the revision, this access level 04290 * denies the reader access to all revision properties and all 04291 * changed-paths information. 04292 * 04293 * 'partial access' -- Granted when the reader has access to at least 04294 * one, but not all, of the paths changed or copied in the revision, 04295 * this access level permits visibility of the svn:date and 04296 * svn:author revision properties and only the paths of the 04297 * changed-paths information to which the reader has access. 04298 * 04299 */ 04300 04301 04302 /** An enum defining levels of revision access. 04303 * 04304 * @since New in 1.5. 04305 */ 04306 typedef enum svn_repos_revision_access_level_t 04307 { 04308 /** no access allowed to the revision properties and all changed-paths 04309 * information. */ 04310 svn_repos_revision_access_none, 04311 /** access granted to some (svn:date and svn:author) revision properties and 04312 * changed-paths information on paths the read has access to. */ 04313 svn_repos_revision_access_partial, 04314 /** access granted to all revision properites and changed-paths 04315 * information. */ 04316 svn_repos_revision_access_full 04317 } 04318 svn_repos_revision_access_level_t; 04319 04320 04321 /** 04322 * Set @a access to the access level granted for @a revision in @a 04323 * repos, as determined by consulting the @a authz_read_func callback 04324 * function and its associated @a authz_read_baton. 04325 * 04326 * @a authz_read_func may be @c NULL, in which case @a access will be 04327 * set to #svn_repos_revision_access_full. 04328 * 04329 * @since New in 1.5. 04330 */ 04331 svn_error_t * 04332 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level, 04333 svn_repos_t *repos, 04334 svn_revnum_t revision, 04335 svn_repos_authz_func_t authz_read_func, 04336 void *authz_read_baton, 04337 apr_pool_t *pool); 04338 04339 04340 #ifdef __cplusplus 04341 } 04342 #endif /* __cplusplus */ 04343 04344 #endif /* SVN_REPOS_H */
1.6.1