svn_repos.h revision 262253
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 44extern "C" { 45#endif /* __cplusplus */ 46 47/* ---------------------------------------------------------------*/ 48 49/** 50 * Get libsvn_repos version information. 51 * 52 * @since New in 1.1. 53 */ 54const svn_version_t * 55svn_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. */ 61enum 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/** The different policies for processing the UUID in the dumpfile. */ 70enum svn_repos_load_uuid 71{ 72 /** only update uuid if the repos has no revisions. */ 73 svn_repos_load_uuid_default, 74 /** never update uuid. */ 75 svn_repos_load_uuid_ignore, 76 /** always update uuid. */ 77 svn_repos_load_uuid_force 78}; 79 80 81/** Callback type for checking authorization on paths produced by (at 82 * least) svn_repos_dir_delta2(). 83 * 84 * Set @a *allowed to TRUE to indicate that some operation is 85 * authorized for @a path in @a root, or set it to FALSE to indicate 86 * unauthorized (presumably according to state stored in @a baton). 87 * 88 * Do not assume @a pool has any lifetime beyond this call. 89 * 90 * The exact operation being authorized depends on the callback 91 * implementation. For read authorization, for example, the caller 92 * would implement an instance that does read checking, and pass it as 93 * a parameter named [perhaps] 'authz_read_func'. The receiver of 94 * that parameter might also take another parameter named 95 * 'authz_write_func', which although sharing this type, would be a 96 * different implementation. 97 * 98 * @note If someday we want more sophisticated authorization states 99 * than just yes/no, @a allowed can become an enum type. 100 */ 101typedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed, 102 svn_fs_root_t *root, 103 const char *path, 104 void *baton, 105 apr_pool_t *pool); 106 107 108/** An enum defining the kinds of access authz looks up. 109 * 110 * @since New in 1.3. 111 */ 112typedef enum svn_repos_authz_access_t 113{ 114 /** No access. */ 115 svn_authz_none = 0, 116 117 /** Path can be read. */ 118 svn_authz_read = 1, 119 120 /** Path can be altered. */ 121 svn_authz_write = 2, 122 123 /** The other access credentials are recursive. */ 124 svn_authz_recursive = 4 125} svn_repos_authz_access_t; 126 127 128/** Callback type for checking authorization on paths produced by 129 * the repository commit editor. 130 * 131 * Set @a *allowed to TRUE to indicate that the @a required access on 132 * @a path in @a root is authorized, or set it to FALSE to indicate 133 * unauthorized (presumable according to state stored in @a baton). 134 * 135 * If @a path is NULL, the callback should perform a global authz 136 * lookup for the @a required access. That is, the lookup should 137 * check if the @a required access is granted for at least one path of 138 * the repository, and set @a *allowed to TRUE if so. @a root may 139 * also be NULL if @a path is NULL. 140 * 141 * This callback is very similar to svn_repos_authz_func_t, with the 142 * exception of the addition of the @a required parameter. 143 * This is due to historical reasons: when authz was first implemented 144 * for svn_repos_dir_delta2(), it seemed there would need only checks 145 * for read and write operations, hence the svn_repos_authz_func_t 146 * callback prototype and usage scenario. But it was then realized 147 * that lookups due to copying needed to be recursive, and that 148 * brute-force recursive lookups didn't square with the O(1) 149 * performances a copy operation should have. 150 * 151 * So a special way to ask for a recursive lookup was introduced. The 152 * commit editor needs this capability to retain acceptable 153 * performance. Instead of revving the existing callback, causing 154 * unnecessary revving of functions that don't actually need the 155 * extended functionality, this second, more complete callback was 156 * introduced, for use by the commit editor. 157 * 158 * Some day, it would be nice to reunite these two callbacks and do 159 * the necessary revving anyway, but for the time being, this dual 160 * callback mechanism will do. 161 */ 162typedef svn_error_t *(*svn_repos_authz_callback_t) 163 (svn_repos_authz_access_t required, 164 svn_boolean_t *allowed, 165 svn_fs_root_t *root, 166 const char *path, 167 void *baton, 168 apr_pool_t *pool); 169 170/** 171 * Similar to #svn_file_rev_handler_t, but without the @a 172 * result_of_merge parameter. 173 * 174 * @deprecated Provided for backward compatibility with 1.4 API. 175 * @since New in 1.1. 176 */ 177typedef svn_error_t *(*svn_repos_file_rev_handler_t) 178 (void *baton, 179 const char *path, 180 svn_revnum_t rev, 181 apr_hash_t *rev_props, 182 svn_txdelta_window_handler_t *delta_handler, 183 void **delta_baton, 184 apr_array_header_t *prop_diffs, 185 apr_pool_t *pool); 186 187 188/* Notification system. */ 189 190/** The type of action occurring. 191 * 192 * @since New in 1.7. 193 */ 194typedef enum svn_repos_notify_action_t 195{ 196 /** A warning message is waiting. */ 197 svn_repos_notify_warning = 0, 198 199 /** A revision has finished being dumped. */ 200 svn_repos_notify_dump_rev_end, 201 202 /** A revision has finished being verified. */ 203 svn_repos_notify_verify_rev_end, 204 205 /** All revisions have finished being dumped. */ 206 svn_repos_notify_dump_end, 207 208 /** All revisions have finished being verified. */ 209 svn_repos_notify_verify_end, 210 211 /** packing of an FSFS shard has commenced */ 212 svn_repos_notify_pack_shard_start, 213 214 /** packing of an FSFS shard is completed */ 215 svn_repos_notify_pack_shard_end, 216 217 /** packing of the shard revprops has commenced */ 218 svn_repos_notify_pack_shard_start_revprop, 219 220 /** packing of the shard revprops has completed */ 221 svn_repos_notify_pack_shard_end_revprop, 222 223 /** A revision has begun loading */ 224 svn_repos_notify_load_txn_start, 225 226 /** A revision has finished loading */ 227 svn_repos_notify_load_txn_committed, 228 229 /** A node has begun loading */ 230 svn_repos_notify_load_node_start, 231 232 /** A node has finished loading */ 233 svn_repos_notify_load_node_done, 234 235 /** A copied node has been encountered */ 236 svn_repos_notify_load_copied_node, 237 238 /** Mergeinfo has been normalized */ 239 svn_repos_notify_load_normalized_mergeinfo, 240 241 /** The operation has acquired a mutex for the repo. */ 242 svn_repos_notify_mutex_acquired, 243 244 /** Recover has started. */ 245 svn_repos_notify_recover_start, 246 247 /** Upgrade has started. */ 248 svn_repos_notify_upgrade_start, 249 250 /** A revision was skipped during loading. @since New in 1.8. */ 251 svn_repos_notify_load_skipped_rev, 252 253 /** The structure of a revision is being verified. @since New in 1.8. */ 254 svn_repos_notify_verify_rev_structure 255 256} svn_repos_notify_action_t; 257 258/** The type of error occurring. 259 * 260 * @since New in 1.7. 261 */ 262typedef enum svn_repos_notify_warning_t 263{ 264 /** Referencing copy source data from a revision earlier than the 265 * first revision dumped. */ 266 svn_repos_notify_warning_found_old_reference, 267 268 /** An #SVN_PROP_MERGEINFO property's encoded mergeinfo references a 269 * revision earlier than the first revision dumped. */ 270 svn_repos_notify_warning_found_old_mergeinfo, 271 272 /** Found an invalid path in the filesystem. 273 * @see svn_fs.h:"Directory entry names and directory paths" */ 274 /* ### TODO(doxygen): make that a proper doxygen link */ 275 /* See svn_fs__path_valid(). */ 276 svn_repos_notify_warning_invalid_fspath 277 278} svn_repos_notify_warning_t; 279 280/** 281 * Structure used by #svn_repos_notify_func_t. 282 * 283 * The only field guaranteed to be populated is @c action. Other fields are 284 * dependent upon the @c action. (See individual fields for more information.) 285 * 286 * @note Callers of notification functions should use 287 * svn_repos_notify_create() to create structures of this type to allow for 288 * future extensibility. 289 * 290 * @since New in 1.7. 291 */ 292typedef struct svn_repos_notify_t 293{ 294 /** Action that describes what happened in the repository. */ 295 svn_repos_notify_action_t action; 296 297 /** For #svn_repos_notify_dump_rev_end and #svn_repos_notify_verify_rev_end, 298 * the revision which just completed. */ 299 svn_revnum_t revision; 300 301 /** For #svn_repos_notify_warning, the warning object. */ 302 const char *warning_str; 303 svn_repos_notify_warning_t warning; 304 305 /** For #svn_repos_notify_pack_shard_start, 306 #svn_repos_notify_pack_shard_end, 307 #svn_repos_notify_pack_shard_start_revprop, and 308 #svn_repos_notify_pack_shard_end_revprop, the shard processed. */ 309 apr_int64_t shard; 310 311 /** For #svn_repos_notify_load_node_done, the revision committed. */ 312 svn_revnum_t new_revision; 313 314 /** For #svn_repos_notify_load_node_done, the source revision, if 315 different from @a new_revision, otherwise #SVN_INVALID_REVNUM. 316 For #svn_repos_notify_load_txn_start, the source revision. */ 317 svn_revnum_t old_revision; 318 319 /** For #svn_repos_notify_load_node_start, the action being taken on the 320 node. */ 321 enum svn_node_action node_action; 322 323 /** For #svn_repos_notify_load_node_start, the path of the node. */ 324 const char *path; 325 326 /* NOTE: Add new fields at the end to preserve binary compatibility. 327 Also, if you add fields here, you have to update 328 svn_repos_notify_create(). */ 329} svn_repos_notify_t; 330 331/** Callback for providing notification from the repository. 332 * Returns @c void. Justification: success of an operation is not dependent 333 * upon successful notification of that operation. 334 * 335 * @since New in 1.7. */ 336typedef void (*svn_repos_notify_func_t)(void *baton, 337 const svn_repos_notify_t *notify, 338 apr_pool_t *scratch_pool); 339 340/** 341 * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize 342 * and return it. 343 * 344 * @since New in 1.7. 345 */ 346svn_repos_notify_t * 347svn_repos_notify_create(svn_repos_notify_action_t action, 348 apr_pool_t *result_pool); 349 350 351/** The repository object. */ 352typedef struct svn_repos_t svn_repos_t; 353 354/* Opening and creating repositories. */ 355 356 357/** Find the root path of the repository that contains @a path. 358 * 359 * If a repository was found, the path to the root of the repository 360 * is returned, else @c NULL. The pointer to the returned path may be 361 * equal to @a path. 362 */ 363const char * 364svn_repos_find_root_path(const char *path, 365 apr_pool_t *pool); 366 367/** Set @a *repos_p to a repository object for the repository at @a path. 368 * 369 * Allocate @a *repos_p in @a pool. 370 * 371 * Acquires a shared lock on the repository, and attaches a cleanup 372 * function to @a pool to remove the lock. If no lock can be acquired, 373 * returns error, with undefined effect on @a *repos_p. If an exclusive 374 * lock is present, this blocks until it's gone. @a fs_config will be 375 * passed to the filesystem initialization function and may be @c NULL. 376 * 377 * @since New in 1.7. 378 */ 379svn_error_t * 380svn_repos_open2(svn_repos_t **repos_p, 381 const char *path, 382 apr_hash_t *fs_config, 383 apr_pool_t *pool); 384 385/** Similar to svn_repos_open2() with @a fs_config set to NULL. 386 * 387 * @deprecated Provided for backward compatibility with 1.6 API. 388 */ 389SVN_DEPRECATED 390svn_error_t * 391svn_repos_open(svn_repos_t **repos_p, 392 const char *path, 393 apr_pool_t *pool); 394 395/** Create a new Subversion repository at @a path, building the necessary 396 * directory structure, creating the filesystem, and so on. 397 * Return the repository object in @a *repos_p, allocated in @a pool. 398 * 399 * @a config is a client configuration hash of #svn_config_t * items 400 * keyed on config category names, and may be NULL. 401 * 402 * @a fs_config is passed to the filesystem, and may be NULL. 403 * 404 * @a unused_1 and @a unused_2 are not used and should be NULL. 405 */ 406svn_error_t * 407svn_repos_create(svn_repos_t **repos_p, 408 const char *path, 409 const char *unused_1, 410 const char *unused_2, 411 apr_hash_t *config, 412 apr_hash_t *fs_config, 413 apr_pool_t *pool); 414 415/** 416 * Upgrade the Subversion repository (and its underlying versioned 417 * filesystem) located in the directory @a path to the latest version 418 * supported by this library. If the requested upgrade is not 419 * supported due to the current state of the repository or it 420 * underlying filesystem, return #SVN_ERR_REPOS_UNSUPPORTED_UPGRADE 421 * or #SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no 422 * changes to the repository or filesystem. 423 * 424 * Acquires an exclusive lock on the repository, upgrades the 425 * repository, and releases the lock. If an exclusive lock can't be 426 * acquired, returns error. 427 * 428 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 429 * returned if the lock is not immediately available. 430 * 431 * If @a start_callback is not NULL, it will be called with @a 432 * start_callback_baton as argument before the upgrade starts, but 433 * after the exclusive lock has been acquired. 434 * 435 * Use @a pool for necessary allocations. 436 * 437 * @note This functionality is provided as a convenience for 438 * administrators wishing to make use of new Subversion functionality 439 * without a potentially costly full repository dump/load. As such, 440 * the operation performs only the minimum amount of work needed to 441 * accomplish this while maintaining the integrity of the repository. 442 * It does *not* guarantee the most optimized repository state as a 443 * dump and subsequent load would. 444 * 445 * @note On some platforms the exclusive lock does not exclude other 446 * threads in the same process so this function should only be called 447 * by a single threaded process, or by a multi-threaded process when 448 * no other threads are accessing the repository. 449 * 450 * @since New in 1.7. 451 */ 452svn_error_t * 453svn_repos_upgrade2(const char *path, 454 svn_boolean_t nonblocking, 455 svn_repos_notify_func_t notify_func, 456 void *notify_baton, 457 apr_pool_t *pool); 458 459/** 460 * Similar to svn_repos_upgrade2(), but with @a start_callback and baton, 461 * rather than a notify_callback / baton 462 * 463 * @since New in 1.5. 464 * @deprecated Provided for backward compatibility with the 1.6 API. 465 */ 466SVN_DEPRECATED 467svn_error_t * 468svn_repos_upgrade(const char *path, 469 svn_boolean_t nonblocking, 470 svn_error_t *(*start_callback)(void *baton), 471 void *start_callback_baton, 472 apr_pool_t *pool); 473 474/** Destroy the Subversion repository found at @a path, using @a pool for any 475 * necessary allocations. 476 */ 477svn_error_t * 478svn_repos_delete(const char *path, 479 apr_pool_t *pool); 480 481/** 482 * Set @a *has to TRUE if @a repos has @a capability (one of the 483 * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set 484 * @a *has to FALSE. 485 * 486 * If @a capability isn't recognized, throw #SVN_ERR_UNKNOWN_CAPABILITY, 487 * with the effect on @a *has undefined. 488 * 489 * Use @a pool for all allocation. 490 * 491 * @since New in 1.5. 492 */ 493svn_error_t * 494svn_repos_has_capability(svn_repos_t *repos, 495 svn_boolean_t *has, 496 const char *capability, 497 apr_pool_t *pool); 498 499/** @} */ 500 501/** 502 * The capability of doing the right thing with merge-tracking 503 * information, both storing it and responding to queries about it. 504 * 505 * @since New in 1.5. 506 */ 507#define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo" 508/* *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY *** 509 * 510 * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to 511 * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid 512 * colons for their own reasons. While this RA limitation has no 513 * direct impact on repository capabilities, there's no reason to be 514 * gratuitously different either. 515 * 516 * If you add a capability, update svn_repos_capabilities(). 517 */ 518 519 520/** Return the filesystem associated with repository object @a repos. */ 521svn_fs_t * 522svn_repos_fs(svn_repos_t *repos); 523 524 525/** Make a hot copy of the Subversion repository found at @a src_path 526 * to @a dst_path. 527 * 528 * Copy a possibly live Subversion repository from @a src_path to 529 * @a dst_path. If @a clean_logs is @c TRUE, perform cleanup on the 530 * source filesystem as part of the copy operation; currently, this 531 * means deleting copied, unused logfiles for a Berkeley DB source 532 * repository. 533 * 534 * If @a incremental is TRUE, make an effort to not re-copy information 535 * already present in the destination. If incremental hotcopy is not 536 * implemented by the filesystem backend, raise SVN_ERR_UNSUPPORTED_FEATURE. 537 * 538 * @since New in 1.8. 539 */ 540svn_error_t * 541svn_repos_hotcopy2(const char *src_path, 542 const char *dst_path, 543 svn_boolean_t clean_logs, 544 svn_boolean_t incremental, 545 svn_cancel_func_t cancel_func, 546 void *cancel_baton, 547 apr_pool_t *pool); 548 549/** 550 * Like svn_repos_hotcopy2(), but with @a incremental always passed as 551 * @c FALSE and without cancellation support. 552 * 553 * @deprecated Provided for backward compatibility with the 1.6 API. 554 */ 555SVN_DEPRECATED 556svn_error_t * 557svn_repos_hotcopy(const char *src_path, 558 const char *dst_path, 559 svn_boolean_t clean_logs, 560 apr_pool_t *pool); 561 562 563/** 564 * Possibly update the repository, @a repos, to use a more efficient 565 * filesystem representation. Use @a pool for allocations. 566 * 567 * @since New in 1.7. 568 */ 569svn_error_t * 570svn_repos_fs_pack2(svn_repos_t *repos, 571 svn_repos_notify_func_t notify_func, 572 void *notify_baton, 573 svn_cancel_func_t cancel_func, 574 void *cancel_baton, 575 apr_pool_t *pool); 576 577/** 578 * Similar to svn_repos_fs_pack2(), but with a #svn_fs_pack_notify_t instead 579 * of a #svn_repos_notify_t. 580 * 581 * @since New in 1.6. 582 * @deprecated Provided for backward compatibility with the 1.6 API. 583 */ 584SVN_DEPRECATED 585svn_error_t * 586svn_repos_fs_pack(svn_repos_t *repos, 587 svn_fs_pack_notify_t notify_func, 588 void *notify_baton, 589 svn_cancel_func_t cancel_func, 590 void *cancel_baton, 591 apr_pool_t *pool); 592 593/** 594 * Run database recovery procedures on the repository at @a path, 595 * returning the database to a consistent state. Use @a pool for all 596 * allocation. 597 * 598 * Acquires an exclusive lock on the repository, recovers the 599 * database, and releases the lock. If an exclusive lock can't be 600 * acquired, returns error. 601 * 602 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 603 * returned if the lock is not immediately available. 604 * 605 * If @a notify_func is not NULL, it will be called with @a 606 * notify_baton as argument before the recovery starts, but 607 * after the exclusive lock has been acquired. 608 * 609 * If @a cancel_func is not @c NULL, it is called periodically with 610 * @a cancel_baton as argument to see if the client wishes to cancel 611 * the recovery. 612 * 613 * @note On some platforms the exclusive lock does not exclude other 614 * threads in the same process so this function should only be called 615 * by a single threaded process, or by a multi-threaded process when 616 * no other threads are accessing the repository. 617 * 618 * @since New in 1.7. 619 */ 620svn_error_t * 621svn_repos_recover4(const char *path, 622 svn_boolean_t nonblocking, 623 svn_repos_notify_func_t notify_func, 624 void *notify_baton, 625 svn_cancel_func_t cancel_func, 626 void * cancel_baton, 627 apr_pool_t *pool); 628 629/** 630 * Similar to svn_repos_recover4(), but with @a start callback in place of 631 * the notify_func / baton. 632 * 633 * @since New in 1.5. 634 * @deprecated Provided for backward compatibility with the 1.6 API. 635 */ 636SVN_DEPRECATED 637svn_error_t * 638svn_repos_recover3(const char *path, 639 svn_boolean_t nonblocking, 640 svn_error_t *(*start_callback)(void *baton), 641 void *start_callback_baton, 642 svn_cancel_func_t cancel_func, 643 void * cancel_baton, 644 apr_pool_t *pool); 645 646/** 647 * Similar to svn_repos_recover3(), but without cancellation support. 648 * 649 * @deprecated Provided for backward compatibility with the 1.4 API. 650 */ 651SVN_DEPRECATED 652svn_error_t * 653svn_repos_recover2(const char *path, 654 svn_boolean_t nonblocking, 655 svn_error_t *(*start_callback)(void *baton), 656 void *start_callback_baton, 657 apr_pool_t *pool); 658 659/** 660 * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and 661 * with no callbacks provided. 662 * 663 * @deprecated Provided for backward compatibility with the 1.0 API. 664 */ 665SVN_DEPRECATED 666svn_error_t * 667svn_repos_recover(const char *path, 668 apr_pool_t *pool); 669 670/** 671 * Callback for svn_repos_freeze. 672 * 673 * @since New in 1.8. 674 */ 675typedef svn_error_t *(*svn_repos_freeze_func_t)(void *baton, apr_pool_t *pool); 676 677/** 678 * Take an exclusive lock on each of the repositories in @a paths to 679 * prevent commits and then while holding all the locks invoke @a 680 * freeze_func passing @a freeze_baton. Each repository may be readable by 681 * Subversion while frozen, or may be unreadable, depending on which 682 * FS backend the repository uses. Repositories are locked in the 683 * order in which they are specified in the array. 684 * 685 * @note On some platforms the exclusive lock does not exclude other 686 * threads in the same process so this function should only be called 687 * by a single threaded process, or by a multi-threaded process when 688 * no other threads are accessing the repositories. 689 * 690 * @since New in 1.8. 691 */ 692svn_error_t * 693svn_repos_freeze(apr_array_header_t *paths, 694 svn_repos_freeze_func_t freeze_func, 695 void *freeze_baton, 696 apr_pool_t *pool); 697 698/** This function is a wrapper around svn_fs_berkeley_logfiles(), 699 * returning log file paths relative to the root of the repository. 700 * 701 * @copydoc svn_fs_berkeley_logfiles() 702 */ 703svn_error_t * 704svn_repos_db_logfiles(apr_array_header_t **logfiles, 705 const char *path, 706 svn_boolean_t only_unused, 707 apr_pool_t *pool); 708 709 710 711/* Repository Paths */ 712 713/** Return the top-level repository path allocated in @a pool. */ 714const char * 715svn_repos_path(svn_repos_t *repos, 716 apr_pool_t *pool); 717 718/** Return the path to @a repos's filesystem directory, allocated in 719 * @a pool. 720 */ 721const char * 722svn_repos_db_env(svn_repos_t *repos, 723 apr_pool_t *pool); 724 725/** Return path to @a repos's config directory, allocated in @a pool. */ 726const char * 727svn_repos_conf_dir(svn_repos_t *repos, 728 apr_pool_t *pool); 729 730/** Return path to @a repos's svnserve.conf, allocated in @a pool. */ 731const char * 732svn_repos_svnserve_conf(svn_repos_t *repos, 733 apr_pool_t *pool); 734 735/** Return path to @a repos's lock directory, allocated in @a pool. */ 736const char * 737svn_repos_lock_dir(svn_repos_t *repos, 738 apr_pool_t *pool); 739 740/** Return path to @a repos's db lockfile, allocated in @a pool. */ 741const char * 742svn_repos_db_lockfile(svn_repos_t *repos, 743 apr_pool_t *pool); 744 745/** Return path to @a repos's db logs lockfile, allocated in @a pool. */ 746const char * 747svn_repos_db_logs_lockfile(svn_repos_t *repos, 748 apr_pool_t *pool); 749 750/** Return the path to @a repos's hook directory, allocated in @a pool. */ 751const char * 752svn_repos_hook_dir(svn_repos_t *repos, 753 apr_pool_t *pool); 754 755/** Return the path to @a repos's start-commit hook, allocated in @a pool. */ 756const char * 757svn_repos_start_commit_hook(svn_repos_t *repos, 758 apr_pool_t *pool); 759 760/** Return the path to @a repos's pre-commit hook, allocated in @a pool. */ 761const char * 762svn_repos_pre_commit_hook(svn_repos_t *repos, 763 apr_pool_t *pool); 764 765/** Return the path to @a repos's post-commit hook, allocated in @a pool. */ 766const char * 767svn_repos_post_commit_hook(svn_repos_t *repos, 768 apr_pool_t *pool); 769 770/** Return the path to @a repos's pre-revprop-change hook, allocated in 771 * @a pool. 772 */ 773const char * 774svn_repos_pre_revprop_change_hook(svn_repos_t *repos, 775 apr_pool_t *pool); 776 777/** Return the path to @a repos's post-revprop-change hook, allocated in 778 * @a pool. 779 */ 780const char * 781svn_repos_post_revprop_change_hook(svn_repos_t *repos, 782 apr_pool_t *pool); 783 784 785/** @defgroup svn_repos_lock_hooks Paths to lock hooks 786 * @{ 787 * @since New in 1.2. */ 788 789/** Return the path to @a repos's pre-lock hook, allocated in @a pool. */ 790const char * 791svn_repos_pre_lock_hook(svn_repos_t *repos, 792 apr_pool_t *pool); 793 794/** Return the path to @a repos's post-lock hook, allocated in @a pool. */ 795const char * 796svn_repos_post_lock_hook(svn_repos_t *repos, 797 apr_pool_t *pool); 798 799/** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */ 800const char * 801svn_repos_pre_unlock_hook(svn_repos_t *repos, 802 apr_pool_t *pool); 803 804/** Return the path to @a repos's post-unlock hook, allocated in @a pool. */ 805const char * 806svn_repos_post_unlock_hook(svn_repos_t *repos, 807 apr_pool_t *pool); 808 809/** Specify that Subversion should consult the configuration file 810 * located at @a hooks_env_path to determine how to setup the 811 * environment for hook scripts invoked for the repository @a repos. 812 * As a special case, if @a hooks_env_path is @c NULL, look for the 813 * file in its default location within the repository disk structure. 814 * If @a hooks_env_path is not absolute, it specifies a path relative 815 * to the parent of the file's default location. 816 * 817 * Use @a scratch_pool for temporary allocations. 818 * 819 * If this function is not called, or if the specified configuration 820 * file does not define any environment variables, hooks will run in 821 * an empty environment. 822 * 823 * @since New in 1.8. 824 */ 825svn_error_t * 826svn_repos_hooks_setenv(svn_repos_t *repos, 827 const char *hooks_env_path, 828 apr_pool_t *scratch_pool); 829 830/** @} */ 831 832/* ---------------------------------------------------------------*/ 833 834/* Reporting the state of a working copy, for updates. */ 835 836 837/** 838 * Construct and return a @a report_baton that will be passed to the 839 * other functions in this section to describe the state of a pre-existing 840 * tree (typically, a working copy). When the report is finished, 841 * @a editor/@a edit_baton will be driven in such a way as to transform the 842 * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the 843 * reported hierarchy to @a tgt_path. 844 * 845 * @a fs_base is the absolute path of the node in the filesystem at which 846 * the comparison should be rooted. @a target is a single path component, 847 * used to limit the scope of the report to a single entry of @a fs_base, 848 * or "" if all of @a fs_base itself is the main subject of the report. 849 * 850 * @a tgt_path and @a revnum is the fs path/revision pair that is the 851 * "target" of the delta. @a tgt_path should be provided only when 852 * the source and target paths of the report differ. That is, @a tgt_path 853 * should *only* be specified when specifying that the resultant editor 854 * drive be one that transforms the reported hierarchy into a pristine tree 855 * of @a tgt_path at revision @a revnum. A @c NULL value for @a tgt_path 856 * will indicate that the editor should be driven in such a way as to 857 * transform the reported hierarchy to revision @a revnum, preserving the 858 * reported hierarchy. 859 * 860 * @a text_deltas instructs the driver of the @a editor to enable 861 * the generation of text deltas. 862 * 863 * @a ignore_ancestry instructs the driver to ignore node ancestry 864 * when determining how to transmit differences. 865 * 866 * @a send_copyfrom_args instructs the driver to send 'copyfrom' 867 * arguments to the editor's add_file() and add_directory() methods, 868 * whenever it deems feasible. 869 * 870 * Use @a authz_read_func and @a authz_read_baton (if not @c NULL) to 871 * avoid sending data through @a editor/@a edit_baton which is not 872 * authorized for transmission. 873 * 874 * @a zero_copy_limit controls the maximum size (in bytes) at which 875 * data blocks may be sent using the zero-copy code path. On that 876 * path, a number of in-memory copy operations have been eliminated to 877 * maximize throughput. However, until the whole block has been 878 * pushed to the network stack, other clients block, so be careful 879 * when using larger values here. Pass 0 for @a zero_copy_limit to 880 * disable this optimization altogether. 881 * 882 * @a note Never activate this optimization if @a editor might access 883 * any FSFS data structures (and, hence, caches). So, it is basically 884 * safe for networked editors only. 885 * 886 * All allocation for the context and collected state will occur in 887 * @a pool. 888 * 889 * @a depth is the requested depth of the editor drive. 890 * 891 * If @a depth is #svn_depth_unknown, the editor will affect only the 892 * paths reported by the individual calls to svn_repos_set_path3() and 893 * svn_repos_link_path3(). 894 * 895 * For example, if the reported tree is the @c A subdir of the Greek Tree 896 * (see Subversion's test suite), at depth #svn_depth_empty, but the 897 * @c A/B subdir is reported at depth #svn_depth_infinity, then 898 * repository-side changes to @c A/mu, or underneath @c A/C and @c 899 * A/D, would not be reflected in the editor drive, but changes 900 * underneath @c A/B would be. 901 * 902 * Additionally, the editor driver will call @c add_directory and 903 * and @c add_file for directories with an appropriate depth. For 904 * example, a directory reported at #svn_depth_files will receive 905 * file (but not directory) additions. A directory at #svn_depth_empty 906 * will receive neither. 907 * 908 * If @a depth is #svn_depth_files, #svn_depth_immediates or 909 * #svn_depth_infinity and @a depth is greater than the reported depth 910 * of the working copy, then the editor driver will emit editor 911 * operations so as to upgrade the working copy to this depth. 912 * 913 * If @a depth is #svn_depth_empty, #svn_depth_files, 914 * #svn_depth_immediates and @a depth is lower 915 * than or equal to the depth of the working copy, then the editor 916 * operations will affect only paths at or above @a depth. 917 * 918 * @since New in 1.8. 919 */ 920svn_error_t * 921svn_repos_begin_report3(void **report_baton, 922 svn_revnum_t revnum, 923 svn_repos_t *repos, 924 const char *fs_base, 925 const char *target, 926 const char *tgt_path, 927 svn_boolean_t text_deltas, 928 svn_depth_t depth, 929 svn_boolean_t ignore_ancestry, 930 svn_boolean_t send_copyfrom_args, 931 const svn_delta_editor_t *editor, 932 void *edit_baton, 933 svn_repos_authz_func_t authz_read_func, 934 void *authz_read_baton, 935 apr_size_t zero_copy_limit, 936 apr_pool_t *pool); 937 938/** 939 * The same as svn_repos_begin_report3(), but with @a zero_copy_limit 940 * always passed as 0. 941 * 942 * @since New in 1.5. 943 * @deprecated Provided for backward compatibility with the 1.7 API. 944 */ 945SVN_DEPRECATED 946svn_error_t * 947svn_repos_begin_report2(void **report_baton, 948 svn_revnum_t revnum, 949 svn_repos_t *repos, 950 const char *fs_base, 951 const char *target, 952 const char *tgt_path, 953 svn_boolean_t text_deltas, 954 svn_depth_t depth, 955 svn_boolean_t ignore_ancestry, 956 svn_boolean_t send_copyfrom_args, 957 const svn_delta_editor_t *editor, 958 void *edit_baton, 959 svn_repos_authz_func_t authz_read_func, 960 void *authz_read_baton, 961 apr_pool_t *pool); 962 963/** 964 * The same as svn_repos_begin_report2(), but taking a boolean 965 * @a recurse flag, and sending FALSE for @a send_copyfrom_args. 966 * 967 * If @a recurse is TRUE, the editor driver will drive the editor with 968 * a depth of #svn_depth_infinity; if FALSE, then with a depth of 969 * #svn_depth_files. 970 * 971 * @note @a username is ignored, and has been removed in a revised 972 * version of this API. 973 * 974 * @deprecated Provided for backward compatibility with the 1.4 API. 975 */ 976SVN_DEPRECATED 977svn_error_t * 978svn_repos_begin_report(void **report_baton, 979 svn_revnum_t revnum, 980 const char *username, 981 svn_repos_t *repos, 982 const char *fs_base, 983 const char *target, 984 const char *tgt_path, 985 svn_boolean_t text_deltas, 986 svn_boolean_t recurse, 987 svn_boolean_t ignore_ancestry, 988 const svn_delta_editor_t *editor, 989 void *edit_baton, 990 svn_repos_authz_func_t authz_read_func, 991 void *authz_read_baton, 992 apr_pool_t *pool); 993 994 995/** 996 * Given a @a report_baton constructed by svn_repos_begin_report3(), 997 * record the presence of @a path, at @a revision with depth @a depth, 998 * in the current tree. 999 * 1000 * @a path is relative to the anchor/target used in the creation of the 1001 * @a report_baton. 1002 * 1003 * @a revision may be SVN_INVALID_REVNUM if (for example) @a path 1004 * represents a locally-added path with no revision number, or @a 1005 * depth is #svn_depth_exclude. 1006 * 1007 * @a path may not be underneath a path on which svn_repos_set_path3() 1008 * was previously called with #svn_depth_exclude in this report. 1009 * 1010 * The first call of this in a given report usually passes an empty 1011 * @a path; this is used to set up the correct root revision for the editor 1012 * drive. 1013 * 1014 * A depth of #svn_depth_unknown is not allowed, and results in an 1015 * error. 1016 * 1017 * If @a start_empty is TRUE and @a path is a directory, then require the 1018 * caller to explicitly provide all the children of @a path - do not assume 1019 * that the tree also contains all the children of @a path at @a revision. 1020 * This is for 'low confidence' client reporting. 1021 * 1022 * If the caller has a lock token for @a path, then @a lock_token should 1023 * be set to that token. Else, @a lock_token should be NULL. 1024 * 1025 * All temporary allocations are done in @a pool. 1026 * 1027 * @since New in 1.5. 1028 */ 1029svn_error_t * 1030svn_repos_set_path3(void *report_baton, 1031 const char *path, 1032 svn_revnum_t revision, 1033 svn_depth_t depth, 1034 svn_boolean_t start_empty, 1035 const char *lock_token, 1036 apr_pool_t *pool); 1037 1038/** 1039 * Similar to svn_repos_set_path3(), but with @a depth set to 1040 * #svn_depth_infinity. 1041 * 1042 * @deprecated Provided for backward compatibility with the 1.4 API. 1043 */ 1044SVN_DEPRECATED 1045svn_error_t * 1046svn_repos_set_path2(void *report_baton, 1047 const char *path, 1048 svn_revnum_t revision, 1049 svn_boolean_t start_empty, 1050 const char *lock_token, 1051 apr_pool_t *pool); 1052 1053/** 1054 * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL. 1055 * 1056 * @deprecated Provided for backward compatibility with the 1.1 API. 1057 */ 1058SVN_DEPRECATED 1059svn_error_t * 1060svn_repos_set_path(void *report_baton, 1061 const char *path, 1062 svn_revnum_t revision, 1063 svn_boolean_t start_empty, 1064 apr_pool_t *pool); 1065 1066/** 1067 * Given a @a report_baton constructed by svn_repos_begin_report3(), 1068 * record the presence of @a path in the current tree, containing the contents 1069 * of @a link_path at @a revision with depth @a depth. 1070 * 1071 * A depth of #svn_depth_unknown is not allowed, and results in an 1072 * error. 1073 * 1074 * @a path may not be underneath a path on which svn_repos_set_path3() 1075 * was previously called with #svn_depth_exclude in this report. 1076 * 1077 * Note that while @a path is relative to the anchor/target used in the 1078 * creation of the @a report_baton, @a link_path is an absolute filesystem 1079 * path! 1080 * 1081 * If @a start_empty is TRUE and @a path is a directory, then require the 1082 * caller to explicitly provide all the children of @a path - do not assume 1083 * that the tree also contains all the children of @a link_path at 1084 * @a revision. This is for 'low confidence' client reporting. 1085 * 1086 * If the caller has a lock token for @a link_path, then @a lock_token 1087 * should be set to that token. Else, @a lock_token should be NULL. 1088 * 1089 * All temporary allocations are done in @a pool. 1090 * 1091 * @since New in 1.5. 1092 */ 1093svn_error_t * 1094svn_repos_link_path3(void *report_baton, 1095 const char *path, 1096 const char *link_path, 1097 svn_revnum_t revision, 1098 svn_depth_t depth, 1099 svn_boolean_t start_empty, 1100 const char *lock_token, 1101 apr_pool_t *pool); 1102 1103/** 1104 * Similar to svn_repos_link_path3(), but with @a depth set to 1105 * #svn_depth_infinity. 1106 * 1107 * @deprecated Provided for backward compatibility with the 1.4 API. 1108 */ 1109SVN_DEPRECATED 1110svn_error_t * 1111svn_repos_link_path2(void *report_baton, 1112 const char *path, 1113 const char *link_path, 1114 svn_revnum_t revision, 1115 svn_boolean_t start_empty, 1116 const char *lock_token, 1117 apr_pool_t *pool); 1118 1119/** 1120 * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL. 1121 * 1122 * @deprecated Provided for backward compatibility with the 1.1 API. 1123 */ 1124SVN_DEPRECATED 1125svn_error_t * 1126svn_repos_link_path(void *report_baton, 1127 const char *path, 1128 const char *link_path, 1129 svn_revnum_t revision, 1130 svn_boolean_t start_empty, 1131 apr_pool_t *pool); 1132 1133/** Given a @a report_baton constructed by svn_repos_begin_report3(), 1134 * record the non-existence of @a path in the current tree. 1135 * 1136 * @a path may not be underneath a path on which svn_repos_set_path3() 1137 * was previously called with #svn_depth_exclude in this report. 1138 * 1139 * (This allows the reporter's driver to describe missing pieces of a 1140 * working copy, so that 'svn up' can recreate them.) 1141 * 1142 * All temporary allocations are done in @a pool. 1143 */ 1144svn_error_t * 1145svn_repos_delete_path(void *report_baton, 1146 const char *path, 1147 apr_pool_t *pool); 1148 1149/** Given a @a report_baton constructed by svn_repos_begin_report3(), 1150 * finish the report and drive the editor as specified when the report 1151 * baton was constructed. 1152 * 1153 * If an error occurs during the driving of the editor, do NOT abort the 1154 * edit; that responsibility belongs to the caller of this function, if 1155 * it happens at all. 1156 * 1157 * After the call to this function, @a report_baton is no longer valid; 1158 * it should not be passed to any other reporting functions, including 1159 * svn_repos_abort_report(), even if this function returns an error. 1160 */ 1161svn_error_t * 1162svn_repos_finish_report(void *report_baton, 1163 apr_pool_t *pool); 1164 1165 1166/** Given a @a report_baton constructed by svn_repos_begin_report3(), 1167 * abort the report. This function can be called anytime before 1168 * svn_repos_finish_report() is called. 1169 * 1170 * After the call to this function, @a report_baton is no longer valid; 1171 * it should not be passed to any other reporting functions. 1172 */ 1173svn_error_t * 1174svn_repos_abort_report(void *report_baton, 1175 apr_pool_t *pool); 1176 1177 1178/* ---------------------------------------------------------------*/ 1179 1180/* The magical dir_delta update routines. */ 1181 1182/** Use the provided @a editor and @a edit_baton to describe the changes 1183 * necessary for making a given node (and its descendants, if it is a 1184 * directory) under @a src_root look exactly like @a tgt_path under 1185 * @a tgt_root. @a src_entry is the node to update. If @a src_entry 1186 * is empty, then compute the difference between the entire tree 1187 * anchored at @a src_parent_dir under @a src_root and @a tgt_path 1188 * under @a tgt_root. Else, describe the changes needed to update 1189 * only that entry in @a src_parent_dir. Typically, callers of this 1190 * function will use a @a tgt_path that is the concatenation of @a 1191 * src_parent_dir and @a src_entry. 1192 * 1193 * @a src_root and @a tgt_root can both be either revision or transaction 1194 * roots. If @a tgt_root is a revision, @a editor's set_target_revision() 1195 * will be called with the @a tgt_root's revision number, else it will 1196 * not be called at all. 1197 * 1198 * If @a authz_read_func is non-NULL, invoke it before any call to 1199 * 1200 * @a editor->open_root 1201 * @a editor->add_directory 1202 * @a editor->open_directory 1203 * @a editor->add_file 1204 * @a editor->open_file 1205 * 1206 * passing @a tgt_root, the same path that would be passed to the 1207 * editor function in question, and @a authz_read_baton. If the 1208 * @a *allowed parameter comes back TRUE, then proceed with the planned 1209 * editor call; else if FALSE, then invoke @a editor->absent_file or 1210 * @a editor->absent_directory as appropriate, except if the planned 1211 * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE. 1212 * 1213 * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to 1214 * the window handler returned by @a editor->apply_textdelta(). 1215 * 1216 * If @a depth is #svn_depth_empty, invoke @a editor calls only on 1217 * @a src_entry (or @a src_parent_dir, if @a src_entry is empty). 1218 * If @a depth is #svn_depth_files, also invoke the editor on file 1219 * children, if any; if #svn_depth_immediates, invoke it on 1220 * immediate subdirectories as well as files; if #svn_depth_infinity, 1221 * recurse fully. 1222 * 1223 * If @a entry_props is @c TRUE, accompany each opened/added entry with 1224 * propchange editor calls that relay special "entry props" (this 1225 * is typically used only for working copy updates). 1226 * 1227 * @a ignore_ancestry instructs the function to ignore node ancestry 1228 * when determining how to transmit differences. 1229 * 1230 * Before completing successfully, this function calls @a editor's 1231 * close_edit(), so the caller should expect its @a edit_baton to be 1232 * invalid after its use with this function. 1233 * 1234 * Do any allocation necessary for the delta computation in @a pool. 1235 * This function's maximum memory consumption is at most roughly 1236 * proportional to the greatest depth of the tree under @a tgt_root, not 1237 * the total size of the delta. 1238 * 1239 * ### svn_repos_dir_delta2 is mostly superseded by the reporter 1240 * ### functionality (svn_repos_begin_report3 and friends). 1241 * ### svn_repos_dir_delta2 does allow the roots to be transaction 1242 * ### roots rather than just revision roots, and it has the 1243 * ### entry_props flag. Almost all of Subversion's own code uses the 1244 * ### reporter instead; there are some stray references to the 1245 * ### svn_repos_dir_delta[2] in comments which should probably 1246 * ### actually refer to the reporter. 1247 * 1248 * @since New in 1.5. 1249 */ 1250svn_error_t * 1251svn_repos_dir_delta2(svn_fs_root_t *src_root, 1252 const char *src_parent_dir, 1253 const char *src_entry, 1254 svn_fs_root_t *tgt_root, 1255 const char *tgt_path, 1256 const svn_delta_editor_t *editor, 1257 void *edit_baton, 1258 svn_repos_authz_func_t authz_read_func, 1259 void *authz_read_baton, 1260 svn_boolean_t text_deltas, 1261 svn_depth_t depth, 1262 svn_boolean_t entry_props, 1263 svn_boolean_t ignore_ancestry, 1264 apr_pool_t *pool); 1265 1266/** 1267 * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass 1268 * #svn_depth_infinity for @a depth, and if @a recurse is FALSE, 1269 * pass #svn_depth_files for @a depth. 1270 * 1271 * @deprecated Provided for backward compatibility with the 1.4 API. 1272 */ 1273SVN_DEPRECATED 1274svn_error_t * 1275svn_repos_dir_delta(svn_fs_root_t *src_root, 1276 const char *src_parent_dir, 1277 const char *src_entry, 1278 svn_fs_root_t *tgt_root, 1279 const char *tgt_path, 1280 const svn_delta_editor_t *editor, 1281 void *edit_baton, 1282 svn_repos_authz_func_t authz_read_func, 1283 void *authz_read_baton, 1284 svn_boolean_t text_deltas, 1285 svn_boolean_t recurse, 1286 svn_boolean_t entry_props, 1287 svn_boolean_t ignore_ancestry, 1288 apr_pool_t *pool); 1289 1290 1291/** Use the provided @a editor and @a edit_baton to describe the 1292 * skeletal changes made in a particular filesystem @a root 1293 * (revision or transaction). 1294 * 1295 * Changes will be limited to those within @a base_dir, and if 1296 * @a low_water_mark is set to something other than #SVN_INVALID_REVNUM 1297 * it is assumed that the client has no knowledge of revisions prior to 1298 * @a low_water_mark. Together, these two arguments define the portion of 1299 * the tree that the client is assumed to have knowledge of, and thus any 1300 * copies of data from outside that part of the tree will be sent in their 1301 * entirety, not as simple copies or deltas against a previous version. 1302 * 1303 * The @a editor passed to this function should be aware of the fact 1304 * that, if @a send_deltas is FALSE, calls to its change_dir_prop(), 1305 * change_file_prop(), and apply_textdelta() functions will not 1306 * contain meaningful data, and merely serve as indications that 1307 * properties or textual contents were changed. 1308 * 1309 * If @a send_deltas is @c TRUE, the text and property deltas for changes 1310 * will be sent, otherwise NULL text deltas and empty prop changes will be 1311 * used. 1312 * 1313 * If @a authz_read_func is non-NULL, it will be used to determine if the 1314 * user has read access to the data being accessed. Data that the user 1315 * cannot access will be skipped. 1316 * 1317 * @note This editor driver passes SVN_INVALID_REVNUM for all 1318 * revision parameters in the editor interface except the copyfrom 1319 * parameter of the add_file() and add_directory() editor functions. 1320 * 1321 * @since New in 1.4. 1322 */ 1323svn_error_t * 1324svn_repos_replay2(svn_fs_root_t *root, 1325 const char *base_dir, 1326 svn_revnum_t low_water_mark, 1327 svn_boolean_t send_deltas, 1328 const svn_delta_editor_t *editor, 1329 void *edit_baton, 1330 svn_repos_authz_func_t authz_read_func, 1331 void *authz_read_baton, 1332 apr_pool_t *pool); 1333 1334/** 1335 * Similar to svn_repos_replay2(), but with @a base_dir set to @c "", 1336 * @a low_water_mark set to #SVN_INVALID_REVNUM, @a send_deltas 1337 * set to @c FALSE, and @a authz_read_func and @a authz_read_baton 1338 * set to @c NULL. 1339 * 1340 * @deprecated Provided for backward compatibility with the 1.3 API. 1341 */ 1342SVN_DEPRECATED 1343svn_error_t * 1344svn_repos_replay(svn_fs_root_t *root, 1345 const svn_delta_editor_t *editor, 1346 void *edit_baton, 1347 apr_pool_t *pool); 1348 1349/* ---------------------------------------------------------------*/ 1350 1351/* Making commits. */ 1352 1353/** 1354 * Return an @a editor and @a edit_baton to commit changes to the 1355 * filesystem of @a repos, beginning at location 'rev:@a base_path', 1356 * where "rev" is the argument given to open_root(). 1357 * 1358 * @a repos is a previously opened repository. @a repos_url is the 1359 * decoded URL to the base of the repository, and is used to check 1360 * copyfrom paths. copyfrom paths passed to the editor must be full, 1361 * URI-encoded, URLs. @a txn is a filesystem transaction object to use 1362 * during the commit, or @c NULL to indicate that this function should 1363 * create (and fully manage) a new transaction. 1364 * 1365 * Store the contents of @a revprop_table, a hash mapping <tt>const 1366 * char *</tt> property names to #svn_string_t values, as properties 1367 * of the commit transaction, including author and log message if 1368 * present. 1369 * 1370 * @note #SVN_PROP_REVISION_DATE may be present in @a revprop_table, but 1371 * it will be overwritten when the transaction is committed. 1372 * 1373 * Iff @a authz_callback is provided, check read/write authorizations 1374 * on paths accessed by editor operations. An operation which fails 1375 * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or 1376 * SVN_ERR_AUTHZ_UNWRITABLE. 1377 * 1378 * Calling @a (*editor)->close_edit completes the commit. 1379 * 1380 * If @a commit_callback is non-NULL, then before @c close_edit returns (but 1381 * after the commit has succeeded) @c close_edit will invoke 1382 * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton, 1383 * and @a pool or some subpool thereof as arguments. If @a commit_callback 1384 * returns an error, that error will be returned from @c close_edit, 1385 * otherwise if there was a post-commit hook failure, then that error 1386 * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. 1387 * (Note that prior to Subversion 1.6, @a commit_callback cannot be NULL; if 1388 * you don't need a callback, pass a dummy function.) 1389 * 1390 * Calling @a (*editor)->abort_edit aborts the commit, and will also 1391 * abort the commit transaction unless @a txn was supplied (not @c 1392 * NULL). Callers who supply their own transactions are responsible 1393 * for cleaning them up (either by committing them, or aborting them). 1394 * 1395 * @since New in 1.5. 1396 * 1397 * @note Yes, @a repos_url is a <em>decoded</em> URL. We realize 1398 * that's sorta wonky. Sorry about that. 1399 */ 1400svn_error_t * 1401svn_repos_get_commit_editor5(const svn_delta_editor_t **editor, 1402 void **edit_baton, 1403 svn_repos_t *repos, 1404 svn_fs_txn_t *txn, 1405 const char *repos_url, 1406 const char *base_path, 1407 apr_hash_t *revprop_table, 1408 svn_commit_callback2_t commit_callback, 1409 void *commit_baton, 1410 svn_repos_authz_callback_t authz_callback, 1411 void *authz_baton, 1412 apr_pool_t *pool); 1413 1414/** 1415 * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table 1416 * set to a hash containing @a user and @a log_msg as the 1417 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties, 1418 * respectively. @a user and @a log_msg may both be @c NULL. 1419 * 1420 * @since New in 1.4. 1421 * 1422 * @deprecated Provided for backward compatibility with the 1.4 API. 1423 */ 1424SVN_DEPRECATED 1425svn_error_t * 1426svn_repos_get_commit_editor4(const svn_delta_editor_t **editor, 1427 void **edit_baton, 1428 svn_repos_t *repos, 1429 svn_fs_txn_t *txn, 1430 const char *repos_url, 1431 const char *base_path, 1432 const char *user, 1433 const char *log_msg, 1434 svn_commit_callback2_t commit_callback, 1435 void *commit_baton, 1436 svn_repos_authz_callback_t authz_callback, 1437 void *authz_baton, 1438 apr_pool_t *pool); 1439 1440/** 1441 * Similar to svn_repos_get_commit_editor4(), but 1442 * uses the svn_commit_callback_t type. 1443 * 1444 * @since New in 1.3. 1445 * 1446 * @deprecated Provided for backward compatibility with the 1.3 API. 1447 */ 1448SVN_DEPRECATED 1449svn_error_t * 1450svn_repos_get_commit_editor3(const svn_delta_editor_t **editor, 1451 void **edit_baton, 1452 svn_repos_t *repos, 1453 svn_fs_txn_t *txn, 1454 const char *repos_url, 1455 const char *base_path, 1456 const char *user, 1457 const char *log_msg, 1458 svn_commit_callback_t callback, 1459 void *callback_baton, 1460 svn_repos_authz_callback_t authz_callback, 1461 void *authz_baton, 1462 apr_pool_t *pool); 1463 1464/** 1465 * Similar to svn_repos_get_commit_editor3(), but with @a 1466 * authz_callback and @a authz_baton set to @c NULL. 1467 * 1468 * @deprecated Provided for backward compatibility with the 1.2 API. 1469 */ 1470SVN_DEPRECATED 1471svn_error_t * 1472svn_repos_get_commit_editor2(const svn_delta_editor_t **editor, 1473 void **edit_baton, 1474 svn_repos_t *repos, 1475 svn_fs_txn_t *txn, 1476 const char *repos_url, 1477 const char *base_path, 1478 const char *user, 1479 const char *log_msg, 1480 svn_commit_callback_t callback, 1481 void *callback_baton, 1482 apr_pool_t *pool); 1483 1484 1485/** 1486 * Similar to svn_repos_get_commit_editor2(), but with @a txn always 1487 * set to @c NULL. 1488 * 1489 * @deprecated Provided for backward compatibility with the 1.1 API. 1490 */ 1491SVN_DEPRECATED 1492svn_error_t * 1493svn_repos_get_commit_editor(const svn_delta_editor_t **editor, 1494 void **edit_baton, 1495 svn_repos_t *repos, 1496 const char *repos_url, 1497 const char *base_path, 1498 const char *user, 1499 const char *log_msg, 1500 svn_commit_callback_t callback, 1501 void *callback_baton, 1502 apr_pool_t *pool); 1503 1504/* ---------------------------------------------------------------*/ 1505 1506/* Finding particular revisions. */ 1507 1508/** Set @a *revision to the revision number in @a repos's filesystem that was 1509 * youngest at time @a tm. 1510 */ 1511svn_error_t * 1512svn_repos_dated_revision(svn_revnum_t *revision, 1513 svn_repos_t *repos, 1514 apr_time_t tm, 1515 apr_pool_t *pool); 1516 1517 1518/** Given a @a root/@a path within some filesystem, return three pieces of 1519 * information allocated in @a pool: 1520 * 1521 * - set @a *committed_rev to the revision in which the object was 1522 * last modified. (In fs parlance, this is the revision in which 1523 * the particular node-rev-id was 'created'.) 1524 * 1525 * - set @a *committed_date to the date of said revision, or @c NULL 1526 * if not available. 1527 * 1528 * - set @a *last_author to the author of said revision, or @c NULL 1529 * if not available. 1530 */ 1531svn_error_t * 1532svn_repos_get_committed_info(svn_revnum_t *committed_rev, 1533 const char **committed_date, 1534 const char **last_author, 1535 svn_fs_root_t *root, 1536 const char *path, 1537 apr_pool_t *pool); 1538 1539 1540/** 1541 * Set @a *dirent to an #svn_dirent_t associated with @a path in @a 1542 * root. If @a path does not exist in @a root, set @a *dirent to 1543 * NULL. Use @a pool for memory allocation. 1544 * 1545 * @since New in 1.2. 1546 */ 1547svn_error_t * 1548svn_repos_stat(svn_dirent_t **dirent, 1549 svn_fs_root_t *root, 1550 const char *path, 1551 apr_pool_t *pool); 1552 1553 1554/** 1555 * Given @a path which exists at revision @a start in @a fs, set 1556 * @a *deleted to the revision @a path was first deleted, within the 1557 * inclusive revision range bounded by @a start and @a end. If @a path 1558 * does not exist at revision @a start or was not deleted within the 1559 * specified range, then set @a *deleted to SVN_INVALID_REVNUM. 1560 * Use @a pool for memory allocation. 1561 * 1562 * @since New in 1.5. 1563 */ 1564svn_error_t * 1565svn_repos_deleted_rev(svn_fs_t *fs, 1566 const char *path, 1567 svn_revnum_t start, 1568 svn_revnum_t end, 1569 svn_revnum_t *deleted, 1570 apr_pool_t *pool); 1571 1572 1573/** Callback type for use with svn_repos_history(). @a path and @a 1574 * revision represent interesting history locations in the lifetime 1575 * of the path passed to svn_repos_history(). @a baton is the same 1576 * baton given to svn_repos_history(). @a pool is provided for the 1577 * convenience of the implementor, who should not expect it to live 1578 * longer than a single callback call. 1579 * 1580 * Signal to callback driver to stop processing/invoking this callback 1581 * by returning the #SVN_ERR_CEASE_INVOCATION error code. 1582 * 1583 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 1584 */ 1585typedef svn_error_t *(*svn_repos_history_func_t)(void *baton, 1586 const char *path, 1587 svn_revnum_t revision, 1588 apr_pool_t *pool); 1589 1590/** 1591 * Call @a history_func (with @a history_baton) for each interesting 1592 * history location in the lifetime of @a path in @a fs, from the 1593 * youngest of @a end and @a start to the oldest. Stop processing if 1594 * @a history_func returns #SVN_ERR_CEASE_INVOCATION. Only cross 1595 * filesystem copy history if @a cross_copies is @c TRUE. And do all 1596 * of this in @a pool. 1597 * 1598 * If @a authz_read_func is non-NULL, then use it (and @a 1599 * authz_read_baton) to verify that @a path in @a end is readable; if 1600 * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability 1601 * of every ancestral path/revision pair before pushing them at @a 1602 * history_func. If a pair is deemed unreadable, then do not send 1603 * them; instead, immediately stop traversing history and return 1604 * SVN_NO_ERROR. 1605 * 1606 * @since New in 1.1. 1607 * 1608 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 1609 */ 1610svn_error_t * 1611svn_repos_history2(svn_fs_t *fs, 1612 const char *path, 1613 svn_repos_history_func_t history_func, 1614 void *history_baton, 1615 svn_repos_authz_func_t authz_read_func, 1616 void *authz_read_baton, 1617 svn_revnum_t start, 1618 svn_revnum_t end, 1619 svn_boolean_t cross_copies, 1620 apr_pool_t *pool); 1621 1622/** 1623 * Similar to svn_repos_history2(), but with @a authz_read_func 1624 * and @a authz_read_baton always set to NULL. 1625 * 1626 * @deprecated Provided for backward compatibility with the 1.0 API. 1627 */ 1628SVN_DEPRECATED 1629svn_error_t * 1630svn_repos_history(svn_fs_t *fs, 1631 const char *path, 1632 svn_repos_history_func_t history_func, 1633 void *history_baton, 1634 svn_revnum_t start, 1635 svn_revnum_t end, 1636 svn_boolean_t cross_copies, 1637 apr_pool_t *pool); 1638 1639 1640/** 1641 * Set @a *locations to be a mapping of the revisions to the paths of 1642 * the file @a fs_path present at the repository in revision 1643 * @a peg_revision, where the revisions are taken out of the array 1644 * @a location_revisions. 1645 * 1646 * @a location_revisions is an array of svn_revnum_t's and @a *locations 1647 * maps 'svn_revnum_t *' to 'const char *'. 1648 * 1649 * If optional @a authz_read_func is non-NULL, then use it (and @a 1650 * authz_read_baton) to verify that the peg-object is readable. If not, 1651 * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func 1652 * to check that every path returned in the hash is readable. If an 1653 * unreadable path is encountered, stop tracing and return 1654 * SVN_NO_ERROR. 1655 * 1656 * @a pool is used for all allocations. 1657 * 1658 * @since New in 1.1. 1659 */ 1660svn_error_t * 1661svn_repos_trace_node_locations(svn_fs_t *fs, 1662 apr_hash_t **locations, 1663 const char *fs_path, 1664 svn_revnum_t peg_revision, 1665 const apr_array_header_t *location_revisions, 1666 svn_repos_authz_func_t authz_read_func, 1667 void *authz_read_baton, 1668 apr_pool_t *pool); 1669 1670 1671/** 1672 * Call @a receiver and @a receiver_baton to report successive 1673 * location segments in revisions between @a start_rev and @a end_rev 1674 * (inclusive) for the line of history identified by the peg-object @a 1675 * path in @a peg_revision (and in @a repos). 1676 * 1677 * @a end_rev may be #SVN_INVALID_REVNUM to indicate that you want 1678 * to trace the history of the object to its origin. 1679 * 1680 * @a start_rev may be #SVN_INVALID_REVNUM to indicate "the HEAD 1681 * revision". Otherwise, @a start_rev must be younger than @a end_rev 1682 * (unless @a end_rev is #SVN_INVALID_REVNUM). 1683 * 1684 * @a peg_revision may be #SVN_INVALID_REVNUM to indicate "the HEAD 1685 * revision", and must evaluate to be at least as young as @a start_rev. 1686 * 1687 * If optional @a authz_read_func is not @c NULL, then use it (and @a 1688 * authz_read_baton) to verify that the peg-object is readable. If 1689 * not, return #SVN_ERR_AUTHZ_UNREADABLE. Also use the @a 1690 * authz_read_func to check that every path reported in a location 1691 * segment is readable. If an unreadable path is encountered, report 1692 * a final (possibly truncated) location segment (if any), stop 1693 * tracing history, and return #SVN_NO_ERROR. 1694 * 1695 * @a pool is used for all allocations. 1696 * 1697 * @since New in 1.5. 1698 */ 1699svn_error_t * 1700svn_repos_node_location_segments(svn_repos_t *repos, 1701 const char *path, 1702 svn_revnum_t peg_revision, 1703 svn_revnum_t start_rev, 1704 svn_revnum_t end_rev, 1705 svn_location_segment_receiver_t receiver, 1706 void *receiver_baton, 1707 svn_repos_authz_func_t authz_read_func, 1708 void *authz_read_baton, 1709 apr_pool_t *pool); 1710 1711 1712/* ### other queries we can do someday -- 1713 1714 * fetch the last revision created by <user> 1715 (once usernames become revision properties!) 1716 * fetch the last revision where <path> was modified 1717 1718*/ 1719 1720 1721 1722/* ---------------------------------------------------------------*/ 1723 1724/* Retrieving log messages. */ 1725 1726 1727/** 1728 * Invoke @a receiver with @a receiver_baton on each log message from 1729 * @a start to @a end in @a repos's filesystem. @a start may be greater 1730 * or less than @a end; this just controls whether the log messages are 1731 * processed in descending or ascending revision number order. 1732 * 1733 * If @a start or @a end is #SVN_INVALID_REVNUM, it defaults to youngest. 1734 * 1735 * If @a paths is non-NULL and has one or more elements, then only show 1736 * revisions in which at least one of @a paths was changed (i.e., if 1737 * file, text or props changed; if dir, props or entries changed or any node 1738 * changed below it). Each path is a <tt>const char *</tt> representing 1739 * an absolute path in the repository. If @a paths is NULL or empty, 1740 * show all revisions regardless of what paths were changed in those 1741 * revisions. 1742 * 1743 * If @a limit is non-zero then only invoke @a receiver on the first 1744 * @a limit logs. 1745 * 1746 * If @a discover_changed_paths, then each call to @a receiver passes a 1747 * hash mapping paths committed in that revision to information about them 1748 * as the receiver's @a changed_paths argument. 1749 * Otherwise, each call to @a receiver passes NULL for @a changed_paths. 1750 * 1751 * If @a strict_node_history is set, copy history (if any exists) will 1752 * not be traversed while harvesting revision logs for each path. 1753 * 1754 * If @a include_merged_revisions is set, log information for revisions 1755 * which have been merged to @a paths will also be returned, unless these 1756 * revisions are already part of @a start to @a end in @a repos's 1757 * filesystem, as limited by @a paths. In the latter case those revisions 1758 * are skipped and @a receiver is not invoked. 1759 * 1760 * If @a revprops is NULL, retrieve all revision properties; else, retrieve 1761 * only the revision properties named by the (const char *) array elements 1762 * (i.e. retrieve none if the array is empty). 1763 * 1764 * If any invocation of @a receiver returns error, return that error 1765 * immediately and without wrapping it. 1766 * 1767 * If @a start or @a end is a non-existent revision, return the error 1768 * #SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver. 1769 * 1770 * If optional @a authz_read_func is non-NULL, then use this function 1771 * (along with optional @a authz_read_baton) to check the readability 1772 * of each changed-path in each revision about to be "pushed" at 1773 * @a receiver. If a revision has some changed-paths readable and 1774 * others unreadable, unreadable paths are omitted from the 1775 * changed_paths field and only svn:author and svn:date will be 1776 * available in the revprops field. If a revision has no 1777 * changed-paths readable at all, then all paths are omitted and no 1778 * revprops are available. 1779 * 1780 * See also the documentation for #svn_log_entry_receiver_t. 1781 * 1782 * Use @a pool for temporary allocations. 1783 * 1784 * @since New in 1.5. 1785 */ 1786svn_error_t * 1787svn_repos_get_logs4(svn_repos_t *repos, 1788 const apr_array_header_t *paths, 1789 svn_revnum_t start, 1790 svn_revnum_t end, 1791 int limit, 1792 svn_boolean_t discover_changed_paths, 1793 svn_boolean_t strict_node_history, 1794 svn_boolean_t include_merged_revisions, 1795 const apr_array_header_t *revprops, 1796 svn_repos_authz_func_t authz_read_func, 1797 void *authz_read_baton, 1798 svn_log_entry_receiver_t receiver, 1799 void *receiver_baton, 1800 apr_pool_t *pool); 1801 1802/** 1803 * Same as svn_repos_get_logs4(), but with @a receiver being 1804 * #svn_log_message_receiver_t instead of #svn_log_entry_receiver_t. 1805 * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is 1806 * svn:author, svn:date, and svn:log. If @a paths is empty, nothing 1807 * is returned. 1808 * 1809 * @since New in 1.2. 1810 * @deprecated Provided for backward compatibility with the 1.4 API. 1811 */ 1812SVN_DEPRECATED 1813svn_error_t * 1814svn_repos_get_logs3(svn_repos_t *repos, 1815 const apr_array_header_t *paths, 1816 svn_revnum_t start, 1817 svn_revnum_t end, 1818 int limit, 1819 svn_boolean_t discover_changed_paths, 1820 svn_boolean_t strict_node_history, 1821 svn_repos_authz_func_t authz_read_func, 1822 void *authz_read_baton, 1823 svn_log_message_receiver_t receiver, 1824 void *receiver_baton, 1825 apr_pool_t *pool); 1826 1827 1828/** 1829 * Same as svn_repos_get_logs3(), but with @a limit always set to 0. 1830 * 1831 * @deprecated Provided for backward compatibility with the 1.1 API. 1832 */ 1833SVN_DEPRECATED 1834svn_error_t * 1835svn_repos_get_logs2(svn_repos_t *repos, 1836 const apr_array_header_t *paths, 1837 svn_revnum_t start, 1838 svn_revnum_t end, 1839 svn_boolean_t discover_changed_paths, 1840 svn_boolean_t strict_node_history, 1841 svn_repos_authz_func_t authz_read_func, 1842 void *authz_read_baton, 1843 svn_log_message_receiver_t receiver, 1844 void *receiver_baton, 1845 apr_pool_t *pool); 1846 1847/** 1848 * Same as svn_repos_get_logs2(), but with @a authz_read_func and 1849 * @a authz_read_baton always set to NULL. 1850 * 1851 * @deprecated Provided for backward compatibility with the 1.0 API. 1852 */ 1853SVN_DEPRECATED 1854svn_error_t * 1855svn_repos_get_logs(svn_repos_t *repos, 1856 const apr_array_header_t *paths, 1857 svn_revnum_t start, 1858 svn_revnum_t end, 1859 svn_boolean_t discover_changed_paths, 1860 svn_boolean_t strict_node_history, 1861 svn_log_message_receiver_t receiver, 1862 void *receiver_baton, 1863 apr_pool_t *pool); 1864 1865 1866 1867/* ---------------------------------------------------------------*/ 1868 1869/* Retrieving mergeinfo. */ 1870 1871/** 1872 * Fetch the mergeinfo for @a paths at @a revision in @a repos, and 1873 * set @a *catalog to a catalog of this mergeinfo. @a *catalog will 1874 * never be @c NULL but may be empty. 1875 * 1876 * The paths in @a paths, and the keys of @a catalog, start with '/'. 1877 * 1878 * @a inherit indicates whether explicit, explicit or inherited, or 1879 * only inherited mergeinfo for @a paths is fetched. 1880 * 1881 * If @a revision is #SVN_INVALID_REVNUM, it defaults to youngest. 1882 * 1883 * If @a include_descendants is TRUE, then additionally return the 1884 * mergeinfo for any descendant of any element of @a paths which has 1885 * the #SVN_PROP_MERGEINFO property explicitly set on it. (Note 1886 * that inheritance is only taken into account for the elements in @a 1887 * paths; descendants of the elements in @a paths which get their 1888 * mergeinfo via inheritance are not included in @a *catalog.) 1889 * 1890 * If optional @a authz_read_func is non-NULL, then use this function 1891 * (along with optional @a authz_read_baton) to check the readability 1892 * of each path which mergeinfo was requested for (from @a paths). 1893 * Silently omit unreadable paths from the request for mergeinfo. 1894 * 1895 * Use @a pool for all allocations. 1896 * 1897 * @since New in 1.5. 1898 */ 1899svn_error_t * 1900svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog, 1901 svn_repos_t *repos, 1902 const apr_array_header_t *paths, 1903 svn_revnum_t revision, 1904 svn_mergeinfo_inheritance_t inherit, 1905 svn_boolean_t include_descendants, 1906 svn_repos_authz_func_t authz_read_func, 1907 void *authz_read_baton, 1908 apr_pool_t *pool); 1909 1910 1911/* ---------------------------------------------------------------*/ 1912 1913/* Retrieving multiple revisions of a file. */ 1914 1915/** 1916 * Retrieve a subset of the interesting revisions of a file @a path in 1917 * @a repos as seen in revision @a end. Invoke @a handler with 1918 * @a handler_baton as its first argument for each such revision. 1919 * @a pool is used for all allocations. See svn_fs_history_prev() for 1920 * a discussion of interesting revisions. 1921 * 1922 * If optional @a authz_read_func is non-NULL, then use this function 1923 * (along with optional @a authz_read_baton) to check the readability 1924 * of the rev-path in each interesting revision encountered. 1925 * 1926 * Revision discovery happens from @a end to @a start, and if an 1927 * unreadable revision is encountered before @a start is reached, then 1928 * revision discovery stops and only the revisions from @a end to the 1929 * oldest readable revision are returned (So it will appear that @a 1930 * path was added without history in the latter revision). 1931 * 1932 * If there is an interesting revision of the file that is less than or 1933 * equal to start, the iteration will start at that revision. Else, the 1934 * iteration will start at the first revision of the file in the repository, 1935 * which has to be less than or equal to end. Note that if the function 1936 * succeeds, @a handler will have been called at least once. 1937 * 1938 * In a series of calls, the file contents for the first interesting revision 1939 * will be provided as a text delta against the empty file. In the following 1940 * calls, the delta will be against the contents for the previous call. 1941 * 1942 * If @a include_merged_revisions is TRUE, revisions which a included as a 1943 * result of a merge between @a start and @a end will be included. 1944 * 1945 * Since Subversion 1.8 this function has been enabled to support reversion 1946 * the revision range for @a include_merged_revision @c FALSE reporting by 1947 * switching @a start with @a end. 1948 * 1949 * @since New in 1.5. 1950 */ 1951svn_error_t * 1952svn_repos_get_file_revs2(svn_repos_t *repos, 1953 const char *path, 1954 svn_revnum_t start, 1955 svn_revnum_t end, 1956 svn_boolean_t include_merged_revisions, 1957 svn_repos_authz_func_t authz_read_func, 1958 void *authz_read_baton, 1959 svn_file_rev_handler_t handler, 1960 void *handler_baton, 1961 apr_pool_t *pool); 1962 1963/** 1964 * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions 1965 * set to FALSE. 1966 * 1967 * @deprecated Provided for backward compatibility with the 1.4 API. 1968 * @since New in 1.1. 1969 */ 1970SVN_DEPRECATED 1971svn_error_t * 1972svn_repos_get_file_revs(svn_repos_t *repos, 1973 const char *path, 1974 svn_revnum_t start, 1975 svn_revnum_t end, 1976 svn_repos_authz_func_t authz_read_func, 1977 void *authz_read_baton, 1978 svn_repos_file_rev_handler_t handler, 1979 void *handler_baton, 1980 apr_pool_t *pool); 1981 1982 1983/* ---------------------------------------------------------------*/ 1984 1985/** 1986 * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \ 1987 * routines. 1988 * @{ 1989 */ 1990 1991/** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and 1992 * post-commit hooks around the commit. Use @a pool for any necessary 1993 * allocations. 1994 * 1995 * If the pre-commit hook fails, do not attempt to commit the 1996 * transaction and throw the original error to the caller. 1997 * 1998 * A successful commit is indicated by a valid revision value in @a 1999 * *new_rev, not if svn_fs_commit_txn() returns an error, which can 2000 * occur during its post commit FS processing. If the transaction was 2001 * not committed, then return the associated error and do not execute 2002 * the post-commit hook. 2003 * 2004 * If the commit succeeds the post-commit hook is executed. If the 2005 * post-commit hook returns an error, always wrap it with 2006 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to 2007 * find the post-commit hook error in the returned error chain. If 2008 * both svn_fs_commit_txn() and the post-commit hook return errors, 2009 * then svn_fs_commit_txn()'s error is the parent error and the 2010 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child 2011 * error. 2012 * 2013 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn(). 2014 */ 2015svn_error_t * 2016svn_repos_fs_commit_txn(const char **conflict_p, 2017 svn_repos_t *repos, 2018 svn_revnum_t *new_rev, 2019 svn_fs_txn_t *txn, 2020 apr_pool_t *pool); 2021 2022/** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping 2023 * <tt>const char *</tt> property names to #svn_string_t values, to 2024 * set the properties on transaction @a *txn_p. @a repos is the 2025 * repository object which contains the filesystem. @a rev, @a 2026 * *txn_p, and @a pool are as in svn_fs_begin_txn(). 2027 * 2028 * Before a txn is created, the repository's start-commit hooks are 2029 * run; if any of them fail, no txn is created, @a *txn_p is unaffected, 2030 * and #SVN_ERR_REPOS_HOOK_FAILURE is returned. 2031 * 2032 * @note @a revprop_table may contain an #SVN_PROP_REVISION_DATE property, 2033 * which will be set on the transaction, but that will be overwritten 2034 * when the transaction is committed. 2035 * 2036 * @since New in 1.5. 2037 */ 2038svn_error_t * 2039svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p, 2040 svn_repos_t *repos, 2041 svn_revnum_t rev, 2042 apr_hash_t *revprop_table, 2043 apr_pool_t *pool); 2044 2045 2046/** 2047 * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table 2048 * set to a hash containing @a author and @a log_msg as the 2049 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties, 2050 * respectively. @a author and @a log_msg may both be @c NULL. 2051 * 2052 * @deprecated Provided for backward compatibility with the 1.4 API. 2053 */ 2054SVN_DEPRECATED 2055svn_error_t * 2056svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p, 2057 svn_repos_t *repos, 2058 svn_revnum_t rev, 2059 const char *author, 2060 const char *log_msg, 2061 apr_pool_t *pool); 2062 2063 2064/** Like svn_fs_begin_txn(), but use @a author to set the corresponding 2065 * property on transaction @a *txn_p. @a repos is the repository object 2066 * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in 2067 * svn_fs_begin_txn(). 2068 * 2069 * ### Someday: before a txn is created, some kind of read-hook could 2070 * be called here. 2071 * 2072 * @note This function was never fully implemented, nor used. Ignore it. 2073 * @deprecated Provided for backward compatibility with the 1.7 API. 2074 */ 2075SVN_DEPRECATED 2076svn_error_t * 2077svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p, 2078 svn_repos_t *repos, 2079 svn_revnum_t rev, 2080 const char *author, 2081 apr_pool_t *pool); 2082 2083 2084/** @} */ 2085 2086/** @defgroup svn_repos_fs_locks Repository lock wrappers 2087 * @{ 2088 */ 2089 2090/** Like svn_fs_lock(), but invoke the @a repos's pre- and 2091 * post-lock hooks before and after the locking action. Use @a pool 2092 * for any necessary allocations. 2093 * 2094 * If the pre-lock hook or svn_fs_lock() fails, throw the original 2095 * error to caller. If an error occurs when running the post-lock 2096 * hook, return the original error wrapped with 2097 * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the caller sees this 2098 * error, it knows that the lock succeeded anyway. 2099 * 2100 * The pre-lock hook may cause a different token to be used for the 2101 * lock, instead of @a token; see the pre-lock-hook documentation for 2102 * more. 2103 * 2104 * @since New in 1.2. 2105 */ 2106svn_error_t * 2107svn_repos_fs_lock(svn_lock_t **lock, 2108 svn_repos_t *repos, 2109 const char *path, 2110 const char *token, 2111 const char *comment, 2112 svn_boolean_t is_dav_comment, 2113 apr_time_t expiration_date, 2114 svn_revnum_t current_rev, 2115 svn_boolean_t steal_lock, 2116 apr_pool_t *pool); 2117 2118 2119/** Like svn_fs_unlock(), but invoke the @a repos's pre- and 2120 * post-unlock hooks before and after the unlocking action. Use @a 2121 * pool for any necessary allocations. 2122 * 2123 * If the pre-unlock hook or svn_fs_unlock() fails, throw the original 2124 * error to caller. If an error occurs when running the post-unlock 2125 * hook, return the original error wrapped with 2126 * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. If the caller sees this 2127 * error, it knows that the unlock succeeded anyway. 2128 * 2129 * @since New in 1.2. 2130 */ 2131svn_error_t * 2132svn_repos_fs_unlock(svn_repos_t *repos, 2133 const char *path, 2134 const char *token, 2135 svn_boolean_t break_lock, 2136 apr_pool_t *pool); 2137 2138 2139 2140/** Look up all the locks in and under @a path in @a repos, setting @a 2141 * *locks to a hash which maps <tt>const char *</tt> paths to the 2142 * #svn_lock_t locks associated with those paths. Use @a 2143 * authz_read_func and @a authz_read_baton to "screen" all returned 2144 * locks. That is: do not return any locks on any paths that are 2145 * unreadable in HEAD, just silently omit them. 2146 * 2147 * @a depth limits the returned locks to those associated with paths 2148 * within the specified depth of @a path, and must be one of the 2149 * following values: #svn_depth_empty, #svn_depth_files, 2150 * #svn_depth_immediates, or #svn_depth_infinity. 2151 * 2152 * @since New in 1.7. 2153 */ 2154svn_error_t * 2155svn_repos_fs_get_locks2(apr_hash_t **locks, 2156 svn_repos_t *repos, 2157 const char *path, 2158 svn_depth_t depth, 2159 svn_repos_authz_func_t authz_read_func, 2160 void *authz_read_baton, 2161 apr_pool_t *pool); 2162 2163/** 2164 * Similar to svn_repos_fs_get_locks2(), but with @a depth always 2165 * passed as svn_depth_infinity. 2166 * 2167 * @since New in 1.2. 2168 * @deprecated Provided for backward compatibility with the 1.6 API. 2169 */ 2170SVN_DEPRECATED 2171svn_error_t * 2172svn_repos_fs_get_locks(apr_hash_t **locks, 2173 svn_repos_t *repos, 2174 const char *path, 2175 svn_repos_authz_func_t authz_read_func, 2176 void *authz_read_baton, 2177 apr_pool_t *pool); 2178 2179/** @} */ 2180 2181/** 2182 * Like svn_fs_change_rev_prop2(), but validate the name and value of the 2183 * property and invoke the @a repos's pre- and post-revprop-change hooks 2184 * around the change as specified by @a use_pre_revprop_change_hook and 2185 * @a use_post_revprop_change_hook (respectively). 2186 * 2187 * @a rev is the revision whose property to change, @a name is the 2188 * name of the property, and @a new_value is the new value of the 2189 * property. If @a old_value_p is not @c NULL, then @a *old_value_p 2190 * is the expected current (preexisting) value of the property (or @c NULL 2191 * for "unset"). @a author is the authenticated username of the person 2192 * changing the property value, or NULL if not available. 2193 * 2194 * If @a authz_read_func is non-NULL, then use it (with @a 2195 * authz_read_baton) to validate the changed-paths associated with @a 2196 * rev. If the revision contains any unreadable changed paths, then 2197 * return #SVN_ERR_AUTHZ_UNREADABLE. 2198 * 2199 * Validate @a name and @a new_value like the same way 2200 * svn_repos_fs_change_node_prop() does. 2201 * 2202 * Use @a pool for temporary allocations. 2203 * 2204 * @since New in 1.7. 2205 */ 2206svn_error_t * 2207svn_repos_fs_change_rev_prop4(svn_repos_t *repos, 2208 svn_revnum_t rev, 2209 const char *author, 2210 const char *name, 2211 const svn_string_t *const *old_value_p, 2212 const svn_string_t *new_value, 2213 svn_boolean_t 2214 use_pre_revprop_change_hook, 2215 svn_boolean_t 2216 use_post_revprop_change_hook, 2217 svn_repos_authz_func_t 2218 authz_read_func, 2219 void *authz_read_baton, 2220 apr_pool_t *pool); 2221 2222/** 2223 * Similar to svn_repos_fs_change_rev_prop4(), but with @a old_value_p always 2224 * set to @c NULL. (In other words, it is similar to 2225 * svn_fs_change_rev_prop().) 2226 * 2227 * @deprecated Provided for backward compatibility with the 1.6 API. 2228 * @since New in 1.5. 2229 */ 2230SVN_DEPRECATED 2231svn_error_t * 2232svn_repos_fs_change_rev_prop3(svn_repos_t *repos, 2233 svn_revnum_t rev, 2234 const char *author, 2235 const char *name, 2236 const svn_string_t *new_value, 2237 svn_boolean_t 2238 use_pre_revprop_change_hook, 2239 svn_boolean_t 2240 use_post_revprop_change_hook, 2241 svn_repos_authz_func_t 2242 authz_read_func, 2243 void *authz_read_baton, 2244 apr_pool_t *pool); 2245 2246/** 2247 * Similar to svn_repos_fs_change_rev_prop3(), but with the @a 2248 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook 2249 * always set to @c TRUE. 2250 * 2251 * @deprecated Provided for backward compatibility with the 1.4 API. 2252 */ 2253SVN_DEPRECATED 2254svn_error_t * 2255svn_repos_fs_change_rev_prop2(svn_repos_t *repos, 2256 svn_revnum_t rev, 2257 const char *author, 2258 const char *name, 2259 const svn_string_t *new_value, 2260 svn_repos_authz_func_t 2261 authz_read_func, 2262 void *authz_read_baton, 2263 apr_pool_t *pool); 2264 2265/** 2266 * Similar to svn_repos_fs_change_rev_prop2(), but with the 2267 * @a authz_read_func parameter always NULL. 2268 * 2269 * @deprecated Provided for backward compatibility with the 1.0 API. 2270 */ 2271SVN_DEPRECATED 2272svn_error_t * 2273svn_repos_fs_change_rev_prop(svn_repos_t *repos, 2274 svn_revnum_t rev, 2275 const char *author, 2276 const char *name, 2277 const svn_string_t *new_value, 2278 apr_pool_t *pool); 2279 2280 2281 2282/** 2283 * Set @a *value_p to the value of the property named @a propname on 2284 * revision @a rev in the filesystem opened in @a repos. If @a rev 2285 * has no property by that name, set @a *value_p to zero. Allocate 2286 * the result in @a pool. 2287 * 2288 * If @a authz_read_func is non-NULL, then use it (with @a 2289 * authz_read_baton) to validate the changed-paths associated with @a 2290 * rev. If the changed-paths are all unreadable, then set @a *value_p 2291 * to zero unconditionally. If only some of the changed-paths are 2292 * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be 2293 * fetched, but return 0 for any other property. 2294 * 2295 * @since New in 1.1. 2296 */ 2297svn_error_t * 2298svn_repos_fs_revision_prop(svn_string_t **value_p, 2299 svn_repos_t *repos, 2300 svn_revnum_t rev, 2301 const char *propname, 2302 svn_repos_authz_func_t 2303 authz_read_func, 2304 void *authz_read_baton, 2305 apr_pool_t *pool); 2306 2307 2308/** 2309 * Set @a *table_p to the entire property list of revision @a rev in 2310 * filesystem opened in @a repos, as a hash table allocated in @a 2311 * pool. The table maps <tt>char *</tt> property names to 2312 * #svn_string_t * values; the names and values are allocated in @a 2313 * pool. 2314 * 2315 * If @a authz_read_func is non-NULL, then use it (with @a 2316 * authz_read_baton) to validate the changed-paths associated with @a 2317 * rev. If the changed-paths are all unreadable, then return an empty 2318 * hash. If only some of the changed-paths are unreadable, then return 2319 * an empty hash, except for 'svn:author' and 'svn:date' properties 2320 * (assuming those properties exist). 2321 * 2322 * @since New in 1.1. 2323 */ 2324svn_error_t * 2325svn_repos_fs_revision_proplist(apr_hash_t **table_p, 2326 svn_repos_t *repos, 2327 svn_revnum_t rev, 2328 svn_repos_authz_func_t 2329 authz_read_func, 2330 void *authz_read_baton, 2331 apr_pool_t *pool); 2332 2333 2334 2335/* ---------------------------------------------------------------*/ 2336 2337/* Prop-changing wrappers for libsvn_fs routines. */ 2338 2339/* NOTE: svn_repos_fs_change_rev_prop() also exists, but is located 2340 above with the hook-related functions. */ 2341 2342 2343/** Validating wrapper for svn_fs_change_node_prop() (which see for 2344 * argument descriptions). 2345 * 2346 * If @a name's kind is not #svn_prop_regular_kind, return 2347 * #SVN_ERR_REPOS_BAD_ARGS. If @a name is an "svn:" property, validate its 2348 * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the 2349 * property. 2350 * 2351 * @note Currently, the only properties validated are the "svn:" properties 2352 * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. This may change 2353 * in future releases. 2354 */ 2355svn_error_t * 2356svn_repos_fs_change_node_prop(svn_fs_root_t *root, 2357 const char *path, 2358 const char *name, 2359 const svn_string_t *value, 2360 apr_pool_t *pool); 2361 2362/** Validating wrapper for svn_fs_change_txn_prop() (which see for 2363 * argument descriptions). See svn_repos_fs_change_txn_props() for more 2364 * information. 2365 */ 2366svn_error_t * 2367svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn, 2368 const char *name, 2369 const svn_string_t *value, 2370 apr_pool_t *pool); 2371 2372/** Validating wrapper for svn_fs_change_txn_props() (which see for 2373 * argument descriptions). Validate properties and their values the 2374 * same way svn_repos_fs_change_node_prop() does. 2375 * 2376 * @since New in 1.5. 2377 */ 2378svn_error_t * 2379svn_repos_fs_change_txn_props(svn_fs_txn_t *txn, 2380 const apr_array_header_t *props, 2381 apr_pool_t *pool); 2382 2383 2384/* ---------------------------------------------------------------*/ 2385 2386/** 2387 * @defgroup svn_repos_inspection Data structures and editor things for \ 2388 * repository inspection. 2389 * @{ 2390 * 2391 * As it turns out, the svn_repos_replay2(), svn_repos_dir_delta2() and 2392 * svn_repos_begin_report3() interfaces can be extremely useful for 2393 * examining the repository, or more exactly, changes to the repository. 2394 * These drivers allows for differences between two trees to be 2395 * described using an editor. 2396 * 2397 * By using the editor obtained from svn_repos_node_editor() with one of 2398 * the drivers mentioned above, the description of how to transform one 2399 * tree into another can be used to build an in-memory linked-list tree, 2400 * which each node representing a repository node that was changed. 2401 */ 2402 2403/** A node in the repository. */ 2404typedef struct svn_repos_node_t 2405{ 2406 /** Node type (file, dir, etc.) */ 2407 svn_node_kind_t kind; 2408 2409 /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */ 2410 char action; 2411 2412 /** Were there any textual mods? (files only) */ 2413 svn_boolean_t text_mod; 2414 2415 /** Where there any property mods? */ 2416 svn_boolean_t prop_mod; 2417 2418 /** The name of this node as it appears in its parent's entries list */ 2419 const char *name; 2420 2421 /** The filesystem revision where this was copied from (if any) */ 2422 svn_revnum_t copyfrom_rev; 2423 2424 /** The filesystem path where this was copied from (if any) */ 2425 const char *copyfrom_path; 2426 2427 /** Pointer to the next sibling of this node */ 2428 struct svn_repos_node_t *sibling; 2429 2430 /** Pointer to the first child of this node */ 2431 struct svn_repos_node_t *child; 2432 2433 /** Pointer to the parent of this node */ 2434 struct svn_repos_node_t *parent; 2435 2436} svn_repos_node_t; 2437 2438 2439/** Set @a *editor and @a *edit_baton to an editor that, when driven by 2440 * a driver such as svn_repos_replay2(), builds an <tt>svn_repos_node_t *</tt> 2441 * tree representing the delta from @a base_root to @a root in @a 2442 * repos's filesystem. 2443 * 2444 * The editor can also be driven by svn_repos_dir_delta2() or 2445 * svn_repos_begin_report3(), but unless you have special needs, 2446 * svn_repos_replay2() is preferred. 2447 * 2448 * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root 2449 * node afterwards. 2450 * 2451 * Note that the delta includes "bubbled-up" directories; that is, 2452 * many of the directory nodes will have no prop_mods. 2453 * 2454 * Allocate the tree and its contents in @a node_pool; do all other 2455 * allocation in @a pool. 2456 */ 2457svn_error_t * 2458svn_repos_node_editor(const svn_delta_editor_t **editor, 2459 void **edit_baton, 2460 svn_repos_t *repos, 2461 svn_fs_root_t *base_root, 2462 svn_fs_root_t *root, 2463 apr_pool_t *node_pool, 2464 apr_pool_t *pool); 2465 2466/** Return the root node of the linked-list tree generated by driving the 2467 * editor (associated with @a edit_baton) created by svn_repos_node_editor(). 2468 * This is only really useful if used *after* the editor drive is completed. 2469 */ 2470svn_repos_node_t * 2471svn_repos_node_from_baton(void *edit_baton); 2472 2473/** @} */ 2474 2475/* ---------------------------------------------------------------*/ 2476 2477/** 2478 * @defgroup svn_repos_dump_load Dumping and loading filesystem data 2479 * @{ 2480 * 2481 * The filesystem 'dump' format contains nothing but the abstract 2482 * structure of the filesystem -- independent of any internal node-id 2483 * schema or database back-end. All of the data in the dumpfile is 2484 * acquired by public function calls into svn_fs.h. Similarly, the 2485 * parser which reads the dumpfile is able to reconstruct the 2486 * filesystem using only public svn_fs.h routines. 2487 * 2488 * Thus the dump/load feature's main purpose is for *migrating* data 2489 * from one svn filesystem to another -- presumably two filesystems 2490 * which have different internal implementations. 2491 * 2492 * If you simply want to backup your filesystem, you're probably 2493 * better off using the built-in facilities of the DB backend (using 2494 * Berkeley DB's hot-backup feature, for example.) 2495 * 2496 * For a description of the dumpfile format, see 2497 * /trunk/notes/fs_dumprestore.txt. 2498 */ 2499 2500/* The RFC822-style headers in our dumpfile format. */ 2501#define SVN_REPOS_DUMPFILE_MAGIC_HEADER "SVN-fs-dump-format-version" 2502#define SVN_REPOS_DUMPFILE_FORMAT_VERSION 3 2503#define SVN_REPOS_DUMPFILE_FORMAT_VERSION_DELTAS 3 2504#define SVN_REPOS_DUMPFILE_UUID "UUID" 2505#define SVN_REPOS_DUMPFILE_CONTENT_LENGTH "Content-length" 2506 2507#define SVN_REPOS_DUMPFILE_REVISION_NUMBER "Revision-number" 2508 2509#define SVN_REPOS_DUMPFILE_NODE_PATH "Node-path" 2510#define SVN_REPOS_DUMPFILE_NODE_KIND "Node-kind" 2511#define SVN_REPOS_DUMPFILE_NODE_ACTION "Node-action" 2512#define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH "Node-copyfrom-path" 2513#define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV "Node-copyfrom-rev" 2514/** @since New in 1.6. */ 2515#define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 "Text-copy-source-md5" 2516/** @since New in 1.6. */ 2517#define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1 "Text-copy-source-sha1" 2518#define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \ 2519 SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 2520/** @since New in 1.6. */ 2521#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 "Text-content-md5" 2522/** @since New in 1.6. */ 2523#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1 "Text-content-sha1" 2524#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM \ 2525 SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 2526 2527#define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH "Prop-content-length" 2528#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH "Text-content-length" 2529 2530/** @since New in 1.1. */ 2531#define SVN_REPOS_DUMPFILE_PROP_DELTA "Prop-delta" 2532/** @since New in 1.1. */ 2533#define SVN_REPOS_DUMPFILE_TEXT_DELTA "Text-delta" 2534/** @since New in 1.6. */ 2535#define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 "Text-delta-base-md5" 2536/** @since New in 1.6. */ 2537#define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1 "Text-delta-base-sha1" 2538/** @since New in 1.5. */ 2539#define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM \ 2540 SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 2541 2542/** 2543 * Verify the contents of the file system in @a repos. 2544 * 2545 * If @a feedback_stream is not @c NULL, write feedback to it (lines of 2546 * the form "* Verified revision %ld\n"). 2547 * 2548 * If @a start_rev is #SVN_INVALID_REVNUM, then start verifying at 2549 * revision 0. If @a end_rev is #SVN_INVALID_REVNUM, then verify 2550 * through the @c HEAD revision. 2551 * 2552 * For every verified revision call @a notify_func with @a rev set to 2553 * the verified revision and @a warning_text @c NULL. For warnings call @a 2554 * notify_func with @a warning_text set. 2555 * 2556 * If @a cancel_func is not @c NULL, call it periodically with @a 2557 * cancel_baton as argument to see if the caller wishes to cancel the 2558 * verification. 2559 * 2560 * @since New in 1.7. 2561 */ 2562svn_error_t * 2563svn_repos_verify_fs2(svn_repos_t *repos, 2564 svn_revnum_t start_rev, 2565 svn_revnum_t end_rev, 2566 svn_repos_notify_func_t notify_func, 2567 void *notify_baton, 2568 svn_cancel_func_t cancel, 2569 void *cancel_baton, 2570 apr_pool_t *scratch_pool); 2571 2572/** 2573 * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of 2574 * handling feedback via the notify_func handler 2575 * 2576 * @since New in 1.5. 2577 * @deprecated Provided for backward compatibility with the 1.6 API. 2578 */ 2579SVN_DEPRECATED 2580svn_error_t * 2581svn_repos_verify_fs(svn_repos_t *repos, 2582 svn_stream_t *feedback_stream, 2583 svn_revnum_t start_rev, 2584 svn_revnum_t end_rev, 2585 svn_cancel_func_t cancel_func, 2586 void *cancel_baton, 2587 apr_pool_t *pool); 2588 2589/** 2590 * Dump the contents of the filesystem within already-open @a repos into 2591 * writable @a dumpstream. Begin at revision @a start_rev, and dump every 2592 * revision up through @a end_rev. Use @a pool for all allocation. If 2593 * non-@c NULL, send feedback to @a feedback_stream. If @a dumpstream is 2594 * @c NULL, this is effectively a primitive verify. It is not complete, 2595 * however; svn_repos_verify_fs2() and svn_fs_verify(). 2596 * 2597 * If @a start_rev is #SVN_INVALID_REVNUM, then start dumping at revision 2598 * 0. If @a end_rev is #SVN_INVALID_REVNUM, then dump through the @c HEAD 2599 * revision. 2600 * 2601 * If @a incremental is @c TRUE, the first revision dumped will be a diff 2602 * against the previous revision (usually it looks like a full dump of 2603 * the tree). 2604 * 2605 * If @a use_deltas is @c TRUE, output only node properties which have 2606 * changed relative to the previous contents, and output text contents 2607 * as svndiff data against the previous contents. Regardless of how 2608 * this flag is set, the first revision of a non-incremental dump will 2609 * be done with full plain text. A dump with @a use_deltas set cannot 2610 * be loaded by Subversion 1.0.x. 2611 * 2612 * If @a notify_func is not @c NULL, then for every dumped revision call 2613 * @a notify_func with @a rev set to the dumped revision and @a warning_text 2614 * @c NULL. For warnings call @a notify_func with @a warning_text. 2615 * 2616 * If @a cancel_func is not @c NULL, it is called periodically with 2617 * @a cancel_baton as argument to see if the client wishes to cancel 2618 * the dump. 2619 * 2620 * @since New in 1.7. 2621 */ 2622svn_error_t * 2623svn_repos_dump_fs3(svn_repos_t *repos, 2624 svn_stream_t *dumpstream, 2625 svn_revnum_t start_rev, 2626 svn_revnum_t end_rev, 2627 svn_boolean_t incremental, 2628 svn_boolean_t use_deltas, 2629 svn_repos_notify_func_t notify_func, 2630 void *notify_baton, 2631 svn_cancel_func_t cancel_func, 2632 void *cancel_baton, 2633 apr_pool_t *scratch_pool); 2634 2635/** 2636 * Similar to svn_repos_dump_fs3(), but with a feedback_stream instead of 2637 * handling feedback via the notify_func handler 2638 * 2639 * @since New in 1.1. 2640 * @deprecated Provided for backward compatibility with the 1.6 API. 2641 */ 2642SVN_DEPRECATED 2643svn_error_t * 2644svn_repos_dump_fs2(svn_repos_t *repos, 2645 svn_stream_t *dumpstream, 2646 svn_stream_t *feedback_stream, 2647 svn_revnum_t start_rev, 2648 svn_revnum_t end_rev, 2649 svn_boolean_t incremental, 2650 svn_boolean_t use_deltas, 2651 svn_cancel_func_t cancel_func, 2652 void *cancel_baton, 2653 apr_pool_t *pool); 2654 2655/** 2656 * Similar to svn_repos_dump_fs2(), but with the @a use_deltas 2657 * parameter always set to @c FALSE. 2658 * 2659 * @deprecated Provided for backward compatibility with the 1.0 API. 2660 */ 2661SVN_DEPRECATED 2662svn_error_t * 2663svn_repos_dump_fs(svn_repos_t *repos, 2664 svn_stream_t *dumpstream, 2665 svn_stream_t *feedback_stream, 2666 svn_revnum_t start_rev, 2667 svn_revnum_t end_rev, 2668 svn_boolean_t incremental, 2669 svn_cancel_func_t cancel_func, 2670 void *cancel_baton, 2671 apr_pool_t *pool); 2672 2673 2674/** 2675 * Read and parse dumpfile-formatted @a dumpstream, reconstructing 2676 * filesystem revisions in already-open @a repos, handling uuids in 2677 * accordance with @a uuid_action. Use @a pool for all allocation. 2678 * 2679 * If the dumpstream contains copy history that is unavailable in the 2680 * repository, an error will be thrown. 2681 * 2682 * The repository's UUID will be updated iff 2683 * the dumpstream contains a UUID and 2684 * @a uuid_action is not equal to #svn_repos_load_uuid_ignore and 2685 * either the repository contains no revisions or 2686 * @a uuid_action is equal to #svn_repos_load_uuid_force. 2687 * 2688 * If the dumpstream contains no UUID, then @a uuid_action is 2689 * ignored and the repository UUID is not touched. 2690 * 2691 * @a start_rev and @a end_rev act as filters, the lower and upper 2692 * (inclusive) range values of revisions in @a dumpstream which will 2693 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 2694 * which case no revision-based filtering occurs at all), or both are 2695 * valid revisions (where @a start_rev is older than or equivalent to 2696 * @a end_rev). 2697 * 2698 * If @a parent_dir is not NULL, then the parser will reparent all the 2699 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 2700 * must be an existing directory in the repository. 2701 * 2702 * If @a use_pre_commit_hook is set, call the repository's pre-commit 2703 * hook before committing each loaded revision. 2704 * 2705 * If @a use_post_commit_hook is set, call the repository's 2706 * post-commit hook after committing each loaded revision. 2707 * 2708 * If @a validate_props is set, then validate Subversion revision and 2709 * node properties (those in the svn: namespace) against established 2710 * rules for those things. 2711 * 2712 * If non-NULL, use @a notify_func and @a notify_baton to send notification 2713 * of events to the caller. 2714 * 2715 * If @a cancel_func is not @c NULL, it is called periodically with 2716 * @a cancel_baton as argument to see if the client wishes to cancel 2717 * the load. 2718 * 2719 * @since New in 1.8. 2720 */ 2721svn_error_t * 2722svn_repos_load_fs4(svn_repos_t *repos, 2723 svn_stream_t *dumpstream, 2724 svn_revnum_t start_rev, 2725 svn_revnum_t end_rev, 2726 enum svn_repos_load_uuid uuid_action, 2727 const char *parent_dir, 2728 svn_boolean_t use_pre_commit_hook, 2729 svn_boolean_t use_post_commit_hook, 2730 svn_boolean_t validate_props, 2731 svn_repos_notify_func_t notify_func, 2732 void *notify_baton, 2733 svn_cancel_func_t cancel_func, 2734 void *cancel_baton, 2735 apr_pool_t *pool); 2736 2737/** Similar to svn_repos_load_fs4(), but with @a start_rev and @a 2738 * end_rev always passed as #SVN_INVALID_REVNUM. 2739 * 2740 * @since New in 1.7. 2741 * @deprecated Provided for backward compatibility with the 1.7 API. 2742 */ 2743SVN_DEPRECATED 2744svn_error_t * 2745svn_repos_load_fs3(svn_repos_t *repos, 2746 svn_stream_t *dumpstream, 2747 enum svn_repos_load_uuid uuid_action, 2748 const char *parent_dir, 2749 svn_boolean_t use_pre_commit_hook, 2750 svn_boolean_t use_post_commit_hook, 2751 svn_boolean_t validate_props, 2752 svn_repos_notify_func_t notify_func, 2753 void *notify_baton, 2754 svn_cancel_func_t cancel_func, 2755 void *cancel_baton, 2756 apr_pool_t *pool); 2757 2758/** 2759 * Similar to svn_repos_load_fs3(), but with @a feedback_stream in 2760 * place of the #svn_repos_notify_func_t and baton and with 2761 * @a validate_props always FALSE. 2762 * 2763 * @since New in 1.2. 2764 * @deprecated Provided for backward compatibility with the 1.6 API. 2765 */ 2766SVN_DEPRECATED 2767svn_error_t * 2768svn_repos_load_fs2(svn_repos_t *repos, 2769 svn_stream_t *dumpstream, 2770 svn_stream_t *feedback_stream, 2771 enum svn_repos_load_uuid uuid_action, 2772 const char *parent_dir, 2773 svn_boolean_t use_pre_commit_hook, 2774 svn_boolean_t use_post_commit_hook, 2775 svn_cancel_func_t cancel_func, 2776 void *cancel_baton, 2777 apr_pool_t *pool); 2778 2779/** 2780 * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and 2781 * @a use_post_commit_hook always @c FALSE. 2782 * 2783 * @deprecated Provided for backward compatibility with the 1.1 API. 2784 */ 2785SVN_DEPRECATED 2786svn_error_t * 2787svn_repos_load_fs(svn_repos_t *repos, 2788 svn_stream_t *dumpstream, 2789 svn_stream_t *feedback_stream, 2790 enum svn_repos_load_uuid uuid_action, 2791 const char *parent_dir, 2792 svn_cancel_func_t cancel_func, 2793 void *cancel_baton, 2794 apr_pool_t *pool); 2795 2796 2797/** 2798 * A vtable that is driven by svn_repos_parse_dumpstream3(). 2799 * 2800 * @since New in 1.8. 2801 */ 2802typedef struct svn_repos_parse_fns3_t 2803{ 2804 /** The parser has discovered a new "magic header" record within the 2805 * parsing session represented by @a parse_baton. The dump-format 2806 * version number is @a version. 2807 */ 2808 svn_error_t *(*magic_header_record)(int version, 2809 void *parse_baton, 2810 apr_pool_t *pool); 2811 2812 /** The parser has discovered a new uuid record within the parsing 2813 * session represented by @a parse_baton. The uuid's value is 2814 * @a uuid, and it is allocated in @a pool. 2815 */ 2816 svn_error_t *(*uuid_record)(const char *uuid, 2817 void *parse_baton, 2818 apr_pool_t *pool); 2819 2820 /** The parser has discovered a new revision record within the 2821 * parsing session represented by @a parse_baton. All the headers are 2822 * placed in @a headers (allocated in @a pool), which maps <tt>const 2823 * char *</tt> header-name ==> <tt>const char *</tt> header-value. 2824 * The @a revision_baton received back (also allocated in @a pool) 2825 * represents the revision. 2826 */ 2827 svn_error_t *(*new_revision_record)(void **revision_baton, 2828 apr_hash_t *headers, 2829 void *parse_baton, 2830 apr_pool_t *pool); 2831 2832 /** The parser has discovered a new node record within the current 2833 * revision represented by @a revision_baton. All the headers are 2834 * placed in @a headers (as with @c new_revision_record), allocated in 2835 * @a pool. The @a node_baton received back is allocated in @a pool 2836 * and represents the node. 2837 */ 2838 svn_error_t *(*new_node_record)(void **node_baton, 2839 apr_hash_t *headers, 2840 void *revision_baton, 2841 apr_pool_t *pool); 2842 2843 /** For a given @a revision_baton, set a property @a name to @a value. */ 2844 svn_error_t *(*set_revision_property)(void *revision_baton, 2845 const char *name, 2846 const svn_string_t *value); 2847 2848 /** For a given @a node_baton, set a property @a name to @a value. */ 2849 svn_error_t *(*set_node_property)(void *node_baton, 2850 const char *name, 2851 const svn_string_t *value); 2852 2853 /** For a given @a node_baton, delete property @a name. */ 2854 svn_error_t *(*delete_node_property)(void *node_baton, const char *name); 2855 2856 /** For a given @a node_baton, remove all properties. */ 2857 svn_error_t *(*remove_node_props)(void *node_baton); 2858 2859 /** For a given @a node_baton, receive a writable @a stream capable of 2860 * receiving the node's fulltext. After writing the fulltext, call 2861 * the stream's close() function. 2862 * 2863 * If a @c NULL is returned instead of a stream, the vtable is 2864 * indicating that no text is desired, and the parser will not 2865 * attempt to send it. 2866 */ 2867 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 2868 void *node_baton); 2869 2870 /** For a given @a node_baton, set @a handler and @a handler_baton 2871 * to a window handler and baton capable of receiving a delta 2872 * against the node's previous contents. A NULL window will be 2873 * sent to the handler after all the windows are sent. 2874 * 2875 * If a @c NULL is returned instead of a handler, the vtable is 2876 * indicating that no delta is desired, and the parser will not 2877 * attempt to send it. 2878 */ 2879 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler, 2880 void **handler_baton, 2881 void *node_baton); 2882 2883 /** The parser has reached the end of the current node represented by 2884 * @a node_baton, it can be freed. 2885 */ 2886 svn_error_t *(*close_node)(void *node_baton); 2887 2888 /** The parser has reached the end of the current revision 2889 * represented by @a revision_baton. In other words, there are no more 2890 * changed nodes within the revision. The baton can be freed. 2891 */ 2892 svn_error_t *(*close_revision)(void *revision_baton); 2893 2894} svn_repos_parse_fns3_t; 2895 2896 2897/** 2898 * Read and parse dumpfile-formatted @a stream, calling callbacks in 2899 * @a parse_fns/@a parse_baton, and using @a pool for allocations. 2900 * 2901 * If @a deltas_are_text is @c TRUE, handle text-deltas with the @a 2902 * set_fulltext callback. This is useful when manipulating a dump 2903 * stream without loading it. Otherwise handle text-deltas with the 2904 * @a apply_textdelta callback. 2905 * 2906 * If @a cancel_func is not @c NULL, it is called periodically with 2907 * @a cancel_baton as argument to see if the client wishes to cancel 2908 * the dump. 2909 * 2910 * This parser has built-in knowledge of the dumpfile format, but only 2911 * in a limited sense: 2912 * 2913 * * it recognizes the "magic" format-version header. 2914 * 2915 * * it recognizes the UUID header. 2916 * 2917 * * it recognizes revision and node records by looking for either 2918 * a REVISION_NUMBER or NODE_PATH headers. 2919 * 2920 * * it recognizes the CONTENT-LENGTH headers, so it knows if and 2921 * how to suck up the content body. 2922 * 2923 * * it knows how to parse a content body into two parts: props 2924 * and text, and pass the pieces to the vtable. 2925 * 2926 * This is enough knowledge to make it easy on vtable implementors, 2927 * but still allow expansion of the format: most headers do not have 2928 * to be handled explicitly. 2929 * 2930 * @since New in 1.8. 2931 */ 2932svn_error_t * 2933svn_repos_parse_dumpstream3(svn_stream_t *stream, 2934 const svn_repos_parse_fns3_t *parse_fns, 2935 void *parse_baton, 2936 svn_boolean_t deltas_are_text, 2937 svn_cancel_func_t cancel_func, 2938 void *cancel_baton, 2939 apr_pool_t *pool); 2940 2941 2942/** 2943 * Set @a *parser and @a *parse_baton to a vtable parser which commits new 2944 * revisions to the fs in @a repos. The constructed parser will treat 2945 * UUID records in a manner consistent with @a uuid_action. Use @a pool 2946 * to operate on the fs. 2947 * 2948 * @a start_rev and @a end_rev act as filters, the lower and upper 2949 * (inclusive) range values of revisions in @a dumpstream which will 2950 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 2951 * which case no revision-based filtering occurs at all), or both are 2952 * valid revisions (where @a start_rev is older than or equivalent to 2953 * @a end_rev). 2954 * 2955 * If @a use_history is set, then the parser will require relative 2956 * 'copyfrom' history to exist in the repository when it encounters 2957 * nodes that are added-with-history. 2958 * 2959 * If @a validate_props is set, then validate Subversion revision and 2960 * node properties (those in the svn: namespace) against established 2961 * rules for those things. 2962 * 2963 * If @a parent_dir is not NULL, then the parser will reparent all the 2964 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 2965 * must be an existing directory in the repository. 2966 * 2967 * @since New in 1.8. 2968 */ 2969svn_error_t * 2970svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser, 2971 void **parse_baton, 2972 svn_repos_t *repos, 2973 svn_revnum_t start_rev, 2974 svn_revnum_t end_rev, 2975 svn_boolean_t use_history, 2976 svn_boolean_t validate_props, 2977 enum svn_repos_load_uuid uuid_action, 2978 const char *parent_dir, 2979 svn_repos_notify_func_t notify_func, 2980 void *notify_baton, 2981 apr_pool_t *pool); 2982 2983 2984/** 2985 * A vtable that is driven by svn_repos_parse_dumpstream2(). 2986 * Similar to #svn_repos_parse_fns3_t except that it lacks 2987 * the delete_node_property and apply_textdelta callbacks. 2988 * 2989 * @deprecated Provided for backward compatibility with the 1.7 API. 2990 */ 2991typedef struct svn_repos_parse_fns2_t 2992{ 2993 /** Same as #svn_repos_parse_fns3_t.new_revision_record. */ 2994 svn_error_t *(*new_revision_record)(void **revision_baton, 2995 apr_hash_t *headers, 2996 void *parse_baton, 2997 apr_pool_t *pool); 2998 /** Same as #svn_repos_parse_fns3_t.uuid_record. */ 2999 svn_error_t *(*uuid_record)(const char *uuid, 3000 void *parse_baton, 3001 apr_pool_t *pool); 3002 /** Same as #svn_repos_parse_fns3_t.new_node_record. */ 3003 svn_error_t *(*new_node_record)(void **node_baton, 3004 apr_hash_t *headers, 3005 void *revision_baton, 3006 apr_pool_t *pool); 3007 /** Same as #svn_repos_parse_fns3_t.set_revision_property. */ 3008 svn_error_t *(*set_revision_property)(void *revision_baton, 3009 const char *name, 3010 const svn_string_t *value); 3011 /** Same as #svn_repos_parse_fns3_t.set_node_property. */ 3012 svn_error_t *(*set_node_property)(void *node_baton, 3013 const char *name, 3014 const svn_string_t *value); 3015 /** Same as #svn_repos_parse_fns3_t.delete_node_property. */ 3016 svn_error_t *(*delete_node_property)(void *node_baton, 3017 const char *name); 3018 /** Same as #svn_repos_parse_fns3_t.remove_node_props. */ 3019 svn_error_t *(*remove_node_props)(void *node_baton); 3020 /** Same as #svn_repos_parse_fns3_t.set_fulltext. */ 3021 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 3022 void *node_baton); 3023 /** Same as #svn_repos_parse_fns3_t.apply_textdelta. */ 3024 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler, 3025 void **handler_baton, 3026 void *node_baton); 3027 /** Same as #svn_repos_parse_fns3_t.close_node. */ 3028 svn_error_t *(*close_node)(void *node_baton); 3029 /** Same as #svn_repos_parse_fns3_t.close_revision. */ 3030 svn_error_t *(*close_revision)(void *revision_baton); 3031} svn_repos_parse_fns2_t; 3032 3033/** @deprecated Provided for backward compatibility with the 1.7 API. */ 3034typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t; 3035 3036 3037/** 3038 * A vtable that is driven by svn_repos_parse_dumpstream(). 3039 * Similar to #svn_repos_parse_fns2_t except that it lacks 3040 * the delete_node_property and apply_textdelta callbacks. 3041 * 3042 * @deprecated Provided for backward compatibility with the 1.0 API. 3043 */ 3044typedef struct svn_repos_parse_fns_t 3045{ 3046 /** Same as #svn_repos_parse_fns2_t.new_revision_record. */ 3047 svn_error_t *(*new_revision_record)(void **revision_baton, 3048 apr_hash_t *headers, 3049 void *parse_baton, 3050 apr_pool_t *pool); 3051 /** Same as #svn_repos_parse_fns2_t.uuid_record. */ 3052 svn_error_t *(*uuid_record)(const char *uuid, 3053 void *parse_baton, 3054 apr_pool_t *pool); 3055 /** Same as #svn_repos_parse_fns2_t.new_node_record. */ 3056 svn_error_t *(*new_node_record)(void **node_baton, 3057 apr_hash_t *headers, 3058 void *revision_baton, 3059 apr_pool_t *pool); 3060 /** Same as #svn_repos_parse_fns2_t.set_revision_property. */ 3061 svn_error_t *(*set_revision_property)(void *revision_baton, 3062 const char *name, 3063 const svn_string_t *value); 3064 /** Same as #svn_repos_parse_fns2_t.set_node_property. */ 3065 svn_error_t *(*set_node_property)(void *node_baton, 3066 const char *name, 3067 const svn_string_t *value); 3068 /** Same as #svn_repos_parse_fns2_t.remove_node_props. */ 3069 svn_error_t *(*remove_node_props)(void *node_baton); 3070 /** Same as #svn_repos_parse_fns2_t.set_fulltext. */ 3071 svn_error_t *(*set_fulltext)(svn_stream_t **stream, 3072 void *node_baton); 3073 /** Same as #svn_repos_parse_fns2_t.close_node. */ 3074 svn_error_t *(*close_node)(void *node_baton); 3075 /** Same as #svn_repos_parse_fns2_t.close_revision. */ 3076 svn_error_t *(*close_revision)(void *revision_baton); 3077} svn_repos_parser_fns_t; 3078 3079 3080/** 3081 * Similar to svn_repos_parse_dumpstream3(), but uses the more limited 3082 * #svn_repos_parser_fns2_t vtable type. 3083 * 3084 * @deprecated Provided for backward compatibility with the 1.7 API. 3085 */ 3086SVN_DEPRECATED 3087svn_error_t * 3088svn_repos_parse_dumpstream2(svn_stream_t *stream, 3089 const svn_repos_parser_fns2_t *parse_fns, 3090 void *parse_baton, 3091 svn_cancel_func_t cancel_func, 3092 void *cancel_baton, 3093 apr_pool_t *pool); 3094 3095/** 3096 * Similar to svn_repos_parse_dumpstream2(), but uses the more limited 3097 * #svn_repos_parser_fns_t vtable type. 3098 * 3099 * @deprecated Provided for backward compatibility with the 1.0 API. 3100 */ 3101SVN_DEPRECATED 3102svn_error_t * 3103svn_repos_parse_dumpstream(svn_stream_t *stream, 3104 const svn_repos_parser_fns_t *parse_fns, 3105 void *parse_baton, 3106 svn_cancel_func_t cancel_func, 3107 void *cancel_baton, 3108 apr_pool_t *pool); 3109 3110/** 3111 * Similar to svn_repos_get_fs_build_parser4(), but with @a start_rev 3112 * and @a end_rev always passed as #SVN_INVALID_REVNUM, and yielding 3113 * the more limited svn_repos_parse_fns2_t. 3114 * 3115 * @since New in 1.7. 3116 * @deprecated Provided for backward compatibility with the 1.7 API. 3117 */ 3118SVN_DEPRECATED 3119svn_error_t * 3120svn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **parser, 3121 void **parse_baton, 3122 svn_repos_t *repos, 3123 svn_boolean_t use_history, 3124 svn_boolean_t validate_props, 3125 enum svn_repos_load_uuid uuid_action, 3126 const char *parent_dir, 3127 svn_repos_notify_func_t notify_func, 3128 void *notify_baton, 3129 apr_pool_t *pool); 3130 3131/** 3132 * Similar to svn_repos_get_fs_build_parser3(), but with @a outstream 3133 * in place if a #svn_repos_notify_func_t and baton and with 3134 * @a validate_props always FALSE. 3135 * 3136 * @since New in 1.1. 3137 * @deprecated Provided for backward compatibility with the 1.6 API. 3138 */ 3139SVN_DEPRECATED 3140svn_error_t * 3141svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser, 3142 void **parse_baton, 3143 svn_repos_t *repos, 3144 svn_boolean_t use_history, 3145 enum svn_repos_load_uuid uuid_action, 3146 svn_stream_t *outstream, 3147 const char *parent_dir, 3148 apr_pool_t *pool); 3149 3150/** 3151 * Similar to svn_repos_get_fs_build_parser2(), but yields the more 3152 * limited svn_repos_parser_fns_t vtable type. 3153 * 3154 * @deprecated Provided for backward compatibility with the 1.0 API. 3155 */ 3156SVN_DEPRECATED 3157svn_error_t * 3158svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser, 3159 void **parse_baton, 3160 svn_repos_t *repos, 3161 svn_boolean_t use_history, 3162 enum svn_repos_load_uuid uuid_action, 3163 svn_stream_t *outstream, 3164 const char *parent_dir, 3165 apr_pool_t *pool); 3166 3167 3168/** @} */ 3169 3170/** A data type which stores the authz information. 3171 * 3172 * @since New in 1.3. 3173 */ 3174typedef struct svn_authz_t svn_authz_t; 3175 3176/** 3177 * Read authz configuration data from @a path (a dirent, an absolute file url 3178 * or a registry path) into @a *authz_p, allocated in @a pool. 3179 * 3180 * If @a groups_path (a dirent, an absolute file url, or a registry path) is 3181 * set, use the global groups parsed from it. 3182 * 3183 * If @a path or @a groups_path is not a valid authz rule file, then return 3184 * #SVN_ERR_AUTHZ_INVALID_CONFIG. The contents of @a *authz_p is then 3185 * undefined. If @a must_exist is TRUE, a missing authz or groups file 3186 * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error 3187 * depends on the access type). 3188 * 3189 * @since New in 1.8. 3190 */ 3191svn_error_t * 3192svn_repos_authz_read2(svn_authz_t **authz_p, 3193 const char *path, 3194 const char *groups_path, 3195 svn_boolean_t must_exist, 3196 apr_pool_t *pool); 3197 3198 3199/** 3200 * Similar to svn_repos_authz_read2(), but with @a groups_path and @a 3201 * repos_root always passed as @c NULL. 3202 * 3203 * @since New in 1.3. 3204 * @deprecated Provided for backward compatibility with the 1.7 API. 3205 */ 3206SVN_DEPRECATED 3207svn_error_t * 3208svn_repos_authz_read(svn_authz_t **authz_p, 3209 const char *file, 3210 svn_boolean_t must_exist, 3211 apr_pool_t *pool); 3212 3213/** 3214 * Read authz configuration data from @a stream into @a *authz_p, 3215 * allocated in @a pool. 3216 * 3217 * If @a groups_stream is set, use the global groups parsed from it. 3218 * 3219 * @since New in 1.8. 3220 */ 3221svn_error_t * 3222svn_repos_authz_parse(svn_authz_t **authz_p, 3223 svn_stream_t *stream, 3224 svn_stream_t *groups_stream, 3225 apr_pool_t *pool); 3226 3227/** 3228 * Check whether @a user can access @a path in the repository @a 3229 * repos_name with the @a required_access. @a authz lists the ACLs to 3230 * check against. Set @a *access_granted to indicate if the requested 3231 * access is granted. 3232 * 3233 * If @a path is NULL, then check whether @a user has the @a 3234 * required_access anywhere in the repository. Set @a *access_granted 3235 * to TRUE if at least one path is accessible with the @a 3236 * required_access. 3237 * 3238 * For compatibility with 1.6, and earlier, @a repos_name can be NULL 3239 * in which case it is equivalent to a @a repos_name of "". 3240 * 3241 * @note Presently, @a repos_name must byte-for-byte match the repos_name 3242 * specified in the authz file; it is treated as an opaque string, and not 3243 * as a dirent. 3244 * 3245 * @since New in 1.3. 3246 */ 3247svn_error_t * 3248svn_repos_authz_check_access(svn_authz_t *authz, 3249 const char *repos_name, 3250 const char *path, 3251 const char *user, 3252 svn_repos_authz_access_t required_access, 3253 svn_boolean_t *access_granted, 3254 apr_pool_t *pool); 3255 3256 3257 3258/** Revision Access Levels 3259 * 3260 * Like most version control systems, access to versioned objects in 3261 * Subversion is determined on primarily path-based system. Users either 3262 * do or don't have the ability to read a given path. 3263 * 3264 * However, unlike many version control systems where versioned objects 3265 * maintain their own distinct version information (revision numbers, 3266 * authors, log messages, change timestamps, etc.), Subversion binds 3267 * multiple paths changed as part of a single commit operation into a 3268 * set, calls the whole thing a revision, and hangs commit metadata 3269 * (author, date, log message, etc.) off of that revision. So, commit 3270 * metadata is shared across all the paths changed as part of a given 3271 * commit operation. 3272 * 3273 * It is common (or, at least, we hope it is) for log messages to give 3274 * detailed information about changes made in the commit to which the log 3275 * message is attached. Such information might include a mention of all 3276 * the files changed, what was changed in them, and so on. But this 3277 * causes a problem when presenting information to readers who aren't 3278 * authorized to read every path in the repository. Simply knowing that 3279 * a given path exists may be a security leak, even if the user can't see 3280 * the contents of the data located at that path. 3281 * 3282 * So Subversion does what it reasonably can to prevent the leak of this 3283 * information, and does so via a staged revision access policy. A 3284 * reader can be said to have one of three levels of access to a given 3285 * revision's metadata, based solely on the reader's access rights to the 3286 * paths changed or copied in that revision: 3287 * 3288 * 'full access' -- Granted when the reader has access to all paths 3289 * changed or copied in the revision, or when no paths were 3290 * changed in the revision at all, this access level permits 3291 * full visibility of all revision property names and values, 3292 * and the full changed-paths information. 3293 * 3294 * 'no access' -- Granted when the reader does not have access to any 3295 * paths changed or copied in the revision, this access level 3296 * denies the reader access to all revision properties and all 3297 * changed-paths information. 3298 * 3299 * 'partial access' -- Granted when the reader has access to at least 3300 * one, but not all, of the paths changed or copied in the revision, 3301 * this access level permits visibility of the svn:date and 3302 * svn:author revision properties and only the paths of the 3303 * changed-paths information to which the reader has access. 3304 * 3305 */ 3306 3307 3308/** An enum defining levels of revision access. 3309 * 3310 * @since New in 1.5. 3311 */ 3312typedef enum svn_repos_revision_access_level_t 3313{ 3314 /** no access allowed to the revision properties and all changed-paths 3315 * information. */ 3316 svn_repos_revision_access_none, 3317 /** access granted to some (svn:date and svn:author) revision properties and 3318 * changed-paths information on paths the read has access to. */ 3319 svn_repos_revision_access_partial, 3320 /** access granted to all revision properites and changed-paths 3321 * information. */ 3322 svn_repos_revision_access_full 3323} 3324svn_repos_revision_access_level_t; 3325 3326 3327/** 3328 * Set @a access to the access level granted for @a revision in @a 3329 * repos, as determined by consulting the @a authz_read_func callback 3330 * function and its associated @a authz_read_baton. 3331 * 3332 * @a authz_read_func may be @c NULL, in which case @a access will be 3333 * set to #svn_repos_revision_access_full. 3334 * 3335 * @since New in 1.5. 3336 */ 3337svn_error_t * 3338svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level, 3339 svn_repos_t *repos, 3340 svn_revnum_t revision, 3341 svn_repos_authz_func_t authz_read_func, 3342 void *authz_read_baton, 3343 apr_pool_t *pool); 3344 3345/** 3346 * Set @a *inherited_values to a depth-first ordered array of 3347 * #svn_prop_inherited_item_t * structures (the path_or_url members of 3348 * which are relative filesystem paths) representing the properties 3349 * inherited by @a path in @a root. If no properties are inherited, 3350 * then set @a *inherited_values to an empty array. 3351 * 3352 * if @a propname is NULL then retrieve all explicit and/or inherited 3353 * properties. Otherwise retrieve only the properties named @a propname. 3354 * 3355 * If optional @a authz_read_func is non-NULL, then use this function 3356 * (along with optional @a authz_read_baton) to check the readability 3357 * of each parent path from which properties are inherited. Silently omit 3358 * properties for unreadable parent paths. 3359 * 3360 * Allocate @a *inherited_props in @a result_pool. Use @a scratch_pool for 3361 * temporary allocations. 3362 * 3363 * @since New in 1.8. 3364 */ 3365svn_error_t * 3366svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props, 3367 svn_fs_root_t *root, 3368 const char *path, 3369 const char *propname, 3370 svn_repos_authz_func_t authz_read_func, 3371 void *authz_read_baton, 3372 apr_pool_t *result_pool, 3373 apr_pool_t *scratch_pool); 3374 3375 3376/** Capabilities **/ 3377 3378/** 3379 * Store in @a repos the client-reported capabilities @a capabilities, 3380 * which must be allocated in memory at least as long-lived as @a repos. 3381 * 3382 * The elements of @a capabilities are 'const char *', a subset of 3383 * the constants beginning with @c SVN_RA_CAPABILITY_. 3384 * @a capabilities is not copied, so changing it later will affect 3385 * what is remembered by @a repos. 3386 * 3387 * @note The capabilities are passed along to the start-commit hook; 3388 * see that hook's template for details. 3389 * 3390 * @note As of Subversion 1.5, there are no error conditions defined, 3391 * so this always returns SVN_NO_ERROR. In future releases it may 3392 * return error, however, so callers should check. 3393 * 3394 * @since New in 1.5. 3395 */ 3396svn_error_t * 3397svn_repos_remember_client_capabilities(svn_repos_t *repos, 3398 const apr_array_header_t *capabilities); 3399 3400 3401#ifdef __cplusplus 3402} 3403#endif /* __cplusplus */ 3404 3405#endif /* SVN_REPOS_H */ 3406