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