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