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