1 /** 2 * @copyright 3 * ==================================================================== 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 * ==================================================================== 21 * @endcopyright 22 * 23 * @file svn_repos.h 24 * @brief Tools built on top of the filesystem. 25 */ 26 27 #ifndef SVN_REPOS_H 28 #define SVN_REPOS_H 29 30 #include <apr_pools.h> 31 #include <apr_hash.h> 32 #include <apr_tables.h> 33 #include <apr_time.h> 34 35 #include "svn_types.h" 36 #include "svn_string.h" 37 #include "svn_delta.h" 38 #include "svn_fs.h" 39 #include "svn_io.h" 40 #include "svn_mergeinfo.h" 41 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif /* __cplusplus */ 46 47 /* ---------------------------------------------------------------*/ 48 49 /** 50 * Get libsvn_repos version information. 51 * 52 * @since New in 1.1. 53 */ 54 const svn_version_t * 55 svn_repos_version(void); 56 57 58 /* Some useful enums. They need to be declared here for the notification 59 system to pick them up. */ 60 /** The different "actions" attached to nodes in the dumpfile. */ 61 enum svn_node_action 62 { 63 svn_node_action_change, 64 svn_node_action_add, 65 svn_node_action_delete, 66 svn_node_action_replace 67 }; 68 69 70 /** @defgroup svn_repos_authz_callbacks Repository authorization callbacks 71 * @{ 72 */ 73 74 /** Callback type for checking authorization on a path. 75 * 76 * Set @a *allowed to TRUE to indicate that some operation is 77 * authorized for @a path in @a root, or set it to FALSE to indicate 78 * unauthorized (presumably according to state stored in @a baton). 79 * 80 * Do not assume @a pool has any lifetime beyond this call. 81 * 82 * The exact operation being authorized depends on the callback 83 * implementation. For read authorization, for example, the caller 84 * would implement an instance that does read checking, and pass it as 85 * a parameter named [perhaps] 'authz_read_func'. The receiver of 86 * that parameter might also take another parameter named 87 * 'authz_write_func', which although sharing this type, would be a 88 * different implementation. 89 * 90 * @note If someday we want more sophisticated authorization states 91 * than just yes/no, @a allowed can become an enum type. 92 */ 93 typedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed, 94 svn_fs_root_t *root, 95 const char *path, 96 void *baton, 97 apr_pool_t *pool); 98 99 100 /** An enum defining the kinds of access authz looks up. 101 * 102 * @since New in 1.3. 103 */ 104 typedef enum svn_repos_authz_access_t 105 { 106 /** No access. */ 107 svn_authz_none = 0, 108 109 /** Path can be read. */ 110 svn_authz_read = 1, 111 112 /** Path can be altered. */ 113 svn_authz_write = 2, 114 115 /** The other access credentials are recursive. */ 116 svn_authz_recursive = 4 117 } svn_repos_authz_access_t; 118 119 120 /** Callback type for checking authorization on paths produced by 121 * the repository commit editor. 122 * 123 * Set @a *allowed to TRUE to indicate that the @a required access on 124 * @a path in @a root is authorized, or set it to FALSE to indicate 125 * unauthorized (presumable according to state stored in @a baton). 126 * 127 * If @a path is NULL, the callback should perform a global authz 128 * lookup for the @a required access. That is, the lookup should 129 * check if the @a required access is granted for at least one path of 130 * the repository, and set @a *allowed to TRUE if so. @a root may 131 * also be NULL if @a path is NULL. 132 * 133 * This callback is very similar to svn_repos_authz_func_t, with the 134 * exception of the addition of the @a required parameter. 135 * This is due to historical reasons: when authz was first implemented 136 * for svn_repos_dir_delta2(), it seemed there would need only checks 137 * for read and write operations, hence the svn_repos_authz_func_t 138 * callback prototype and usage scenario. But it was then realized 139 * that lookups due to copying needed to be recursive, and that 140 * brute-force recursive lookups didn't square with the O(1) 141 * performances a copy operation should have. 142 * 143 * So a special way to ask for a recursive lookup was introduced. The 144 * commit editor needs this capability to retain acceptable 145 * performance. Instead of revving the existing callback, causing 146 * unnecessary revving of functions that don't actually need the 147 * extended functionality, this second, more complete callback was 148 * introduced, for use by the commit editor. 149 * 150 * Some day, it would be nice to reunite these two callbacks and do 151 * the necessary revving anyway, but for the time being, this dual 152 * callback mechanism will do. 153 */ 154 typedef svn_error_t *(*svn_repos_authz_callback_t) 155 (svn_repos_authz_access_t required, 156 svn_boolean_t *allowed, 157 svn_fs_root_t *root, 158 const char *path, 159 void *baton, 160 apr_pool_t *pool); 161 162 /** @} */ 163 164 165 /** @defgroup svn_repos_notifications Repository notifications 166 * @{ 167 */ 168 169 /* Notification system. */ 170 171 /** The type of action occurring. 172 * 173 * @since New in 1.7. 174 */ 175 typedef enum svn_repos_notify_action_t 176 { 177 /** A warning message is waiting. */ 178 svn_repos_notify_warning = 0, 179 180 /** A revision has finished being dumped. */ 181 svn_repos_notify_dump_rev_end, 182 183 /** A revision has finished being verified. */ 184 svn_repos_notify_verify_rev_end, 185 186 /** All revisions have finished being dumped. */ 187 svn_repos_notify_dump_end, 188 189 /** All revisions have finished being verified. */ 190 svn_repos_notify_verify_end, 191 192 /** packing of an FSFS shard has commenced */ 193 svn_repos_notify_pack_shard_start, 194 195 /** packing of an FSFS shard is completed */ 196 svn_repos_notify_pack_shard_end, 197 198 /** packing of the shard revprops has commenced */ 199 svn_repos_notify_pack_shard_start_revprop, 200 201 /** packing of the shard revprops has completed */ 202 svn_repos_notify_pack_shard_end_revprop, 203 204 /** A revision has begun loading */ 205 svn_repos_notify_load_txn_start, 206 207 /** A revision has finished loading */ 208 svn_repos_notify_load_txn_committed, 209 210 /** A node has begun loading */ 211 svn_repos_notify_load_node_start, 212 213 /** A node has finished loading */ 214 svn_repos_notify_load_node_done, 215 216 /** A copied node has been encountered */ 217 svn_repos_notify_load_copied_node, 218 219 /** Mergeinfo has been normalized */ 220 svn_repos_notify_load_normalized_mergeinfo, 221 222 /** The operation has acquired a mutex for the repo. */ 223 svn_repos_notify_mutex_acquired, 224 225 /** Recover has started. */ 226 svn_repos_notify_recover_start, 227 228 /** Upgrade has started. */ 229 svn_repos_notify_upgrade_start, 230 231 /** A revision was skipped during loading. @since New in 1.8. */ 232 svn_repos_notify_load_skipped_rev, 233 234 /** The structure of a revision is being verified. @since New in 1.8. */ 235 svn_repos_notify_verify_rev_structure, 236 237 /** A revprop shard got packed. @since New in 1.9. */ 238 svn_repos_notify_pack_revprops, 239 240 /** A non-packed revprop shard got removed. @since New in 1.9. */ 241 svn_repos_notify_cleanup_revprops, 242 243 /** The repository format got bumped. @since New in 1.9. */ 244 svn_repos_notify_format_bumped, 245 246 /** A revision range was copied. @since New in 1.9. */ 247 svn_repos_notify_hotcopy_rev_range, 248 249 /** The repository pack did not do anything. @since New in 1.10. */ 250 svn_repos_notify_pack_noop, 251 252 /** The revision properties got set. @since New in 1.10. */ 253 svn_repos_notify_load_revprop_set 254 } svn_repos_notify_action_t; 255 256 /** The type of warning occurring. 257 * 258 * @since New in 1.7. 259 */ 260 typedef enum svn_repos_notify_warning_t 261 { 262 /** Referencing copy source data from a revision earlier than the 263 * first revision dumped. */ 264 svn_repos_notify_warning_found_old_reference, 265 266 /** An #SVN_PROP_MERGEINFO property's encoded mergeinfo references a 267 * revision earlier than the first revision dumped. */ 268 svn_repos_notify_warning_found_old_mergeinfo, 269 270 /** Found an invalid path in the filesystem. 271 * @see svn_fs.h:"Directory entry names and directory paths" */ 272 /* ### TODO(doxygen): make that a proper doxygen link */ 273 /* See svn_fs__path_valid(). */ 274 svn_repos_notify_warning_invalid_fspath, 275 276 /** 277 * Detected a name collision. Reported when the names of two or more 278 * entries in the same directory differ only in character 279 * representation (normalization), but are otherwise identical. 280 * 281 * @since New in 1.9. 282 */ 283 svn_repos_notify_warning_name_collision, 284 285 /** 286 * Detected a mergeinfo path collision. Reported when the paths in 287 * two or more entries in the same svn:mergeinfo property differ 288 * only in character representation (normalization), but are 289 * otherwise identical. 290 * 291 * @since New in 1.9. 292 */ 293 svn_repos_notify_warning_mergeinfo_collision, 294 295 /** 296 * Detected invalid mergeinfo. 297 * 298 * @since New in 1.9. 299 */ 300 svn_repos_notify_warning_invalid_mergeinfo 301 } svn_repos_notify_warning_t; 302 303 /** 304 * Structure used by #svn_repos_notify_func_t. 305 * 306 * The only field guaranteed to be populated is @c action. Other fields are 307 * dependent upon the @c action. (See individual fields for more information.) 308 * 309 * @note Callers of notification functions should use 310 * svn_repos_notify_create() to create structures of this type to allow for 311 * future extensibility. 312 * 313 * @since New in 1.7. 314 */ 315 typedef struct svn_repos_notify_t 316 { 317 /** Action that describes what happened in the repository. */ 318 svn_repos_notify_action_t action; 319 320 /** For #svn_repos_notify_dump_rev_end and #svn_repos_notify_verify_rev_end, 321 * the revision which just completed. 322 * For #svn_fs_upgrade_format_bumped, the new format version. */ 323 svn_revnum_t revision; 324 325 /** For #svn_repos_notify_warning, the warning message. */ 326 const char *warning_str; 327 /** For #svn_repos_notify_warning, the warning type. */ 328 svn_repos_notify_warning_t warning; 329 330 /** For #svn_repos_notify_pack_shard_start, 331 #svn_repos_notify_pack_shard_end, 332 #svn_repos_notify_pack_revprops, 333 #svn_repos_notify_cleanup_revprops 334 #svn_repos_notify_pack_shard_start_revprop, and 335 #svn_repos_notify_pack_shard_end_revprop, the shard processed. */ 336 apr_int64_t shard; 337 338 /** For #svn_repos_notify_load_txn_committed, the revision committed. */ 339 svn_revnum_t new_revision; 340 341 /** For #svn_repos_notify_load_txn_committed, the source revision, if 342 different from @a new_revision, otherwise #SVN_INVALID_REVNUM. 343 For #svn_repos_notify_load_txn_start and 344 #svn_repos_notify_load_skipped_rev, the source revision. */ 345 svn_revnum_t old_revision; 346 347 /** For #svn_repos_notify_load_node_start, the action being taken on the 348 node. */ 349 enum svn_node_action node_action; 350 351 /** For #svn_repos_notify_load_node_start, the path of the node. */ 352 const char *path; 353 354 /** For #svn_repos_notify_hotcopy_rev_range, the start of the copied 355 revision range. 356 @since New in 1.9. */ 357 svn_revnum_t start_revision; 358 359 /** For #svn_repos_notify_hotcopy_rev_range, the end of the copied 360 revision range (might be the same as @a start_revision). 361 @since New in 1.9. */ 362 svn_revnum_t end_revision; 363 364 /* NOTE: Add new fields at the end to preserve binary compatibility. 365 Also, if you add fields here, you have to update 366 svn_repos_notify_create(). */ 367 } svn_repos_notify_t; 368 369 /** Callback for providing notification from the repository. 370 * Returns @c void. Justification: success of an operation is not dependent 371 * upon successful notification of that operation. 372 * 373 * @since New in 1.7. */ 374 typedef void (*svn_repos_notify_func_t)(void *baton, 375 const svn_repos_notify_t *notify, 376 apr_pool_t *scratch_pool); 377 378 /** Callback for filtering repository contents during dump. 379 * 380 * Set @a *include to TRUE to indicate that node, identified by path 381 * @a path in @a root should be included in dump, or set it to @c FALSE 382 * to indicate that node should be excluded (presumably according to state 383 * stored in @a baton). 384 * 385 * Do not assume @a scratch_pool has any lifetime beyond this call. 386 * 387 * @since New in 1.10. 388 */ 389 typedef svn_error_t * (*svn_repos_dump_filter_func_t)( 390 svn_boolean_t *include, 391 svn_fs_root_t *root, 392 const char *path, 393 void *baton, 394 apr_pool_t *scratch_pool); 395 396 /** 397 * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize 398 * and return it. 399 * 400 * @since New in 1.7. 401 */ 402 svn_repos_notify_t * 403 svn_repos_notify_create(svn_repos_notify_action_t action, 404 apr_pool_t *result_pool); 405 406 /** @} */ 407 408 409 /** The repository object. */ 410 typedef struct svn_repos_t svn_repos_t; 411 412 /* Opening and creating repositories. */ 413 414 415 /** Find the root path of the repository that contains @a path. 416 * 417 * If a repository was found, the path to the root of the repository 418 * is returned, else @c NULL. The pointer to the returned path may be 419 * equal to @a path. 420 */ 421 const char * 422 svn_repos_find_root_path(const char *path, 423 apr_pool_t *pool); 424 425 /** Set @a *repos_p to a repository object for the repository at @a path. 426 * 427 * Allocate @a *repos_p in @a result_pool. 428 * 429 * Acquires a shared lock on the repository, and attaches a cleanup 430 * function to @a result_pool to remove the lock. If no lock can be acquired, 431 * returns error, with undefined effect on @a *repos_p. If an exclusive 432 * lock is present, this blocks until it's gone. @a fs_config will be 433 * passed to the filesystem initialization function and may be @c NULL. 434 * 435 * Use @a scratch_pool for temporary allocations. 436 * 437 * @since New in 1.9. 438 */ 439 svn_error_t * 440 svn_repos_open3(svn_repos_t **repos_p, 441 const char *path, 442 apr_hash_t *fs_config, 443 apr_pool_t *result_pool, 444 apr_pool_t *scratch_pool); 445 446 /** Similar to svn_repos_open3() but without @a scratch_pool. 447 * 448 * @deprecated Provided for backward compatibility with 1.8 API. 449 * @since New in 1.7. 450 */ 451 SVN_DEPRECATED 452 svn_error_t * 453 svn_repos_open2(svn_repos_t **repos_p, 454 const char *path, 455 apr_hash_t *fs_config, 456 apr_pool_t *pool); 457 458 /** Similar to svn_repos_open2() with @a fs_config set to NULL. 459 * 460 * @deprecated Provided for backward compatibility with 1.6 API. 461 */ 462 SVN_DEPRECATED 463 svn_error_t * 464 svn_repos_open(svn_repos_t **repos_p, 465 const char *path, 466 apr_pool_t *pool); 467 468 /** Create a new Subversion repository at @a path, building the necessary 469 * directory structure, creating the filesystem, and so on. 470 * Return the repository object in @a *repos_p, allocated in @a pool. 471 * 472 * @a config is a client configuration hash of #svn_config_t * items 473 * keyed on config category names, and may be NULL. 474 * 475 * @a fs_config is passed to the filesystem, and may be NULL. 476 * 477 * @a unused_1 and @a unused_2 are not used and should be NULL. 478 */ 479 svn_error_t * 480 svn_repos_create(svn_repos_t **repos_p, 481 const char *path, 482 const char *unused_1, 483 const char *unused_2, 484 apr_hash_t *config, 485 apr_hash_t *fs_config, 486 apr_pool_t *pool); 487 488 /** 489 * Upgrade the Subversion repository (and its underlying versioned 490 * filesystem) located in the directory @a path to the latest version 491 * supported by this library. If the requested upgrade is not 492 * supported due to the current state of the repository or it 493 * underlying filesystem, return #SVN_ERR_REPOS_UNSUPPORTED_UPGRADE 494 * or #SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no 495 * changes to the repository or filesystem. 496 * 497 * Acquires an exclusive lock on the repository, upgrades the 498 * repository, and releases the lock. If an exclusive lock can't be 499 * acquired, returns error. 500 * 501 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 502 * returned if the lock is not immediately available. 503 * 504 * If @a start_callback is not NULL, it will be called with @a 505 * start_callback_baton as argument before the upgrade starts, but 506 * after the exclusive lock has been acquired. 507 * 508 * Use @a pool for necessary allocations. 509 * 510 * @note This functionality is provided as a convenience for 511 * administrators wishing to make use of new Subversion functionality 512 * without a potentially costly full repository dump/load. As such, 513 * the operation performs only the minimum amount of work needed to 514 * accomplish this while maintaining the integrity of the repository. 515 * It does *not* guarantee the most optimized repository state as a 516 * dump and subsequent load would. 517 * 518 * @note On some platforms the exclusive lock does not exclude other 519 * threads in the same process so this function should only be called 520 * by a single threaded process, or by a multi-threaded process when 521 * no other threads are accessing the repository. 522 * 523 * @since New in 1.7. 524 */ 525 svn_error_t * 526 svn_repos_upgrade2(const char *path, 527 svn_boolean_t nonblocking, 528 svn_repos_notify_func_t notify_func, 529 void *notify_baton, 530 apr_pool_t *pool); 531 532 /** 533 * Similar to svn_repos_upgrade2(), but with @a start_callback and baton, 534 * rather than a notify_callback / baton 535 * 536 * @since New in 1.5. 537 * @deprecated Provided for backward compatibility with the 1.6 API. 538 */ 539 SVN_DEPRECATED 540 svn_error_t * 541 svn_repos_upgrade(const char *path, 542 svn_boolean_t nonblocking, 543 svn_error_t *(*start_callback)(void *baton), 544 void *start_callback_baton, 545 apr_pool_t *pool); 546 547 /** Destroy the Subversion repository found at @a path, using @a pool for any 548 * necessary allocations. 549 */ 550 svn_error_t * 551 svn_repos_delete(const char *path, 552 apr_pool_t *pool); 553 554 555 /** @defgroup svn_repos_capabilities Repository capabilities 556 * @{ 557 */ 558 559 /** 560 * Set @a *has to TRUE if @a repos has @a capability (one of the 561 * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set 562 * @a *has to FALSE. 563 * 564 * If @a capability isn't recognized, throw #SVN_ERR_UNKNOWN_CAPABILITY, 565 * with the effect on @a *has undefined. 566 * 567 * Use @a pool for all allocation. 568 * 569 * @since New in 1.5. 570 */ 571 svn_error_t * 572 svn_repos_has_capability(svn_repos_t *repos, 573 svn_boolean_t *has, 574 const char *capability, 575 apr_pool_t *pool); 576 577 /** 578 * Return a set of @a capabilities supported by the running Subversion 579 * library and by @a repos. (Capabilities supported by this version of 580 * Subversion but not by @a repos are not listed. This may happen when 581 * svn_repos_upgrade2() has not been called after a software upgrade.) 582 * 583 * The set is represented as a hash whose const char * keys are the set 584 * members. The values are not defined. 585 * 586 * Allocate @a capabilities in @a result_pool and use @a scratch_pool for 587 * temporary allocations. 588 * 589 * @see svn_repos_info_format 590 * 591 * @since New in 1.9. 592 */ 593 svn_error_t * 594 svn_repos_capabilities(apr_hash_t **capabilities, 595 svn_repos_t *repos, 596 apr_pool_t *result_pool, 597 apr_pool_t *scratch_pool); 598 599 /** 600 * The capability of doing the right thing with merge-tracking 601 * information, both storing it and responding to queries about it. 602 * 603 * @since New in 1.5. 604 */ 605 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo" 606 /* *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY *** 607 * 608 * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to 609 * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid 610 * colons for their own reasons. While this RA limitation has no 611 * direct impact on repository capabilities, there's no reason to be 612 * gratuitously different either. 613 * 614 * If you add a capability, update svn_repos_capabilities(). 615 */ 616 617 /** @} */ 618 619 620 /** 621 * Store in @a repos the client-reported capabilities @a capabilities, 622 * which must be allocated in memory at least as long-lived as @a repos. 623 * 624 * The elements of @a capabilities are 'const char *', a subset of 625 * the constants beginning with @c SVN_RA_CAPABILITY_. 626 * @a capabilities is not copied, so changing it later will affect 627 * what is remembered by @a repos. 628 * 629 * @note The capabilities are passed along to the start-commit hook; 630 * see that hook's template for details. 631 * 632 * @note As of Subversion 1.5, there are no error conditions defined, 633 * so this always returns SVN_NO_ERROR. In future releases it may 634 * return error, however, so callers should check. 635 * 636 * @since New in 1.5. 637 */ 638 svn_error_t * 639 svn_repos_remember_client_capabilities(svn_repos_t *repos, 640 const apr_array_header_t *capabilities); 641 642 643 /** Return the filesystem associated with repository object @a repos. */ 644 svn_fs_t * 645 svn_repos_fs(svn_repos_t *repos); 646 647 /** Return the type of filesystem associated with repository object 648 * @a repos allocated in @a result_pool. 649 * 650 * @see #svn_fs_backend_names 651 * 652 * @since New in 1.9. 653 */ 654 const char * 655 svn_repos_fs_type(svn_repos_t *repos, 656 apr_pool_t *result_pool); 657 658 /** Make a hot copy of the Subversion repository found at @a src_path 659 * to @a dst_path. 660 * 661 * Copy a possibly live Subversion repository from @a src_path to 662 * @a dst_path. If @a clean_logs is @c TRUE, perform cleanup on the 663 * source filesystem as part of the copy operation; currently, this 664 * means deleting copied, unused logfiles for a Berkeley DB source 665 * repository. 666 * 667 * If @a incremental is TRUE, make an effort to not re-copy information 668 * already present in the destination. If incremental hotcopy is not 669 * implemented by the filesystem backend, raise SVN_ERR_UNSUPPORTED_FEATURE. 670 * 671 * For each revision range copied, the @a notify_func function will be 672 * called with the @a notify_baton and a notification structure containing 673 * appropriate values in @c start_revision and @c end_revision (both 674 * inclusive). @c start_revision might be equal to @c end_revision in 675 * case the copied range consists of a single revision. Currently, this 676 * notification is not triggered by the BDB backend. @a notify_func 677 * may be @c NULL if this notification is not required. 678 * 679 * The optional @a cancel_func callback will be invoked with 680 * @a cancel_baton as usual to allow the user to preempt this potentially 681 * lengthy operation. 682 * 683 * Use @a scratch_pool for temporary allocations. 684 * 685 * @since New in 1.9. 686 */ 687 svn_error_t * 688 svn_repos_hotcopy3(const char *src_path, 689 const char *dst_path, 690 svn_boolean_t clean_logs, 691 svn_boolean_t incremental, 692 svn_repos_notify_func_t notify_func, 693 void *notify_baton, 694 svn_cancel_func_t cancel_func, 695 void *cancel_baton, 696 apr_pool_t *scratch_pool); 697 698 /** 699 * Like svn_repos_hotcopy3(), but with @a notify_func and @a notify_baton 700 * always passed as @c NULL. 701 * 702 * @since New in 1.8. 703 * @deprecated Provided for backward compatibility with the 1.8 API. 704 */ 705 SVN_DEPRECATED 706 svn_error_t * 707 svn_repos_hotcopy2(const char *src_path, 708 const char *dst_path, 709 svn_boolean_t clean_logs, 710 svn_boolean_t incremental, 711 svn_cancel_func_t cancel_func, 712 void *cancel_baton, 713 apr_pool_t *pool); 714 715 /** 716 * Like svn_repos_hotcopy2(), but with @a incremental always passed as 717 * @c FALSE and without cancellation support. 718 * 719 * @deprecated Provided for backward compatibility with the 1.6 API. 720 */ 721 SVN_DEPRECATED 722 svn_error_t * 723 svn_repos_hotcopy(const char *src_path, 724 const char *dst_path, 725 svn_boolean_t clean_logs, 726 apr_pool_t *pool); 727 728 729 /** 730 * Possibly update the repository, @a repos, to use a more efficient 731 * filesystem representation. Use @a pool for allocations. 732 * 733 * @since New in 1.7. 734 */ 735 svn_error_t * 736 svn_repos_fs_pack2(svn_repos_t *repos, 737 svn_repos_notify_func_t notify_func, 738 void *notify_baton, 739 svn_cancel_func_t cancel_func, 740 void *cancel_baton, 741 apr_pool_t *pool); 742 743 /** 744 * Similar to svn_repos_fs_pack2(), but with a #svn_fs_pack_notify_t instead 745 * of a #svn_repos_notify_t. 746 * 747 * @since New in 1.6. 748 * @deprecated Provided for backward compatibility with the 1.6 API. 749 */ 750 SVN_DEPRECATED 751 svn_error_t * 752 svn_repos_fs_pack(svn_repos_t *repos, 753 svn_fs_pack_notify_t notify_func, 754 void *notify_baton, 755 svn_cancel_func_t cancel_func, 756 void *cancel_baton, 757 apr_pool_t *pool); 758 759 /** 760 * Run database recovery procedures on the repository at @a path, 761 * returning the database to a consistent state. Use @a pool for all 762 * allocation. 763 * 764 * Acquires an exclusive lock on the repository, recovers the 765 * database, and releases the lock. If an exclusive lock can't be 766 * acquired, returns error. 767 * 768 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 769 * returned if the lock is not immediately available. 770 * 771 * If @a notify_func is not NULL, it will be called with @a 772 * notify_baton as argument before the recovery starts, but 773 * after the exclusive lock has been acquired. 774 * 775 * If @a cancel_func is not @c NULL, it is called periodically with 776 * @a cancel_baton as argument to see if the client wishes to cancel 777 * the recovery. 778 * 779 * @note On some platforms the exclusive lock does not exclude other 780 * threads in the same process so this function should only be called 781 * by a single threaded process, or by a multi-threaded process when 782 * no other threads are accessing the repository. 783 * 784 * @since New in 1.7. 785 */ 786 svn_error_t * 787 svn_repos_recover4(const char *path, 788 svn_boolean_t nonblocking, 789 svn_repos_notify_func_t notify_func, 790 void *notify_baton, 791 svn_cancel_func_t cancel_func, 792 void * cancel_baton, 793 apr_pool_t *pool); 794 795 /** 796 * Similar to svn_repos_recover4(), but with @a start callback in place of 797 * the notify_func / baton. 798 * 799 * @since New in 1.5. 800 * @deprecated Provided for backward compatibility with the 1.6 API. 801 */ 802 SVN_DEPRECATED 803 svn_error_t * 804 svn_repos_recover3(const char *path, 805 svn_boolean_t nonblocking, 806 svn_error_t *(*start_callback)(void *baton), 807 void *start_callback_baton, 808 svn_cancel_func_t cancel_func, 809 void * cancel_baton, 810 apr_pool_t *pool); 811 812 /** 813 * Similar to svn_repos_recover3(), but without cancellation support. 814 * 815 * @deprecated Provided for backward compatibility with the 1.4 API. 816 */ 817 SVN_DEPRECATED 818 svn_error_t * 819 svn_repos_recover2(const char *path, 820 svn_boolean_t nonblocking, 821 svn_error_t *(*start_callback)(void *baton), 822 void *start_callback_baton, 823 apr_pool_t *pool); 824 825 /** 826 * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and 827 * with no callbacks provided. 828 * 829 * @deprecated Provided for backward compatibility with the 1.0 API. 830 */ 831 SVN_DEPRECATED 832 svn_error_t * 833 svn_repos_recover(const char *path, 834 apr_pool_t *pool); 835 836 /** 837 * Callback for svn_repos_freeze. 838 * 839 * @since New in 1.8. 840 */ 841 typedef svn_error_t *(*svn_repos_freeze_func_t)(void *baton, apr_pool_t *pool); 842 843 /** 844 * Take an exclusive lock on each of the repositories in @a paths to 845 * prevent commits and then while holding all the locks invoke @a 846 * freeze_func passing @a freeze_baton. Each repository may be readable by 847 * Subversion while frozen, or may be unreadable, depending on which 848 * FS backend the repository uses. Repositories are locked in the 849 * order in which they are specified in the array. 850 * 851 * @note @a freeze_func must not, directly or indirectly, call any function 852 * that attempts to take out a lock on the underlying repository. These 853 * include functions for packing, hotcopying, setting revprops and commits. 854 * Attempts to do so may result in a deadlock. 855 * 856 * @note On some platforms the exclusive lock does not exclude other 857 * threads in the same process so this function should only be called 858 * by a single threaded process, or by a multi-threaded process when 859 * no other threads are accessing the repositories. 860 * 861 * @since New in 1.8. 862 */ 863 svn_error_t * 864 svn_repos_freeze(apr_array_header_t *paths, 865 svn_repos_freeze_func_t freeze_func, 866 void *freeze_baton, 867 apr_pool_t *pool); 868 869 /** This function is a wrapper around svn_fs_berkeley_logfiles(), 870 * returning log file paths relative to the root of the repository. 871 * 872 * @copydoc svn_fs_berkeley_logfiles() 873 */ 874 svn_error_t * 875 svn_repos_db_logfiles(apr_array_header_t **logfiles, 876 const char *path, 877 svn_boolean_t only_unused, 878 apr_pool_t *pool); 879 880 881 882 /* Repository Paths */ 883 884 /** Return the top-level repository path allocated in @a pool. */ 885 const char * 886 svn_repos_path(svn_repos_t *repos, 887 apr_pool_t *pool); 888 889 /** Return the path to @a repos's filesystem directory, allocated in 890 * @a pool. 891 */ 892 const char * 893 svn_repos_db_env(svn_repos_t *repos, 894 apr_pool_t *pool); 895 896 /** Return path to @a repos's config directory, allocated in @a pool. */ 897 const char * 898 svn_repos_conf_dir(svn_repos_t *repos, 899 apr_pool_t *pool); 900 901 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */ 902 const char * 903 svn_repos_svnserve_conf(svn_repos_t *repos, 904 apr_pool_t *pool); 905 906 /** Return path to @a repos's lock directory, allocated in @a pool. */ 907 const char * 908 svn_repos_lock_dir(svn_repos_t *repos, 909 apr_pool_t *pool); 910 911 /** Return path to @a repos's db lockfile, allocated in @a pool. */ 912 const char * 913 svn_repos_db_lockfile(svn_repos_t *repos, 914 apr_pool_t *pool); 915 916 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */ 917 const char * 918 svn_repos_db_logs_lockfile(svn_repos_t *repos, 919 apr_pool_t *pool); 920 921 /** Return the path to @a repos's hook directory, allocated in @a pool. */ 922 const char * 923 svn_repos_hook_dir(svn_repos_t *repos, 924 apr_pool_t *pool); 925 926 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */ 927 const char * 928 svn_repos_start_commit_hook(svn_repos_t *repos, 929 apr_pool_t *pool); 930 931 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */ 932 const char * 933 svn_repos_pre_commit_hook(svn_repos_t *repos, 934 apr_pool_t *pool); 935 936 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */ 937 const char * 938 svn_repos_post_commit_hook(svn_repos_t *repos, 939 apr_pool_t *pool); 940 941 /** Return the path to @a repos's pre-revprop-change hook, allocated in 942 * @a pool. 943 */ 944 const char * 945 svn_repos_pre_revprop_change_hook(svn_repos_t *repos, 946 apr_pool_t *pool); 947 948 /** Return the path to @a repos's post-revprop-change hook, allocated in 949 * @a pool. 950 */ 951 const char * 952 svn_repos_post_revprop_change_hook(svn_repos_t *repos, 953 apr_pool_t *pool); 954 955 956 /** @defgroup svn_repos_lock_hooks Paths to lock hooks 957 * @{ 958 * @since New in 1.2. */ 959 960 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */ 961 const char * 962 svn_repos_pre_lock_hook(svn_repos_t *repos, 963 apr_pool_t *pool); 964 965 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */ 966 const char * 967 svn_repos_post_lock_hook(svn_repos_t *repos, 968 apr_pool_t *pool); 969 970 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */ 971 const char * 972 svn_repos_pre_unlock_hook(svn_repos_t *repos, 973 apr_pool_t *pool); 974 975 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */ 976 const char * 977 svn_repos_post_unlock_hook(svn_repos_t *repos, 978 apr_pool_t *pool); 979 980 /** Specify that Subversion should consult the configuration file 981 * located at @a hooks_env_path to determine how to setup the 982 * environment for hook scripts invoked for the repository @a repos. 983 * As a special case, if @a hooks_env_path is @c NULL, look for the 984 * file in its default location within the repository disk structure. 985 * If @a hooks_env_path is not absolute, it specifies a path relative 986 * to the parent of the file's default location. 987 * 988 * Use @a scratch_pool for temporary allocations. 989 * 990 * If this function is not called, or if the specified configuration 991 * file does not define any environment variables, hooks will run in 992 * an empty environment. 993 * 994 * @since New in 1.8. 995 */ 996 svn_error_t * 997 svn_repos_hooks_setenv(svn_repos_t *repos, 998 const char *hooks_env_path, 999 apr_pool_t *scratch_pool); 1000 1001 /** @} */ 1002 1003 /* ---------------------------------------------------------------*/ 1004 1005 /* Reporting the state of a working copy, for updates. */ 1006 1007 1008 /** 1009 * Construct and return a @a report_baton that will be passed to the 1010 * other functions in this section to describe the state of a pre-existing 1011 * tree (typically, a working copy). When the report is finished, 1012 * @a editor/@a edit_baton will be driven in such a way as to transform the 1013 * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the 1014 * reported hierarchy to @a tgt_path. 1015 * 1016 * @a fs_base is the absolute path of the node in the filesystem at which 1017 * the comparison should be rooted. @a target is a single path component, 1018 * used to limit the scope of the report to a single entry of @a fs_base, 1019 * or "" if all of @a fs_base itself is the main subject of the report. 1020 * 1021 * @a tgt_path and @a revnum is the fs path/revision pair that is the 1022 * "target" of the delta. @a tgt_path should be provided only when 1023 * the source and target paths of the report differ. That is, @a tgt_path 1024 * should *only* be specified when specifying that the resultant editor 1025 * drive be one that transforms the reported hierarchy into a pristine tree 1026 * of @a tgt_path at revision @a revnum. A @c NULL value for @a tgt_path 1027 * will indicate that the editor should be driven in such a way as to 1028 * transform the reported hierarchy to revision @a revnum, preserving the 1029 * reported hierarchy. 1030 * 1031 * @a text_deltas instructs the driver of the @a editor to enable 1032 * the generation of text deltas. 1033 * 1034 * @a ignore_ancestry instructs the driver to ignore node ancestry 1035 * when determining how to transmit differences. 1036 * 1037 * @a send_copyfrom_args instructs the driver to send 'copyfrom' 1038 * arguments to the editor's add_file() and add_directory() methods, 1039 * whenever it deems feasible. 1040 * 1041 * Use @a authz_read_func and @a authz_read_baton (if not @c NULL) to 1042 * avoid sending data through @a editor/@a edit_baton which is not 1043 * authorized for transmission. 1044 * 1045 * @a zero_copy_limit controls the maximum size (in bytes) at which 1046 * data blocks may be sent using the zero-copy code path. On that 1047 * path, a number of in-memory copy operations have been eliminated to 1048 * maximize throughput. However, until the whole block has been 1049 * pushed to the network stack, other clients block, so be careful 1050 * when using larger values here. Pass 0 for @a zero_copy_limit to 1051 * disable this optimization altogether. 1052 * 1053 * @note Never activate this optimization if @a editor might access 1054 * any FSFS data structures (and, hence, caches). So, it is basically 1055 * safe for networked editors only. 1056 * 1057 * All allocation for the context and collected state will occur in 1058 * @a pool. 1059 * 1060 * @a depth is the requested depth of the editor drive. 1061 * 1062 * If @a depth is #svn_depth_unknown, the editor will affect only the 1063 * paths reported by the individual calls to svn_repos_set_path3() and 1064 * svn_repos_link_path3(). 1065 * 1066 * For example, if the reported tree is the @c A subdir of the Greek Tree 1067 * (see Subversion's test suite), at depth #svn_depth_empty, but the 1068 * @c A/B subdir is reported at depth #svn_depth_infinity, then 1069 * repository-side changes to @c A/mu, or underneath @c A/C and @c 1070 * A/D, would not be reflected in the editor drive, but changes 1071 * underneath @c A/B would be. 1072 * 1073 * Additionally, the editor driver will call @c add_directory and 1074 * and @c add_file for directories with an appropriate depth. For 1075 * example, a directory reported at #svn_depth_files will receive 1076 * file (but not directory) additions. A directory at #svn_depth_empty 1077 * will receive neither. 1078 * 1079 * If @a depth is #svn_depth_files, #svn_depth_immediates or 1080 * #svn_depth_infinity and @a depth is greater than the reported depth 1081 * of the working copy, then the editor driver will emit editor 1082 * operations so as to upgrade the working copy to this depth. 1083 * 1084 * If @a depth is #svn_depth_empty, #svn_depth_files, 1085 * #svn_depth_immediates and @a depth is lower 1086 * than or equal to the depth of the working copy, then the editor 1087 * operations will affect only paths at or above @a depth. 1088 * 1089 * @since New in 1.8. 1090 */ 1091 svn_error_t * 1092 svn_repos_begin_report3(void **report_baton, 1093 svn_revnum_t revnum, 1094 svn_repos_t *repos, 1095 const char *fs_base, 1096 const char *target, 1097 const char *tgt_path, 1098 svn_boolean_t text_deltas, 1099 svn_depth_t depth, 1100 svn_boolean_t ignore_ancestry, 1101 svn_boolean_t send_copyfrom_args, 1102 const svn_delta_editor_t *editor, 1103 void *edit_baton, 1104 svn_repos_authz_func_t authz_read_func, 1105 void *authz_read_baton, 1106 apr_size_t zero_copy_limit, 1107 apr_pool_t *pool); 1108 1109 /** 1110 * The same as svn_repos_begin_report3(), but with @a zero_copy_limit 1111 * always passed as 0. 1112 * 1113 * @since New in 1.5. 1114 * @deprecated Provided for backward compatibility with the 1.7 API. 1115 */ 1116 SVN_DEPRECATED 1117 svn_error_t * 1118 svn_repos_begin_report2(void **report_baton, 1119 svn_revnum_t revnum, 1120 svn_repos_t *repos, 1121 const char *fs_base, 1122 const char *target, 1123 const char *tgt_path, 1124 svn_boolean_t text_deltas, 1125 svn_depth_t depth, 1126 svn_boolean_t ignore_ancestry, 1127 svn_boolean_t send_copyfrom_args, 1128 const svn_delta_editor_t *editor, 1129 void *edit_baton, 1130 svn_repos_authz_func_t authz_read_func, 1131 void *authz_read_baton, 1132 apr_pool_t *pool); 1133 1134 /** 1135 * The same as svn_repos_begin_report2(), but taking a boolean 1136 * @a recurse flag, and sending FALSE for @a send_copyfrom_args. 1137 * 1138 * If @a recurse is TRUE, the editor driver will drive the editor with 1139 * a depth of #svn_depth_infinity; if FALSE, then with a depth of 1140 * #svn_depth_files. 1141 * 1142 * @note @a username is ignored, and has been removed in a revised 1143 * version of this API. 1144 * 1145 * @deprecated Provided for backward compatibility with the 1.4 API. 1146 */ 1147 SVN_DEPRECATED 1148 svn_error_t * 1149 svn_repos_begin_report(void **report_baton, 1150 svn_revnum_t revnum, 1151 const char *username, 1152 svn_repos_t *repos, 1153 const char *fs_base, 1154 const char *target, 1155 const char *tgt_path, 1156 svn_boolean_t text_deltas, 1157 svn_boolean_t recurse, 1158 svn_boolean_t ignore_ancestry, 1159 const svn_delta_editor_t *editor, 1160 void *edit_baton, 1161 svn_repos_authz_func_t authz_read_func, 1162 void *authz_read_baton, 1163 apr_pool_t *pool); 1164 1165 1166 /** 1167 * Given a @a report_baton constructed by svn_repos_begin_report3(), 1168 * record the presence of @a path, at @a revision with depth @a depth, 1169 * in the current tree. 1170 * 1171 * @a path is relative to the anchor/target used in the creation of the 1172 * @a report_baton. 1173 * 1174 * @a revision may be SVN_INVALID_REVNUM if (for example) @a path 1175 * represents a locally-added path with no revision number, or @a 1176 * depth is #svn_depth_exclude. 1177 * 1178 * @a path may not be underneath a path on which svn_repos_set_path3() 1179 * was previously called with #svn_depth_exclude in this report. 1180 * 1181 * The first call of this in a given report usually passes an empty 1182 * @a path; this is used to set up the correct root revision for the editor 1183 * drive. 1184 * 1185 * A depth of #svn_depth_unknown is not allowed, and results in an 1186 * error. 1187 * 1188 * If @a start_empty is TRUE and @a path is a directory, then require the 1189 * caller to explicitly provide all the children of @a path - do not assume 1190 * that the tree also contains all the children of @a path at @a revision. 1191 * This is for 'low confidence' client reporting. 1192 * 1193 * If the caller has a lock token for @a path, then @a lock_token should 1194 * be set to that token. Else, @a lock_token should be NULL. 1195 * 1196 * All temporary allocations are done in @a pool. 1197 * 1198 * @since New in 1.5. 1199 */ 1200 svn_error_t * 1201 svn_repos_set_path3(void *report_baton, 1202 const char *path, 1203 svn_revnum_t revision, 1204 svn_depth_t depth, 1205 svn_boolean_t start_empty, 1206 const char *lock_token, 1207 apr_pool_t *pool); 1208 1209 /** 1210 * Similar to svn_repos_set_path3(), but with @a depth set to 1211 * #svn_depth_infinity. 1212 * 1213 * @deprecated Provided for backward compatibility with the 1.4 API. 1214 */ 1215 SVN_DEPRECATED 1216 svn_error_t * 1217 svn_repos_set_path2(void *report_baton, 1218 const char *path, 1219 svn_revnum_t revision, 1220 svn_boolean_t start_empty, 1221 const char *lock_token, 1222 apr_pool_t *pool); 1223 1224 /** 1225 * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL. 1226 * 1227 * @deprecated Provided for backward compatibility with the 1.1 API. 1228 */ 1229 SVN_DEPRECATED 1230 svn_error_t * 1231 svn_repos_set_path(void *report_baton, 1232 const char *path, 1233 svn_revnum_t revision, 1234 svn_boolean_t start_empty, 1235 apr_pool_t *pool); 1236 1237 /** 1238 * Given a @a report_baton constructed by svn_repos_begin_report3(), 1239 * record the presence of @a path in the current tree, containing the contents 1240 * of @a link_path at @a revision with depth @a depth. 1241 * 1242 * A depth of #svn_depth_unknown is not allowed, and results in an 1243 * error. 1244 * 1245 * @a path may not be underneath a path on which svn_repos_set_path3() 1246 * was previously called with #svn_depth_exclude in this report. 1247 * 1248 * Note that while @a path is relative to the anchor/target used in the 1249 * creation of the @a report_baton, @a link_path is an absolute filesystem 1250 * path! 1251 * 1252 * If @a start_empty is TRUE and @a path is a directory, then require the 1253 * caller to explicitly provide all the children of @a path - do not assume 1254 * that the tree also contains all the children of @a link_path at 1255 * @a revision. This is for 'low confidence' client reporting. 1256 * 1257 * If the caller has a lock token for @a link_path, then @a lock_token 1258 * should be set to that token. Else, @a lock_token should be NULL. 1259 * 1260 * All temporary allocations are done in @a pool. 1261 * 1262 * @since New in 1.5. 1263 */ 1264 svn_error_t * 1265 svn_repos_link_path3(void *report_baton, 1266 const char *path, 1267 const char *link_path, 1268 svn_revnum_t revision, 1269 svn_depth_t depth, 1270 svn_boolean_t start_empty, 1271 const char *lock_token, 1272 apr_pool_t *pool); 1273 1274 /** 1275 * Similar to svn_repos_link_path3(), but with @a depth set to 1276 * #svn_depth_infinity. 1277 * 1278 * @deprecated Provided for backward compatibility with the 1.4 API. 1279 */ 1280 SVN_DEPRECATED 1281 svn_error_t * 1282 svn_repos_link_path2(void *report_baton, 1283 const char *path, 1284 const char *link_path, 1285 svn_revnum_t revision, 1286 svn_boolean_t start_empty, 1287 const char *lock_token, 1288 apr_pool_t *pool); 1289 1290 /** 1291 * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL. 1292 * 1293 * @deprecated Provided for backward compatibility with the 1.1 API. 1294 */ 1295 SVN_DEPRECATED 1296 svn_error_t * 1297 svn_repos_link_path(void *report_baton, 1298 const char *path, 1299 const char *link_path, 1300 svn_revnum_t revision, 1301 svn_boolean_t start_empty, 1302 apr_pool_t *pool); 1303 1304 /** Given a @a report_baton constructed by svn_repos_begin_report3(), 1305 * record the non-existence of @a path in the current tree. 1306 * 1307 * @a path may not be underneath a path on which svn_repos_set_path3() 1308 * was previously called with #svn_depth_exclude in this report. 1309 * 1310 * (This allows the reporter's driver to describe missing pieces of a 1311 * working copy, so that 'svn up' can recreate them.) 1312 * 1313 * All temporary allocations are done in @a pool. 1314 */ 1315 svn_error_t * 1316 svn_repos_delete_path(void *report_baton, 1317 const char *path, 1318 apr_pool_t *pool); 1319 1320 /** Given a @a report_baton constructed by svn_repos_begin_report3(), 1321 * finish the report and drive the editor as specified when the report 1322 * baton was constructed. 1323 * 1324 * If an error occurs during the driving of the editor, do NOT abort the 1325 * edit; that responsibility belongs to the caller of this function, if 1326 * it happens at all. 1327 * 1328 * After the call to this function, @a report_baton is no longer valid; 1329 * it should not be passed to any other reporting functions, including 1330 * svn_repos_abort_report(), even if this function returns an error. 1331 */ 1332 svn_error_t * 1333 svn_repos_finish_report(void *report_baton, 1334 apr_pool_t *pool); 1335 1336 1337 /** Given a @a report_baton constructed by svn_repos_begin_report3(), 1338 * abort the report. This function can be called anytime before 1339 * svn_repos_finish_report() is called. 1340 * 1341 * After the call to this function, @a report_baton is no longer valid; 1342 * it should not be passed to any other reporting functions. 1343 */ 1344 svn_error_t * 1345 svn_repos_abort_report(void *report_baton, 1346 apr_pool_t *pool); 1347 1348 1349 /* ---------------------------------------------------------------*/ 1350 1351 /* The magical dir_delta update routines. */ 1352 1353 /** Use the provided @a editor and @a edit_baton to describe the changes 1354 * necessary for making a given node (and its descendants, if it is a 1355 * directory) under @a src_root look exactly like @a tgt_path under 1356 * @a tgt_root. @a src_entry is the node to update. If @a src_entry 1357 * is empty, then compute the difference between the entire tree 1358 * anchored at @a src_parent_dir under @a src_root and @a tgt_path 1359 * under @a tgt_root. Else, describe the changes needed to update 1360 * only that entry in @a src_parent_dir. Typically, callers of this 1361 * function will use a @a tgt_path that is the concatenation of @a 1362 * src_parent_dir and @a src_entry. 1363 * 1364 * @a src_root and @a tgt_root can both be either revision or transaction 1365 * roots. If @a tgt_root is a revision, @a editor's set_target_revision() 1366 * will be called with the @a tgt_root's revision number, else it will 1367 * not be called at all. 1368 * 1369 * If @a authz_read_func is non-NULL, invoke it before any call to 1370 * 1371 * @a editor->open_root 1372 * @a editor->add_directory 1373 * @a editor->open_directory 1374 * @a editor->add_file 1375 * @a editor->open_file 1376 * 1377 * passing @a tgt_root, the same path that would be passed to the 1378 * editor function in question, and @a authz_read_baton. If the 1379 * @a *allowed parameter comes back TRUE, then proceed with the planned 1380 * editor call; else if FALSE, then invoke @a editor->absent_file or 1381 * @a editor->absent_directory as appropriate, except if the planned 1382 * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE. 1383 * 1384 * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to 1385 * the window handler returned by @a editor->apply_textdelta(). 1386 * 1387 * If @a depth is #svn_depth_empty, invoke @a editor calls only on 1388 * @a src_entry (or @a src_parent_dir, if @a src_entry is empty). 1389 * If @a depth is #svn_depth_files, also invoke the editor on file 1390 * children, if any; if #svn_depth_immediates, invoke it on 1391 * immediate subdirectories as well as files; if #svn_depth_infinity, 1392 * recurse fully. 1393 * 1394 * If @a entry_props is @c TRUE, accompany each opened/added entry with 1395 * propchange editor calls that relay special "entry props" (this 1396 * is typically used only for working copy updates). 1397 * 1398 * @a ignore_ancestry instructs the function to ignore node ancestry 1399 * when determining how to transmit differences. 1400 * 1401 * Before completing successfully, this function calls @a editor's 1402 * close_edit(), so the caller should expect its @a edit_baton to be 1403 * invalid after its use with this function. 1404 * 1405 * Do any allocation necessary for the delta computation in @a pool. 1406 * This function's maximum memory consumption is at most roughly 1407 * proportional to the greatest depth of the tree under @a tgt_root, not 1408 * the total size of the delta. 1409 * 1410 * ### svn_repos_dir_delta2 is mostly superseded by the reporter 1411 * ### functionality (svn_repos_begin_report3 and friends). 1412 * ### svn_repos_dir_delta2 does allow the roots to be transaction 1413 * ### roots rather than just revision roots, and it has the 1414 * ### entry_props flag. Almost all of Subversion's own code uses the 1415 * ### reporter instead; there are some stray references to the 1416 * ### svn_repos_dir_delta[2] in comments which should probably 1417 * ### actually refer to the reporter. 1418 * 1419 * @since New in 1.5. 1420 */ 1421 svn_error_t * 1422 svn_repos_dir_delta2(svn_fs_root_t *src_root, 1423 const char *src_parent_dir, 1424 const char *src_entry, 1425 svn_fs_root_t *tgt_root, 1426 const char *tgt_path, 1427 const svn_delta_editor_t *editor, 1428 void *edit_baton, 1429 svn_repos_authz_func_t authz_read_func, 1430 void *authz_read_baton, 1431 svn_boolean_t text_deltas, 1432 svn_depth_t depth, 1433 svn_boolean_t entry_props, 1434 svn_boolean_t ignore_ancestry, 1435 apr_pool_t *pool); 1436 1437 /** 1438 * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass 1439 * #svn_depth_infinity for @a depth, and if @a recurse is FALSE, 1440 * pass #svn_depth_files for @a depth. 1441 * 1442 * @deprecated Provided for backward compatibility with the 1.4 API. 1443 */ 1444 SVN_DEPRECATED 1445 svn_error_t * 1446 svn_repos_dir_delta(svn_fs_root_t *src_root, 1447 const char *src_parent_dir, 1448 const char *src_entry, 1449 svn_fs_root_t *tgt_root, 1450 const char *tgt_path, 1451 const svn_delta_editor_t *editor, 1452 void *edit_baton, 1453 svn_repos_authz_func_t authz_read_func, 1454 void *authz_read_baton, 1455 svn_boolean_t text_deltas, 1456 svn_boolean_t recurse, 1457 svn_boolean_t entry_props, 1458 svn_boolean_t ignore_ancestry, 1459 apr_pool_t *pool); 1460 1461 1462 /** Use the provided @a editor and @a edit_baton to describe the 1463 * skeletal changes made in a particular filesystem @a root 1464 * (revision or transaction). 1465 * 1466 * Changes will be limited to those within @a base_dir, and if 1467 * @a low_water_mark is set to something other than #SVN_INVALID_REVNUM 1468 * it is assumed that the client has no knowledge of revisions prior to 1469 * @a low_water_mark. Together, these two arguments define the portion of 1470 * the tree that the client is assumed to have knowledge of, and thus any 1471 * copies of data from outside that part of the tree will be sent in their 1472 * entirety, not as simple copies or deltas against a previous version. 1473 * 1474 * The @a editor passed to this function should be aware of the fact 1475 * that, if @a send_deltas is FALSE, calls to its change_dir_prop(), 1476 * change_file_prop(), and apply_textdelta() functions will not 1477 * contain meaningful data, and merely serve as indications that 1478 * properties or textual contents were changed. 1479 * 1480 * If @a send_deltas is @c TRUE, the text and property deltas for changes 1481 * will be sent, otherwise NULL text deltas and empty prop changes will be 1482 * used. 1483 * 1484 * If @a authz_read_func is non-NULL, it will be used to determine if the 1485 * user has read access to the data being accessed. Data that the user 1486 * cannot access will be skipped. 1487 * 1488 * @note This editor driver passes SVN_INVALID_REVNUM for all 1489 * revision parameters in the editor interface except the copyfrom 1490 * parameter of the add_file() and add_directory() editor functions. 1491 * 1492 * @since New in 1.4. 1493 */ 1494 svn_error_t * 1495 svn_repos_replay2(svn_fs_root_t *root, 1496 const char *base_dir, 1497 svn_revnum_t low_water_mark, 1498 svn_boolean_t send_deltas, 1499 const svn_delta_editor_t *editor, 1500 void *edit_baton, 1501 svn_repos_authz_func_t authz_read_func, 1502 void *authz_read_baton, 1503 apr_pool_t *pool); 1504 1505 /** 1506 * Similar to svn_repos_replay2(), but with @a base_dir set to @c "", 1507 * @a low_water_mark set to #SVN_INVALID_REVNUM, @a send_deltas 1508 * set to @c FALSE, and @a authz_read_func and @a authz_read_baton 1509 * set to @c NULL. 1510 * 1511 * @deprecated Provided for backward compatibility with the 1.3 API. 1512 */ 1513 SVN_DEPRECATED 1514 svn_error_t * 1515 svn_repos_replay(svn_fs_root_t *root, 1516 const svn_delta_editor_t *editor, 1517 void *edit_baton, 1518 apr_pool_t *pool); 1519 1520 /* ---------------------------------------------------------------*/ 1521 1522 /* Making commits. */ 1523 1524 /** 1525 * Return an @a editor and @a edit_baton to commit changes to the 1526 * filesystem of @a repos, beginning at location 'rev:@a base_path', 1527 * where "rev" is the argument given to open_root(). 1528 * 1529 * @a repos is a previously opened repository. @a repos_url_decoded is the 1530 * decoded URL to the base of the repository, and is used to check 1531 * copyfrom paths. @a txn is a filesystem transaction object to use 1532 * during the commit, or @c NULL to indicate that this function should 1533 * create (and fully manage) a new transaction. 1534 * 1535 * Store the contents of @a revprop_table, a hash mapping <tt>const 1536 * char *</tt> property names to #svn_string_t values, as properties 1537 * of the commit transaction, including author and log message if 1538 * present. 1539 * 1540 * @note #SVN_PROP_REVISION_DATE may be present in @a revprop_table, but 1541 * it will be overwritten when the transaction is committed. 1542 * 1543 * Iff @a authz_callback is provided, check read/write authorizations 1544 * on paths accessed by editor operations. An operation which fails 1545 * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or 1546 * SVN_ERR_AUTHZ_UNWRITABLE. 1547 * 1548 * Calling @a (*editor)->close_edit completes the commit. 1549 * 1550 * If @a commit_callback is non-NULL, then before @c close_edit returns (but 1551 * after the commit has succeeded) @c close_edit will invoke 1552 * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton, 1553 * and @a pool or some subpool thereof as arguments. The @c repos_root field 1554 * of the #svn_commit_info_t is @c NULL. If @a commit_callback 1555 * returns an error, that error will be returned from @c close_edit, 1556 * otherwise if there was a post-commit hook failure, then that error 1557 * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. 1558 * (Note that prior to Subversion 1.6, @a commit_callback cannot be @c NULL; 1559 * if you don't need a callback, pass a dummy function.) 1560 * 1561 * Calling @a (*editor)->abort_edit aborts the commit, and will also 1562 * abort the commit transaction unless @a txn was supplied (not @c 1563 * NULL). Callers who supply their own transactions are responsible 1564 * for cleaning them up (either by committing them, or aborting them). 1565 * 1566 * @since New in 1.5. Since 1.6, @a commit_callback can be @c NULL. 1567 * 1568 * @note Yes, @a repos_url_decoded is a <em>decoded</em> URL. We realize 1569 * that's sorta wonky. Sorry about that. 1570 * 1571 * @note Like most commit editors, the returned editor requires that the 1572 * @c copyfrom_path parameter passed to its @c add_file and @c add_directory 1573 * methods is a full, URI-encoded URL, not a relative path. 1574 */ 1575 svn_error_t * 1576 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor, 1577 void **edit_baton, 1578 svn_repos_t *repos, 1579 svn_fs_txn_t *txn, 1580 const char *repos_url_decoded, 1581 const char *base_path, 1582 apr_hash_t *revprop_table, 1583 svn_commit_callback2_t commit_callback, 1584 void *commit_baton, 1585 svn_repos_authz_callback_t authz_callback, 1586 void *authz_baton, 1587 apr_pool_t *pool); 1588 1589 /** 1590 * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table 1591 * set to a hash containing @a user and @a log_msg as the 1592 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties, 1593 * respectively. @a user and @a log_msg may both be @c NULL. 1594 * 1595 * @since New in 1.4. 1596 * 1597 * @deprecated Provided for backward compatibility with the 1.4 API. 1598 */ 1599 SVN_DEPRECATED 1600 svn_error_t * 1601 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor, 1602 void **edit_baton, 1603 svn_repos_t *repos, 1604 svn_fs_txn_t *txn, 1605 const char *repos_url, 1606 const char *base_path, 1607 const char *user, 1608 const char *log_msg, 1609 svn_commit_callback2_t commit_callback, 1610 void *commit_baton, 1611 svn_repos_authz_callback_t authz_callback, 1612 void *authz_baton, 1613 apr_pool_t *pool); 1614 1615 /** 1616 * Similar to svn_repos_get_commit_editor4(), but 1617 * uses the svn_commit_callback_t type. 1618 * 1619 * @since New in 1.3. 1620 * 1621 * @deprecated Provided for backward compatibility with the 1.3 API. 1622 */ 1623 SVN_DEPRECATED 1624 svn_error_t * 1625 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor, 1626 void **edit_baton, 1627 svn_repos_t *repos, 1628 svn_fs_txn_t *txn, 1629 const char *repos_url, 1630 const char *base_path, 1631 const char *user, 1632 const char *log_msg, 1633 svn_commit_callback_t callback, 1634 void *callback_baton, 1635 svn_repos_authz_callback_t authz_callback, 1636 void *authz_baton, 1637 apr_pool_t *pool); 1638 1639 /** 1640 * Similar to svn_repos_get_commit_editor3(), but with @a 1641 * authz_callback and @a authz_baton set to @c NULL. 1642 * 1643 * @deprecated Provided for backward compatibility with the 1.2 API. 1644 */ 1645 SVN_DEPRECATED 1646 svn_error_t * 1647 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor, 1648 void **edit_baton, 1649 svn_repos_t *repos, 1650 svn_fs_txn_t *txn, 1651 const char *repos_url, 1652 const char *base_path, 1653 const char *user, 1654 const char *log_msg, 1655 svn_commit_callback_t callback, 1656 void *callback_baton, 1657 apr_pool_t *pool); 1658 1659 1660 /** 1661 * Similar to svn_repos_get_commit_editor2(), but with @a txn always 1662 * set to @c NULL. 1663 * 1664 * @deprecated Provided for backward compatibility with the 1.1 API. 1665 */ 1666 SVN_DEPRECATED 1667 svn_error_t * 1668 svn_repos_get_commit_editor(const svn_delta_editor_t **editor, 1669 void **edit_baton, 1670 svn_repos_t *repos, 1671 const char *repos_url, 1672 const char *base_path, 1673 const char *user, 1674 const char *log_msg, 1675 svn_commit_callback_t callback, 1676 void *callback_baton, 1677 apr_pool_t *pool); 1678 1679 /* ---------------------------------------------------------------*/ 1680 1681 /* Finding particular revisions. */ 1682 1683 /** Set @a *revision to the revision number in @a repos's filesystem that was 1684 * youngest at time @a tm. 1685 */ 1686 svn_error_t * 1687 svn_repos_dated_revision(svn_revnum_t *revision, 1688 svn_repos_t *repos, 1689 apr_time_t tm, 1690 apr_pool_t *pool); 1691 1692 1693 /** Given a @a root/@a path within some filesystem, return three pieces of 1694 * information allocated in @a pool: 1695 * 1696 * - set @a *committed_rev to the revision in which the object was 1697 * last modified. (In fs parlance, this is the revision in which 1698 * the particular node-rev-id was 'created'.) 1699 * 1700 * - set @a *committed_date to the date of said revision, or @c NULL 1701 * if not available. 1702 * 1703 * - set @a *last_author to the author of said revision, or @c NULL 1704 * if not available. 1705 */ 1706 svn_error_t * 1707 svn_repos_get_committed_info(svn_revnum_t *committed_rev, 1708 const char **committed_date, 1709 const char **last_author, 1710 svn_fs_root_t *root, 1711 const char *path, 1712 apr_pool_t *pool); 1713 1714 1715 /** 1716 * Set @a *dirent to an #svn_dirent_t associated with @a path in @a 1717 * root. If @a path does not exist in @a root, set @a *dirent to 1718 * NULL. Use @a pool for memory allocation. 1719 * 1720 * @since New in 1.2. 1721 */ 1722 svn_error_t * 1723 svn_repos_stat(svn_dirent_t **dirent, 1724 svn_fs_root_t *root, 1725 const char *path, 1726 apr_pool_t *pool); 1727 1728 /** 1729 * Callback type to be used with svn_repos_list(). It will be invoked for 1730 * every directory entry found. 1731 * 1732 * The full path of the entry is given in @a path and @a dirent contains 1733 * various additional information. If svn_repos_list() has been called 1734 * with @a path_info_only set, only the @a kind element of this struct 1735 * will be valid. 1736 * 1737 * @a baton is the user-provided receiver baton. @a scratch_pool may be 1738 * used for temporary allocations. 1739 * 1740 * @since New in 1.10. 1741 */ 1742 typedef svn_error_t *(* svn_repos_dirent_receiver_t)(const char *path, 1743 svn_dirent_t *dirent, 1744 void *baton, 1745 apr_pool_t *scratch_pool); 1746 1747 /** 1748 * Efficiently list everything within a sub-tree. Specify glob patterns 1749 * to search for specific files and folders. 1750 * 1751 * Walk the sub-tree starting at @a path under @a root up to the given 1752 * @a depth. For each directory entry found, @a receiver will be called 1753 * with @a receiver_baton. The starting @a path will be reported as well. 1754 * Because retrieving all elements of a #svn_dirent_t can be expensive, 1755 * you may set @a path_info_only to receive only the path name and the node 1756 * kind. The entries will be reported ordered by their path. 1757 * 1758 * @a patterns is an optional array of <tt>const char *</tt>. If it is 1759 * not @c NULL, only those directory entries will be reported whose last 1760 * path segment matches at least one of these patterns. This feature uses 1761 * apr_fnmatch() for glob matching and requiring '.' to matched by dots 1762 * in the path. 1763 * 1764 * If @a authz_read_func is not @c NULL, this function will neither report 1765 * entries nor recurse into directories that the user has no access to. 1766 * 1767 * Cancellation support is provided in the usual way through the optional 1768 * @a cancel_func and @a cancel_baton. 1769 * 1770 * @a path must point to a directory and @a depth must be at least 1771 * #svn_depth_empty. 1772 * 1773 * Use @a scratch_pool for temporary memory allocation. 1774 * 1775 * @since New in 1.10. 1776 */ 1777 svn_error_t * 1778 svn_repos_list(svn_fs_root_t *root, 1779 const char *path, 1780 const apr_array_header_t *patterns, 1781 svn_depth_t depth, 1782 svn_boolean_t path_info_only, 1783 svn_repos_authz_func_t authz_read_func, 1784 void *authz_read_baton, 1785 svn_repos_dirent_receiver_t receiver, 1786 void *receiver_baton, 1787 svn_cancel_func_t cancel_func, 1788 void *cancel_baton, 1789 apr_pool_t *scratch_pool); 1790 1791 /** 1792 * Given @a path which exists at revision @a start in @a fs, set 1793 * @a *deleted to the revision @a path was first deleted, within the 1794 * inclusive revision range bounded by @a start and @a end. If @a path 1795 * does not exist at revision @a start or was not deleted within the 1796 * specified range, then set @a *deleted to SVN_INVALID_REVNUM. 1797 * Use @a pool for memory allocation. 1798 * 1799 * @since New in 1.5. 1800 */ 1801 svn_error_t * 1802 svn_repos_deleted_rev(svn_fs_t *fs, 1803 const char *path, 1804 svn_revnum_t start, 1805 svn_revnum_t end, 1806 svn_revnum_t *deleted, 1807 apr_pool_t *pool); 1808 1809 1810 /** Callback type for use with svn_repos_history(). @a path and @a 1811 * revision represent interesting history locations in the lifetime 1812 * of the path passed to svn_repos_history(). @a baton is the same 1813 * baton given to svn_repos_history(). @a pool is provided for the 1814 * convenience of the implementor, who should not expect it to live 1815 * longer than a single callback call. 1816 * 1817 * Signal to callback driver to stop processing/invoking this callback 1818 * by returning the #SVN_ERR_CEASE_INVOCATION error code. 1819 * 1820 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 1821 */ 1822 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton, 1823 const char *path, 1824 svn_revnum_t revision, 1825 apr_pool_t *pool); 1826 1827 /** 1828 * Call @a history_func (with @a history_baton) for each interesting 1829 * history location in the lifetime of @a path in @a fs, from the 1830 * youngest of @a end and @a start to the oldest. Stop processing if 1831 * @a history_func returns #SVN_ERR_CEASE_INVOCATION. Only cross 1832 * filesystem copy history if @a cross_copies is @c TRUE. And do all 1833 * of this in @a pool. 1834 * 1835 * If @a authz_read_func is non-NULL, then use it (and @a 1836 * authz_read_baton) to verify that @a path in @a end is readable; if 1837 * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability 1838 * of every ancestral path/revision pair before pushing them at @a 1839 * history_func. If a pair is deemed unreadable, then do not send 1840 * them; instead, immediately stop traversing history and return 1841 * SVN_NO_ERROR. 1842 * 1843 * @since New in 1.1. 1844 * 1845 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 1846 */ 1847 svn_error_t * 1848 svn_repos_history2(svn_fs_t *fs, 1849 const char *path, 1850 svn_repos_history_func_t history_func, 1851 void *history_baton, 1852 svn_repos_authz_func_t authz_read_func, 1853 void *authz_read_baton, 1854 svn_revnum_t start, 1855 svn_revnum_t end, 1856 svn_boolean_t cross_copies, 1857 apr_pool_t *pool); 1858 1859 /** 1860 * Similar to svn_repos_history2(), but with @a authz_read_func 1861 * and @a authz_read_baton always set to NULL. 1862 * 1863 * @deprecated Provided for backward compatibility with the 1.0 API. 1864 */ 1865 SVN_DEPRECATED 1866 svn_error_t * 1867 svn_repos_history(svn_fs_t *fs, 1868 const char *path, 1869 svn_repos_history_func_t history_func, 1870 void *history_baton, 1871 svn_revnum_t start, 1872 svn_revnum_t end, 1873 svn_boolean_t cross_copies, 1874 apr_pool_t *pool); 1875 1876 1877 /** 1878 * Set @a *locations to be a mapping of the revisions to the paths of 1879 * the file @a fs_path present at the repository in revision 1880 * @a peg_revision, where the revisions are taken out of the array 1881 * @a location_revisions. 1882 * 1883 * @a location_revisions is an array of svn_revnum_t's and @a *locations 1884 * maps 'svn_revnum_t *' to 'const char *'. 1885 * 1886 * If optional @a authz_read_func is non-NULL, then use it (and @a 1887 * authz_read_baton) to verify that the peg-object is readable. If not, 1888 * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func 1889 * to check that every path returned in the hash is readable. If an 1890 * unreadable path is encountered, stop tracing and return 1891 * SVN_NO_ERROR. 1892 * 1893 * @a pool is used for all allocations. 1894 * 1895 * @since New in 1.1. 1896 */ 1897 svn_error_t * 1898 svn_repos_trace_node_locations(svn_fs_t *fs, 1899 apr_hash_t **locations, 1900 const char *fs_path, 1901 svn_revnum_t peg_revision, 1902 const apr_array_header_t *location_revisions, 1903 svn_repos_authz_func_t authz_read_func, 1904 void *authz_read_baton, 1905 apr_pool_t *pool); 1906 1907 1908 /** 1909 * Call @a receiver and @a receiver_baton to report successive 1910 * location segments in revisions between @a start_rev and @a end_rev 1911 * (inclusive) for the line of history identified by the peg-object @a 1912 * path in @a peg_revision (and in @a repos). 1913 * 1914 * @a end_rev may be #SVN_INVALID_REVNUM to indicate that you want 1915 * to trace the history of the object to its origin. 1916 * 1917 * @a start_rev may be #SVN_INVALID_REVNUM to indicate "the HEAD 1918 * revision". Otherwise, @a start_rev must be younger than @a end_rev 1919 * (unless @a end_rev is #SVN_INVALID_REVNUM). 1920 * 1921 * @a peg_revision may be #SVN_INVALID_REVNUM to indicate "the HEAD 1922 * revision", and must evaluate to be at least as young as @a start_rev. 1923 * 1924 * If optional @a authz_read_func is not @c NULL, then use it (and @a 1925 * authz_read_baton) to verify that the peg-object is readable. If 1926 * not, return #SVN_ERR_AUTHZ_UNREADABLE. Also use the @a 1927 * authz_read_func to check that every path reported in a location 1928 * segment is readable. If an unreadable path is encountered, report 1929 * a final (possibly truncated) location segment (if any), stop 1930 * tracing history, and return #SVN_NO_ERROR. 1931 * 1932 * @a pool is used for all allocations. 1933 * 1934 * @since New in 1.5. 1935 */ 1936 svn_error_t * 1937 svn_repos_node_location_segments(svn_repos_t *repos, 1938 const char *path, 1939 svn_revnum_t peg_revision, 1940 svn_revnum_t start_rev, 1941 svn_revnum_t end_rev, 1942 svn_location_segment_receiver_t receiver, 1943 void *receiver_baton, 1944 svn_repos_authz_func_t authz_read_func, 1945 void *authz_read_baton, 1946 apr_pool_t *pool); 1947 1948 1949 /* ---------------------------------------------------------------*/ 1950 1951 /* Retrieving log messages. */ 1952 1953 /** Path change descriptor. 1954 * 1955 * @note Identical to #svn_fs_path_change3_t but with all information 1956 * known, i.e. @a node_kind is never #svn_node_unknown and 1957 * @a copyfrom_known is always @c TRUE. 1958 * 1959 * @note To allow for extending this structure in future releases, 1960 * always use svn_repos_path_change_create() to allocate the stucture. 1961 * 1962 * @see svn_fs_path_change3_t 1963 * 1964 * @since New in 1.10. 1965 */ 1966 typedef svn_fs_path_change3_t svn_repos_path_change_t; 1967 1968 /** 1969 * Return an #svn_repos_path_change_t structure, allocated in @a result_pool, 1970 * with all fields initialized to their respective null/none/empty/invalid 1971 * values. 1972 * 1973 * @note To allow for extending the #svn_repos_path_change_t structure in 1974 * future releases, this function should always be used to allocate it. 1975 * 1976 * @since New in 1.10. 1977 */ 1978 svn_repos_path_change_t * 1979 svn_repos_path_change_create(apr_pool_t *result_pool); 1980 1981 /** 1982 * Return a deep copy of @a change, allocated in @a result_pool. 1983 * 1984 * @since New in 1.10. 1985 */ 1986 svn_repos_path_change_t * 1987 svn_repos_path_change_dup(svn_repos_path_change_t *change, 1988 apr_pool_t *result_pool); 1989 1990 /** The callback invoked by log message loopers, such as 1991 * svn_repos_get_logs5(). 1992 * 1993 * This function is invoked once on each changed path, in a potentially 1994 * random order that may even change between invocations for the same 1995 * revisions. 1996 * 1997 * @a baton is what you think it is, and @a change contains relevant 1998 * information for the changed path. Please note that @a change may be 1999 * modified within this callback but it will become invalid as soon as 2000 * the callback returns. 2001 * 2002 * Use @a scratch_pool for temporary allocation. The caller may clear it 2003 * between or after invocations. 2004 * 2005 * @since New in 1.10. 2006 */ 2007 typedef svn_error_t *(*svn_repos_path_change_receiver_t)( 2008 void *baton, 2009 svn_repos_path_change_t *change, 2010 apr_pool_t *scratch_pool); 2011 2012 2013 /** 2014 * A structure to represent all the information about a particular log entry. 2015 * 2016 * @note To allow for extending this structure in future releases, 2017 * always use svn_repos_log_entry_create() to allocate the stucture. 2018 * 2019 * @since New in 1.10. 2020 */ 2021 typedef struct svn_repos_log_entry_t 2022 { 2023 /** The revision of the commit. */ 2024 svn_revnum_t revision; 2025 2026 /** The hash of requested revision properties, which may be NULL if it 2027 * would contain no revprops. Maps (const char *) property name to 2028 * (svn_string_t *) property value. */ 2029 apr_hash_t *revprops; 2030 2031 /** 2032 * Whether or not this message has children. 2033 * 2034 * When a log operation requests additional merge information, extra log 2035 * entries may be returned as a result of this entry. The new entries, are 2036 * considered children of the original entry, and will follow it. When 2037 * the HAS_CHILDREN flag is set, the receiver should increment its stack 2038 * depth, and wait until an entry is provided with SVN_INVALID_REVNUM which 2039 * indicates the end of the children. 2040 * 2041 * For log operations which do not request additional merge information, the 2042 * HAS_CHILDREN flag is always FALSE. 2043 * 2044 * For more information see: 2045 * https://svn.apache.org/repos/asf/subversion/trunk/notes/merge-tracking/design.html#commutative-reporting 2046 */ 2047 svn_boolean_t has_children; 2048 2049 /** 2050 * Whether @a revision should be interpreted as non-inheritable in the 2051 * same sense of #svn_merge_range_t. 2052 * 2053 * Currently always FALSE. 2054 */ 2055 svn_boolean_t non_inheritable; 2056 2057 /** 2058 * Whether @a revision is a merged revision resulting from a reverse merge. 2059 */ 2060 svn_boolean_t subtractive_merge; 2061 2062 /* NOTE: Add new fields at the end to preserve binary compatibility. */ 2063 } svn_repos_log_entry_t; 2064 2065 /** 2066 * Return an #svn_repos_log_entry_t, allocated in @a result_pool, 2067 * with all fields initialized to their respective null/none/empty/invalid 2068 * values. 2069 * 2070 * @note To allow for extending the #svn_repos_log_entry_t structure in 2071 * future releases, this function should always be used to allocate it. 2072 * 2073 * @since New in 1.10. 2074 */ 2075 svn_repos_log_entry_t * 2076 svn_repos_log_entry_create(apr_pool_t *result_pool); 2077 2078 /** Return a deep copy of @a log_entry, allocated in @a result_pool. 2079 * 2080 * @since New in 1.10. 2081 */ 2082 svn_repos_log_entry_t * 2083 svn_repos_log_entry_dup(const svn_repos_log_entry_t *log_entry, 2084 apr_pool_t *result_pool); 2085 2086 2087 /** The callback invoked by log message loopers, such as 2088 * svn_repos_get_logs5(). 2089 * 2090 * This function is invoked once on each log message, in the order 2091 * determined by the caller (see above-mentioned functions). 2092 * 2093 * @a baton is what you think it is, and @a log_entry contains relevant 2094 * information for the log message. 2095 * 2096 * If @a log_entry->has_children is @c TRUE, the message will be followed 2097 * immediately by any number of merged revisions (child messages), which are 2098 * terminated by an invocation with SVN_INVALID_REVNUM. This usage may 2099 * be recursive. 2100 * 2101 * Use @a scratch_pool for temporary allocation. The caller may clear it 2102 * between or after invocations. 2103 * 2104 * @since New in 1.10. 2105 */ 2106 typedef svn_error_t *(*svn_repos_log_entry_receiver_t)( 2107 void *baton, 2108 svn_repos_log_entry_t *log_entry, 2109 apr_pool_t *scratch_pool); 2110 2111 2112 /** 2113 * Invoke @a revision_receiver with @a revision_receiver_baton on each 2114 * revision from @a start to @a end in @a repos's filesystem. @a start may 2115 * be greater or less than @a end; this just controls whether the log is 2116 * processed in descending or ascending revision number order. 2117 * 2118 * If not @c NULL, @a path_change_receiver will be invoked with 2119 * @a path_change_receiver_baton for each changed path in the respective 2120 * revision. These changes will be reported before the @a revision_receiver 2121 * is invoked for that revision. So, for each revision in the log, there 2122 * is a number of calls to @a path_change_receiver followed by a single 2123 * invocation of @a revision_receiver, implicitly marking the end of the 2124 * changes list for that revision. If a revision does not contain any 2125 * changes (or if none are visible due to @a authz_read_func), 2126 * @a path_change_receiver will not be called for that revision. 2127 * 2128 * If @a start or @a end is #SVN_INVALID_REVNUM, it defaults to youngest. 2129 * 2130 * If @a paths is non-NULL and has one or more elements, then only show 2131 * revisions in which at least one of @a paths was changed (i.e., if 2132 * file, text or props changed; if dir, props or entries changed or any node 2133 * changed below it). Each path is a <tt>const char *</tt> representing 2134 * an absolute path in the repository. If @a paths is NULL or empty, 2135 * show all revisions regardless of what paths were changed in those 2136 * revisions. 2137 * 2138 * If @a limit is greater than zero then only invoke @a revision_receiver 2139 * on the first @a limit logs. 2140 * 2141 * If @a strict_node_history is set, copy history (if any exists) will 2142 * not be traversed while harvesting revision logs for each path. 2143 * 2144 * If @a include_merged_revisions is set, log information for revisions 2145 * which have been merged to @a paths will also be returned, unless these 2146 * revisions are already part of @a start to @a end in @a repos's 2147 * filesystem, as limited by @a paths. In the latter case those revisions 2148 * are skipped and @a receiver is not invoked. 2149 * 2150 * If @a revprops is NULL, retrieve all revision properties; else, retrieve 2151 * only the revision properties named by the (const char *) array elements 2152 * (i.e. retrieve none if the array is empty). 2153 * 2154 * If any invocation of @a revision_receiver or @a path_change_receiver 2155 * returnn an error, return that error immediately and without wrapping it. 2156 * 2157 * If @a start or @a end is a non-existent revision, return the error 2158 * #SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a revision_receiver. 2159 * 2160 * If optional @a authz_read_func is non-NULL, then use this function 2161 * (along with optional @a authz_read_baton) to check the readability 2162 * of each changed-path in each revision about to be "pushed" at 2163 * @a path_change_receiver. If a revision has some changed-paths readable 2164 * and others unreadable, unreadable paths are omitted from the 2165 * @a path_change_receiver invocations and only svn:author and svn:date 2166 * will be available in the revprops field in the @a revision_receiver 2167 * callback. If a revision has no changed-paths readable at all, then all 2168 * paths are omitted and no revprops are available. If 2169 * @a path_change_receiver is @c NULL, the same filtering is performed 2170 * just without reporting any path changes. 2171 * 2172 * Use @a scratch_pool for temporary allocations. 2173 * 2174 * @see svn_repos_path_change_receiver_t, svn_repos_log_entry_receiver_t 2175 * 2176 * @since New in 1.10. 2177 */ 2178 svn_error_t * 2179 svn_repos_get_logs5(svn_repos_t *repos, 2180 const apr_array_header_t *paths, 2181 svn_revnum_t start, 2182 svn_revnum_t end, 2183 int limit, 2184 svn_boolean_t strict_node_history, 2185 svn_boolean_t include_merged_revisions, 2186 const apr_array_header_t *revprops, 2187 svn_repos_authz_func_t authz_read_func, 2188 void *authz_read_baton, 2189 svn_repos_path_change_receiver_t path_change_receiver, 2190 void *path_change_receiver_baton, 2191 svn_repos_log_entry_receiver_t revision_receiver, 2192 void *revision_receiver_baton, 2193 apr_pool_t *scratch_pool); 2194 2195 /** 2196 * Similar to svn_repos_get_logs5 but using a #svn_log_entry_receiver_t 2197 * @a receiver to receive revision properties and changed paths through a 2198 * single callback and the @a discover_changed_paths flag to control it. 2199 * 2200 * If @a discover_changed_paths, then each call to @a receiver passes a 2201 * hash mapping paths committed in that revision to information about them 2202 * as the receiver's @a changed_paths argument. 2203 * Otherwise, each call to @a receiver passes NULL for @a changed_paths. 2204 * 2205 * @see svn_log_entry_receiver_t 2206 * 2207 * @since New in 1.5. 2208 * 2209 * @deprecated Provided for backward compatibility with the 1.9 API. 2210 */ 2211 SVN_DEPRECATED 2212 svn_error_t * 2213 svn_repos_get_logs4(svn_repos_t *repos, 2214 const apr_array_header_t *paths, 2215 svn_revnum_t start, 2216 svn_revnum_t end, 2217 int limit, 2218 svn_boolean_t discover_changed_paths, 2219 svn_boolean_t strict_node_history, 2220 svn_boolean_t include_merged_revisions, 2221 const apr_array_header_t *revprops, 2222 svn_repos_authz_func_t authz_read_func, 2223 void *authz_read_baton, 2224 svn_log_entry_receiver_t receiver, 2225 void *receiver_baton, 2226 apr_pool_t *pool); 2227 2228 /** 2229 * Same as svn_repos_get_logs4(), but with @a receiver being 2230 * #svn_log_message_receiver_t instead of #svn_log_entry_receiver_t. 2231 * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is 2232 * svn:author, svn:date, and svn:log. If @a paths is empty, nothing 2233 * is returned. 2234 * 2235 * @since New in 1.2. 2236 * @deprecated Provided for backward compatibility with the 1.4 API. 2237 */ 2238 SVN_DEPRECATED 2239 svn_error_t * 2240 svn_repos_get_logs3(svn_repos_t *repos, 2241 const apr_array_header_t *paths, 2242 svn_revnum_t start, 2243 svn_revnum_t end, 2244 int limit, 2245 svn_boolean_t discover_changed_paths, 2246 svn_boolean_t strict_node_history, 2247 svn_repos_authz_func_t authz_read_func, 2248 void *authz_read_baton, 2249 svn_log_message_receiver_t receiver, 2250 void *receiver_baton, 2251 apr_pool_t *pool); 2252 2253 2254 /** 2255 * Same as svn_repos_get_logs3(), but with @a limit always set to 0. 2256 * 2257 * @deprecated Provided for backward compatibility with the 1.1 API. 2258 */ 2259 SVN_DEPRECATED 2260 svn_error_t * 2261 svn_repos_get_logs2(svn_repos_t *repos, 2262 const apr_array_header_t *paths, 2263 svn_revnum_t start, 2264 svn_revnum_t end, 2265 svn_boolean_t discover_changed_paths, 2266 svn_boolean_t strict_node_history, 2267 svn_repos_authz_func_t authz_read_func, 2268 void *authz_read_baton, 2269 svn_log_message_receiver_t receiver, 2270 void *receiver_baton, 2271 apr_pool_t *pool); 2272 2273 /** 2274 * Same as svn_repos_get_logs2(), but with @a authz_read_func and 2275 * @a authz_read_baton always set to NULL. 2276 * 2277 * @deprecated Provided for backward compatibility with the 1.0 API. 2278 */ 2279 SVN_DEPRECATED 2280 svn_error_t * 2281 svn_repos_get_logs(svn_repos_t *repos, 2282 const apr_array_header_t *paths, 2283 svn_revnum_t start, 2284 svn_revnum_t end, 2285 svn_boolean_t discover_changed_paths, 2286 svn_boolean_t strict_node_history, 2287 svn_log_message_receiver_t receiver, 2288 void *receiver_baton, 2289 apr_pool_t *pool); 2290 2291 2292 2293 /* ---------------------------------------------------------------*/ 2294 2295 /* Retrieving mergeinfo. */ 2296 2297 /** Receives parsed @a mergeinfo for the file system path @a path. 2298 * 2299 * The user-provided @a baton is being passed through by the retrieval 2300 * function and @a scratch_pool will be cleared between invocations. 2301 * 2302 * @since New in 1.10. 2303 */ 2304 typedef svn_fs_mergeinfo_receiver_t svn_repos_mergeinfo_receiver_t; 2305 2306 /** 2307 * For each node found with mergeinfo on it, invoke @a receiver with 2308 * the provided @a receiver_baton. 2309 * 2310 * The paths in @a paths start with '/'. 2311 * 2312 * @a inherit indicates whether explicit, explicit or inherited, or 2313 * only inherited mergeinfo for @a paths is fetched. 2314 * 2315 * If @a revision is #SVN_INVALID_REVNUM, it defaults to youngest. 2316 * 2317 * If @a include_descendants is TRUE, then additionally return the 2318 * mergeinfo for any descendant of any element of @a paths which has 2319 * the #SVN_PROP_MERGEINFO property explicitly set on it. (Note 2320 * that inheritance is only taken into account for the elements in @a 2321 * paths; descendants of the elements in @a paths which get their 2322 * mergeinfo via inheritance are not reported to @a receiver.) 2323 * 2324 * If optional @a authz_read_func is non-NULL, then use this function 2325 * (along with optional @a authz_read_baton) to check the readability 2326 * of each path which mergeinfo was requested for (from @a paths). 2327 * Silently omit unreadable paths from the request for mergeinfo. 2328 * 2329 * Use @a scratch_pool for temporary allocations. 2330 * 2331 * @since New in 1.10. 2332 */ 2333 svn_error_t * 2334 svn_repos_fs_get_mergeinfo2(svn_repos_t *repos, 2335 const apr_array_header_t *paths, 2336 svn_revnum_t revision, 2337 svn_mergeinfo_inheritance_t inherit, 2338 svn_boolean_t include_descendants, 2339 svn_repos_authz_func_t authz_read_func, 2340 void *authz_read_baton, 2341 svn_repos_mergeinfo_receiver_t receiver, 2342 void *receiver_baton, 2343 apr_pool_t *scratch_pool); 2344 2345 /** 2346 * Same as svn_repos_fs_get_mergeinfo2(), but all mergeinfo is being collected 2347 * and returned in @a *catalog. It will never be @c NULL, but may be empty. 2348 * 2349 * @since New in 1.5. 2350 * 2351 * @deprecated Provided for backward compatibility with the 1.9 API. 2352 */ 2353 SVN_DEPRECATED 2354 svn_error_t * 2355 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog, 2356 svn_repos_t *repos, 2357 const apr_array_header_t *paths, 2358 svn_revnum_t revision, 2359 svn_mergeinfo_inheritance_t inherit, 2360 svn_boolean_t include_descendants, 2361 svn_repos_authz_func_t authz_read_func, 2362 void *authz_read_baton, 2363 apr_pool_t *pool); 2364 2365 2366 /* ---------------------------------------------------------------*/ 2367 2368 /* Retrieving multiple revisions of a file. */ 2369 2370 /** 2371 * Retrieve a subset of the interesting revisions of a file @a path in 2372 * @a repos as seen in revision @a end. Invoke @a handler with 2373 * @a handler_baton as its first argument for each such revision. 2374 * @a pool is used for all allocations. See svn_fs_history_prev() for 2375 * a discussion of interesting revisions. 2376 * 2377 * If optional @a authz_read_func is non-NULL, then use this function 2378 * (along with optional @a authz_read_baton) to check the readability 2379 * of the rev-path in each interesting revision encountered. 2380 * 2381 * Revision discovery happens from @a end to @a start, and if an 2382 * unreadable revision is encountered before @a start is reached, then 2383 * revision discovery stops and only the revisions from @a end to the 2384 * oldest readable revision are returned (So it will appear that @a 2385 * path was added without history in the latter revision). 2386 * 2387 * If there is an interesting revision of the file that is less than or 2388 * equal to start, the iteration will start at that revision. Else, the 2389 * iteration will start at the first revision of the file in the repository, 2390 * which has to be less than or equal to end. Note that if the function 2391 * succeeds, @a handler will have been called at least once. 2392 * 2393 * In a series of calls, the file contents for the first interesting revision 2394 * will be provided as a text delta against the empty file. In the following 2395 * calls, the delta will be against the contents for the previous call. 2396 * 2397 * If @a include_merged_revisions is TRUE, revisions which a included as a 2398 * result of a merge between @a start and @a end will be included. 2399 * 2400 * Since Subversion 1.8 this function has been enabled to support reversion 2401 * the revision range for @a include_merged_revision @c FALSE reporting by 2402 * switching @a start with @a end. 2403 * 2404 * @note Prior to Subversion 1.9, this function may request delta handlers 2405 * from @a handler even for empty text deltas. Starting with 1.9, the 2406 * delta handler / baton return arguments passed to @a handler will be 2407 * #NULL unless there is an actual difference in the file contents between 2408 * the current and the previous call. 2409 * 2410 * @since New in 1.5. 2411 */ 2412 svn_error_t * 2413 svn_repos_get_file_revs2(svn_repos_t *repos, 2414 const char *path, 2415 svn_revnum_t start, 2416 svn_revnum_t end, 2417 svn_boolean_t include_merged_revisions, 2418 svn_repos_authz_func_t authz_read_func, 2419 void *authz_read_baton, 2420 svn_file_rev_handler_t handler, 2421 void *handler_baton, 2422 apr_pool_t *pool); 2423 2424 /** 2425 * Similar to #svn_file_rev_handler_t, but without the @a 2426 * result_of_merge parameter. 2427 * 2428 * @deprecated Provided for backward compatibility with 1.4 API. 2429 * @since New in 1.1. 2430 */ 2431 typedef svn_error_t *(*svn_repos_file_rev_handler_t) 2432 (void *baton, 2433 const char *path, 2434 svn_revnum_t rev, 2435 apr_hash_t *rev_props, 2436 svn_txdelta_window_handler_t *delta_handler, 2437 void **delta_baton, 2438 apr_array_header_t *prop_diffs, 2439 apr_pool_t *pool); 2440 2441 /** 2442 * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions 2443 * set to FALSE. 2444 * 2445 * @deprecated Provided for backward compatibility with the 1.4 API. 2446 * @since New in 1.1. 2447 */ 2448 SVN_DEPRECATED 2449 svn_error_t * 2450 svn_repos_get_file_revs(svn_repos_t *repos, 2451 const char *path, 2452 svn_revnum_t start, 2453 svn_revnum_t end, 2454 svn_repos_authz_func_t authz_read_func, 2455 void *authz_read_baton, 2456 svn_repos_file_rev_handler_t handler, 2457 void *handler_baton, 2458 apr_pool_t *pool); 2459 2460 2461 /* ---------------------------------------------------------------*/ 2462 2463 /** 2464 * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \ 2465 * routines. 2466 * @{ 2467 */ 2468 2469 /** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and 2470 * post-commit hooks around the commit. Use @a pool for any necessary 2471 * allocations. 2472 * 2473 * If the pre-commit hook fails, do not attempt to commit the 2474 * transaction and throw the original error to the caller. 2475 * 2476 * A successful commit is indicated by a valid revision value in @a 2477 * *new_rev, not if svn_fs_commit_txn() returns an error, which can 2478 * occur during its post commit FS processing. If the transaction was 2479 * not committed, then return the associated error and do not execute 2480 * the post-commit hook. 2481 * 2482 * If the commit succeeds the post-commit hook is executed. If the 2483 * post-commit hook returns an error, always wrap it with 2484 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to 2485 * find the post-commit hook error in the returned error chain. If 2486 * both svn_fs_commit_txn() and the post-commit hook return errors, 2487 * then svn_fs_commit_txn()'s error is the parent error and the 2488 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child 2489 * error. 2490 * 2491 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn(). 2492 */ 2493 svn_error_t * 2494 svn_repos_fs_commit_txn(const char **conflict_p, 2495 svn_repos_t *repos, 2496 svn_revnum_t *new_rev, 2497 svn_fs_txn_t *txn, 2498 apr_pool_t *pool); 2499 2500 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping 2501 * <tt>const char *</tt> property names to #svn_string_t values, to 2502 * set the properties on transaction @a *txn_p. @a repos is the 2503 * repository object which contains the filesystem. @a rev, @a 2504 * *txn_p, and @a pool are as in svn_fs_begin_txn(). 2505 * 2506 * Before a txn is created, the repository's start-commit hooks are 2507 * run; if any of them fail, no txn is created, @a *txn_p is unaffected, 2508 * and #SVN_ERR_REPOS_HOOK_FAILURE is returned. 2509 * 2510 * @note @a revprop_table may contain an #SVN_PROP_REVISION_DATE property, 2511 * which will be set on the transaction, but that will be overwritten 2512 * when the transaction is committed. 2513 * 2514 * @since New in 1.5. 2515 */ 2516 svn_error_t * 2517 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p, 2518 svn_repos_t *repos, 2519 svn_revnum_t rev, 2520 apr_hash_t *revprop_table, 2521 apr_pool_t *pool); 2522 2523 2524 /** 2525 * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table 2526 * set to a hash containing @a author and @a log_msg as the 2527 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties, 2528 * respectively. @a author and @a log_msg may both be @c NULL. 2529 * 2530 * @deprecated Provided for backward compatibility with the 1.4 API. 2531 */ 2532 SVN_DEPRECATED 2533 svn_error_t * 2534 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p, 2535 svn_repos_t *repos, 2536 svn_revnum_t rev, 2537 const char *author, 2538 const char *log_msg, 2539 apr_pool_t *pool); 2540 2541 2542 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding 2543 * property on transaction @a *txn_p. @a repos is the repository object 2544 * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in 2545 * svn_fs_begin_txn(). 2546 * 2547 * ### Someday: before a txn is created, some kind of read-hook could 2548 * be called here. 2549 * 2550 * @note This function was never fully implemented, nor used. Ignore it. 2551 * @deprecated Provided for backward compatibility with the 1.7 API. 2552 */ 2553 SVN_DEPRECATED 2554 svn_error_t * 2555 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p, 2556 svn_repos_t *repos, 2557 svn_revnum_t rev, 2558 const char *author, 2559 apr_pool_t *pool); 2560 2561 2562 /** @} */ 2563 2564 /** @defgroup svn_repos_fs_locks Repository lock wrappers 2565 * @{ 2566 */ 2567 2568 /** Like svn_fs_lock_many(), but invoke the @a repos's pre- and 2569 * post-lock hooks before and after the locking action. 2570 * 2571 * The pre-lock is run for every path in @a targets. Those targets for 2572 * which the pre-lock is successful are passed to svn_fs_lock_many and 2573 * the post-lock is run for those that are successfully locked. 2574 * Pre-lock hook errors are passed to @a lock_callback. 2575 * 2576 * For each path in @a targets @a lock_callback will be invoked 2577 * passing @a lock_baton and the lock and error that apply to path. 2578 * @a lock_callback can be NULL in which case it is not called and any 2579 * errors that would have been passed to the callback are not reported. 2580 * 2581 * If an error occurs when running the post-lock hook the error is 2582 * returned wrapped with #SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the 2583 * caller sees this error, it knows that some locks succeeded. 2584 * 2585 * The pre-lock hook may cause a different token to be used for the 2586 * lock, instead of the token supplied; see the pre-lock-hook 2587 * documentation for more. 2588 * 2589 * The lock and path passed to @a lock_callback will be allocated in 2590 * @a result_pool. Use @a scratch_pool for temporary allocations. 2591 * 2592 * @note This function is not atomic. If it returns an error, some targets 2593 * may remain unlocked while others may have been locked. 2594 * 2595 * @see svn_fs_lock_many 2596 * 2597 * @since New in 1.9. 2598 */ 2599 svn_error_t * 2600 svn_repos_fs_lock_many(svn_repos_t *repos, 2601 apr_hash_t *lock_targets, 2602 const char *comment, 2603 svn_boolean_t is_dav_comment, 2604 apr_time_t expiration_date, 2605 svn_boolean_t steal_lock, 2606 svn_fs_lock_callback_t lock_callback, 2607 void *lock_baton, 2608 apr_pool_t *result_pool, 2609 apr_pool_t *scratch_pool); 2610 2611 /** Similar to svn_repos_fs_lock_many() but locks only a single path. 2612 * 2613 * @since New in 1.2. 2614 */ 2615 svn_error_t * 2616 svn_repos_fs_lock(svn_lock_t **lock, 2617 svn_repos_t *repos, 2618 const char *path, 2619 const char *token, 2620 const char *comment, 2621 svn_boolean_t is_dav_comment, 2622 apr_time_t expiration_date, 2623 svn_revnum_t current_rev, 2624 svn_boolean_t steal_lock, 2625 apr_pool_t *pool); 2626 2627 2628 /** Like svn_fs_unlock_many(), but invoke the @a repos's pre- and 2629 * post-unlock hooks before and after the unlocking action. 2630 * 2631 * The pre-unlock hook is run for every path in @a targets. Those 2632 * targets for which the pre-unlock is successful are passed to 2633 * svn_fs_unlock_many and the post-unlock is run for those that are 2634 * successfully unlocked. Pre-unlock hook errors are passed to @a 2635 * lock_callback. 2636 * 2637 * For each path in @a targets @a lock_callback will be invoked 2638 * passing @a lock_baton and error that apply to path. The lock 2639 * passed to the callback will be NULL. @a lock_callback can be NULL 2640 * in which case it is not called and any errors that would have been 2641 * passed to the callback are not reported. 2642 * 2643 * If an error occurs when running the post-unlock hook, return the 2644 * original error wrapped with #SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. 2645 * If the caller sees this error, it knows that some unlocks 2646 * succeeded. 2647 * 2648 * The path passed to @a lock_callback will be allocated in @a result_pool. 2649 * Use @a scratch_pool for temporary allocations. 2650 * 2651 * @note This function is not atomic. If it returns an error, some targets 2652 * may remain locked while others may have been unlocked. 2653 * 2654 * @see svn_fs_unlock_many 2655 * 2656 * @since New in 1.9. 2657 */ 2658 svn_error_t * 2659 svn_repos_fs_unlock_many(svn_repos_t *repos, 2660 apr_hash_t *unlock_targets, 2661 svn_boolean_t break_lock, 2662 svn_fs_lock_callback_t lock_callback, 2663 void *lock_baton, 2664 apr_pool_t *result_pool, 2665 apr_pool_t *scratch_pool); 2666 2667 /** Similar to svn_repos_fs_unlock_many() but only unlocks a single path. 2668 * 2669 * @since New in 1.2. 2670 */ 2671 svn_error_t * 2672 svn_repos_fs_unlock(svn_repos_t *repos, 2673 const char *path, 2674 const char *token, 2675 svn_boolean_t break_lock, 2676 apr_pool_t *pool); 2677 2678 2679 2680 /** Look up all the locks in and under @a path in @a repos, setting @a 2681 * *locks to a hash which maps <tt>const char *</tt> paths to the 2682 * #svn_lock_t locks associated with those paths. Use @a 2683 * authz_read_func and @a authz_read_baton to "screen" all returned 2684 * locks. That is: do not return any locks on any paths that are 2685 * unreadable in HEAD, just silently omit them. 2686 * 2687 * @a depth limits the returned locks to those associated with paths 2688 * within the specified depth of @a path, and must be one of the 2689 * following values: #svn_depth_empty, #svn_depth_files, 2690 * #svn_depth_immediates, or #svn_depth_infinity. 2691 * 2692 * @since New in 1.7. 2693 */ 2694 svn_error_t * 2695 svn_repos_fs_get_locks2(apr_hash_t **locks, 2696 svn_repos_t *repos, 2697 const char *path, 2698 svn_depth_t depth, 2699 svn_repos_authz_func_t authz_read_func, 2700 void *authz_read_baton, 2701 apr_pool_t *pool); 2702 2703 /** 2704 * Similar to svn_repos_fs_get_locks2(), but with @a depth always 2705 * passed as svn_depth_infinity. 2706 * 2707 * @since New in 1.2. 2708 * @deprecated Provided for backward compatibility with the 1.6 API. 2709 */ 2710 SVN_DEPRECATED 2711 svn_error_t * 2712 svn_repos_fs_get_locks(apr_hash_t **locks, 2713 svn_repos_t *repos, 2714 const char *path, 2715 svn_repos_authz_func_t authz_read_func, 2716 void *authz_read_baton, 2717 apr_pool_t *pool); 2718 2719 /** @} */ 2720 2721 /** @defgroup svn_repos_properties Versioned and Unversioned Properties 2722 * 2723 * Prop-changing and prop-reading wrappers for libsvn_fs routines. 2724 * @{ 2725 */ 2726 2727 /** 2728 * Like svn_fs_change_rev_prop2(), but validate the name and value of the 2729 * property and invoke the @a repos's pre- and post-revprop-change hooks 2730 * around the change as specified by @a use_pre_revprop_change_hook and 2731 * @a use_post_revprop_change_hook (respectively). 2732 * 2733 * @a rev is the revision whose property to change, @a name is the 2734 * name of the property, and @a new_value is the new value of the 2735 * property. If @a old_value_p is not @c NULL, then @a *old_value_p 2736 * is the expected current (preexisting) value of the property (or @c NULL 2737 * for "unset"). @a author is the authenticated username of the person 2738 * changing the property value, or NULL if not available. 2739 * 2740 * If @a authz_read_func is non-NULL, then use it (with @a 2741 * authz_read_baton) to validate the changed-paths associated with @a 2742 * rev. If the revision contains any unreadable changed paths, then 2743 * return #SVN_ERR_AUTHZ_UNREADABLE. 2744 * 2745 * Validate @a name and @a new_value like the same way 2746 * svn_repos_fs_change_node_prop() does. 2747 * 2748 * Use @a pool for temporary allocations. 2749 * 2750 * @since New in 1.7. 2751 */ 2752 svn_error_t * 2753 svn_repos_fs_change_rev_prop4(svn_repos_t *repos, 2754 svn_revnum_t rev, 2755 const char *author, 2756 const char *name, 2757 const svn_string_t *const *old_value_p, 2758 const svn_string_t *new_value, 2759 svn_boolean_t use_pre_revprop_change_hook, 2760 svn_boolean_t use_post_revprop_change_hook, 2761 svn_repos_authz_func_t authz_read_func, 2762 void *authz_read_baton, 2763 apr_pool_t *pool); 2764 2765 /** 2766 * Similar to svn_repos_fs_change_rev_prop4(), but with @a old_value_p always 2767 * set to @c NULL. (In other words, it is similar to 2768 * svn_fs_change_rev_prop().) 2769 * 2770 * @deprecated Provided for backward compatibility with the 1.6 API. 2771 * @since New in 1.5. 2772 */ 2773 SVN_DEPRECATED 2774 svn_error_t * 2775 svn_repos_fs_change_rev_prop3(svn_repos_t *repos, 2776 svn_revnum_t rev, 2777 const char *author, 2778 const char *name, 2779 const svn_string_t *new_value, 2780 svn_boolean_t use_pre_revprop_change_hook, 2781 svn_boolean_t use_post_revprop_change_hook, 2782 svn_repos_authz_func_t authz_read_func, 2783 void *authz_read_baton, 2784 apr_pool_t *pool); 2785 2786 /** 2787 * Similar to svn_repos_fs_change_rev_prop3(), but with the @a 2788 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook 2789 * always set to @c TRUE. 2790 * 2791 * @deprecated Provided for backward compatibility with the 1.4 API. 2792 */ 2793 SVN_DEPRECATED 2794 svn_error_t * 2795 svn_repos_fs_change_rev_prop2(svn_repos_t *repos, 2796 svn_revnum_t rev, 2797 const char *author, 2798 const char *name, 2799 const svn_string_t *new_value, 2800 svn_repos_authz_func_t authz_read_func, 2801 void *authz_read_baton, 2802 apr_pool_t *pool); 2803 2804 /** 2805 * Similar to svn_repos_fs_change_rev_prop2(), but with the 2806 * @a authz_read_func parameter always NULL. 2807 * 2808 * @deprecated Provided for backward compatibility with the 1.0 API. 2809 */ 2810 SVN_DEPRECATED 2811 svn_error_t * 2812 svn_repos_fs_change_rev_prop(svn_repos_t *repos, 2813 svn_revnum_t rev, 2814 const char *author, 2815 const char *name, 2816 const svn_string_t *new_value, 2817 apr_pool_t *pool); 2818 2819 2820 2821 /** 2822 * Set @a *value_p to the value of the property named @a propname on 2823 * revision @a rev in the filesystem opened in @a repos. If @a rev 2824 * has no property by that name, set @a *value_p to zero. Allocate 2825 * the result in @a pool. 2826 * 2827 * If @a authz_read_func is non-NULL, then use it (with @a 2828 * authz_read_baton) to validate the changed-paths associated with @a 2829 * rev. If the changed-paths are all unreadable, then set @a *value_p 2830 * to zero unconditionally. If only some of the changed-paths are 2831 * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be 2832 * fetched, but return 0 for any other property. 2833 * 2834 * @since New in 1.1. 2835 */ 2836 svn_error_t * 2837 svn_repos_fs_revision_prop(svn_string_t **value_p, 2838 svn_repos_t *repos, 2839 svn_revnum_t rev, 2840 const char *propname, 2841 svn_repos_authz_func_t authz_read_func, 2842 void *authz_read_baton, 2843 apr_pool_t *pool); 2844 2845 2846 /** 2847 * Set @a *table_p to the entire property list of revision @a rev in 2848 * filesystem opened in @a repos, as a hash table allocated in @a 2849 * pool. The table maps <tt>char *</tt> property names to 2850 * #svn_string_t * values; the names and values are allocated in @a 2851 * pool. 2852 * 2853 * If @a authz_read_func is non-NULL, then use it (with @a 2854 * authz_read_baton) to validate the changed-paths associated with @a 2855 * rev. If the changed-paths are all unreadable, then return an empty 2856 * hash. If only some of the changed-paths are unreadable, then return 2857 * an empty hash, except for 'svn:author' and 'svn:date' properties 2858 * (assuming those properties exist). 2859 * 2860 * @since New in 1.1. 2861 */ 2862 svn_error_t * 2863 svn_repos_fs_revision_proplist(apr_hash_t **table_p, 2864 svn_repos_t *repos, 2865 svn_revnum_t rev, 2866 svn_repos_authz_func_t authz_read_func, 2867 void *authz_read_baton, 2868 apr_pool_t *pool); 2869 2870 /** Validating wrapper for svn_fs_change_node_prop() (which see for 2871 * argument descriptions). 2872 * 2873 * If @a name's kind is not #svn_prop_regular_kind, return 2874 * #SVN_ERR_REPOS_BAD_ARGS. If @a name is an "svn:" property, validate its 2875 * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the 2876 * property. 2877 * 2878 * @note Originally, the only properties validated were the "svn:" properties 2879 * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. For the current 2880 * validation rules see the private function svn_repos__validate_prop(). 2881 */ 2882 svn_error_t * 2883 svn_repos_fs_change_node_prop(svn_fs_root_t *root, 2884 const char *path, 2885 const char *name, 2886 const svn_string_t *value, 2887 apr_pool_t *pool); 2888 2889 /** 2890 * Set @a *inherited_values to a depth-first ordered array of 2891 * #svn_prop_inherited_item_t * structures (the path_or_url members of 2892 * which are relative filesystem paths) representing the properties 2893 * inherited by @a path in @a root. If no properties are inherited, 2894 * then set @a *inherited_values to an empty array. 2895 * 2896 * if @a propname is NULL then retrieve all explicit and/or inherited 2897 * properties. Otherwise retrieve only the properties named @a propname. 2898 * 2899 * If optional @a authz_read_func is non-NULL, then use this function 2900 * (along with optional @a authz_read_baton) to check the readability 2901 * of each parent path from which properties are inherited. Silently omit 2902 * properties for unreadable parent paths. 2903 * 2904 * Allocate @a *inherited_props in @a result_pool. Use @a scratch_pool for 2905 * temporary allocations. 2906 * 2907 * @since New in 1.8. 2908 */ 2909 svn_error_t * 2910 svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props, 2911 svn_fs_root_t *root, 2912 const char *path, 2913 const char *propname, 2914 svn_repos_authz_func_t authz_read_func, 2915 void *authz_read_baton, 2916 apr_pool_t *result_pool, 2917 apr_pool_t *scratch_pool); 2918 2919 /** Validating wrapper for svn_fs_change_txn_prop() (which see for 2920 * argument descriptions). See svn_repos_fs_change_txn_props() for more 2921 * information. 2922 */ 2923 svn_error_t * 2924 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn, 2925 const char *name, 2926 const svn_string_t *value, 2927 apr_pool_t *pool); 2928 2929 /** Validating wrapper for svn_fs_change_txn_props() (which see for 2930 * argument descriptions). Validate properties and their values the 2931 * same way svn_repos_fs_change_node_prop() does. 2932 * 2933 * @since New in 1.5. 2934 */ 2935 svn_error_t * 2936 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn, 2937 const apr_array_header_t *props, 2938 apr_pool_t *pool); 2939 2940 /** @} */ 2941 2942 2943 /* ---------------------------------------------------------------*/ 2944 2945 /** 2946 * @defgroup svn_repos_inspection Data structures and editor things for \ 2947 * repository inspection. 2948 * @{ 2949 * 2950 * As it turns out, the svn_repos_replay2(), svn_repos_dir_delta2() and 2951 * svn_repos_begin_report3() interfaces can be extremely useful for 2952 * examining the repository, or more exactly, changes to the repository. 2953 * These drivers allows for differences between two trees to be 2954 * described using an editor. 2955 * 2956 * By using the editor obtained from svn_repos_node_editor() with one of 2957 * the drivers mentioned above, the description of how to transform one 2958 * tree into another can be used to build an in-memory linked-list tree, 2959 * which each node representing a repository node that was changed. 2960 */ 2961 2962 /** A node in the repository. */ 2963 typedef struct svn_repos_node_t 2964 { 2965 /** Node type (file, dir, etc.) */ 2966 svn_node_kind_t kind; 2967 2968 /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */ 2969 char action; 2970 2971 /** Were there any textual mods? (files only) */ 2972 svn_boolean_t text_mod; 2973 2974 /** Where there any property mods? */ 2975 svn_boolean_t prop_mod; 2976 2977 /** The name of this node as it appears in its parent's entries list */ 2978 const char *name; 2979 2980 /** The filesystem revision where this was copied from (if any) */ 2981 svn_revnum_t copyfrom_rev; 2982 2983 /** The filesystem path where this was copied from (if any) */ 2984 const char *copyfrom_path; 2985 2986 /** Pointer to the next sibling of this node */ 2987 struct svn_repos_node_t *sibling; 2988 2989 /** Pointer to the first child of this node */ 2990 struct svn_repos_node_t *child; 2991 2992 /** Pointer to the parent of this node */ 2993 struct svn_repos_node_t *parent; 2994 2995 } svn_repos_node_t; 2996 2997 2998 /** Set @a *editor and @a *edit_baton to an editor that, when driven by 2999 * a driver such as svn_repos_replay2(), builds an <tt>svn_repos_node_t *</tt> 3000 * tree representing the delta from @a base_root to @a root in @a 3001 * repos's filesystem. 3002 * 3003 * The editor can also be driven by svn_repos_dir_delta2() or 3004 * svn_repos_begin_report3(), but unless you have special needs, 3005 * svn_repos_replay2() is preferred. 3006 * 3007 * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root 3008 * node afterwards. 3009 * 3010 * Note that the delta includes "bubbled-up" directories; that is, 3011 * many of the directory nodes will have no prop_mods. 3012 * 3013 * Allocate the tree and its contents in @a node_pool; do all other 3014 * allocation in @a pool. 3015 */ 3016 svn_error_t * 3017 svn_repos_node_editor(const svn_delta_editor_t **editor, 3018 void **edit_baton, 3019 svn_repos_t *repos, 3020 svn_fs_root_t *base_root, 3021 svn_fs_root_t *root, 3022 apr_pool_t *node_pool, 3023 apr_pool_t *pool); 3024 3025 /** Return the root node of the linked-list tree generated by driving the 3026 * editor (associated with @a edit_baton) created by svn_repos_node_editor(). 3027 * This is only really useful if used *after* the editor drive is completed. 3028 */ 3029 svn_repos_node_t * 3030 svn_repos_node_from_baton(void *edit_baton); 3031 3032 /** 3033 * Return repository format information for @a repos. 3034 * 3035 * Set @a *repos_format to the repository format number of @a repos, which is 3036 * an integer that increases when incompatible changes are made (such as 3037 * by #svn_repos_upgrade2). 3038 * 3039 * Set @a *supports_version to the version number of the minimum Subversion 3040 * GA release that can read and write @a repos; allocate it in 3041 * @a result_pool. Use @a scratch_pool for temporary allocations. 3042 * 3043 * @see svn_fs_info_format, svn_repos_capabilities 3044 * 3045 * @since New in 1.9. 3046 */ 3047 svn_error_t * 3048 svn_repos_info_format(int *repos_format, 3049 svn_version_t **supports_version, 3050 svn_repos_t *repos, 3051 apr_pool_t *result_pool, 3052 apr_pool_t *scratch_pool); 3053 3054 /** @} */ 3055 3056 /* ---------------------------------------------------------------*/ 3057 3058 /** 3059 * @defgroup svn_repos_dump_load Dumping, loading and verifying filesystem data 3060 * @{ 3061 * 3062 * The filesystem 'dump' format contains nothing but the abstract 3063 * structure of the filesystem -- independent of any internal node-id 3064 * schema or database back-end. All of the data in the dumpfile is 3065 * acquired by public function calls into svn_fs.h. Similarly, the 3066 * parser which reads the dumpfile is able to reconstruct the 3067 * filesystem using only public svn_fs.h routines. 3068 * 3069 * Thus the dump/load feature's main purpose is for *migrating* data 3070 * from one svn filesystem to another -- presumably two filesystems 3071 * which have different internal implementations. 3072 * 3073 * If you simply want to backup your filesystem, you're probably 3074 * better off using the built-in facilities of the DB backend (using 3075 * Berkeley DB's hot-backup feature, for example.) 3076 * 3077 * For a description of the dumpfile format, see 3078 * /trunk/notes/fs_dumprestore.txt. 3079 */ 3080 3081 /* The RFC822-style headers in our dumpfile format. */ 3082 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER "SVN-fs-dump-format-version" 3083 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION 3 3084 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION_DELTAS 3 3085 #define SVN_REPOS_DUMPFILE_UUID "UUID" 3086 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH "Content-length" 3087 3088 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER "Revision-number" 3089 3090 #define SVN_REPOS_DUMPFILE_NODE_PATH "Node-path" 3091 #define SVN_REPOS_DUMPFILE_NODE_KIND "Node-kind" 3092 #define SVN_REPOS_DUMPFILE_NODE_ACTION "Node-action" 3093 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH "Node-copyfrom-path" 3094 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV "Node-copyfrom-rev" 3095 /** @since New in 1.6. */ 3096 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 "Text-copy-source-md5" 3097 /** @since New in 1.6. */ 3098 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1 "Text-copy-source-sha1" 3099 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \ 3100 SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 3101 /** @since New in 1.6. */ 3102 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 "Text-content-md5" 3103 /** @since New in 1.6. */ 3104 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1 "Text-content-sha1" 3105 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM \ 3106 SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 3107 3108 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH "Prop-content-length" 3109 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH "Text-content-length" 3110 3111 /** @since New in 1.1. */ 3112 #define SVN_REPOS_DUMPFILE_PROP_DELTA "Prop-delta" 3113 /** @since New in 1.1. */ 3114 #define SVN_REPOS_DUMPFILE_TEXT_DELTA "Text-delta" 3115 /** @since New in 1.6. */ 3116 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 "Text-delta-base-md5" 3117 /** @since New in 1.6. */ 3118 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1 "Text-delta-base-sha1" 3119 /** @since New in 1.5. */ 3120 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM \ 3121 SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 3122 3123 /** The different policies for processing the UUID in the dumpfile. */ 3124 enum svn_repos_load_uuid 3125 { 3126 /** only update uuid if the repos has no revisions. */ 3127 svn_repos_load_uuid_default, 3128 /** never update uuid. */ 3129 svn_repos_load_uuid_ignore, 3130 /** always update uuid. */ 3131 svn_repos_load_uuid_force 3132 }; 3133 3134 /** Callback type for use with svn_repos_verify_fs3(). @a revision 3135 * and @a verify_err are the details of a single verification failure 3136 * that occurred during the svn_repos_verify_fs3() call. @a baton is 3137 * the same baton given to svn_repos_verify_fs3(). @a scratch_pool is 3138 * provided for the convenience of the implementor, who should not 3139 * expect it to live longer than a single callback call. 3140 * 3141 * @a verify_err will be cleared and becomes invalid after the callback 3142 * returns, use svn_error_dup() to preserve the error. If a callback uses 3143 * @a verify_err as the return value or as a part of the return value, it 3144 * should also call svn_error_dup() for @a verify_err. Implementors of this 3145 * callback are forbidden to call svn_error_clear() for @a verify_err. 3146 * 3147 * @see svn_repos_verify_fs3 3148 * 3149 * @since New in 1.9. 3150 */ 3151 typedef svn_error_t *(*svn_repos_verify_callback_t)(void *baton, 3152 svn_revnum_t revision, 3153 svn_error_t *verify_err, 3154 apr_pool_t *scratch_pool); 3155 3156 /** 3157 * Verify the contents of the file system in @a repos. 3158 * 3159 * Verify the revisions from @a start_rev to @a end_rev inclusive. If 3160 * @a start_rev is #SVN_INVALID_REVNUM, start at revision 0; if @a end_rev 3161 * is #SVN_INVALID_REVNUM, end at the head revision. @a start_rev must be 3162 * older than or equal to @a end_rev. If revision 0 is included in the 3163 * range, then also verify "global invariants" of the repository, as 3164 * described in svn_fs_verify(). 3165 * 3166 * If @a check_normalization is @c TRUE, report any name collisions 3167 * within the same directory or svn:mergeinfo property where the names 3168 * differ only in character representation, but are otherwise 3169 * identical. 3170 * 3171 * If @a metadata_only is @c TRUE, backends that have a concept of separate 3172 * metadata verification will only perform that and skip the more expensive 3173 * file context reconstruction and verification. For FSFS format 7+ and 3174 * FSX, this allows for a very fast check against external corruption. 3175 * 3176 * If @a verify_callback is not @c NULL, call it with @a verify_baton upon 3177 * receiving an FS-specific structure failure or a revision verification 3178 * failure. Set @c revision callback argument to #SVN_INVALID_REVNUM or 3179 * to the revision number respectively. Set @c verify_err to svn_error_t 3180 * describing the reason of the failure. @c verify_err will be cleared 3181 * after the callback returns, use svn_error_dup() to preserve the error. 3182 * If @a verify_callback returns an error different from #SVN_NO_ERROR, 3183 * stop verifying the repository and immediately return the error from 3184 * @a verify_callback. 3185 * 3186 * If @a verify_callback is @c NULL, this function returns the first 3187 * encountered verification error or #SVN_NO_ERROR if there were no failures 3188 * during the verification. Errors that prevent the verification process 3189 * from continuing, such as #SVN_ERR_CANCELLED, are returned immediately 3190 * and do not trigger an invocation of @a verify_callback. 3191 * 3192 * If @a notify_func is not null, then call it with @a notify_baton and 3193 * with a notification structure in which the fields are set as follows. 3194 * (For a warning that does not apply to a specific revision, the revision 3195 * number is #SVN_INVALID_REVNUM.) 3196 * 3197 * For each FS-specific structure warning: 3198 * @c action = svn_repos_notify_verify_rev_structure 3199 * @c revision = the revision or #SVN_INVALID_REVNUM 3200 * 3201 * For each revision verification warning: 3202 * @c action = #svn_repos_notify_warning 3203 * @c warning and @c warning_str fields set accordingly 3204 * ### TODO: Set @c revision = the revision? 3205 * 3206 * For each successfully verified revision: 3207 * @c action = #svn_repos_notify_verify_rev_end 3208 * @c revision = the revision 3209 * 3210 * At the end: 3211 * @c action = svn_repos_notify_verify_end 3212 * ### Do we really need a callback to tell us the function we 3213 * called has reached its end and is about to return? 3214 * ### Not sent, currently, if a FS structure error is found. 3215 * 3216 * If @a cancel_func is not @c NULL, call it periodically with @a 3217 * cancel_baton as argument to see if the caller wishes to cancel the 3218 * verification. 3219 * 3220 * Use @a scratch_pool for temporary allocation. 3221 * 3222 * @see svn_repos_verify_callback_t 3223 * 3224 * @since New in 1.9. 3225 */ 3226 svn_error_t * 3227 svn_repos_verify_fs3(svn_repos_t *repos, 3228 svn_revnum_t start_rev, 3229 svn_revnum_t end_rev, 3230 svn_boolean_t check_normalization, 3231 svn_boolean_t metadata_only, 3232 svn_repos_notify_func_t notify_func, 3233 void *notify_baton, 3234 svn_repos_verify_callback_t verify_callback, 3235 void *verify_baton, 3236 svn_cancel_func_t cancel, 3237 void *cancel_baton, 3238 apr_pool_t *scratch_pool); 3239 3240 /** 3241 * Like svn_repos_verify_fs3(), but with @a verify_callback and 3242 * @a verify_baton set to @c NULL and with @a check_normalization 3243 * and @a metadata_only set to @c FALSE. 3244 * 3245 * @since New in 1.7. 3246 * @deprecated Provided for backward compatibility with the 1.8 API. 3247 */ 3248 SVN_DEPRECATED 3249 svn_error_t * 3250 svn_repos_verify_fs2(svn_repos_t *repos, 3251 svn_revnum_t start_rev, 3252 svn_revnum_t end_rev, 3253 svn_repos_notify_func_t notify_func, 3254 void *notify_baton, 3255 svn_cancel_func_t cancel, 3256 void *cancel_baton, 3257 apr_pool_t *scratch_pool); 3258 3259 /** 3260 * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of 3261 * handling feedback via the notify_func handler. 3262 * 3263 * If @a feedback_stream is not @c NULL, write feedback to it (lines of 3264 * the form "* Verified revision %ld\n"). 3265 * 3266 * @since New in 1.5. 3267 * @deprecated Provided for backward compatibility with the 1.6 API. 3268 */ 3269 SVN_DEPRECATED 3270 svn_error_t * 3271 svn_repos_verify_fs(svn_repos_t *repos, 3272 svn_stream_t *feedback_stream, 3273 svn_revnum_t start_rev, 3274 svn_revnum_t end_rev, 3275 svn_cancel_func_t cancel_func, 3276 void *cancel_baton, 3277 apr_pool_t *pool); 3278 3279 /** 3280 * Dump the contents of the filesystem within already-open @a repos into 3281 * writable @a dumpstream. If @a dumpstream is 3282 * @c NULL, this is effectively a primitive verify. It is not complete, 3283 * however; see instead svn_repos_verify_fs3(). 3284 * 3285 * Begin at revision @a start_rev, and dump every revision up through 3286 * @a end_rev. If @a start_rev is #SVN_INVALID_REVNUM, start at revision 3287 * 0. If @a end_rev is #SVN_INVALID_REVNUM, end at the head revision. 3288 * 3289 * If @a incremental is @c TRUE, the first revision dumped will be a diff 3290 * against the previous revision (usually it looks like a full dump of 3291 * the tree). 3292 * 3293 * If @a use_deltas is @c TRUE, output only node properties which have 3294 * changed relative to the previous contents, and output text contents 3295 * as svndiff data against the previous contents. Regardless of how 3296 * this flag is set, the first revision of a non-incremental dump will 3297 * be done with full plain text. A dump with @a use_deltas set cannot 3298 * be loaded by Subversion 1.0.x. 3299 * 3300 * If @a include_revprops is @c TRUE, output the revision properties as 3301 * well, otherwise omit them. 3302 * 3303 * If @a include_changes is @c TRUE, output the revision contents, i.e. 3304 * tree and node changes. 3305 * 3306 * If @a notify_func is not null, then call it with @a notify_baton and 3307 * with a notification structure in which the fields are set as follows. 3308 * (For a warning or error notification that does not apply to a specific 3309 * revision, the revision number is #SVN_INVALID_REVNUM.) 3310 * 3311 * For each warning: 3312 * @c action = #svn_repos_notify_warning 3313 * @c warning and @c warning_str fields set accordingly 3314 * ### TODO: Set @c revision = the revision or #SVN_INVALID_REVNUM? 3315 * 3316 * For each successfully dumped revision: 3317 * @c action = #svn_repos_notify_dump_rev_end 3318 * @c revision = the revision 3319 * 3320 * At the end: 3321 * @c action = svn_repos_notify_verify_end 3322 * ### Do we really need a callback to tell us the function we 3323 * called has reached its end and is about to return? 3324 * 3325 * At the end, if there were certain warnings previously: 3326 * @c action = #svn_repos_notify_warning 3327 * @c warning and @c warning_str fields set accordingly, 3328 * reiterating the existence of previous warnings 3329 * ### This is a presentation issue. Caller could do this itself. 3330 * 3331 * If @a filter_func is not @c NULL, it is called for each node being 3332 * dumped, allowing the caller to exclude it from dump. 3333 * 3334 * If @a cancel_func is not @c NULL, it is called periodically with 3335 * @a cancel_baton as argument to see if the client wishes to cancel 3336 * the dump. 3337 * 3338 * Use @a scratch_pool for temporary allocation. 3339 * 3340 * @since New in 1.10. 3341 */ 3342 svn_error_t * 3343 svn_repos_dump_fs4(svn_repos_t *repos, 3344 svn_stream_t *stream, 3345 svn_revnum_t start_rev, 3346 svn_revnum_t end_rev, 3347 svn_boolean_t incremental, 3348 svn_boolean_t use_deltas, 3349 svn_boolean_t include_revprops, 3350 svn_boolean_t include_changes, 3351 svn_repos_notify_func_t notify_func, 3352 void *notify_baton, 3353 svn_repos_dump_filter_func_t filter_func, 3354 void *filter_baton, 3355 svn_cancel_func_t cancel_func, 3356 void *cancel_baton, 3357 apr_pool_t *pool); 3358 3359 /** 3360 * Similar to svn_repos_dump_fs4(), but with @a include_revprops and 3361 * @a include_changes both set to @c TRUE and @a filter_func and 3362 * @a filter_baton set to @c NULL. 3363 * 3364 * @since New in 1.7. 3365 * @deprecated Provided for backward compatibility with the 1.9 API. 3366 */ 3367 SVN_DEPRECATED 3368 svn_error_t * 3369 svn_repos_dump_fs3(svn_repos_t *repos, 3370 svn_stream_t *dumpstream, 3371 svn_revnum_t start_rev, 3372 svn_revnum_t end_rev, 3373 svn_boolean_t incremental, 3374 svn_boolean_t use_deltas, 3375 svn_repos_notify_func_t notify_func, 3376 void *notify_baton, 3377 svn_cancel_func_t cancel_func, 3378 void *cancel_baton, 3379 apr_pool_t *scratch_pool); 3380 3381 /** 3382 * Similar to svn_repos_dump_fs3(), but with a feedback_stream instead of 3383 * handling feedback via the notify_func handler 3384 * 3385 * @since New in 1.1. 3386 * @deprecated Provided for backward compatibility with the 1.6 API. 3387 */ 3388 SVN_DEPRECATED 3389 svn_error_t * 3390 svn_repos_dump_fs2(svn_repos_t *repos, 3391 svn_stream_t *dumpstream, 3392 svn_stream_t *feedback_stream, 3393 svn_revnum_t start_rev, 3394 svn_revnum_t end_rev, 3395 svn_boolean_t incremental, 3396 svn_boolean_t use_deltas, 3397 svn_cancel_func_t cancel_func, 3398 void *cancel_baton, 3399 apr_pool_t *pool); 3400 3401 /** 3402 * Similar to svn_repos_dump_fs2(), but with the @a use_deltas 3403 * parameter always set to @c FALSE. 3404 * 3405 * @deprecated Provided for backward compatibility with the 1.0 API. 3406 */ 3407 SVN_DEPRECATED 3408 svn_error_t * 3409 svn_repos_dump_fs(svn_repos_t *repos, 3410 svn_stream_t *dumpstream, 3411 svn_stream_t *feedback_stream, 3412 svn_revnum_t start_rev, 3413 svn_revnum_t end_rev, 3414 svn_boolean_t incremental, 3415 svn_cancel_func_t cancel_func, 3416 void *cancel_baton, 3417 apr_pool_t *pool); 3418 3419 3420 /** 3421 * Read and parse dumpfile-formatted @a dumpstream, reconstructing 3422 * filesystem revisions in already-open @a repos, handling uuids in 3423 * accordance with @a uuid_action. Use @a pool for all allocation. 3424 * 3425 * If the dumpstream contains copy history that is unavailable in the 3426 * repository, an error will be thrown. 3427 * 3428 * The repository's UUID will be updated iff 3429 * the dumpstream contains a UUID and 3430 * @a uuid_action is not equal to #svn_repos_load_uuid_ignore and 3431 * either the repository contains no revisions or 3432 * @a uuid_action is equal to #svn_repos_load_uuid_force. 3433 * 3434 * If the dumpstream contains no UUID, then @a uuid_action is 3435 * ignored and the repository UUID is not touched. 3436 * 3437 * @a start_rev and @a end_rev act as filters, the lower and upper 3438 * (inclusive) range values of revisions in @a dumpstream which will 3439 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 3440 * which case no revision-based filtering occurs at all), or both are 3441 * valid revisions (where @a start_rev is older than or equivalent to 3442 * @a end_rev). 3443 * 3444 * If @a parent_dir is not NULL, then the parser will reparent all the 3445 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 3446 * must be an existing directory in the repository. 3447 * 3448 * If @a use_pre_commit_hook is set, call the repository's pre-commit 3449 * hook before committing each loaded revision. 3450 * 3451 * If @a use_post_commit_hook is set, call the repository's 3452 * post-commit hook after committing each loaded revision. 3453 * 3454 * If @a validate_props is set, then validate Subversion revision and 3455 * node properties (those in the svn: namespace) against established 3456 * rules for those things. 3457 * 3458 * If @a ignore_dates is set, ignore any revision datestamps found in 3459 * @a dumpstream, allowing the revisions created by the load process 3460 * to be stamped as if they were newly created via the normal commit 3461 * process. 3462 * 3463 * If @a normalize_props is set, attempt to normalize invalid Subversion 3464 * revision and node properties (those in the svn: namespace) so that 3465 * their values would follow the established rules for them. For example, 3466 * for such properties, typically the value must be in UTF-8 with LF 3467 * line endings. 3468 * 3469 * @note The details or the performed normalizations are deliberately 3470 * left unspecified and may change in the future. 3471 * 3472 * If non-NULL, use @a notify_func and @a notify_baton to send notification 3473 * of events to the caller. 3474 * 3475 * If @a cancel_func is not @c NULL, it is called periodically with 3476 * @a cancel_baton as argument to see if the client wishes to cancel 3477 * the load. 3478 * 3479 * @since New in 1.10. 3480 */ 3481 svn_error_t * 3482 svn_repos_load_fs6(svn_repos_t *repos, 3483 svn_stream_t *dumpstream, 3484 svn_revnum_t start_rev, 3485 svn_revnum_t end_rev, 3486 enum svn_repos_load_uuid uuid_action, 3487 const char *parent_dir, 3488 svn_boolean_t use_pre_commit_hook, 3489 svn_boolean_t use_post_commit_hook, 3490 svn_boolean_t validate_props, 3491 svn_boolean_t ignore_dates, 3492 svn_boolean_t normalize_props, 3493 svn_repos_notify_func_t notify_func, 3494 void *notify_baton, 3495 svn_cancel_func_t cancel_func, 3496 void *cancel_baton, 3497 apr_pool_t *pool); 3498 3499 /** 3500 * Similar to svn_repos_load_fs6(), but with the @a normalize_props 3501 * parameter always set to @c FALSE. 3502 * 3503 * @since New in 1.9. 3504 * @deprecated Provided for backward compatibility with the 1.9 API. 3505 */ 3506 SVN_DEPRECATED 3507 svn_error_t * 3508 svn_repos_load_fs5(svn_repos_t *repos, 3509 svn_stream_t *dumpstream, 3510 svn_revnum_t start_rev, 3511 svn_revnum_t end_rev, 3512 enum svn_repos_load_uuid uuid_action, 3513 const char *parent_dir, 3514 svn_boolean_t use_pre_commit_hook, 3515 svn_boolean_t use_post_commit_hook, 3516 svn_boolean_t validate_props, 3517 svn_boolean_t ignore_dates, 3518 svn_repos_notify_func_t notify_func, 3519 void *notify_baton, 3520 svn_cancel_func_t cancel_func, 3521 void *cancel_baton, 3522 apr_pool_t *pool); 3523 3524 /** Similar to svn_repos_load_fs5(), but with @a ignore_dates 3525 * always passed as FALSE. 3526 * 3527 * @since New in 1.8. 3528 * @deprecated Provided for backward compatibility with the 1.8 API. 3529 */ 3530 SVN_DEPRECATED 3531 svn_error_t * 3532 svn_repos_load_fs4(svn_repos_t *repos, 3533 svn_stream_t *dumpstream, 3534 svn_revnum_t start_rev, 3535 svn_revnum_t end_rev, 3536 enum svn_repos_load_uuid uuid_action, 3537 const char *parent_dir, 3538 svn_boolean_t use_pre_commit_hook, 3539 svn_boolean_t use_post_commit_hook, 3540 svn_boolean_t validate_props, 3541 svn_repos_notify_func_t notify_func, 3542 void *notify_baton, 3543 svn_cancel_func_t cancel_func, 3544 void *cancel_baton, 3545 apr_pool_t *pool); 3546 3547 /** Similar to svn_repos_load_fs4(), but with @a start_rev and @a 3548 * end_rev always passed as #SVN_INVALID_REVNUM. 3549 * 3550 * @since New in 1.7. 3551 * @deprecated Provided for backward compatibility with the 1.7 API. 3552 */ 3553 SVN_DEPRECATED 3554 svn_error_t * 3555 svn_repos_load_fs3(svn_repos_t *repos, 3556 svn_stream_t *dumpstream, 3557 enum svn_repos_load_uuid uuid_action, 3558 const char *parent_dir, 3559 svn_boolean_t use_pre_commit_hook, 3560 svn_boolean_t use_post_commit_hook, 3561 svn_boolean_t validate_props, 3562 svn_repos_notify_func_t notify_func, 3563 void *notify_baton, 3564 svn_cancel_func_t cancel_func, 3565 void *cancel_baton, 3566 apr_pool_t *pool); 3567 3568 /** 3569 * Similar to svn_repos_load_fs3(), but with @a feedback_stream in 3570 * place of the #svn_repos_notify_func_t and baton and with 3571 * @a validate_props always FALSE. 3572 * 3573 * @since New in 1.2. 3574 * @deprecated Provided for backward compatibility with the 1.6 API. 3575 */ 3576 SVN_DEPRECATED 3577 svn_error_t * 3578 svn_repos_load_fs2(svn_repos_t *repos, 3579 svn_stream_t *dumpstream, 3580 svn_stream_t *feedback_stream, 3581 enum svn_repos_load_uuid uuid_action, 3582 const char *parent_dir, 3583 svn_boolean_t use_pre_commit_hook, 3584 svn_boolean_t use_post_commit_hook, 3585 svn_cancel_func_t cancel_func, 3586 void *cancel_baton, 3587 apr_pool_t *pool); 3588 3589 /** 3590 * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and 3591 * @a use_post_commit_hook always @c FALSE. 3592 * 3593 * @deprecated Provided for backward compatibility with the 1.1 API. 3594 */ 3595 SVN_DEPRECATED 3596 svn_error_t * 3597 svn_repos_load_fs(svn_repos_t *repos, 3598 svn_stream_t *dumpstream, 3599 svn_stream_t *feedback_stream, 3600 enum svn_repos_load_uuid uuid_action, 3601 const char *parent_dir, 3602 svn_cancel_func_t cancel_func, 3603 void *cancel_baton, 3604 apr_pool_t *pool); 3605 3606 /** 3607 * Read and parse dumpfile-formatted @a dumpstream, extracting the 3608 * revision properties from it and apply them to the already-open 3609 * @a repos. Use @a scratch_pool for temporary allocations. 3610 * 3611 * If, after filtering by the @a start_rev and @a end_rev, the dumpstream 3612 * contains revisions missing in @a repos, an error will be thrown. 3613 * 3614 * @a start_rev and @a end_rev act as filters, the lower and upper 3615 * (inclusive) range values of revisions in @a dumpstream which will 3616 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 3617 * which case no revision-based filtering occurs at all), or both are 3618 * valid revisions (where @a start_rev is older than or equivalent to 3619 * @a end_rev). 3620 * 3621 * If @a validate_props is set, then validate Subversion revision 3622 * properties (those in the svn: namespace) against established 3623 * rules for those things. 3624 * 3625 * If @a ignore_dates is set, ignore any revision datestamps found in 3626 * @a dumpstream, keeping whatever timestamps the revisions currently 3627 * have. 3628 * 3629 * If @a normalize_props is set, attempt to normalize invalid Subversion 3630 * revision and node properties (those in the svn: namespace) so that 3631 * their values would follow the established rules for them. For example, 3632 * for such properties, typically the value must be in UTF-8 with LF 3633 * line endings. 3634 * 3635 * @note The details or the performed normalizations are deliberately 3636 * left unspecified and may change in the future. 3637 * 3638 * If non-NULL, use @a notify_func and @a notify_baton to send notification 3639 * of events to the caller. 3640 * 3641 * If @a cancel_func is not @c NULL, it is called periodically with 3642 * @a cancel_baton as argument to see if the client wishes to cancel 3643 * the load. 3644 * 3645 * @remark No repository hooks will be triggered. 3646 * 3647 * @since New in 1.10. 3648 */ 3649 svn_error_t * 3650 svn_repos_load_fs_revprops(svn_repos_t *repos, 3651 svn_stream_t *dumpstream, 3652 svn_revnum_t start_rev, 3653 svn_revnum_t end_rev, 3654 svn_boolean_t validate_props, 3655 svn_boolean_t ignore_dates, 3656 svn_boolean_t normalize_props, 3657 svn_repos_notify_func_t notify_func, 3658 void *notify_baton, 3659 svn_cancel_func_t cancel_func, 3660 void *cancel_baton, 3661 apr_pool_t *scratch_pool); 3662 3663 /** 3664 * A vtable that is driven by svn_repos_parse_dumpstream3(). 3665 * 3666 * @since New in 1.8. 3667 */ 3668 typedef struct svn_repos_parse_fns3_t 3669 { 3670 /** The parser has discovered a new "magic header" record within the 3671 * parsing session represented by @a parse_baton. The dump-format 3672 * version number is @a version. 3673 */ 3674 svn_error_t *(*magic_header_record)(int version, 3675 void *parse_baton, 3676 apr_pool_t *pool); 3677 3678 /** The parser has discovered a new uuid record within the parsing 3679 * session represented by @a parse_baton. The uuid's value is 3680 * @a uuid, and it is allocated in @a pool. 3681 */ 3682 svn_error_t *(*uuid_record)(const char *uuid, 3683 void *parse_baton, 3684 apr_pool_t *pool); 3685 3686 /** The parser has discovered a new revision record within the 3687 * parsing session represented by @a parse_baton. All the headers are 3688 * placed in @a headers (allocated in @a pool), which maps <tt>const 3689 * char *</tt> header-name ==> <tt>const char *</tt> header-value. 3690 * The @a revision_baton received back (also allocated in @a pool) 3691 * represents the revision. 3692 */ 3693 svn_error_t *(*new_revision_record)(void **revision_baton, 3694 apr_hash_t *headers, 3695 void *parse_baton, 3696 apr_pool_t *pool); 3697 3698 /** The parser has discovered a new node record within the current 3699 * revision represented by @a revision_baton. All the headers are 3700 * placed in @a headers (as with @c new_revision_record), allocated in 3701 * @a pool. The @a node_baton received back is allocated in @a pool 3702 * and represents the node. 3703 */ 3704 svn_error_t *(*new_node_record)(void **node_baton, 3705 apr_hash_t *headers, 3706 void *revision_baton, 3707 apr_pool_t *pool); 3708 3709 /** For a given @a revision_baton, set a property @a name to @a value. */ 3710 svn_error_t *(*set_revision_property)(void *revision_baton, 3711 const char *name, 3712 const svn_string_t *value); 3713 3714 /** For a given @a node_baton, set a property @a name to @a value. */ 3715 svn_error_t *(*set_node_property)(void *node_baton, 3716 const char *name, 3717 const svn_string_t *value); 3718 3719 /** For a given @a node_baton, delete property @a name. */ 3720 svn_error_t *(*delete_node_property)(void *node_baton, const char *name); 3721 3722 /** For a given @a node_baton, remove all properties. */ 3723 svn_error_t *(*remove_node_props)(void *node_baton); 3724 3725 /** For a given @a node_baton, set @a stream to a writable stream 3726 * capable of receiving the node's fulltext. The parser will write 3727 * the fulltext to the stream and then close the stream to signal 3728 * completion. 3729 * 3730 * If a @c NULL is returned instead of a stream, the vtable is 3731 * indicating that no text is desired, and the parser will not 3732 * attempt to send it. 3733 */ 3734 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 3735 void *node_baton); 3736 3737 /** For a given @a node_baton, set @a handler and @a handler_baton 3738 * to a window handler and baton capable of receiving a delta 3739 * against the node's previous contents. The parser will send all 3740 * the windows of data to this handler, and will then send a NULL 3741 * window to signal completion. 3742 * 3743 * If a @c NULL is returned instead of a handler, the vtable is 3744 * indicating that no delta is desired, and the parser will not 3745 * attempt to send it. 3746 */ 3747 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler, 3748 void **handler_baton, 3749 void *node_baton); 3750 3751 /** The parser has reached the end of the current node represented by 3752 * @a node_baton, it can be freed. 3753 */ 3754 svn_error_t *(*close_node)(void *node_baton); 3755 3756 /** The parser has reached the end of the current revision 3757 * represented by @a revision_baton. In other words, there are no more 3758 * changed nodes within the revision. The baton can be freed. 3759 */ 3760 svn_error_t *(*close_revision)(void *revision_baton); 3761 3762 } svn_repos_parse_fns3_t; 3763 3764 3765 /** 3766 * Read and parse dumpfile-formatted @a stream, calling callbacks in 3767 * @a parse_fns/@a parse_baton, and using @a pool for allocations. 3768 * 3769 * If @a deltas_are_text is @c TRUE, handle text-deltas with the @a 3770 * set_fulltext callback. This is useful when manipulating a dump 3771 * stream without loading it. Otherwise handle text-deltas with the 3772 * @a apply_textdelta callback. 3773 * 3774 * If @a cancel_func is not @c NULL, it is called periodically with 3775 * @a cancel_baton as argument to see if the client wishes to cancel 3776 * the dump. 3777 * 3778 * This parser has built-in knowledge of the dumpfile format, but only 3779 * in a limited sense: 3780 * 3781 * * it recognizes the "magic" format-version header. 3782 * 3783 * * it recognizes the UUID header. 3784 * 3785 * * it recognizes revision and node records by looking for either 3786 * a REVISION_NUMBER or NODE_PATH headers. 3787 * 3788 * * it recognizes the CONTENT-LENGTH headers, so it knows if and 3789 * how to suck up the content body. 3790 * 3791 * * it knows how to parse a content body into two parts: props 3792 * and text, and pass the pieces to the vtable. 3793 * 3794 * This is enough knowledge to make it easy on vtable implementors, 3795 * but still allow expansion of the format: most headers do not have 3796 * to be handled explicitly. 3797 * 3798 * ### [JAF] Wouldn't it be more efficient to support a start/end rev 3799 * range here than only supporting it in receivers such as 3800 * svn_repos_get_fs_build_parser4()? This parser could then skip over 3801 * chunks of the input stream before the oldest required rev, and 3802 * could stop reading entirely after the youngest required rev. 3803 * 3804 * @since New in 1.8. 3805 3806 * @since Starting in 1.10, @a parse_fns may contain #NULL pointers for 3807 * those callbacks that the caller is not interested in. 3808 */ 3809 svn_error_t * 3810 svn_repos_parse_dumpstream3(svn_stream_t *stream, 3811 const svn_repos_parse_fns3_t *parse_fns, 3812 void *parse_baton, 3813 svn_boolean_t deltas_are_text, 3814 svn_cancel_func_t cancel_func, 3815 void *cancel_baton, 3816 apr_pool_t *pool); 3817 3818 3819 /** 3820 * Set @a *parser and @a *parse_baton to a vtable parser which commits new 3821 * revisions to the fs in @a repos. The constructed parser will treat 3822 * UUID records in a manner consistent with @a uuid_action. Use @a pool 3823 * to operate on the fs. 3824 * 3825 * @a start_rev and @a end_rev act as filters, the lower and upper 3826 * (inclusive) range values of revisions which will 3827 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 3828 * which case no revision-based filtering occurs at all), or both are 3829 * valid revisions (where @a start_rev is older than or equivalent to 3830 * @a end_rev). They refer to dump stream revision numbers rather than 3831 * committed revision numbers. 3832 * 3833 * If @a use_history is true, then when the parser encounters a node that 3834 * is added-with-history, it will require 'copy-from' history to exist in 3835 * the repository at the relative (adjusted) copy-from revision and path. 3836 * It will perform a copy from that source location, and will fail if no 3837 * suitable source exists there. If @a use_history is false, then it will 3838 * instead convert every copy to a plain add. 3839 * 3840 * ### The 'use_history=FALSE' case is unused and untested in Subversion. 3841 * It seems to me it would not work with a deltas dumpfile (a driver 3842 * that calls the @c apply_textdelta method), as it would not have 3843 * access to the delta base text. 3844 * 3845 * If @a use_pre_commit_hook is set, call the repository's pre-commit 3846 * hook before committing each loaded revision. 3847 * 3848 * If @a use_post_commit_hook is set, call the repository's 3849 * post-commit hook after committing each loaded revision. 3850 * 3851 * If @a validate_props is set, then validate Subversion revision and 3852 * node properties (those in the svn: namespace) against established 3853 * rules for those things. 3854 * 3855 * If @a ignore_dates is set, ignore any revision datestamps found in 3856 * @a dumpstream, allowing the revisions created by the load process 3857 * to be stamped as if they were newly created via the normal commit 3858 * process. 3859 * 3860 * If @a normalize_props is set, attempt to normalize invalid Subversion 3861 * revision and node properties (those in the svn: namespace) so that 3862 * their values would follow the established rules for them. For example, 3863 * for such properties, typically the value must be in UTF-8 with LF 3864 * line endings. 3865 * 3866 * @note The details or the performed normalizations are deliberately 3867 * left unspecified and may change in the future. 3868 * 3869 * If @a parent_dir is not NULL, then the parser will reparent all the 3870 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 3871 * must be an existing directory in the repository. 3872 * 3873 * @since New in 1.10. 3874 */ 3875 svn_error_t * 3876 svn_repos_get_fs_build_parser6(const svn_repos_parse_fns3_t **parser, 3877 void **parse_baton, 3878 svn_repos_t *repos, 3879 svn_revnum_t start_rev, 3880 svn_revnum_t end_rev, 3881 svn_boolean_t use_history, 3882 svn_boolean_t validate_props, 3883 enum svn_repos_load_uuid uuid_action, 3884 const char *parent_dir, 3885 svn_boolean_t use_pre_commit_hook, 3886 svn_boolean_t use_post_commit_hook, 3887 svn_boolean_t ignore_dates, 3888 svn_boolean_t normalize_props, 3889 svn_repos_notify_func_t notify_func, 3890 void *notify_baton, 3891 apr_pool_t *pool); 3892 3893 /** 3894 * Similar to svn_repos_get_fs_build_parser6(), but with the 3895 * @a normalize_props parameter always set to @c FALSE. 3896 * 3897 * @since New in 1.9. 3898 * @deprecated Provided for backward compatibility with the 1.9 API. 3899 */ 3900 SVN_DEPRECATED 3901 svn_error_t * 3902 svn_repos_get_fs_build_parser5(const svn_repos_parse_fns3_t **parser, 3903 void **parse_baton, 3904 svn_repos_t *repos, 3905 svn_revnum_t start_rev, 3906 svn_revnum_t end_rev, 3907 svn_boolean_t use_history, 3908 svn_boolean_t validate_props, 3909 enum svn_repos_load_uuid uuid_action, 3910 const char *parent_dir, 3911 svn_boolean_t use_pre_commit_hook, 3912 svn_boolean_t use_post_commit_hook, 3913 svn_boolean_t ignore_dates, 3914 svn_repos_notify_func_t notify_func, 3915 void *notify_baton, 3916 apr_pool_t *pool); 3917 3918 /** 3919 * Similar to svn_repos_get_fs_build_parser5(), but with the 3920 * @c use_pre_commit_hook, @c use_post_commit_hook and @c ignore_dates 3921 * arguments all false. 3922 * 3923 * @since New in 1.8. 3924 * @deprecated Provided for backward compatibility with the 1.8 API. 3925 */ 3926 SVN_DEPRECATED 3927 svn_error_t * 3928 svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser, 3929 void **parse_baton, 3930 svn_repos_t *repos, 3931 svn_revnum_t start_rev, 3932 svn_revnum_t end_rev, 3933 svn_boolean_t use_history, 3934 svn_boolean_t validate_props, 3935 enum svn_repos_load_uuid uuid_action, 3936 const char *parent_dir, 3937 svn_repos_notify_func_t notify_func, 3938 void *notify_baton, 3939 apr_pool_t *pool); 3940 3941 3942 3943 /** 3944 * A vtable that is driven by svn_repos_parse_dumpstream2(). 3945 * Similar to #svn_repos_parse_fns3_t except that it lacks 3946 * the magic_header_record callback. 3947 * 3948 * @deprecated Provided for backward compatibility with the 1.7 API. 3949 */ 3950 typedef struct svn_repos_parse_fns2_t 3951 { 3952 /** Same as #svn_repos_parse_fns3_t.new_revision_record. */ 3953 svn_error_t *(*new_revision_record)(void **revision_baton, 3954 apr_hash_t *headers, 3955 void *parse_baton, 3956 apr_pool_t *pool); 3957 /** Same as #svn_repos_parse_fns3_t.uuid_record. */ 3958 svn_error_t *(*uuid_record)(const char *uuid, 3959 void *parse_baton, 3960 apr_pool_t *pool); 3961 /** Same as #svn_repos_parse_fns3_t.new_node_record. */ 3962 svn_error_t *(*new_node_record)(void **node_baton, 3963 apr_hash_t *headers, 3964 void *revision_baton, 3965 apr_pool_t *pool); 3966 /** Same as #svn_repos_parse_fns3_t.set_revision_property. */ 3967 svn_error_t *(*set_revision_property)(void *revision_baton, 3968 const char *name, 3969 const svn_string_t *value); 3970 /** Same as #svn_repos_parse_fns3_t.set_node_property. */ 3971 svn_error_t *(*set_node_property)(void *node_baton, 3972 const char *name, 3973 const svn_string_t *value); 3974 /** Same as #svn_repos_parse_fns3_t.delete_node_property. */ 3975 svn_error_t *(*delete_node_property)(void *node_baton, 3976 const char *name); 3977 /** Same as #svn_repos_parse_fns3_t.remove_node_props. */ 3978 svn_error_t *(*remove_node_props)(void *node_baton); 3979 /** Same as #svn_repos_parse_fns3_t.set_fulltext. */ 3980 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 3981 void *node_baton); 3982 /** Same as #svn_repos_parse_fns3_t.apply_textdelta. */ 3983 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler, 3984 void **handler_baton, 3985 void *node_baton); 3986 /** Same as #svn_repos_parse_fns3_t.close_node. */ 3987 svn_error_t *(*close_node)(void *node_baton); 3988 /** Same as #svn_repos_parse_fns3_t.close_revision. */ 3989 svn_error_t *(*close_revision)(void *revision_baton); 3990 } svn_repos_parse_fns2_t; 3991 3992 /** @deprecated Provided for backward compatibility with the 1.7 API. */ 3993 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t; 3994 3995 3996 /** 3997 * A vtable that is driven by svn_repos_parse_dumpstream(). 3998 * Similar to #svn_repos_parse_fns2_t except that it lacks 3999 * the delete_node_property and apply_textdelta callbacks. 4000 * 4001 * @deprecated Provided for backward compatibility with the 1.0 API. 4002 */ 4003 typedef struct svn_repos_parse_fns_t 4004 { 4005 /** Same as #svn_repos_parse_fns2_t.new_revision_record. */ 4006 svn_error_t *(*new_revision_record)(void **revision_baton, 4007 apr_hash_t *headers, 4008 void *parse_baton, 4009 apr_pool_t *pool); 4010 /** Same as #svn_repos_parse_fns2_t.uuid_record. */ 4011 svn_error_t *(*uuid_record)(const char *uuid, 4012 void *parse_baton, 4013 apr_pool_t *pool); 4014 /** Same as #svn_repos_parse_fns2_t.new_node_record. */ 4015 svn_error_t *(*new_node_record)(void **node_baton, 4016 apr_hash_t *headers, 4017 void *revision_baton, 4018 apr_pool_t *pool); 4019 /** Same as #svn_repos_parse_fns2_t.set_revision_property. */ 4020 svn_error_t *(*set_revision_property)(void *revision_baton, 4021 const char *name, 4022 const svn_string_t *value); 4023 /** Same as #svn_repos_parse_fns2_t.set_node_property. */ 4024 svn_error_t *(*set_node_property)(void *node_baton, 4025 const char *name, 4026 const svn_string_t *value); 4027 /** Same as #svn_repos_parse_fns2_t.remove_node_props. */ 4028 svn_error_t *(*remove_node_props)(void *node_baton); 4029 /** Same as #svn_repos_parse_fns2_t.set_fulltext. */ 4030 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 4031 void *node_baton); 4032 /** Same as #svn_repos_parse_fns2_t.close_node. */ 4033 svn_error_t *(*close_node)(void *node_baton); 4034 /** Same as #svn_repos_parse_fns2_t.close_revision. */ 4035 svn_error_t *(*close_revision)(void *revision_baton); 4036 } svn_repos_parser_fns_t; 4037 4038 4039 /** 4040 * Similar to svn_repos_parse_dumpstream3(), but uses the more limited 4041 * #svn_repos_parser_fns2_t vtable type. 4042 * 4043 * @deprecated Provided for backward compatibility with the 1.7 API. 4044 */ 4045 SVN_DEPRECATED 4046 svn_error_t * 4047 svn_repos_parse_dumpstream2(svn_stream_t *stream, 4048 const svn_repos_parser_fns2_t *parse_fns, 4049 void *parse_baton, 4050 svn_cancel_func_t cancel_func, 4051 void *cancel_baton, 4052 apr_pool_t *pool); 4053 4054 /** 4055 * Similar to svn_repos_parse_dumpstream2(), but uses the more limited 4056 * #svn_repos_parser_fns_t vtable type. 4057 * 4058 * @deprecated Provided for backward compatibility with the 1.0 API. 4059 */ 4060 SVN_DEPRECATED 4061 svn_error_t * 4062 svn_repos_parse_dumpstream(svn_stream_t *stream, 4063 const svn_repos_parser_fns_t *parse_fns, 4064 void *parse_baton, 4065 svn_cancel_func_t cancel_func, 4066 void *cancel_baton, 4067 apr_pool_t *pool); 4068 4069 /** 4070 * Similar to svn_repos_get_fs_build_parser4(), but with @a start_rev 4071 * and @a end_rev always passed as #SVN_INVALID_REVNUM, and yielding 4072 * the more limited svn_repos_parse_fns2_t. 4073 * 4074 * @since New in 1.7. 4075 * @deprecated Provided for backward compatibility with the 1.7 API. 4076 */ 4077 SVN_DEPRECATED 4078 svn_error_t * 4079 svn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **parser, 4080 void **parse_baton, 4081 svn_repos_t *repos, 4082 svn_boolean_t use_history, 4083 svn_boolean_t validate_props, 4084 enum svn_repos_load_uuid uuid_action, 4085 const char *parent_dir, 4086 svn_repos_notify_func_t notify_func, 4087 void *notify_baton, 4088 apr_pool_t *pool); 4089 4090 /** 4091 * Similar to svn_repos_get_fs_build_parser3(), but with @a outstream 4092 * in place if a #svn_repos_notify_func_t and baton and with 4093 * @a validate_props always FALSE. 4094 * 4095 * @since New in 1.1. 4096 * @deprecated Provided for backward compatibility with the 1.6 API. 4097 */ 4098 SVN_DEPRECATED 4099 svn_error_t * 4100 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser, 4101 void **parse_baton, 4102 svn_repos_t *repos, 4103 svn_boolean_t use_history, 4104 enum svn_repos_load_uuid uuid_action, 4105 svn_stream_t *outstream, 4106 const char *parent_dir, 4107 apr_pool_t *pool); 4108 4109 /** 4110 * Similar to svn_repos_get_fs_build_parser2(), but yields the more 4111 * limited svn_repos_parser_fns_t vtable type. 4112 * 4113 * @deprecated Provided for backward compatibility with the 1.0 API. 4114 */ 4115 SVN_DEPRECATED 4116 svn_error_t * 4117 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser, 4118 void **parse_baton, 4119 svn_repos_t *repos, 4120 svn_boolean_t use_history, 4121 enum svn_repos_load_uuid uuid_action, 4122 svn_stream_t *outstream, 4123 const char *parent_dir, 4124 apr_pool_t *pool); 4125 4126 4127 /** @} */ 4128 4129 /** A data type which stores the authz information. 4130 * 4131 * @since New in 1.3. 4132 */ 4133 typedef struct svn_authz_t svn_authz_t; 4134 4135 /** 4136 * This should be called before any other authz function. 4137 * 4138 * @a pool must support multi-threaded access if the application will use 4139 * authz from multiple threads. 4140 * 4141 * @since New in 1.10. 4142 */ 4143 svn_error_t * 4144 svn_repos_authz_initialize(apr_pool_t *pool); 4145 4146 /** 4147 * Read authz configuration data from @a path (a dirent, an absolute file url 4148 * or a registry path) into @a *authz_p, allocated in @a pool. 4149 * 4150 * If @a groups_path (a dirent, an absolute file url, or a registry path) is 4151 * set, use the global groups parsed from it. 4152 * 4153 * If @a path or @a groups_path is not a valid authz rule file, then return 4154 * #SVN_ERR_AUTHZ_INVALID_CONFIG. The contents of @a *authz_p is then 4155 * undefined. If @a must_exist is TRUE, a missing authz or groups file 4156 * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error 4157 * depends on the access type). 4158 * 4159 * For efficient access of in-repository authz, you may provide @a repos_hint 4160 * which will be tried first and may remove the need to open a temporary 4161 * repository instance. Otherwise, set it to NULL and the repositories will 4162 * be opened as needed. 4163 * 4164 * @since New in 1.10. 4165 */ 4166 svn_error_t * 4167 svn_repos_authz_read3(svn_authz_t **authz_p, 4168 const char *path, 4169 const char *groups_path, 4170 svn_boolean_t must_exist, 4171 svn_repos_t *repos_hint, 4172 apr_pool_t *result_pool, 4173 apr_pool_t *scratch_pool); 4174 4175 /** 4176 * Similar to svn_repos_authz_read3(), but with @a repos_hint set to @c NULL. 4177 * 4178 * @since New in 1.8. 4179 * @deprecated Provided for backward compatibility with the 1.9 API. 4180 */ 4181 SVN_DEPRECATED 4182 svn_error_t * 4183 svn_repos_authz_read2(svn_authz_t **authz_p, 4184 const char *path, 4185 const char *groups_path, 4186 svn_boolean_t must_exist, 4187 apr_pool_t *pool); 4188 4189 4190 /** 4191 * Similar to svn_repos_authz_read2(), but with @a groups_path and @a 4192 * repos_root always passed as @c NULL. 4193 * 4194 * @since New in 1.3. 4195 * @deprecated Provided for backward compatibility with the 1.7 API. 4196 */ 4197 SVN_DEPRECATED 4198 svn_error_t * 4199 svn_repos_authz_read(svn_authz_t **authz_p, 4200 const char *file, 4201 svn_boolean_t must_exist, 4202 apr_pool_t *pool); 4203 4204 /** 4205 * Read authz configuration data from @a stream into @a *authz_p, 4206 * allocated in @a pool. 4207 * 4208 * If @a groups_stream is set, use the global groups parsed from it. 4209 * 4210 * @since New in 1.8. 4211 */ 4212 svn_error_t * 4213 svn_repos_authz_parse(svn_authz_t **authz_p, 4214 svn_stream_t *stream, 4215 svn_stream_t *groups_stream, 4216 apr_pool_t *pool); 4217 4218 /** 4219 * Check whether @a user can access @a path in the repository @a 4220 * repos_name with the @a required_access. @a authz lists the ACLs to 4221 * check against. Set @a *access_granted to indicate if the requested 4222 * access is granted. 4223 * 4224 * If @a path is NULL, then check whether @a user has the @a 4225 * required_access anywhere in the repository. Set @a *access_granted 4226 * to TRUE if at least one path is accessible with the @a 4227 * required_access. 4228 * 4229 * For compatibility with 1.6, and earlier, @a repos_name can be NULL 4230 * in which case it is equivalent to a @a repos_name of "". 4231 * 4232 * @note Presently, @a repos_name must byte-for-byte match the repos_name 4233 * specified in the authz file; it is treated as an opaque string, and not 4234 * as a dirent. 4235 * 4236 * @since New in 1.3. 4237 */ 4238 svn_error_t * 4239 svn_repos_authz_check_access(svn_authz_t *authz, 4240 const char *repos_name, 4241 const char *path, 4242 const char *user, 4243 svn_repos_authz_access_t required_access, 4244 svn_boolean_t *access_granted, 4245 apr_pool_t *pool); 4246 4247 4248 4249 /** Revision Access Levels 4250 * 4251 * Like most version control systems, access to versioned objects in 4252 * Subversion is determined on primarily path-based system. Users either 4253 * do or don't have the ability to read a given path. 4254 * 4255 * However, unlike many version control systems where versioned objects 4256 * maintain their own distinct version information (revision numbers, 4257 * authors, log messages, change timestamps, etc.), Subversion binds 4258 * multiple paths changed as part of a single commit operation into a 4259 * set, calls the whole thing a revision, and hangs commit metadata 4260 * (author, date, log message, etc.) off of that revision. So, commit 4261 * metadata is shared across all the paths changed as part of a given 4262 * commit operation. 4263 * 4264 * It is common (or, at least, we hope it is) for log messages to give 4265 * detailed information about changes made in the commit to which the log 4266 * message is attached. Such information might include a mention of all 4267 * the files changed, what was changed in them, and so on. But this 4268 * causes a problem when presenting information to readers who aren't 4269 * authorized to read every path in the repository. Simply knowing that 4270 * a given path exists may be a security leak, even if the user can't see 4271 * the contents of the data located at that path. 4272 * 4273 * So Subversion does what it reasonably can to prevent the leak of this 4274 * information, and does so via a staged revision access policy. A 4275 * reader can be said to have one of three levels of access to a given 4276 * revision's metadata, based solely on the reader's access rights to the 4277 * paths changed or copied in that revision: 4278 * 4279 * 'full access' -- Granted when the reader has access to all paths 4280 * changed or copied in the revision, or when no paths were 4281 * changed in the revision at all, this access level permits 4282 * full visibility of all revision property names and values, 4283 * and the full changed-paths information. 4284 * 4285 * 'no access' -- Granted when the reader does not have access to any 4286 * paths changed or copied in the revision, this access level 4287 * denies the reader access to all revision properties and all 4288 * changed-paths information. 4289 * 4290 * 'partial access' -- Granted when the reader has access to at least 4291 * one, but not all, of the paths changed or copied in the revision, 4292 * this access level permits visibility of the svn:date and 4293 * svn:author revision properties and only the paths of the 4294 * changed-paths information to which the reader has access. 4295 * 4296 */ 4297 4298 4299 /** An enum defining levels of revision access. 4300 * 4301 * @since New in 1.5. 4302 */ 4303 typedef enum svn_repos_revision_access_level_t 4304 { 4305 /** no access allowed to the revision properties and all changed-paths 4306 * information. */ 4307 svn_repos_revision_access_none, 4308 /** access granted to some (svn:date and svn:author) revision properties and 4309 * changed-paths information on paths the read has access to. */ 4310 svn_repos_revision_access_partial, 4311 /** access granted to all revision properites and changed-paths 4312 * information. */ 4313 svn_repos_revision_access_full 4314 } 4315 svn_repos_revision_access_level_t; 4316 4317 4318 /** 4319 * Set @a access to the access level granted for @a revision in @a 4320 * repos, as determined by consulting the @a authz_read_func callback 4321 * function and its associated @a authz_read_baton. 4322 * 4323 * @a authz_read_func may be @c NULL, in which case @a access will be 4324 * set to #svn_repos_revision_access_full. 4325 * 4326 * @since New in 1.5. 4327 */ 4328 svn_error_t * 4329 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level, 4330 svn_repos_t *repos, 4331 svn_revnum_t revision, 4332 svn_repos_authz_func_t authz_read_func, 4333 void *authz_read_baton, 4334 apr_pool_t *pool); 4335 4336 4337 #ifdef __cplusplus 4338 } 4339 #endif /* __cplusplus */ 4340 4341 #endif /* SVN_REPOS_H */ 4342