1251881Speter/** 2251881Speter * @copyright 3251881Speter * ==================================================================== 4251881Speter * Licensed to the Apache Software Foundation (ASF) under one 5251881Speter * or more contributor license agreements. See the NOTICE file 6251881Speter * distributed with this work for additional information 7251881Speter * regarding copyright ownership. The ASF licenses this file 8251881Speter * to you under the Apache License, Version 2.0 (the 9251881Speter * "License"); you may not use this file except in compliance 10251881Speter * with the License. You may obtain a copy of the License at 11251881Speter * 12251881Speter * http://www.apache.org/licenses/LICENSE-2.0 13251881Speter * 14251881Speter * Unless required by applicable law or agreed to in writing, 15251881Speter * software distributed under the License is distributed on an 16251881Speter * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17251881Speter * KIND, either express or implied. See the License for the 18251881Speter * specific language governing permissions and limitations 19251881Speter * under the License. 20251881Speter * ==================================================================== 21251881Speter * @endcopyright 22251881Speter * 23251881Speter * @file svn_repos.h 24251881Speter * @brief Tools built on top of the filesystem. 25251881Speter */ 26251881Speter 27251881Speter#ifndef SVN_REPOS_H 28251881Speter#define SVN_REPOS_H 29251881Speter 30251881Speter#include <apr_pools.h> 31251881Speter#include <apr_hash.h> 32251881Speter#include <apr_tables.h> 33251881Speter#include <apr_time.h> 34251881Speter 35251881Speter#include "svn_types.h" 36251881Speter#include "svn_string.h" 37251881Speter#include "svn_delta.h" 38251881Speter#include "svn_fs.h" 39251881Speter#include "svn_io.h" 40251881Speter#include "svn_mergeinfo.h" 41251881Speter 42251881Speter 43251881Speter#ifdef __cplusplus 44251881Speterextern "C" { 45251881Speter#endif /* __cplusplus */ 46251881Speter 47251881Speter/* ---------------------------------------------------------------*/ 48251881Speter 49251881Speter/** 50251881Speter * Get libsvn_repos version information. 51251881Speter * 52251881Speter * @since New in 1.1. 53251881Speter */ 54251881Speterconst svn_version_t * 55251881Spetersvn_repos_version(void); 56251881Speter 57251881Speter 58251881Speter/* Some useful enums. They need to be declared here for the notification 59251881Speter system to pick them up. */ 60251881Speter/** The different "actions" attached to nodes in the dumpfile. */ 61251881Speterenum svn_node_action 62251881Speter{ 63251881Speter svn_node_action_change, 64251881Speter svn_node_action_add, 65251881Speter svn_node_action_delete, 66251881Speter svn_node_action_replace 67251881Speter}; 68251881Speter 69299742Sdim 70299742Sdim/** @defgroup svn_repos_authz_callbacks Repository authorization callbacks 71299742Sdim * @{ 72299742Sdim */ 73251881Speter 74299742Sdim/** Callback type for checking authorization on a path. 75251881Speter * 76251881Speter * Set @a *allowed to TRUE to indicate that some operation is 77251881Speter * authorized for @a path in @a root, or set it to FALSE to indicate 78251881Speter * unauthorized (presumably according to state stored in @a baton). 79251881Speter * 80251881Speter * Do not assume @a pool has any lifetime beyond this call. 81251881Speter * 82251881Speter * The exact operation being authorized depends on the callback 83251881Speter * implementation. For read authorization, for example, the caller 84251881Speter * would implement an instance that does read checking, and pass it as 85251881Speter * a parameter named [perhaps] 'authz_read_func'. The receiver of 86251881Speter * that parameter might also take another parameter named 87251881Speter * 'authz_write_func', which although sharing this type, would be a 88251881Speter * different implementation. 89251881Speter * 90251881Speter * @note If someday we want more sophisticated authorization states 91251881Speter * than just yes/no, @a allowed can become an enum type. 92251881Speter */ 93251881Spetertypedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed, 94251881Speter svn_fs_root_t *root, 95251881Speter const char *path, 96251881Speter void *baton, 97251881Speter apr_pool_t *pool); 98251881Speter 99251881Speter 100251881Speter/** An enum defining the kinds of access authz looks up. 101251881Speter * 102251881Speter * @since New in 1.3. 103251881Speter */ 104251881Spetertypedef enum svn_repos_authz_access_t 105251881Speter{ 106251881Speter /** No access. */ 107251881Speter svn_authz_none = 0, 108251881Speter 109251881Speter /** Path can be read. */ 110251881Speter svn_authz_read = 1, 111251881Speter 112251881Speter /** Path can be altered. */ 113251881Speter svn_authz_write = 2, 114251881Speter 115251881Speter /** The other access credentials are recursive. */ 116251881Speter svn_authz_recursive = 4 117251881Speter} svn_repos_authz_access_t; 118251881Speter 119251881Speter 120251881Speter/** Callback type for checking authorization on paths produced by 121251881Speter * the repository commit editor. 122251881Speter * 123251881Speter * Set @a *allowed to TRUE to indicate that the @a required access on 124251881Speter * @a path in @a root is authorized, or set it to FALSE to indicate 125251881Speter * unauthorized (presumable according to state stored in @a baton). 126251881Speter * 127251881Speter * If @a path is NULL, the callback should perform a global authz 128251881Speter * lookup for the @a required access. That is, the lookup should 129251881Speter * check if the @a required access is granted for at least one path of 130251881Speter * the repository, and set @a *allowed to TRUE if so. @a root may 131251881Speter * also be NULL if @a path is NULL. 132251881Speter * 133251881Speter * This callback is very similar to svn_repos_authz_func_t, with the 134251881Speter * exception of the addition of the @a required parameter. 135251881Speter * This is due to historical reasons: when authz was first implemented 136251881Speter * for svn_repos_dir_delta2(), it seemed there would need only checks 137251881Speter * for read and write operations, hence the svn_repos_authz_func_t 138251881Speter * callback prototype and usage scenario. But it was then realized 139251881Speter * that lookups due to copying needed to be recursive, and that 140251881Speter * brute-force recursive lookups didn't square with the O(1) 141251881Speter * performances a copy operation should have. 142251881Speter * 143251881Speter * So a special way to ask for a recursive lookup was introduced. The 144251881Speter * commit editor needs this capability to retain acceptable 145251881Speter * performance. Instead of revving the existing callback, causing 146251881Speter * unnecessary revving of functions that don't actually need the 147251881Speter * extended functionality, this second, more complete callback was 148251881Speter * introduced, for use by the commit editor. 149251881Speter * 150251881Speter * Some day, it would be nice to reunite these two callbacks and do 151251881Speter * the necessary revving anyway, but for the time being, this dual 152251881Speter * callback mechanism will do. 153251881Speter */ 154251881Spetertypedef svn_error_t *(*svn_repos_authz_callback_t) 155251881Speter (svn_repos_authz_access_t required, 156251881Speter svn_boolean_t *allowed, 157251881Speter svn_fs_root_t *root, 158251881Speter const char *path, 159251881Speter void *baton, 160251881Speter apr_pool_t *pool); 161251881Speter 162299742Sdim/** @} */ 163299742Sdim 164299742Sdim 165299742Sdim/** @defgroup svn_repos_notifications Repository notifications 166299742Sdim * @{ 167251881Speter */ 168251881Speter 169251881Speter/* Notification system. */ 170251881Speter 171251881Speter/** The type of action occurring. 172251881Speter * 173251881Speter * @since New in 1.7. 174251881Speter */ 175251881Spetertypedef enum svn_repos_notify_action_t 176251881Speter{ 177251881Speter /** A warning message is waiting. */ 178251881Speter svn_repos_notify_warning = 0, 179251881Speter 180251881Speter /** A revision has finished being dumped. */ 181251881Speter svn_repos_notify_dump_rev_end, 182251881Speter 183251881Speter /** A revision has finished being verified. */ 184251881Speter svn_repos_notify_verify_rev_end, 185251881Speter 186251881Speter /** All revisions have finished being dumped. */ 187251881Speter svn_repos_notify_dump_end, 188251881Speter 189251881Speter /** All revisions have finished being verified. */ 190251881Speter svn_repos_notify_verify_end, 191251881Speter 192251881Speter /** packing of an FSFS shard has commenced */ 193251881Speter svn_repos_notify_pack_shard_start, 194251881Speter 195251881Speter /** packing of an FSFS shard is completed */ 196251881Speter svn_repos_notify_pack_shard_end, 197251881Speter 198251881Speter /** packing of the shard revprops has commenced */ 199251881Speter svn_repos_notify_pack_shard_start_revprop, 200251881Speter 201251881Speter /** packing of the shard revprops has completed */ 202251881Speter svn_repos_notify_pack_shard_end_revprop, 203251881Speter 204251881Speter /** A revision has begun loading */ 205251881Speter svn_repos_notify_load_txn_start, 206251881Speter 207251881Speter /** A revision has finished loading */ 208251881Speter svn_repos_notify_load_txn_committed, 209251881Speter 210251881Speter /** A node has begun loading */ 211251881Speter svn_repos_notify_load_node_start, 212251881Speter 213251881Speter /** A node has finished loading */ 214251881Speter svn_repos_notify_load_node_done, 215251881Speter 216251881Speter /** A copied node has been encountered */ 217251881Speter svn_repos_notify_load_copied_node, 218251881Speter 219251881Speter /** Mergeinfo has been normalized */ 220251881Speter svn_repos_notify_load_normalized_mergeinfo, 221251881Speter 222251881Speter /** The operation has acquired a mutex for the repo. */ 223251881Speter svn_repos_notify_mutex_acquired, 224251881Speter 225251881Speter /** Recover has started. */ 226251881Speter svn_repos_notify_recover_start, 227251881Speter 228251881Speter /** Upgrade has started. */ 229251881Speter svn_repos_notify_upgrade_start, 230251881Speter 231251881Speter /** A revision was skipped during loading. @since New in 1.8. */ 232251881Speter svn_repos_notify_load_skipped_rev, 233251881Speter 234251881Speter /** The structure of a revision is being verified. @since New in 1.8. */ 235299742Sdim svn_repos_notify_verify_rev_structure, 236251881Speter 237299742Sdim /** A revprop shard got packed. @since New in 1.9. */ 238299742Sdim svn_repos_notify_pack_revprops, 239299742Sdim 240299742Sdim /** A non-packed revprop shard got removed. @since New in 1.9. */ 241299742Sdim svn_repos_notify_cleanup_revprops, 242299742Sdim 243299742Sdim /** The repository format got bumped. @since New in 1.9. */ 244299742Sdim svn_repos_notify_format_bumped, 245299742Sdim 246299742Sdim /** A revision range was copied. @since New in 1.9. */ 247299742Sdim svn_repos_notify_hotcopy_rev_range 248251881Speter} svn_repos_notify_action_t; 249251881Speter 250299742Sdim/** The type of warning occurring. 251251881Speter * 252251881Speter * @since New in 1.7. 253251881Speter */ 254251881Spetertypedef enum svn_repos_notify_warning_t 255251881Speter{ 256251881Speter /** Referencing copy source data from a revision earlier than the 257251881Speter * first revision dumped. */ 258251881Speter svn_repos_notify_warning_found_old_reference, 259251881Speter 260251881Speter /** An #SVN_PROP_MERGEINFO property's encoded mergeinfo references a 261251881Speter * revision earlier than the first revision dumped. */ 262251881Speter svn_repos_notify_warning_found_old_mergeinfo, 263251881Speter 264251881Speter /** Found an invalid path in the filesystem. 265251881Speter * @see svn_fs.h:"Directory entry names and directory paths" */ 266251881Speter /* ### TODO(doxygen): make that a proper doxygen link */ 267251881Speter /* See svn_fs__path_valid(). */ 268299742Sdim svn_repos_notify_warning_invalid_fspath, 269251881Speter 270299742Sdim /** 271299742Sdim * Detected a name collision. Reported when the names of two or more 272299742Sdim * entries in the same directory differ only in character 273299742Sdim * representation (normalization), but are otherwise identical. 274299742Sdim * 275299742Sdim * @since New in 1.9. 276299742Sdim */ 277299742Sdim svn_repos_notify_warning_name_collision, 278299742Sdim 279299742Sdim /** 280299742Sdim * Detected a mergeinfo path collision. Reported when the paths in 281299742Sdim * two or more entries in the same svn:mergeinfo property differ 282299742Sdim * only in character representation (normalization), but are 283299742Sdim * otherwise identical. 284299742Sdim * 285299742Sdim * @since New in 1.9. 286299742Sdim */ 287299742Sdim svn_repos_notify_warning_mergeinfo_collision, 288299742Sdim 289299742Sdim /** 290299742Sdim * Detected invalid mergeinfo. 291299742Sdim * 292299742Sdim * @since New in 1.9. 293299742Sdim */ 294299742Sdim svn_repos_notify_warning_invalid_mergeinfo 295251881Speter} svn_repos_notify_warning_t; 296251881Speter 297251881Speter/** 298251881Speter * Structure used by #svn_repos_notify_func_t. 299251881Speter * 300251881Speter * The only field guaranteed to be populated is @c action. Other fields are 301251881Speter * dependent upon the @c action. (See individual fields for more information.) 302251881Speter * 303251881Speter * @note Callers of notification functions should use 304251881Speter * svn_repos_notify_create() to create structures of this type to allow for 305251881Speter * future extensibility. 306251881Speter * 307251881Speter * @since New in 1.7. 308251881Speter */ 309251881Spetertypedef struct svn_repos_notify_t 310251881Speter{ 311251881Speter /** Action that describes what happened in the repository. */ 312251881Speter svn_repos_notify_action_t action; 313251881Speter 314251881Speter /** For #svn_repos_notify_dump_rev_end and #svn_repos_notify_verify_rev_end, 315299742Sdim * the revision which just completed. 316299742Sdim * For #svn_fs_upgrade_format_bumped, the new format version. */ 317251881Speter svn_revnum_t revision; 318251881Speter 319299742Sdim /** For #svn_repos_notify_warning, the warning message. */ 320251881Speter const char *warning_str; 321299742Sdim /** For #svn_repos_notify_warning, the warning type. */ 322251881Speter svn_repos_notify_warning_t warning; 323251881Speter 324251881Speter /** For #svn_repos_notify_pack_shard_start, 325251881Speter #svn_repos_notify_pack_shard_end, 326299742Sdim #svn_repos_notify_pack_revprops, 327299742Sdim #svn_repos_notify_cleanup_revprops 328251881Speter #svn_repos_notify_pack_shard_start_revprop, and 329251881Speter #svn_repos_notify_pack_shard_end_revprop, the shard processed. */ 330251881Speter apr_int64_t shard; 331251881Speter 332299742Sdim /** For #svn_repos_notify_load_txn_committed, the revision committed. */ 333251881Speter svn_revnum_t new_revision; 334251881Speter 335299742Sdim /** For #svn_repos_notify_load_txn_committed, the source revision, if 336251881Speter different from @a new_revision, otherwise #SVN_INVALID_REVNUM. 337299742Sdim For #svn_repos_notify_load_txn_start and 338299742Sdim #svn_repos_notify_load_skipped_rev, the source revision. */ 339251881Speter svn_revnum_t old_revision; 340251881Speter 341251881Speter /** For #svn_repos_notify_load_node_start, the action being taken on the 342251881Speter node. */ 343251881Speter enum svn_node_action node_action; 344251881Speter 345251881Speter /** For #svn_repos_notify_load_node_start, the path of the node. */ 346251881Speter const char *path; 347251881Speter 348299742Sdim /** For #svn_repos_notify_hotcopy_rev_range, the start of the copied 349299742Sdim revision range. 350299742Sdim @since New in 1.9. */ 351299742Sdim svn_revnum_t start_revision; 352299742Sdim 353299742Sdim /** For #svn_repos_notify_hotcopy_rev_range, the end of the copied 354299742Sdim revision range (might be the same as @a start_revision). 355299742Sdim @since New in 1.9. */ 356299742Sdim svn_revnum_t end_revision; 357299742Sdim 358251881Speter /* NOTE: Add new fields at the end to preserve binary compatibility. 359251881Speter Also, if you add fields here, you have to update 360251881Speter svn_repos_notify_create(). */ 361251881Speter} svn_repos_notify_t; 362251881Speter 363251881Speter/** Callback for providing notification from the repository. 364251881Speter * Returns @c void. Justification: success of an operation is not dependent 365251881Speter * upon successful notification of that operation. 366251881Speter * 367251881Speter * @since New in 1.7. */ 368251881Spetertypedef void (*svn_repos_notify_func_t)(void *baton, 369251881Speter const svn_repos_notify_t *notify, 370251881Speter apr_pool_t *scratch_pool); 371251881Speter 372251881Speter/** 373251881Speter * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize 374251881Speter * and return it. 375251881Speter * 376251881Speter * @since New in 1.7. 377251881Speter */ 378251881Spetersvn_repos_notify_t * 379251881Spetersvn_repos_notify_create(svn_repos_notify_action_t action, 380251881Speter apr_pool_t *result_pool); 381251881Speter 382299742Sdim/** @} */ 383299742Sdim 384299742Sdim 385251881Speter/** The repository object. */ 386251881Spetertypedef struct svn_repos_t svn_repos_t; 387251881Speter 388251881Speter/* Opening and creating repositories. */ 389251881Speter 390251881Speter 391251881Speter/** Find the root path of the repository that contains @a path. 392251881Speter * 393251881Speter * If a repository was found, the path to the root of the repository 394251881Speter * is returned, else @c NULL. The pointer to the returned path may be 395251881Speter * equal to @a path. 396251881Speter */ 397251881Speterconst char * 398251881Spetersvn_repos_find_root_path(const char *path, 399251881Speter apr_pool_t *pool); 400251881Speter 401251881Speter/** Set @a *repos_p to a repository object for the repository at @a path. 402251881Speter * 403299742Sdim * Allocate @a *repos_p in @a result_pool. 404251881Speter * 405251881Speter * Acquires a shared lock on the repository, and attaches a cleanup 406299742Sdim * function to @a result_pool to remove the lock. If no lock can be acquired, 407251881Speter * returns error, with undefined effect on @a *repos_p. If an exclusive 408251881Speter * lock is present, this blocks until it's gone. @a fs_config will be 409251881Speter * passed to the filesystem initialization function and may be @c NULL. 410251881Speter * 411299742Sdim * Use @a scratch_pool for temporary allocations. 412299742Sdim * 413299742Sdim * @since New in 1.9. 414299742Sdim */ 415299742Sdimsvn_error_t * 416299742Sdimsvn_repos_open3(svn_repos_t **repos_p, 417299742Sdim const char *path, 418299742Sdim apr_hash_t *fs_config, 419299742Sdim apr_pool_t *result_pool, 420299742Sdim apr_pool_t *scratch_pool); 421299742Sdim 422299742Sdim/** Similar to svn_repos_open3() but without @a scratch_pool. 423299742Sdim * 424299742Sdim * @deprecated Provided for backward compatibility with 1.8 API. 425251881Speter * @since New in 1.7. 426251881Speter */ 427299742SdimSVN_DEPRECATED 428251881Spetersvn_error_t * 429251881Spetersvn_repos_open2(svn_repos_t **repos_p, 430251881Speter const char *path, 431251881Speter apr_hash_t *fs_config, 432251881Speter apr_pool_t *pool); 433251881Speter 434251881Speter/** Similar to svn_repos_open2() with @a fs_config set to NULL. 435251881Speter * 436251881Speter * @deprecated Provided for backward compatibility with 1.6 API. 437251881Speter */ 438251881SpeterSVN_DEPRECATED 439251881Spetersvn_error_t * 440251881Spetersvn_repos_open(svn_repos_t **repos_p, 441251881Speter const char *path, 442251881Speter apr_pool_t *pool); 443251881Speter 444251881Speter/** Create a new Subversion repository at @a path, building the necessary 445251881Speter * directory structure, creating the filesystem, and so on. 446251881Speter * Return the repository object in @a *repos_p, allocated in @a pool. 447251881Speter * 448251881Speter * @a config is a client configuration hash of #svn_config_t * items 449251881Speter * keyed on config category names, and may be NULL. 450251881Speter * 451251881Speter * @a fs_config is passed to the filesystem, and may be NULL. 452251881Speter * 453251881Speter * @a unused_1 and @a unused_2 are not used and should be NULL. 454251881Speter */ 455251881Spetersvn_error_t * 456251881Spetersvn_repos_create(svn_repos_t **repos_p, 457251881Speter const char *path, 458251881Speter const char *unused_1, 459251881Speter const char *unused_2, 460251881Speter apr_hash_t *config, 461251881Speter apr_hash_t *fs_config, 462251881Speter apr_pool_t *pool); 463251881Speter 464251881Speter/** 465251881Speter * Upgrade the Subversion repository (and its underlying versioned 466251881Speter * filesystem) located in the directory @a path to the latest version 467251881Speter * supported by this library. If the requested upgrade is not 468251881Speter * supported due to the current state of the repository or it 469251881Speter * underlying filesystem, return #SVN_ERR_REPOS_UNSUPPORTED_UPGRADE 470251881Speter * or #SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no 471251881Speter * changes to the repository or filesystem. 472251881Speter * 473251881Speter * Acquires an exclusive lock on the repository, upgrades the 474251881Speter * repository, and releases the lock. If an exclusive lock can't be 475251881Speter * acquired, returns error. 476251881Speter * 477251881Speter * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 478251881Speter * returned if the lock is not immediately available. 479251881Speter * 480251881Speter * If @a start_callback is not NULL, it will be called with @a 481251881Speter * start_callback_baton as argument before the upgrade starts, but 482251881Speter * after the exclusive lock has been acquired. 483251881Speter * 484251881Speter * Use @a pool for necessary allocations. 485251881Speter * 486251881Speter * @note This functionality is provided as a convenience for 487251881Speter * administrators wishing to make use of new Subversion functionality 488251881Speter * without a potentially costly full repository dump/load. As such, 489251881Speter * the operation performs only the minimum amount of work needed to 490251881Speter * accomplish this while maintaining the integrity of the repository. 491251881Speter * It does *not* guarantee the most optimized repository state as a 492251881Speter * dump and subsequent load would. 493251881Speter * 494251881Speter * @note On some platforms the exclusive lock does not exclude other 495251881Speter * threads in the same process so this function should only be called 496251881Speter * by a single threaded process, or by a multi-threaded process when 497251881Speter * no other threads are accessing the repository. 498251881Speter * 499251881Speter * @since New in 1.7. 500251881Speter */ 501251881Spetersvn_error_t * 502251881Spetersvn_repos_upgrade2(const char *path, 503251881Speter svn_boolean_t nonblocking, 504251881Speter svn_repos_notify_func_t notify_func, 505251881Speter void *notify_baton, 506251881Speter apr_pool_t *pool); 507251881Speter 508251881Speter/** 509251881Speter * Similar to svn_repos_upgrade2(), but with @a start_callback and baton, 510251881Speter * rather than a notify_callback / baton 511251881Speter * 512251881Speter * @since New in 1.5. 513251881Speter * @deprecated Provided for backward compatibility with the 1.6 API. 514251881Speter */ 515251881SpeterSVN_DEPRECATED 516251881Spetersvn_error_t * 517251881Spetersvn_repos_upgrade(const char *path, 518251881Speter svn_boolean_t nonblocking, 519251881Speter svn_error_t *(*start_callback)(void *baton), 520251881Speter void *start_callback_baton, 521251881Speter apr_pool_t *pool); 522251881Speter 523251881Speter/** Destroy the Subversion repository found at @a path, using @a pool for any 524251881Speter * necessary allocations. 525251881Speter */ 526251881Spetersvn_error_t * 527251881Spetersvn_repos_delete(const char *path, 528251881Speter apr_pool_t *pool); 529251881Speter 530299742Sdim 531299742Sdim/** @defgroup svn_repos_capabilities Repository capabilities 532299742Sdim * @{ 533299742Sdim */ 534299742Sdim 535251881Speter/** 536251881Speter * Set @a *has to TRUE if @a repos has @a capability (one of the 537251881Speter * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set 538251881Speter * @a *has to FALSE. 539251881Speter * 540251881Speter * If @a capability isn't recognized, throw #SVN_ERR_UNKNOWN_CAPABILITY, 541251881Speter * with the effect on @a *has undefined. 542251881Speter * 543251881Speter * Use @a pool for all allocation. 544251881Speter * 545251881Speter * @since New in 1.5. 546251881Speter */ 547251881Spetersvn_error_t * 548251881Spetersvn_repos_has_capability(svn_repos_t *repos, 549251881Speter svn_boolean_t *has, 550251881Speter const char *capability, 551251881Speter apr_pool_t *pool); 552251881Speter 553299742Sdim/** 554299742Sdim * Return a set of @a capabilities supported by the running Subversion 555299742Sdim * library and by @a repos. (Capabilities supported by this version of 556299742Sdim * Subversion but not by @a repos are not listed. This may happen when 557299742Sdim * svn_repos_upgrade2() has not been called after a software upgrade.) 558299742Sdim * 559299742Sdim * The set is represented as a hash whose const char * keys are the set 560299742Sdim * members. The values are not defined. 561299742Sdim * 562299742Sdim * Allocate @a capabilities in @a result_pool and use @a scratch_pool for 563299742Sdim * temporary allocations. 564299742Sdim * 565299742Sdim * @see svn_repos_info_format 566299742Sdim * 567299742Sdim * @since New in 1.9. 568299742Sdim */ 569299742Sdimsvn_error_t * 570299742Sdimsvn_repos_capabilities(apr_hash_t **capabilities, 571299742Sdim svn_repos_t *repos, 572299742Sdim apr_pool_t *result_pool, 573299742Sdim apr_pool_t *scratch_pool); 574251881Speter 575251881Speter/** 576251881Speter * The capability of doing the right thing with merge-tracking 577251881Speter * information, both storing it and responding to queries about it. 578251881Speter * 579251881Speter * @since New in 1.5. 580251881Speter */ 581251881Speter#define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo" 582251881Speter/* *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY *** 583251881Speter * 584251881Speter * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to 585251881Speter * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid 586251881Speter * colons for their own reasons. While this RA limitation has no 587251881Speter * direct impact on repository capabilities, there's no reason to be 588251881Speter * gratuitously different either. 589251881Speter * 590251881Speter * If you add a capability, update svn_repos_capabilities(). 591251881Speter */ 592251881Speter 593299742Sdim/** @} */ 594251881Speter 595299742Sdim 596299742Sdim/** 597299742Sdim * Store in @a repos the client-reported capabilities @a capabilities, 598299742Sdim * which must be allocated in memory at least as long-lived as @a repos. 599299742Sdim * 600299742Sdim * The elements of @a capabilities are 'const char *', a subset of 601299742Sdim * the constants beginning with @c SVN_RA_CAPABILITY_. 602299742Sdim * @a capabilities is not copied, so changing it later will affect 603299742Sdim * what is remembered by @a repos. 604299742Sdim * 605299742Sdim * @note The capabilities are passed along to the start-commit hook; 606299742Sdim * see that hook's template for details. 607299742Sdim * 608299742Sdim * @note As of Subversion 1.5, there are no error conditions defined, 609299742Sdim * so this always returns SVN_NO_ERROR. In future releases it may 610299742Sdim * return error, however, so callers should check. 611299742Sdim * 612299742Sdim * @since New in 1.5. 613299742Sdim */ 614299742Sdimsvn_error_t * 615299742Sdimsvn_repos_remember_client_capabilities(svn_repos_t *repos, 616299742Sdim const apr_array_header_t *capabilities); 617299742Sdim 618299742Sdim 619251881Speter/** Return the filesystem associated with repository object @a repos. */ 620251881Spetersvn_fs_t * 621251881Spetersvn_repos_fs(svn_repos_t *repos); 622251881Speter 623299742Sdim/** Return the type of filesystem associated with repository object 624299742Sdim * @a repos allocated in @a result_pool. 625299742Sdim * 626299742Sdim * @see #svn_fs_backend_names 627299742Sdim * 628299742Sdim * @since New in 1.9. 629299742Sdim */ 630299742Sdimconst char * 631299742Sdimsvn_repos_fs_type(svn_repos_t *repos, 632299742Sdim apr_pool_t *result_pool); 633251881Speter 634251881Speter/** Make a hot copy of the Subversion repository found at @a src_path 635251881Speter * to @a dst_path. 636251881Speter * 637251881Speter * Copy a possibly live Subversion repository from @a src_path to 638251881Speter * @a dst_path. If @a clean_logs is @c TRUE, perform cleanup on the 639251881Speter * source filesystem as part of the copy operation; currently, this 640251881Speter * means deleting copied, unused logfiles for a Berkeley DB source 641251881Speter * repository. 642251881Speter * 643251881Speter * If @a incremental is TRUE, make an effort to not re-copy information 644251881Speter * already present in the destination. If incremental hotcopy is not 645251881Speter * implemented by the filesystem backend, raise SVN_ERR_UNSUPPORTED_FEATURE. 646251881Speter * 647299742Sdim * For each revision range copied, the @a notify_func function will be 648299742Sdim * called with the @a notify_baton and a notification structure containing 649299742Sdim * appropriate values in @c start_revision and @c end_revision (both 650299742Sdim * inclusive). @c start_revision might be equal to @c end_revision in 651299742Sdim * case the copied range consists of a single revision. Currently, this 652299742Sdim * notification is not triggered by the BDB backend. @a notify_func 653299742Sdim * may be @c NULL if this notification is not required. 654299742Sdim * 655299742Sdim * The optional @a cancel_func callback will be invoked with 656299742Sdim * @a cancel_baton as usual to allow the user to preempt this potentially 657299742Sdim * lengthy operation. 658299742Sdim * 659299742Sdim * Use @a scratch_pool for temporary allocations. 660299742Sdim * 661299742Sdim * @since New in 1.9. 662299742Sdim */ 663299742Sdimsvn_error_t * 664299742Sdimsvn_repos_hotcopy3(const char *src_path, 665299742Sdim const char *dst_path, 666299742Sdim svn_boolean_t clean_logs, 667299742Sdim svn_boolean_t incremental, 668299742Sdim svn_repos_notify_func_t notify_func, 669299742Sdim void *notify_baton, 670299742Sdim svn_cancel_func_t cancel_func, 671299742Sdim void *cancel_baton, 672299742Sdim apr_pool_t *scratch_pool); 673299742Sdim 674299742Sdim/** 675299742Sdim * Like svn_repos_hotcopy3(), but with @a notify_func and @a notify_baton 676299742Sdim * always passed as @c NULL. 677299742Sdim * 678251881Speter * @since New in 1.8. 679299742Sdim * @deprecated Provided for backward compatibility with the 1.8 API. 680251881Speter */ 681299742SdimSVN_DEPRECATED 682251881Spetersvn_error_t * 683251881Spetersvn_repos_hotcopy2(const char *src_path, 684251881Speter const char *dst_path, 685251881Speter svn_boolean_t clean_logs, 686251881Speter svn_boolean_t incremental, 687251881Speter svn_cancel_func_t cancel_func, 688251881Speter void *cancel_baton, 689251881Speter apr_pool_t *pool); 690251881Speter 691251881Speter/** 692251881Speter * Like svn_repos_hotcopy2(), but with @a incremental always passed as 693251881Speter * @c FALSE and without cancellation support. 694251881Speter * 695251881Speter * @deprecated Provided for backward compatibility with the 1.6 API. 696251881Speter */ 697251881SpeterSVN_DEPRECATED 698251881Spetersvn_error_t * 699251881Spetersvn_repos_hotcopy(const char *src_path, 700251881Speter const char *dst_path, 701251881Speter svn_boolean_t clean_logs, 702251881Speter apr_pool_t *pool); 703251881Speter 704251881Speter 705251881Speter/** 706251881Speter * Possibly update the repository, @a repos, to use a more efficient 707251881Speter * filesystem representation. Use @a pool for allocations. 708251881Speter * 709251881Speter * @since New in 1.7. 710251881Speter */ 711251881Spetersvn_error_t * 712251881Spetersvn_repos_fs_pack2(svn_repos_t *repos, 713251881Speter svn_repos_notify_func_t notify_func, 714251881Speter void *notify_baton, 715251881Speter svn_cancel_func_t cancel_func, 716251881Speter void *cancel_baton, 717251881Speter apr_pool_t *pool); 718251881Speter 719251881Speter/** 720251881Speter * Similar to svn_repos_fs_pack2(), but with a #svn_fs_pack_notify_t instead 721251881Speter * of a #svn_repos_notify_t. 722251881Speter * 723251881Speter * @since New in 1.6. 724251881Speter * @deprecated Provided for backward compatibility with the 1.6 API. 725251881Speter */ 726251881SpeterSVN_DEPRECATED 727251881Spetersvn_error_t * 728251881Spetersvn_repos_fs_pack(svn_repos_t *repos, 729251881Speter svn_fs_pack_notify_t notify_func, 730251881Speter void *notify_baton, 731251881Speter svn_cancel_func_t cancel_func, 732251881Speter void *cancel_baton, 733251881Speter apr_pool_t *pool); 734251881Speter 735251881Speter/** 736251881Speter * Run database recovery procedures on the repository at @a path, 737251881Speter * returning the database to a consistent state. Use @a pool for all 738251881Speter * allocation. 739251881Speter * 740251881Speter * Acquires an exclusive lock on the repository, recovers the 741251881Speter * database, and releases the lock. If an exclusive lock can't be 742251881Speter * acquired, returns error. 743251881Speter * 744251881Speter * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is 745251881Speter * returned if the lock is not immediately available. 746251881Speter * 747251881Speter * If @a notify_func is not NULL, it will be called with @a 748251881Speter * notify_baton as argument before the recovery starts, but 749251881Speter * after the exclusive lock has been acquired. 750251881Speter * 751251881Speter * If @a cancel_func is not @c NULL, it is called periodically with 752251881Speter * @a cancel_baton as argument to see if the client wishes to cancel 753251881Speter * the recovery. 754251881Speter * 755251881Speter * @note On some platforms the exclusive lock does not exclude other 756251881Speter * threads in the same process so this function should only be called 757251881Speter * by a single threaded process, or by a multi-threaded process when 758251881Speter * no other threads are accessing the repository. 759251881Speter * 760251881Speter * @since New in 1.7. 761251881Speter */ 762251881Spetersvn_error_t * 763251881Spetersvn_repos_recover4(const char *path, 764251881Speter svn_boolean_t nonblocking, 765251881Speter svn_repos_notify_func_t notify_func, 766251881Speter void *notify_baton, 767251881Speter svn_cancel_func_t cancel_func, 768251881Speter void * cancel_baton, 769251881Speter apr_pool_t *pool); 770251881Speter 771251881Speter/** 772251881Speter * Similar to svn_repos_recover4(), but with @a start callback in place of 773251881Speter * the notify_func / baton. 774251881Speter * 775251881Speter * @since New in 1.5. 776251881Speter * @deprecated Provided for backward compatibility with the 1.6 API. 777251881Speter */ 778251881SpeterSVN_DEPRECATED 779251881Spetersvn_error_t * 780251881Spetersvn_repos_recover3(const char *path, 781251881Speter svn_boolean_t nonblocking, 782251881Speter svn_error_t *(*start_callback)(void *baton), 783251881Speter void *start_callback_baton, 784251881Speter svn_cancel_func_t cancel_func, 785251881Speter void * cancel_baton, 786251881Speter apr_pool_t *pool); 787251881Speter 788251881Speter/** 789251881Speter * Similar to svn_repos_recover3(), but without cancellation support. 790251881Speter * 791251881Speter * @deprecated Provided for backward compatibility with the 1.4 API. 792251881Speter */ 793251881SpeterSVN_DEPRECATED 794251881Spetersvn_error_t * 795251881Spetersvn_repos_recover2(const char *path, 796251881Speter svn_boolean_t nonblocking, 797251881Speter svn_error_t *(*start_callback)(void *baton), 798251881Speter void *start_callback_baton, 799251881Speter apr_pool_t *pool); 800251881Speter 801251881Speter/** 802251881Speter * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and 803251881Speter * with no callbacks provided. 804251881Speter * 805251881Speter * @deprecated Provided for backward compatibility with the 1.0 API. 806251881Speter */ 807251881SpeterSVN_DEPRECATED 808251881Spetersvn_error_t * 809251881Spetersvn_repos_recover(const char *path, 810251881Speter apr_pool_t *pool); 811251881Speter 812251881Speter/** 813251881Speter * Callback for svn_repos_freeze. 814251881Speter * 815251881Speter * @since New in 1.8. 816251881Speter */ 817251881Spetertypedef svn_error_t *(*svn_repos_freeze_func_t)(void *baton, apr_pool_t *pool); 818251881Speter 819251881Speter/** 820251881Speter * Take an exclusive lock on each of the repositories in @a paths to 821251881Speter * prevent commits and then while holding all the locks invoke @a 822251881Speter * freeze_func passing @a freeze_baton. Each repository may be readable by 823251881Speter * Subversion while frozen, or may be unreadable, depending on which 824251881Speter * FS backend the repository uses. Repositories are locked in the 825251881Speter * order in which they are specified in the array. 826251881Speter * 827299742Sdim * @note @a freeze_func must not, directly or indirectly, call any function 828299742Sdim * that attempts to take out a lock on the underlying repository. These 829299742Sdim * include functions for packing, hotcopying, setting revprops and commits. 830299742Sdim * Attempts to do so may result in a deadlock. 831299742Sdim * 832251881Speter * @note On some platforms the exclusive lock does not exclude other 833251881Speter * threads in the same process so this function should only be called 834251881Speter * by a single threaded process, or by a multi-threaded process when 835251881Speter * no other threads are accessing the repositories. 836251881Speter * 837251881Speter * @since New in 1.8. 838251881Speter */ 839251881Spetersvn_error_t * 840251881Spetersvn_repos_freeze(apr_array_header_t *paths, 841251881Speter svn_repos_freeze_func_t freeze_func, 842251881Speter void *freeze_baton, 843251881Speter apr_pool_t *pool); 844251881Speter 845251881Speter/** This function is a wrapper around svn_fs_berkeley_logfiles(), 846251881Speter * returning log file paths relative to the root of the repository. 847251881Speter * 848251881Speter * @copydoc svn_fs_berkeley_logfiles() 849251881Speter */ 850251881Spetersvn_error_t * 851251881Spetersvn_repos_db_logfiles(apr_array_header_t **logfiles, 852251881Speter const char *path, 853251881Speter svn_boolean_t only_unused, 854251881Speter apr_pool_t *pool); 855251881Speter 856251881Speter 857251881Speter 858251881Speter/* Repository Paths */ 859251881Speter 860251881Speter/** Return the top-level repository path allocated in @a pool. */ 861251881Speterconst char * 862251881Spetersvn_repos_path(svn_repos_t *repos, 863251881Speter apr_pool_t *pool); 864251881Speter 865251881Speter/** Return the path to @a repos's filesystem directory, allocated in 866251881Speter * @a pool. 867251881Speter */ 868251881Speterconst char * 869251881Spetersvn_repos_db_env(svn_repos_t *repos, 870251881Speter apr_pool_t *pool); 871251881Speter 872251881Speter/** Return path to @a repos's config directory, allocated in @a pool. */ 873251881Speterconst char * 874251881Spetersvn_repos_conf_dir(svn_repos_t *repos, 875251881Speter apr_pool_t *pool); 876251881Speter 877251881Speter/** Return path to @a repos's svnserve.conf, allocated in @a pool. */ 878251881Speterconst char * 879251881Spetersvn_repos_svnserve_conf(svn_repos_t *repos, 880251881Speter apr_pool_t *pool); 881251881Speter 882251881Speter/** Return path to @a repos's lock directory, allocated in @a pool. */ 883251881Speterconst char * 884251881Spetersvn_repos_lock_dir(svn_repos_t *repos, 885251881Speter apr_pool_t *pool); 886251881Speter 887251881Speter/** Return path to @a repos's db lockfile, allocated in @a pool. */ 888251881Speterconst char * 889251881Spetersvn_repos_db_lockfile(svn_repos_t *repos, 890251881Speter apr_pool_t *pool); 891251881Speter 892251881Speter/** Return path to @a repos's db logs lockfile, allocated in @a pool. */ 893251881Speterconst char * 894251881Spetersvn_repos_db_logs_lockfile(svn_repos_t *repos, 895251881Speter apr_pool_t *pool); 896251881Speter 897251881Speter/** Return the path to @a repos's hook directory, allocated in @a pool. */ 898251881Speterconst char * 899251881Spetersvn_repos_hook_dir(svn_repos_t *repos, 900251881Speter apr_pool_t *pool); 901251881Speter 902251881Speter/** Return the path to @a repos's start-commit hook, allocated in @a pool. */ 903251881Speterconst char * 904251881Spetersvn_repos_start_commit_hook(svn_repos_t *repos, 905251881Speter apr_pool_t *pool); 906251881Speter 907251881Speter/** Return the path to @a repos's pre-commit hook, allocated in @a pool. */ 908251881Speterconst char * 909251881Spetersvn_repos_pre_commit_hook(svn_repos_t *repos, 910251881Speter apr_pool_t *pool); 911251881Speter 912251881Speter/** Return the path to @a repos's post-commit hook, allocated in @a pool. */ 913251881Speterconst char * 914251881Spetersvn_repos_post_commit_hook(svn_repos_t *repos, 915251881Speter apr_pool_t *pool); 916251881Speter 917251881Speter/** Return the path to @a repos's pre-revprop-change hook, allocated in 918251881Speter * @a pool. 919251881Speter */ 920251881Speterconst char * 921251881Spetersvn_repos_pre_revprop_change_hook(svn_repos_t *repos, 922251881Speter apr_pool_t *pool); 923251881Speter 924251881Speter/** Return the path to @a repos's post-revprop-change hook, allocated in 925251881Speter * @a pool. 926251881Speter */ 927251881Speterconst char * 928251881Spetersvn_repos_post_revprop_change_hook(svn_repos_t *repos, 929251881Speter apr_pool_t *pool); 930251881Speter 931251881Speter 932251881Speter/** @defgroup svn_repos_lock_hooks Paths to lock hooks 933251881Speter * @{ 934251881Speter * @since New in 1.2. */ 935251881Speter 936251881Speter/** Return the path to @a repos's pre-lock hook, allocated in @a pool. */ 937251881Speterconst char * 938251881Spetersvn_repos_pre_lock_hook(svn_repos_t *repos, 939251881Speter apr_pool_t *pool); 940251881Speter 941251881Speter/** Return the path to @a repos's post-lock hook, allocated in @a pool. */ 942251881Speterconst char * 943251881Spetersvn_repos_post_lock_hook(svn_repos_t *repos, 944251881Speter apr_pool_t *pool); 945251881Speter 946251881Speter/** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */ 947251881Speterconst char * 948251881Spetersvn_repos_pre_unlock_hook(svn_repos_t *repos, 949251881Speter apr_pool_t *pool); 950251881Speter 951251881Speter/** Return the path to @a repos's post-unlock hook, allocated in @a pool. */ 952251881Speterconst char * 953251881Spetersvn_repos_post_unlock_hook(svn_repos_t *repos, 954251881Speter apr_pool_t *pool); 955251881Speter 956251881Speter/** Specify that Subversion should consult the configuration file 957251881Speter * located at @a hooks_env_path to determine how to setup the 958251881Speter * environment for hook scripts invoked for the repository @a repos. 959251881Speter * As a special case, if @a hooks_env_path is @c NULL, look for the 960251881Speter * file in its default location within the repository disk structure. 961251881Speter * If @a hooks_env_path is not absolute, it specifies a path relative 962251881Speter * to the parent of the file's default location. 963251881Speter * 964251881Speter * Use @a scratch_pool for temporary allocations. 965251881Speter * 966251881Speter * If this function is not called, or if the specified configuration 967251881Speter * file does not define any environment variables, hooks will run in 968251881Speter * an empty environment. 969251881Speter * 970251881Speter * @since New in 1.8. 971251881Speter */ 972251881Spetersvn_error_t * 973251881Spetersvn_repos_hooks_setenv(svn_repos_t *repos, 974251881Speter const char *hooks_env_path, 975251881Speter apr_pool_t *scratch_pool); 976251881Speter 977251881Speter/** @} */ 978251881Speter 979251881Speter/* ---------------------------------------------------------------*/ 980251881Speter 981251881Speter/* Reporting the state of a working copy, for updates. */ 982251881Speter 983251881Speter 984251881Speter/** 985251881Speter * Construct and return a @a report_baton that will be passed to the 986251881Speter * other functions in this section to describe the state of a pre-existing 987251881Speter * tree (typically, a working copy). When the report is finished, 988251881Speter * @a editor/@a edit_baton will be driven in such a way as to transform the 989251881Speter * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the 990251881Speter * reported hierarchy to @a tgt_path. 991251881Speter * 992251881Speter * @a fs_base is the absolute path of the node in the filesystem at which 993251881Speter * the comparison should be rooted. @a target is a single path component, 994251881Speter * used to limit the scope of the report to a single entry of @a fs_base, 995251881Speter * or "" if all of @a fs_base itself is the main subject of the report. 996251881Speter * 997251881Speter * @a tgt_path and @a revnum is the fs path/revision pair that is the 998251881Speter * "target" of the delta. @a tgt_path should be provided only when 999251881Speter * the source and target paths of the report differ. That is, @a tgt_path 1000251881Speter * should *only* be specified when specifying that the resultant editor 1001251881Speter * drive be one that transforms the reported hierarchy into a pristine tree 1002251881Speter * of @a tgt_path at revision @a revnum. A @c NULL value for @a tgt_path 1003251881Speter * will indicate that the editor should be driven in such a way as to 1004251881Speter * transform the reported hierarchy to revision @a revnum, preserving the 1005251881Speter * reported hierarchy. 1006251881Speter * 1007251881Speter * @a text_deltas instructs the driver of the @a editor to enable 1008251881Speter * the generation of text deltas. 1009251881Speter * 1010251881Speter * @a ignore_ancestry instructs the driver to ignore node ancestry 1011251881Speter * when determining how to transmit differences. 1012251881Speter * 1013251881Speter * @a send_copyfrom_args instructs the driver to send 'copyfrom' 1014251881Speter * arguments to the editor's add_file() and add_directory() methods, 1015251881Speter * whenever it deems feasible. 1016251881Speter * 1017251881Speter * Use @a authz_read_func and @a authz_read_baton (if not @c NULL) to 1018251881Speter * avoid sending data through @a editor/@a edit_baton which is not 1019251881Speter * authorized for transmission. 1020251881Speter * 1021251881Speter * @a zero_copy_limit controls the maximum size (in bytes) at which 1022251881Speter * data blocks may be sent using the zero-copy code path. On that 1023251881Speter * path, a number of in-memory copy operations have been eliminated to 1024251881Speter * maximize throughput. However, until the whole block has been 1025251881Speter * pushed to the network stack, other clients block, so be careful 1026251881Speter * when using larger values here. Pass 0 for @a zero_copy_limit to 1027251881Speter * disable this optimization altogether. 1028251881Speter * 1029299742Sdim * @note Never activate this optimization if @a editor might access 1030251881Speter * any FSFS data structures (and, hence, caches). So, it is basically 1031251881Speter * safe for networked editors only. 1032251881Speter * 1033251881Speter * All allocation for the context and collected state will occur in 1034251881Speter * @a pool. 1035251881Speter * 1036251881Speter * @a depth is the requested depth of the editor drive. 1037251881Speter * 1038251881Speter * If @a depth is #svn_depth_unknown, the editor will affect only the 1039251881Speter * paths reported by the individual calls to svn_repos_set_path3() and 1040251881Speter * svn_repos_link_path3(). 1041251881Speter * 1042251881Speter * For example, if the reported tree is the @c A subdir of the Greek Tree 1043251881Speter * (see Subversion's test suite), at depth #svn_depth_empty, but the 1044251881Speter * @c A/B subdir is reported at depth #svn_depth_infinity, then 1045251881Speter * repository-side changes to @c A/mu, or underneath @c A/C and @c 1046251881Speter * A/D, would not be reflected in the editor drive, but changes 1047251881Speter * underneath @c A/B would be. 1048251881Speter * 1049251881Speter * Additionally, the editor driver will call @c add_directory and 1050251881Speter * and @c add_file for directories with an appropriate depth. For 1051251881Speter * example, a directory reported at #svn_depth_files will receive 1052251881Speter * file (but not directory) additions. A directory at #svn_depth_empty 1053251881Speter * will receive neither. 1054251881Speter * 1055251881Speter * If @a depth is #svn_depth_files, #svn_depth_immediates or 1056251881Speter * #svn_depth_infinity and @a depth is greater than the reported depth 1057251881Speter * of the working copy, then the editor driver will emit editor 1058251881Speter * operations so as to upgrade the working copy to this depth. 1059251881Speter * 1060251881Speter * If @a depth is #svn_depth_empty, #svn_depth_files, 1061251881Speter * #svn_depth_immediates and @a depth is lower 1062251881Speter * than or equal to the depth of the working copy, then the editor 1063251881Speter * operations will affect only paths at or above @a depth. 1064251881Speter * 1065251881Speter * @since New in 1.8. 1066251881Speter */ 1067251881Spetersvn_error_t * 1068251881Spetersvn_repos_begin_report3(void **report_baton, 1069251881Speter svn_revnum_t revnum, 1070251881Speter svn_repos_t *repos, 1071251881Speter const char *fs_base, 1072251881Speter const char *target, 1073251881Speter const char *tgt_path, 1074251881Speter svn_boolean_t text_deltas, 1075251881Speter svn_depth_t depth, 1076251881Speter svn_boolean_t ignore_ancestry, 1077251881Speter svn_boolean_t send_copyfrom_args, 1078251881Speter const svn_delta_editor_t *editor, 1079251881Speter void *edit_baton, 1080251881Speter svn_repos_authz_func_t authz_read_func, 1081251881Speter void *authz_read_baton, 1082251881Speter apr_size_t zero_copy_limit, 1083251881Speter apr_pool_t *pool); 1084251881Speter 1085251881Speter/** 1086251881Speter * The same as svn_repos_begin_report3(), but with @a zero_copy_limit 1087251881Speter * always passed as 0. 1088251881Speter * 1089251881Speter * @since New in 1.5. 1090251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 1091251881Speter */ 1092251881SpeterSVN_DEPRECATED 1093251881Spetersvn_error_t * 1094251881Spetersvn_repos_begin_report2(void **report_baton, 1095251881Speter svn_revnum_t revnum, 1096251881Speter svn_repos_t *repos, 1097251881Speter const char *fs_base, 1098251881Speter const char *target, 1099251881Speter const char *tgt_path, 1100251881Speter svn_boolean_t text_deltas, 1101251881Speter svn_depth_t depth, 1102251881Speter svn_boolean_t ignore_ancestry, 1103251881Speter svn_boolean_t send_copyfrom_args, 1104251881Speter const svn_delta_editor_t *editor, 1105251881Speter void *edit_baton, 1106251881Speter svn_repos_authz_func_t authz_read_func, 1107251881Speter void *authz_read_baton, 1108251881Speter apr_pool_t *pool); 1109251881Speter 1110251881Speter/** 1111251881Speter * The same as svn_repos_begin_report2(), but taking a boolean 1112251881Speter * @a recurse flag, and sending FALSE for @a send_copyfrom_args. 1113251881Speter * 1114251881Speter * If @a recurse is TRUE, the editor driver will drive the editor with 1115251881Speter * a depth of #svn_depth_infinity; if FALSE, then with a depth of 1116251881Speter * #svn_depth_files. 1117251881Speter * 1118251881Speter * @note @a username is ignored, and has been removed in a revised 1119251881Speter * version of this API. 1120251881Speter * 1121251881Speter * @deprecated Provided for backward compatibility with the 1.4 API. 1122251881Speter */ 1123251881SpeterSVN_DEPRECATED 1124251881Spetersvn_error_t * 1125251881Spetersvn_repos_begin_report(void **report_baton, 1126251881Speter svn_revnum_t revnum, 1127251881Speter const char *username, 1128251881Speter svn_repos_t *repos, 1129251881Speter const char *fs_base, 1130251881Speter const char *target, 1131251881Speter const char *tgt_path, 1132251881Speter svn_boolean_t text_deltas, 1133251881Speter svn_boolean_t recurse, 1134251881Speter svn_boolean_t ignore_ancestry, 1135251881Speter const svn_delta_editor_t *editor, 1136251881Speter void *edit_baton, 1137251881Speter svn_repos_authz_func_t authz_read_func, 1138251881Speter void *authz_read_baton, 1139251881Speter apr_pool_t *pool); 1140251881Speter 1141251881Speter 1142251881Speter/** 1143251881Speter * Given a @a report_baton constructed by svn_repos_begin_report3(), 1144251881Speter * record the presence of @a path, at @a revision with depth @a depth, 1145251881Speter * in the current tree. 1146251881Speter * 1147251881Speter * @a path is relative to the anchor/target used in the creation of the 1148251881Speter * @a report_baton. 1149251881Speter * 1150251881Speter * @a revision may be SVN_INVALID_REVNUM if (for example) @a path 1151251881Speter * represents a locally-added path with no revision number, or @a 1152251881Speter * depth is #svn_depth_exclude. 1153251881Speter * 1154251881Speter * @a path may not be underneath a path on which svn_repos_set_path3() 1155251881Speter * was previously called with #svn_depth_exclude in this report. 1156251881Speter * 1157251881Speter * The first call of this in a given report usually passes an empty 1158251881Speter * @a path; this is used to set up the correct root revision for the editor 1159251881Speter * drive. 1160251881Speter * 1161251881Speter * A depth of #svn_depth_unknown is not allowed, and results in an 1162251881Speter * error. 1163251881Speter * 1164251881Speter * If @a start_empty is TRUE and @a path is a directory, then require the 1165251881Speter * caller to explicitly provide all the children of @a path - do not assume 1166251881Speter * that the tree also contains all the children of @a path at @a revision. 1167251881Speter * This is for 'low confidence' client reporting. 1168251881Speter * 1169251881Speter * If the caller has a lock token for @a path, then @a lock_token should 1170251881Speter * be set to that token. Else, @a lock_token should be NULL. 1171251881Speter * 1172251881Speter * All temporary allocations are done in @a pool. 1173251881Speter * 1174251881Speter * @since New in 1.5. 1175251881Speter */ 1176251881Spetersvn_error_t * 1177251881Spetersvn_repos_set_path3(void *report_baton, 1178251881Speter const char *path, 1179251881Speter svn_revnum_t revision, 1180251881Speter svn_depth_t depth, 1181251881Speter svn_boolean_t start_empty, 1182251881Speter const char *lock_token, 1183251881Speter apr_pool_t *pool); 1184251881Speter 1185251881Speter/** 1186251881Speter * Similar to svn_repos_set_path3(), but with @a depth set to 1187251881Speter * #svn_depth_infinity. 1188251881Speter * 1189251881Speter * @deprecated Provided for backward compatibility with the 1.4 API. 1190251881Speter */ 1191251881SpeterSVN_DEPRECATED 1192251881Spetersvn_error_t * 1193251881Spetersvn_repos_set_path2(void *report_baton, 1194251881Speter const char *path, 1195251881Speter svn_revnum_t revision, 1196251881Speter svn_boolean_t start_empty, 1197251881Speter const char *lock_token, 1198251881Speter apr_pool_t *pool); 1199251881Speter 1200251881Speter/** 1201251881Speter * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL. 1202251881Speter * 1203251881Speter * @deprecated Provided for backward compatibility with the 1.1 API. 1204251881Speter */ 1205251881SpeterSVN_DEPRECATED 1206251881Spetersvn_error_t * 1207251881Spetersvn_repos_set_path(void *report_baton, 1208251881Speter const char *path, 1209251881Speter svn_revnum_t revision, 1210251881Speter svn_boolean_t start_empty, 1211251881Speter apr_pool_t *pool); 1212251881Speter 1213251881Speter/** 1214251881Speter * Given a @a report_baton constructed by svn_repos_begin_report3(), 1215251881Speter * record the presence of @a path in the current tree, containing the contents 1216251881Speter * of @a link_path at @a revision with depth @a depth. 1217251881Speter * 1218251881Speter * A depth of #svn_depth_unknown is not allowed, and results in an 1219251881Speter * error. 1220251881Speter * 1221251881Speter * @a path may not be underneath a path on which svn_repos_set_path3() 1222251881Speter * was previously called with #svn_depth_exclude in this report. 1223251881Speter * 1224251881Speter * Note that while @a path is relative to the anchor/target used in the 1225251881Speter * creation of the @a report_baton, @a link_path is an absolute filesystem 1226251881Speter * path! 1227251881Speter * 1228251881Speter * If @a start_empty is TRUE and @a path is a directory, then require the 1229251881Speter * caller to explicitly provide all the children of @a path - do not assume 1230251881Speter * that the tree also contains all the children of @a link_path at 1231251881Speter * @a revision. This is for 'low confidence' client reporting. 1232251881Speter * 1233251881Speter * If the caller has a lock token for @a link_path, then @a lock_token 1234251881Speter * should be set to that token. Else, @a lock_token should be NULL. 1235251881Speter * 1236251881Speter * All temporary allocations are done in @a pool. 1237251881Speter * 1238251881Speter * @since New in 1.5. 1239251881Speter */ 1240251881Spetersvn_error_t * 1241251881Spetersvn_repos_link_path3(void *report_baton, 1242251881Speter const char *path, 1243251881Speter const char *link_path, 1244251881Speter svn_revnum_t revision, 1245251881Speter svn_depth_t depth, 1246251881Speter svn_boolean_t start_empty, 1247251881Speter const char *lock_token, 1248251881Speter apr_pool_t *pool); 1249251881Speter 1250251881Speter/** 1251251881Speter * Similar to svn_repos_link_path3(), but with @a depth set to 1252251881Speter * #svn_depth_infinity. 1253251881Speter * 1254251881Speter * @deprecated Provided for backward compatibility with the 1.4 API. 1255251881Speter */ 1256251881SpeterSVN_DEPRECATED 1257251881Spetersvn_error_t * 1258251881Spetersvn_repos_link_path2(void *report_baton, 1259251881Speter const char *path, 1260251881Speter const char *link_path, 1261251881Speter svn_revnum_t revision, 1262251881Speter svn_boolean_t start_empty, 1263251881Speter const char *lock_token, 1264251881Speter apr_pool_t *pool); 1265251881Speter 1266251881Speter/** 1267251881Speter * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL. 1268251881Speter * 1269251881Speter * @deprecated Provided for backward compatibility with the 1.1 API. 1270251881Speter */ 1271251881SpeterSVN_DEPRECATED 1272251881Spetersvn_error_t * 1273251881Spetersvn_repos_link_path(void *report_baton, 1274251881Speter const char *path, 1275251881Speter const char *link_path, 1276251881Speter svn_revnum_t revision, 1277251881Speter svn_boolean_t start_empty, 1278251881Speter apr_pool_t *pool); 1279251881Speter 1280251881Speter/** Given a @a report_baton constructed by svn_repos_begin_report3(), 1281251881Speter * record the non-existence of @a path in the current tree. 1282251881Speter * 1283251881Speter * @a path may not be underneath a path on which svn_repos_set_path3() 1284251881Speter * was previously called with #svn_depth_exclude in this report. 1285251881Speter * 1286251881Speter * (This allows the reporter's driver to describe missing pieces of a 1287251881Speter * working copy, so that 'svn up' can recreate them.) 1288251881Speter * 1289251881Speter * All temporary allocations are done in @a pool. 1290251881Speter */ 1291251881Spetersvn_error_t * 1292251881Spetersvn_repos_delete_path(void *report_baton, 1293251881Speter const char *path, 1294251881Speter apr_pool_t *pool); 1295251881Speter 1296251881Speter/** Given a @a report_baton constructed by svn_repos_begin_report3(), 1297251881Speter * finish the report and drive the editor as specified when the report 1298251881Speter * baton was constructed. 1299251881Speter * 1300251881Speter * If an error occurs during the driving of the editor, do NOT abort the 1301251881Speter * edit; that responsibility belongs to the caller of this function, if 1302251881Speter * it happens at all. 1303251881Speter * 1304251881Speter * After the call to this function, @a report_baton is no longer valid; 1305251881Speter * it should not be passed to any other reporting functions, including 1306251881Speter * svn_repos_abort_report(), even if this function returns an error. 1307251881Speter */ 1308251881Spetersvn_error_t * 1309251881Spetersvn_repos_finish_report(void *report_baton, 1310251881Speter apr_pool_t *pool); 1311251881Speter 1312251881Speter 1313251881Speter/** Given a @a report_baton constructed by svn_repos_begin_report3(), 1314251881Speter * abort the report. This function can be called anytime before 1315251881Speter * svn_repos_finish_report() is called. 1316251881Speter * 1317251881Speter * After the call to this function, @a report_baton is no longer valid; 1318251881Speter * it should not be passed to any other reporting functions. 1319251881Speter */ 1320251881Spetersvn_error_t * 1321251881Spetersvn_repos_abort_report(void *report_baton, 1322251881Speter apr_pool_t *pool); 1323251881Speter 1324251881Speter 1325251881Speter/* ---------------------------------------------------------------*/ 1326251881Speter 1327251881Speter/* The magical dir_delta update routines. */ 1328251881Speter 1329251881Speter/** Use the provided @a editor and @a edit_baton to describe the changes 1330251881Speter * necessary for making a given node (and its descendants, if it is a 1331251881Speter * directory) under @a src_root look exactly like @a tgt_path under 1332251881Speter * @a tgt_root. @a src_entry is the node to update. If @a src_entry 1333251881Speter * is empty, then compute the difference between the entire tree 1334251881Speter * anchored at @a src_parent_dir under @a src_root and @a tgt_path 1335251881Speter * under @a tgt_root. Else, describe the changes needed to update 1336251881Speter * only that entry in @a src_parent_dir. Typically, callers of this 1337251881Speter * function will use a @a tgt_path that is the concatenation of @a 1338251881Speter * src_parent_dir and @a src_entry. 1339251881Speter * 1340251881Speter * @a src_root and @a tgt_root can both be either revision or transaction 1341251881Speter * roots. If @a tgt_root is a revision, @a editor's set_target_revision() 1342251881Speter * will be called with the @a tgt_root's revision number, else it will 1343251881Speter * not be called at all. 1344251881Speter * 1345251881Speter * If @a authz_read_func is non-NULL, invoke it before any call to 1346251881Speter * 1347251881Speter * @a editor->open_root 1348251881Speter * @a editor->add_directory 1349251881Speter * @a editor->open_directory 1350251881Speter * @a editor->add_file 1351251881Speter * @a editor->open_file 1352251881Speter * 1353251881Speter * passing @a tgt_root, the same path that would be passed to the 1354251881Speter * editor function in question, and @a authz_read_baton. If the 1355251881Speter * @a *allowed parameter comes back TRUE, then proceed with the planned 1356251881Speter * editor call; else if FALSE, then invoke @a editor->absent_file or 1357251881Speter * @a editor->absent_directory as appropriate, except if the planned 1358251881Speter * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE. 1359251881Speter * 1360251881Speter * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to 1361251881Speter * the window handler returned by @a editor->apply_textdelta(). 1362251881Speter * 1363251881Speter * If @a depth is #svn_depth_empty, invoke @a editor calls only on 1364251881Speter * @a src_entry (or @a src_parent_dir, if @a src_entry is empty). 1365251881Speter * If @a depth is #svn_depth_files, also invoke the editor on file 1366251881Speter * children, if any; if #svn_depth_immediates, invoke it on 1367251881Speter * immediate subdirectories as well as files; if #svn_depth_infinity, 1368251881Speter * recurse fully. 1369251881Speter * 1370251881Speter * If @a entry_props is @c TRUE, accompany each opened/added entry with 1371251881Speter * propchange editor calls that relay special "entry props" (this 1372251881Speter * is typically used only for working copy updates). 1373251881Speter * 1374251881Speter * @a ignore_ancestry instructs the function to ignore node ancestry 1375251881Speter * when determining how to transmit differences. 1376251881Speter * 1377251881Speter * Before completing successfully, this function calls @a editor's 1378251881Speter * close_edit(), so the caller should expect its @a edit_baton to be 1379251881Speter * invalid after its use with this function. 1380251881Speter * 1381251881Speter * Do any allocation necessary for the delta computation in @a pool. 1382251881Speter * This function's maximum memory consumption is at most roughly 1383251881Speter * proportional to the greatest depth of the tree under @a tgt_root, not 1384251881Speter * the total size of the delta. 1385251881Speter * 1386251881Speter * ### svn_repos_dir_delta2 is mostly superseded by the reporter 1387251881Speter * ### functionality (svn_repos_begin_report3 and friends). 1388251881Speter * ### svn_repos_dir_delta2 does allow the roots to be transaction 1389251881Speter * ### roots rather than just revision roots, and it has the 1390251881Speter * ### entry_props flag. Almost all of Subversion's own code uses the 1391251881Speter * ### reporter instead; there are some stray references to the 1392251881Speter * ### svn_repos_dir_delta[2] in comments which should probably 1393251881Speter * ### actually refer to the reporter. 1394251881Speter * 1395251881Speter * @since New in 1.5. 1396251881Speter */ 1397251881Spetersvn_error_t * 1398251881Spetersvn_repos_dir_delta2(svn_fs_root_t *src_root, 1399251881Speter const char *src_parent_dir, 1400251881Speter const char *src_entry, 1401251881Speter svn_fs_root_t *tgt_root, 1402251881Speter const char *tgt_path, 1403251881Speter const svn_delta_editor_t *editor, 1404251881Speter void *edit_baton, 1405251881Speter svn_repos_authz_func_t authz_read_func, 1406251881Speter void *authz_read_baton, 1407251881Speter svn_boolean_t text_deltas, 1408251881Speter svn_depth_t depth, 1409251881Speter svn_boolean_t entry_props, 1410251881Speter svn_boolean_t ignore_ancestry, 1411251881Speter apr_pool_t *pool); 1412251881Speter 1413251881Speter/** 1414251881Speter * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass 1415251881Speter * #svn_depth_infinity for @a depth, and if @a recurse is FALSE, 1416251881Speter * pass #svn_depth_files for @a depth. 1417251881Speter * 1418251881Speter * @deprecated Provided for backward compatibility with the 1.4 API. 1419251881Speter */ 1420251881SpeterSVN_DEPRECATED 1421251881Spetersvn_error_t * 1422251881Spetersvn_repos_dir_delta(svn_fs_root_t *src_root, 1423251881Speter const char *src_parent_dir, 1424251881Speter const char *src_entry, 1425251881Speter svn_fs_root_t *tgt_root, 1426251881Speter const char *tgt_path, 1427251881Speter const svn_delta_editor_t *editor, 1428251881Speter void *edit_baton, 1429251881Speter svn_repos_authz_func_t authz_read_func, 1430251881Speter void *authz_read_baton, 1431251881Speter svn_boolean_t text_deltas, 1432251881Speter svn_boolean_t recurse, 1433251881Speter svn_boolean_t entry_props, 1434251881Speter svn_boolean_t ignore_ancestry, 1435251881Speter apr_pool_t *pool); 1436251881Speter 1437251881Speter 1438251881Speter/** Use the provided @a editor and @a edit_baton to describe the 1439251881Speter * skeletal changes made in a particular filesystem @a root 1440251881Speter * (revision or transaction). 1441251881Speter * 1442251881Speter * Changes will be limited to those within @a base_dir, and if 1443251881Speter * @a low_water_mark is set to something other than #SVN_INVALID_REVNUM 1444251881Speter * it is assumed that the client has no knowledge of revisions prior to 1445251881Speter * @a low_water_mark. Together, these two arguments define the portion of 1446251881Speter * the tree that the client is assumed to have knowledge of, and thus any 1447251881Speter * copies of data from outside that part of the tree will be sent in their 1448251881Speter * entirety, not as simple copies or deltas against a previous version. 1449251881Speter * 1450251881Speter * The @a editor passed to this function should be aware of the fact 1451251881Speter * that, if @a send_deltas is FALSE, calls to its change_dir_prop(), 1452251881Speter * change_file_prop(), and apply_textdelta() functions will not 1453251881Speter * contain meaningful data, and merely serve as indications that 1454251881Speter * properties or textual contents were changed. 1455251881Speter * 1456251881Speter * If @a send_deltas is @c TRUE, the text and property deltas for changes 1457251881Speter * will be sent, otherwise NULL text deltas and empty prop changes will be 1458251881Speter * used. 1459251881Speter * 1460251881Speter * If @a authz_read_func is non-NULL, it will be used to determine if the 1461251881Speter * user has read access to the data being accessed. Data that the user 1462251881Speter * cannot access will be skipped. 1463251881Speter * 1464251881Speter * @note This editor driver passes SVN_INVALID_REVNUM for all 1465251881Speter * revision parameters in the editor interface except the copyfrom 1466251881Speter * parameter of the add_file() and add_directory() editor functions. 1467251881Speter * 1468251881Speter * @since New in 1.4. 1469251881Speter */ 1470251881Spetersvn_error_t * 1471251881Spetersvn_repos_replay2(svn_fs_root_t *root, 1472251881Speter const char *base_dir, 1473251881Speter svn_revnum_t low_water_mark, 1474251881Speter svn_boolean_t send_deltas, 1475251881Speter const svn_delta_editor_t *editor, 1476251881Speter void *edit_baton, 1477251881Speter svn_repos_authz_func_t authz_read_func, 1478251881Speter void *authz_read_baton, 1479251881Speter apr_pool_t *pool); 1480251881Speter 1481251881Speter/** 1482251881Speter * Similar to svn_repos_replay2(), but with @a base_dir set to @c "", 1483251881Speter * @a low_water_mark set to #SVN_INVALID_REVNUM, @a send_deltas 1484251881Speter * set to @c FALSE, and @a authz_read_func and @a authz_read_baton 1485251881Speter * set to @c NULL. 1486251881Speter * 1487251881Speter * @deprecated Provided for backward compatibility with the 1.3 API. 1488251881Speter */ 1489251881SpeterSVN_DEPRECATED 1490251881Spetersvn_error_t * 1491251881Spetersvn_repos_replay(svn_fs_root_t *root, 1492251881Speter const svn_delta_editor_t *editor, 1493251881Speter void *edit_baton, 1494251881Speter apr_pool_t *pool); 1495251881Speter 1496251881Speter/* ---------------------------------------------------------------*/ 1497251881Speter 1498251881Speter/* Making commits. */ 1499251881Speter 1500251881Speter/** 1501251881Speter * Return an @a editor and @a edit_baton to commit changes to the 1502251881Speter * filesystem of @a repos, beginning at location 'rev:@a base_path', 1503251881Speter * where "rev" is the argument given to open_root(). 1504251881Speter * 1505299742Sdim * @a repos is a previously opened repository. @a repos_url_decoded is the 1506251881Speter * decoded URL to the base of the repository, and is used to check 1507299742Sdim * copyfrom paths. @a txn is a filesystem transaction object to use 1508251881Speter * during the commit, or @c NULL to indicate that this function should 1509251881Speter * create (and fully manage) a new transaction. 1510251881Speter * 1511251881Speter * Store the contents of @a revprop_table, a hash mapping <tt>const 1512251881Speter * char *</tt> property names to #svn_string_t values, as properties 1513251881Speter * of the commit transaction, including author and log message if 1514251881Speter * present. 1515251881Speter * 1516251881Speter * @note #SVN_PROP_REVISION_DATE may be present in @a revprop_table, but 1517251881Speter * it will be overwritten when the transaction is committed. 1518251881Speter * 1519251881Speter * Iff @a authz_callback is provided, check read/write authorizations 1520251881Speter * on paths accessed by editor operations. An operation which fails 1521251881Speter * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or 1522251881Speter * SVN_ERR_AUTHZ_UNWRITABLE. 1523251881Speter * 1524251881Speter * Calling @a (*editor)->close_edit completes the commit. 1525251881Speter * 1526251881Speter * If @a commit_callback is non-NULL, then before @c close_edit returns (but 1527251881Speter * after the commit has succeeded) @c close_edit will invoke 1528251881Speter * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton, 1529299742Sdim * and @a pool or some subpool thereof as arguments. The @c repos_root field 1530299742Sdim * of the #svn_commit_info_t is @c NULL. If @a commit_callback 1531251881Speter * returns an error, that error will be returned from @c close_edit, 1532251881Speter * otherwise if there was a post-commit hook failure, then that error 1533251881Speter * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. 1534299742Sdim * (Note that prior to Subversion 1.6, @a commit_callback cannot be @c NULL; 1535299742Sdim * if you don't need a callback, pass a dummy function.) 1536251881Speter * 1537251881Speter * Calling @a (*editor)->abort_edit aborts the commit, and will also 1538251881Speter * abort the commit transaction unless @a txn was supplied (not @c 1539251881Speter * NULL). Callers who supply their own transactions are responsible 1540251881Speter * for cleaning them up (either by committing them, or aborting them). 1541251881Speter * 1542299742Sdim * @since New in 1.5. Since 1.6, @a commit_callback can be @c NULL. 1543251881Speter * 1544299742Sdim * @note Yes, @a repos_url_decoded is a <em>decoded</em> URL. We realize 1545251881Speter * that's sorta wonky. Sorry about that. 1546299742Sdim * 1547299742Sdim * @note Like most commit editors, the returned editor requires that the 1548299742Sdim * @c copyfrom_path parameter passed to its @c add_file and @c add_directory 1549299742Sdim * methods is a full, URI-encoded URL, not a relative path. 1550251881Speter */ 1551251881Spetersvn_error_t * 1552251881Spetersvn_repos_get_commit_editor5(const svn_delta_editor_t **editor, 1553251881Speter void **edit_baton, 1554251881Speter svn_repos_t *repos, 1555251881Speter svn_fs_txn_t *txn, 1556299742Sdim const char *repos_url_decoded, 1557251881Speter const char *base_path, 1558251881Speter apr_hash_t *revprop_table, 1559251881Speter svn_commit_callback2_t commit_callback, 1560251881Speter void *commit_baton, 1561251881Speter svn_repos_authz_callback_t authz_callback, 1562251881Speter void *authz_baton, 1563251881Speter apr_pool_t *pool); 1564251881Speter 1565251881Speter/** 1566251881Speter * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table 1567251881Speter * set to a hash containing @a user and @a log_msg as the 1568251881Speter * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties, 1569251881Speter * respectively. @a user and @a log_msg may both be @c NULL. 1570251881Speter * 1571251881Speter * @since New in 1.4. 1572251881Speter * 1573251881Speter * @deprecated Provided for backward compatibility with the 1.4 API. 1574251881Speter */ 1575251881SpeterSVN_DEPRECATED 1576251881Spetersvn_error_t * 1577251881Spetersvn_repos_get_commit_editor4(const svn_delta_editor_t **editor, 1578251881Speter void **edit_baton, 1579251881Speter svn_repos_t *repos, 1580251881Speter svn_fs_txn_t *txn, 1581251881Speter const char *repos_url, 1582251881Speter const char *base_path, 1583251881Speter const char *user, 1584251881Speter const char *log_msg, 1585251881Speter svn_commit_callback2_t commit_callback, 1586251881Speter void *commit_baton, 1587251881Speter svn_repos_authz_callback_t authz_callback, 1588251881Speter void *authz_baton, 1589251881Speter apr_pool_t *pool); 1590251881Speter 1591251881Speter/** 1592251881Speter * Similar to svn_repos_get_commit_editor4(), but 1593251881Speter * uses the svn_commit_callback_t type. 1594251881Speter * 1595251881Speter * @since New in 1.3. 1596251881Speter * 1597251881Speter * @deprecated Provided for backward compatibility with the 1.3 API. 1598251881Speter */ 1599251881SpeterSVN_DEPRECATED 1600251881Spetersvn_error_t * 1601251881Spetersvn_repos_get_commit_editor3(const svn_delta_editor_t **editor, 1602251881Speter void **edit_baton, 1603251881Speter svn_repos_t *repos, 1604251881Speter svn_fs_txn_t *txn, 1605251881Speter const char *repos_url, 1606251881Speter const char *base_path, 1607251881Speter const char *user, 1608251881Speter const char *log_msg, 1609251881Speter svn_commit_callback_t callback, 1610251881Speter void *callback_baton, 1611251881Speter svn_repos_authz_callback_t authz_callback, 1612251881Speter void *authz_baton, 1613251881Speter apr_pool_t *pool); 1614251881Speter 1615251881Speter/** 1616251881Speter * Similar to svn_repos_get_commit_editor3(), but with @a 1617251881Speter * authz_callback and @a authz_baton set to @c NULL. 1618251881Speter * 1619251881Speter * @deprecated Provided for backward compatibility with the 1.2 API. 1620251881Speter */ 1621251881SpeterSVN_DEPRECATED 1622251881Spetersvn_error_t * 1623251881Spetersvn_repos_get_commit_editor2(const svn_delta_editor_t **editor, 1624251881Speter void **edit_baton, 1625251881Speter svn_repos_t *repos, 1626251881Speter svn_fs_txn_t *txn, 1627251881Speter const char *repos_url, 1628251881Speter const char *base_path, 1629251881Speter const char *user, 1630251881Speter const char *log_msg, 1631251881Speter svn_commit_callback_t callback, 1632251881Speter void *callback_baton, 1633251881Speter apr_pool_t *pool); 1634251881Speter 1635251881Speter 1636251881Speter/** 1637251881Speter * Similar to svn_repos_get_commit_editor2(), but with @a txn always 1638251881Speter * set to @c NULL. 1639251881Speter * 1640251881Speter * @deprecated Provided for backward compatibility with the 1.1 API. 1641251881Speter */ 1642251881SpeterSVN_DEPRECATED 1643251881Spetersvn_error_t * 1644251881Spetersvn_repos_get_commit_editor(const svn_delta_editor_t **editor, 1645251881Speter void **edit_baton, 1646251881Speter svn_repos_t *repos, 1647251881Speter const char *repos_url, 1648251881Speter const char *base_path, 1649251881Speter const char *user, 1650251881Speter const char *log_msg, 1651251881Speter svn_commit_callback_t callback, 1652251881Speter void *callback_baton, 1653251881Speter apr_pool_t *pool); 1654251881Speter 1655251881Speter/* ---------------------------------------------------------------*/ 1656251881Speter 1657251881Speter/* Finding particular revisions. */ 1658251881Speter 1659251881Speter/** Set @a *revision to the revision number in @a repos's filesystem that was 1660251881Speter * youngest at time @a tm. 1661251881Speter */ 1662251881Spetersvn_error_t * 1663251881Spetersvn_repos_dated_revision(svn_revnum_t *revision, 1664251881Speter svn_repos_t *repos, 1665251881Speter apr_time_t tm, 1666251881Speter apr_pool_t *pool); 1667251881Speter 1668251881Speter 1669251881Speter/** Given a @a root/@a path within some filesystem, return three pieces of 1670251881Speter * information allocated in @a pool: 1671251881Speter * 1672251881Speter * - set @a *committed_rev to the revision in which the object was 1673251881Speter * last modified. (In fs parlance, this is the revision in which 1674251881Speter * the particular node-rev-id was 'created'.) 1675251881Speter * 1676251881Speter * - set @a *committed_date to the date of said revision, or @c NULL 1677251881Speter * if not available. 1678251881Speter * 1679251881Speter * - set @a *last_author to the author of said revision, or @c NULL 1680251881Speter * if not available. 1681251881Speter */ 1682251881Spetersvn_error_t * 1683251881Spetersvn_repos_get_committed_info(svn_revnum_t *committed_rev, 1684251881Speter const char **committed_date, 1685251881Speter const char **last_author, 1686251881Speter svn_fs_root_t *root, 1687251881Speter const char *path, 1688251881Speter apr_pool_t *pool); 1689251881Speter 1690251881Speter 1691251881Speter/** 1692251881Speter * Set @a *dirent to an #svn_dirent_t associated with @a path in @a 1693251881Speter * root. If @a path does not exist in @a root, set @a *dirent to 1694251881Speter * NULL. Use @a pool for memory allocation. 1695251881Speter * 1696251881Speter * @since New in 1.2. 1697251881Speter */ 1698251881Spetersvn_error_t * 1699251881Spetersvn_repos_stat(svn_dirent_t **dirent, 1700251881Speter svn_fs_root_t *root, 1701251881Speter const char *path, 1702251881Speter apr_pool_t *pool); 1703251881Speter 1704251881Speter 1705251881Speter/** 1706251881Speter * Given @a path which exists at revision @a start in @a fs, set 1707251881Speter * @a *deleted to the revision @a path was first deleted, within the 1708251881Speter * inclusive revision range bounded by @a start and @a end. If @a path 1709251881Speter * does not exist at revision @a start or was not deleted within the 1710251881Speter * specified range, then set @a *deleted to SVN_INVALID_REVNUM. 1711251881Speter * Use @a pool for memory allocation. 1712251881Speter * 1713251881Speter * @since New in 1.5. 1714251881Speter */ 1715251881Spetersvn_error_t * 1716251881Spetersvn_repos_deleted_rev(svn_fs_t *fs, 1717251881Speter const char *path, 1718251881Speter svn_revnum_t start, 1719251881Speter svn_revnum_t end, 1720251881Speter svn_revnum_t *deleted, 1721251881Speter apr_pool_t *pool); 1722251881Speter 1723251881Speter 1724251881Speter/** Callback type for use with svn_repos_history(). @a path and @a 1725251881Speter * revision represent interesting history locations in the lifetime 1726251881Speter * of the path passed to svn_repos_history(). @a baton is the same 1727251881Speter * baton given to svn_repos_history(). @a pool is provided for the 1728251881Speter * convenience of the implementor, who should not expect it to live 1729251881Speter * longer than a single callback call. 1730251881Speter * 1731251881Speter * Signal to callback driver to stop processing/invoking this callback 1732251881Speter * by returning the #SVN_ERR_CEASE_INVOCATION error code. 1733251881Speter * 1734251881Speter * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 1735251881Speter */ 1736251881Spetertypedef svn_error_t *(*svn_repos_history_func_t)(void *baton, 1737251881Speter const char *path, 1738251881Speter svn_revnum_t revision, 1739251881Speter apr_pool_t *pool); 1740251881Speter 1741251881Speter/** 1742251881Speter * Call @a history_func (with @a history_baton) for each interesting 1743251881Speter * history location in the lifetime of @a path in @a fs, from the 1744251881Speter * youngest of @a end and @a start to the oldest. Stop processing if 1745251881Speter * @a history_func returns #SVN_ERR_CEASE_INVOCATION. Only cross 1746251881Speter * filesystem copy history if @a cross_copies is @c TRUE. And do all 1747251881Speter * of this in @a pool. 1748251881Speter * 1749251881Speter * If @a authz_read_func is non-NULL, then use it (and @a 1750251881Speter * authz_read_baton) to verify that @a path in @a end is readable; if 1751251881Speter * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability 1752251881Speter * of every ancestral path/revision pair before pushing them at @a 1753251881Speter * history_func. If a pair is deemed unreadable, then do not send 1754251881Speter * them; instead, immediately stop traversing history and return 1755251881Speter * SVN_NO_ERROR. 1756251881Speter * 1757251881Speter * @since New in 1.1. 1758251881Speter * 1759251881Speter * @note SVN_ERR_CEASE_INVOCATION is new in 1.5. 1760251881Speter */ 1761251881Spetersvn_error_t * 1762251881Spetersvn_repos_history2(svn_fs_t *fs, 1763251881Speter const char *path, 1764251881Speter svn_repos_history_func_t history_func, 1765251881Speter void *history_baton, 1766251881Speter svn_repos_authz_func_t authz_read_func, 1767251881Speter void *authz_read_baton, 1768251881Speter svn_revnum_t start, 1769251881Speter svn_revnum_t end, 1770251881Speter svn_boolean_t cross_copies, 1771251881Speter apr_pool_t *pool); 1772251881Speter 1773251881Speter/** 1774251881Speter * Similar to svn_repos_history2(), but with @a authz_read_func 1775251881Speter * and @a authz_read_baton always set to NULL. 1776251881Speter * 1777251881Speter * @deprecated Provided for backward compatibility with the 1.0 API. 1778251881Speter */ 1779251881SpeterSVN_DEPRECATED 1780251881Spetersvn_error_t * 1781251881Spetersvn_repos_history(svn_fs_t *fs, 1782251881Speter const char *path, 1783251881Speter svn_repos_history_func_t history_func, 1784251881Speter void *history_baton, 1785251881Speter svn_revnum_t start, 1786251881Speter svn_revnum_t end, 1787251881Speter svn_boolean_t cross_copies, 1788251881Speter apr_pool_t *pool); 1789251881Speter 1790251881Speter 1791251881Speter/** 1792251881Speter * Set @a *locations to be a mapping of the revisions to the paths of 1793251881Speter * the file @a fs_path present at the repository in revision 1794251881Speter * @a peg_revision, where the revisions are taken out of the array 1795251881Speter * @a location_revisions. 1796251881Speter * 1797251881Speter * @a location_revisions is an array of svn_revnum_t's and @a *locations 1798251881Speter * maps 'svn_revnum_t *' to 'const char *'. 1799251881Speter * 1800251881Speter * If optional @a authz_read_func is non-NULL, then use it (and @a 1801251881Speter * authz_read_baton) to verify that the peg-object is readable. If not, 1802251881Speter * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func 1803251881Speter * to check that every path returned in the hash is readable. If an 1804251881Speter * unreadable path is encountered, stop tracing and return 1805251881Speter * SVN_NO_ERROR. 1806251881Speter * 1807251881Speter * @a pool is used for all allocations. 1808251881Speter * 1809251881Speter * @since New in 1.1. 1810251881Speter */ 1811251881Spetersvn_error_t * 1812251881Spetersvn_repos_trace_node_locations(svn_fs_t *fs, 1813251881Speter apr_hash_t **locations, 1814251881Speter const char *fs_path, 1815251881Speter svn_revnum_t peg_revision, 1816251881Speter const apr_array_header_t *location_revisions, 1817251881Speter svn_repos_authz_func_t authz_read_func, 1818251881Speter void *authz_read_baton, 1819251881Speter apr_pool_t *pool); 1820251881Speter 1821251881Speter 1822251881Speter/** 1823251881Speter * Call @a receiver and @a receiver_baton to report successive 1824251881Speter * location segments in revisions between @a start_rev and @a end_rev 1825251881Speter * (inclusive) for the line of history identified by the peg-object @a 1826251881Speter * path in @a peg_revision (and in @a repos). 1827251881Speter * 1828251881Speter * @a end_rev may be #SVN_INVALID_REVNUM to indicate that you want 1829251881Speter * to trace the history of the object to its origin. 1830251881Speter * 1831251881Speter * @a start_rev may be #SVN_INVALID_REVNUM to indicate "the HEAD 1832251881Speter * revision". Otherwise, @a start_rev must be younger than @a end_rev 1833251881Speter * (unless @a end_rev is #SVN_INVALID_REVNUM). 1834251881Speter * 1835251881Speter * @a peg_revision may be #SVN_INVALID_REVNUM to indicate "the HEAD 1836251881Speter * revision", and must evaluate to be at least as young as @a start_rev. 1837251881Speter * 1838251881Speter * If optional @a authz_read_func is not @c NULL, then use it (and @a 1839251881Speter * authz_read_baton) to verify that the peg-object is readable. If 1840251881Speter * not, return #SVN_ERR_AUTHZ_UNREADABLE. Also use the @a 1841251881Speter * authz_read_func to check that every path reported in a location 1842251881Speter * segment is readable. If an unreadable path is encountered, report 1843251881Speter * a final (possibly truncated) location segment (if any), stop 1844251881Speter * tracing history, and return #SVN_NO_ERROR. 1845251881Speter * 1846251881Speter * @a pool is used for all allocations. 1847251881Speter * 1848251881Speter * @since New in 1.5. 1849251881Speter */ 1850251881Spetersvn_error_t * 1851251881Spetersvn_repos_node_location_segments(svn_repos_t *repos, 1852251881Speter const char *path, 1853251881Speter svn_revnum_t peg_revision, 1854251881Speter svn_revnum_t start_rev, 1855251881Speter svn_revnum_t end_rev, 1856251881Speter svn_location_segment_receiver_t receiver, 1857251881Speter void *receiver_baton, 1858251881Speter svn_repos_authz_func_t authz_read_func, 1859251881Speter void *authz_read_baton, 1860251881Speter apr_pool_t *pool); 1861251881Speter 1862251881Speter 1863251881Speter/* ---------------------------------------------------------------*/ 1864251881Speter 1865251881Speter/* Retrieving log messages. */ 1866251881Speter 1867251881Speter 1868251881Speter/** 1869251881Speter * Invoke @a receiver with @a receiver_baton on each log message from 1870251881Speter * @a start to @a end in @a repos's filesystem. @a start may be greater 1871251881Speter * or less than @a end; this just controls whether the log messages are 1872251881Speter * processed in descending or ascending revision number order. 1873251881Speter * 1874251881Speter * If @a start or @a end is #SVN_INVALID_REVNUM, it defaults to youngest. 1875251881Speter * 1876251881Speter * If @a paths is non-NULL and has one or more elements, then only show 1877251881Speter * revisions in which at least one of @a paths was changed (i.e., if 1878251881Speter * file, text or props changed; if dir, props or entries changed or any node 1879251881Speter * changed below it). Each path is a <tt>const char *</tt> representing 1880251881Speter * an absolute path in the repository. If @a paths is NULL or empty, 1881251881Speter * show all revisions regardless of what paths were changed in those 1882251881Speter * revisions. 1883251881Speter * 1884299742Sdim * If @a limit is greater than zero then only invoke @a receiver on the first 1885251881Speter * @a limit logs. 1886251881Speter * 1887251881Speter * If @a discover_changed_paths, then each call to @a receiver passes a 1888251881Speter * hash mapping paths committed in that revision to information about them 1889251881Speter * as the receiver's @a changed_paths argument. 1890251881Speter * Otherwise, each call to @a receiver passes NULL for @a changed_paths. 1891251881Speter * 1892251881Speter * If @a strict_node_history is set, copy history (if any exists) will 1893251881Speter * not be traversed while harvesting revision logs for each path. 1894251881Speter * 1895251881Speter * If @a include_merged_revisions is set, log information for revisions 1896251881Speter * which have been merged to @a paths will also be returned, unless these 1897251881Speter * revisions are already part of @a start to @a end in @a repos's 1898251881Speter * filesystem, as limited by @a paths. In the latter case those revisions 1899251881Speter * are skipped and @a receiver is not invoked. 1900251881Speter * 1901251881Speter * If @a revprops is NULL, retrieve all revision properties; else, retrieve 1902251881Speter * only the revision properties named by the (const char *) array elements 1903251881Speter * (i.e. retrieve none if the array is empty). 1904251881Speter * 1905251881Speter * If any invocation of @a receiver returns error, return that error 1906251881Speter * immediately and without wrapping it. 1907251881Speter * 1908251881Speter * If @a start or @a end is a non-existent revision, return the error 1909251881Speter * #SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver. 1910251881Speter * 1911251881Speter * If optional @a authz_read_func is non-NULL, then use this function 1912251881Speter * (along with optional @a authz_read_baton) to check the readability 1913251881Speter * of each changed-path in each revision about to be "pushed" at 1914251881Speter * @a receiver. If a revision has some changed-paths readable and 1915251881Speter * others unreadable, unreadable paths are omitted from the 1916251881Speter * changed_paths field and only svn:author and svn:date will be 1917251881Speter * available in the revprops field. If a revision has no 1918251881Speter * changed-paths readable at all, then all paths are omitted and no 1919251881Speter * revprops are available. 1920251881Speter * 1921251881Speter * See also the documentation for #svn_log_entry_receiver_t. 1922251881Speter * 1923251881Speter * Use @a pool for temporary allocations. 1924251881Speter * 1925251881Speter * @since New in 1.5. 1926251881Speter */ 1927251881Spetersvn_error_t * 1928251881Spetersvn_repos_get_logs4(svn_repos_t *repos, 1929251881Speter const apr_array_header_t *paths, 1930251881Speter svn_revnum_t start, 1931251881Speter svn_revnum_t end, 1932251881Speter int limit, 1933251881Speter svn_boolean_t discover_changed_paths, 1934251881Speter svn_boolean_t strict_node_history, 1935251881Speter svn_boolean_t include_merged_revisions, 1936251881Speter const apr_array_header_t *revprops, 1937251881Speter svn_repos_authz_func_t authz_read_func, 1938251881Speter void *authz_read_baton, 1939251881Speter svn_log_entry_receiver_t receiver, 1940251881Speter void *receiver_baton, 1941251881Speter apr_pool_t *pool); 1942251881Speter 1943251881Speter/** 1944251881Speter * Same as svn_repos_get_logs4(), but with @a receiver being 1945251881Speter * #svn_log_message_receiver_t instead of #svn_log_entry_receiver_t. 1946251881Speter * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is 1947251881Speter * svn:author, svn:date, and svn:log. If @a paths is empty, nothing 1948251881Speter * is returned. 1949251881Speter * 1950251881Speter * @since New in 1.2. 1951251881Speter * @deprecated Provided for backward compatibility with the 1.4 API. 1952251881Speter */ 1953251881SpeterSVN_DEPRECATED 1954251881Spetersvn_error_t * 1955251881Spetersvn_repos_get_logs3(svn_repos_t *repos, 1956251881Speter const apr_array_header_t *paths, 1957251881Speter svn_revnum_t start, 1958251881Speter svn_revnum_t end, 1959251881Speter int limit, 1960251881Speter svn_boolean_t discover_changed_paths, 1961251881Speter svn_boolean_t strict_node_history, 1962251881Speter svn_repos_authz_func_t authz_read_func, 1963251881Speter void *authz_read_baton, 1964251881Speter svn_log_message_receiver_t receiver, 1965251881Speter void *receiver_baton, 1966251881Speter apr_pool_t *pool); 1967251881Speter 1968251881Speter 1969251881Speter/** 1970251881Speter * Same as svn_repos_get_logs3(), but with @a limit always set to 0. 1971251881Speter * 1972251881Speter * @deprecated Provided for backward compatibility with the 1.1 API. 1973251881Speter */ 1974251881SpeterSVN_DEPRECATED 1975251881Spetersvn_error_t * 1976251881Spetersvn_repos_get_logs2(svn_repos_t *repos, 1977251881Speter const apr_array_header_t *paths, 1978251881Speter svn_revnum_t start, 1979251881Speter svn_revnum_t end, 1980251881Speter svn_boolean_t discover_changed_paths, 1981251881Speter svn_boolean_t strict_node_history, 1982251881Speter svn_repos_authz_func_t authz_read_func, 1983251881Speter void *authz_read_baton, 1984251881Speter svn_log_message_receiver_t receiver, 1985251881Speter void *receiver_baton, 1986251881Speter apr_pool_t *pool); 1987251881Speter 1988251881Speter/** 1989251881Speter * Same as svn_repos_get_logs2(), but with @a authz_read_func and 1990251881Speter * @a authz_read_baton always set to NULL. 1991251881Speter * 1992251881Speter * @deprecated Provided for backward compatibility with the 1.0 API. 1993251881Speter */ 1994251881SpeterSVN_DEPRECATED 1995251881Spetersvn_error_t * 1996251881Spetersvn_repos_get_logs(svn_repos_t *repos, 1997251881Speter const apr_array_header_t *paths, 1998251881Speter svn_revnum_t start, 1999251881Speter svn_revnum_t end, 2000251881Speter svn_boolean_t discover_changed_paths, 2001251881Speter svn_boolean_t strict_node_history, 2002251881Speter svn_log_message_receiver_t receiver, 2003251881Speter void *receiver_baton, 2004251881Speter apr_pool_t *pool); 2005251881Speter 2006251881Speter 2007251881Speter 2008251881Speter/* ---------------------------------------------------------------*/ 2009251881Speter 2010251881Speter/* Retrieving mergeinfo. */ 2011251881Speter 2012251881Speter/** 2013251881Speter * Fetch the mergeinfo for @a paths at @a revision in @a repos, and 2014251881Speter * set @a *catalog to a catalog of this mergeinfo. @a *catalog will 2015251881Speter * never be @c NULL but may be empty. 2016251881Speter * 2017251881Speter * The paths in @a paths, and the keys of @a catalog, start with '/'. 2018251881Speter * 2019251881Speter * @a inherit indicates whether explicit, explicit or inherited, or 2020251881Speter * only inherited mergeinfo for @a paths is fetched. 2021251881Speter * 2022251881Speter * If @a revision is #SVN_INVALID_REVNUM, it defaults to youngest. 2023251881Speter * 2024251881Speter * If @a include_descendants is TRUE, then additionally return the 2025251881Speter * mergeinfo for any descendant of any element of @a paths which has 2026251881Speter * the #SVN_PROP_MERGEINFO property explicitly set on it. (Note 2027251881Speter * that inheritance is only taken into account for the elements in @a 2028251881Speter * paths; descendants of the elements in @a paths which get their 2029251881Speter * mergeinfo via inheritance are not included in @a *catalog.) 2030251881Speter * 2031251881Speter * If optional @a authz_read_func is non-NULL, then use this function 2032251881Speter * (along with optional @a authz_read_baton) to check the readability 2033251881Speter * of each path which mergeinfo was requested for (from @a paths). 2034251881Speter * Silently omit unreadable paths from the request for mergeinfo. 2035251881Speter * 2036251881Speter * Use @a pool for all allocations. 2037251881Speter * 2038251881Speter * @since New in 1.5. 2039251881Speter */ 2040251881Spetersvn_error_t * 2041251881Spetersvn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog, 2042251881Speter svn_repos_t *repos, 2043251881Speter const apr_array_header_t *paths, 2044251881Speter svn_revnum_t revision, 2045251881Speter svn_mergeinfo_inheritance_t inherit, 2046251881Speter svn_boolean_t include_descendants, 2047251881Speter svn_repos_authz_func_t authz_read_func, 2048251881Speter void *authz_read_baton, 2049251881Speter apr_pool_t *pool); 2050251881Speter 2051251881Speter 2052251881Speter/* ---------------------------------------------------------------*/ 2053251881Speter 2054251881Speter/* Retrieving multiple revisions of a file. */ 2055251881Speter 2056251881Speter/** 2057251881Speter * Retrieve a subset of the interesting revisions of a file @a path in 2058251881Speter * @a repos as seen in revision @a end. Invoke @a handler with 2059251881Speter * @a handler_baton as its first argument for each such revision. 2060251881Speter * @a pool is used for all allocations. See svn_fs_history_prev() for 2061251881Speter * a discussion of interesting revisions. 2062251881Speter * 2063251881Speter * If optional @a authz_read_func is non-NULL, then use this function 2064251881Speter * (along with optional @a authz_read_baton) to check the readability 2065251881Speter * of the rev-path in each interesting revision encountered. 2066251881Speter * 2067251881Speter * Revision discovery happens from @a end to @a start, and if an 2068251881Speter * unreadable revision is encountered before @a start is reached, then 2069251881Speter * revision discovery stops and only the revisions from @a end to the 2070251881Speter * oldest readable revision are returned (So it will appear that @a 2071251881Speter * path was added without history in the latter revision). 2072251881Speter * 2073251881Speter * If there is an interesting revision of the file that is less than or 2074251881Speter * equal to start, the iteration will start at that revision. Else, the 2075251881Speter * iteration will start at the first revision of the file in the repository, 2076251881Speter * which has to be less than or equal to end. Note that if the function 2077251881Speter * succeeds, @a handler will have been called at least once. 2078251881Speter * 2079251881Speter * In a series of calls, the file contents for the first interesting revision 2080251881Speter * will be provided as a text delta against the empty file. In the following 2081251881Speter * calls, the delta will be against the contents for the previous call. 2082251881Speter * 2083251881Speter * If @a include_merged_revisions is TRUE, revisions which a included as a 2084251881Speter * result of a merge between @a start and @a end will be included. 2085251881Speter * 2086251881Speter * Since Subversion 1.8 this function has been enabled to support reversion 2087251881Speter * the revision range for @a include_merged_revision @c FALSE reporting by 2088251881Speter * switching @a start with @a end. 2089251881Speter * 2090299742Sdim * @note Prior to Subversion 1.9, this function may request delta handlers 2091299742Sdim * from @a handler even for empty text deltas. Starting with 1.9, the 2092299742Sdim * delta handler / baton return arguments passed to @a handler will be 2093299742Sdim * #NULL unless there is an actual difference in the file contents between 2094299742Sdim * the current and the previous call. 2095299742Sdim * 2096251881Speter * @since New in 1.5. 2097251881Speter */ 2098251881Spetersvn_error_t * 2099251881Spetersvn_repos_get_file_revs2(svn_repos_t *repos, 2100251881Speter const char *path, 2101251881Speter svn_revnum_t start, 2102251881Speter svn_revnum_t end, 2103251881Speter svn_boolean_t include_merged_revisions, 2104251881Speter svn_repos_authz_func_t authz_read_func, 2105251881Speter void *authz_read_baton, 2106251881Speter svn_file_rev_handler_t handler, 2107251881Speter void *handler_baton, 2108251881Speter apr_pool_t *pool); 2109251881Speter 2110251881Speter/** 2111299742Sdim * Similar to #svn_file_rev_handler_t, but without the @a 2112299742Sdim * result_of_merge parameter. 2113299742Sdim * 2114299742Sdim * @deprecated Provided for backward compatibility with 1.4 API. 2115299742Sdim * @since New in 1.1. 2116299742Sdim */ 2117299742Sdimtypedef svn_error_t *(*svn_repos_file_rev_handler_t) 2118299742Sdim (void *baton, 2119299742Sdim const char *path, 2120299742Sdim svn_revnum_t rev, 2121299742Sdim apr_hash_t *rev_props, 2122299742Sdim svn_txdelta_window_handler_t *delta_handler, 2123299742Sdim void **delta_baton, 2124299742Sdim apr_array_header_t *prop_diffs, 2125299742Sdim apr_pool_t *pool); 2126299742Sdim 2127299742Sdim/** 2128251881Speter * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions 2129251881Speter * set to FALSE. 2130251881Speter * 2131251881Speter * @deprecated Provided for backward compatibility with the 1.4 API. 2132251881Speter * @since New in 1.1. 2133251881Speter */ 2134251881SpeterSVN_DEPRECATED 2135251881Spetersvn_error_t * 2136251881Spetersvn_repos_get_file_revs(svn_repos_t *repos, 2137251881Speter const char *path, 2138251881Speter svn_revnum_t start, 2139251881Speter svn_revnum_t end, 2140251881Speter svn_repos_authz_func_t authz_read_func, 2141251881Speter void *authz_read_baton, 2142251881Speter svn_repos_file_rev_handler_t handler, 2143251881Speter void *handler_baton, 2144251881Speter apr_pool_t *pool); 2145251881Speter 2146251881Speter 2147251881Speter/* ---------------------------------------------------------------*/ 2148251881Speter 2149251881Speter/** 2150251881Speter * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \ 2151251881Speter * routines. 2152251881Speter * @{ 2153251881Speter */ 2154251881Speter 2155251881Speter/** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and 2156251881Speter * post-commit hooks around the commit. Use @a pool for any necessary 2157251881Speter * allocations. 2158251881Speter * 2159251881Speter * If the pre-commit hook fails, do not attempt to commit the 2160251881Speter * transaction and throw the original error to the caller. 2161251881Speter * 2162251881Speter * A successful commit is indicated by a valid revision value in @a 2163251881Speter * *new_rev, not if svn_fs_commit_txn() returns an error, which can 2164251881Speter * occur during its post commit FS processing. If the transaction was 2165251881Speter * not committed, then return the associated error and do not execute 2166251881Speter * the post-commit hook. 2167251881Speter * 2168251881Speter * If the commit succeeds the post-commit hook is executed. If the 2169251881Speter * post-commit hook returns an error, always wrap it with 2170251881Speter * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to 2171251881Speter * find the post-commit hook error in the returned error chain. If 2172251881Speter * both svn_fs_commit_txn() and the post-commit hook return errors, 2173251881Speter * then svn_fs_commit_txn()'s error is the parent error and the 2174251881Speter * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child 2175251881Speter * error. 2176251881Speter * 2177251881Speter * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn(). 2178251881Speter */ 2179251881Spetersvn_error_t * 2180251881Spetersvn_repos_fs_commit_txn(const char **conflict_p, 2181251881Speter svn_repos_t *repos, 2182251881Speter svn_revnum_t *new_rev, 2183251881Speter svn_fs_txn_t *txn, 2184251881Speter apr_pool_t *pool); 2185251881Speter 2186251881Speter/** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping 2187251881Speter * <tt>const char *</tt> property names to #svn_string_t values, to 2188251881Speter * set the properties on transaction @a *txn_p. @a repos is the 2189251881Speter * repository object which contains the filesystem. @a rev, @a 2190251881Speter * *txn_p, and @a pool are as in svn_fs_begin_txn(). 2191251881Speter * 2192251881Speter * Before a txn is created, the repository's start-commit hooks are 2193251881Speter * run; if any of them fail, no txn is created, @a *txn_p is unaffected, 2194251881Speter * and #SVN_ERR_REPOS_HOOK_FAILURE is returned. 2195251881Speter * 2196251881Speter * @note @a revprop_table may contain an #SVN_PROP_REVISION_DATE property, 2197251881Speter * which will be set on the transaction, but that will be overwritten 2198251881Speter * when the transaction is committed. 2199251881Speter * 2200251881Speter * @since New in 1.5. 2201251881Speter */ 2202251881Spetersvn_error_t * 2203251881Spetersvn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p, 2204251881Speter svn_repos_t *repos, 2205251881Speter svn_revnum_t rev, 2206251881Speter apr_hash_t *revprop_table, 2207251881Speter apr_pool_t *pool); 2208251881Speter 2209251881Speter 2210251881Speter/** 2211251881Speter * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table 2212251881Speter * set to a hash containing @a author and @a log_msg as the 2213251881Speter * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties, 2214251881Speter * respectively. @a author and @a log_msg may both be @c NULL. 2215251881Speter * 2216251881Speter * @deprecated Provided for backward compatibility with the 1.4 API. 2217251881Speter */ 2218251881SpeterSVN_DEPRECATED 2219251881Spetersvn_error_t * 2220251881Spetersvn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p, 2221251881Speter svn_repos_t *repos, 2222251881Speter svn_revnum_t rev, 2223251881Speter const char *author, 2224251881Speter const char *log_msg, 2225251881Speter apr_pool_t *pool); 2226251881Speter 2227251881Speter 2228251881Speter/** Like svn_fs_begin_txn(), but use @a author to set the corresponding 2229251881Speter * property on transaction @a *txn_p. @a repos is the repository object 2230251881Speter * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in 2231251881Speter * svn_fs_begin_txn(). 2232251881Speter * 2233251881Speter * ### Someday: before a txn is created, some kind of read-hook could 2234251881Speter * be called here. 2235251881Speter * 2236251881Speter * @note This function was never fully implemented, nor used. Ignore it. 2237251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 2238251881Speter */ 2239251881SpeterSVN_DEPRECATED 2240251881Spetersvn_error_t * 2241251881Spetersvn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p, 2242251881Speter svn_repos_t *repos, 2243251881Speter svn_revnum_t rev, 2244251881Speter const char *author, 2245251881Speter apr_pool_t *pool); 2246251881Speter 2247251881Speter 2248251881Speter/** @} */ 2249251881Speter 2250251881Speter/** @defgroup svn_repos_fs_locks Repository lock wrappers 2251251881Speter * @{ 2252251881Speter */ 2253251881Speter 2254299742Sdim/** Like svn_fs_lock_many(), but invoke the @a repos's pre- and 2255299742Sdim * post-lock hooks before and after the locking action. 2256251881Speter * 2257299742Sdim * The pre-lock is run for every path in @a targets. Those targets for 2258299742Sdim * which the pre-lock is successful are passed to svn_fs_lock_many and 2259299742Sdim * the post-lock is run for those that are successfully locked. 2260299742Sdim * Pre-lock hook errors are passed to @a lock_callback. 2261251881Speter * 2262299742Sdim * For each path in @a targets @a lock_callback will be invoked 2263299742Sdim * passing @a lock_baton and the lock and error that apply to path. 2264299742Sdim * @a lock_callback can be NULL in which case it is not called and any 2265299742Sdim * errors that would have been passed to the callback are not reported. 2266299742Sdim * 2267299742Sdim * If an error occurs when running the post-lock hook the error is 2268299742Sdim * returned wrapped with #SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the 2269299742Sdim * caller sees this error, it knows that some locks succeeded. 2270299742Sdim * 2271251881Speter * The pre-lock hook may cause a different token to be used for the 2272299742Sdim * lock, instead of the token supplied; see the pre-lock-hook 2273299742Sdim * documentation for more. 2274251881Speter * 2275299742Sdim * The lock and path passed to @a lock_callback will be allocated in 2276299742Sdim * @a result_pool. Use @a scratch_pool for temporary allocations. 2277299742Sdim * 2278299742Sdim * @note This function is not atomic. If it returns an error, some targets 2279299742Sdim * may remain unlocked while others may have been locked. 2280299742Sdim * 2281299742Sdim * @see svn_fs_lock_many 2282299742Sdim * 2283299742Sdim * @since New in 1.9. 2284299742Sdim */ 2285299742Sdimsvn_error_t * 2286299742Sdimsvn_repos_fs_lock_many(svn_repos_t *repos, 2287299742Sdim apr_hash_t *lock_targets, 2288299742Sdim const char *comment, 2289299742Sdim svn_boolean_t is_dav_comment, 2290299742Sdim apr_time_t expiration_date, 2291299742Sdim svn_boolean_t steal_lock, 2292299742Sdim svn_fs_lock_callback_t lock_callback, 2293299742Sdim void *lock_baton, 2294299742Sdim apr_pool_t *result_pool, 2295299742Sdim apr_pool_t *scratch_pool); 2296299742Sdim 2297299742Sdim/** Similar to svn_repos_fs_lock_many() but locks only a single path. 2298299742Sdim * 2299251881Speter * @since New in 1.2. 2300251881Speter */ 2301251881Spetersvn_error_t * 2302251881Spetersvn_repos_fs_lock(svn_lock_t **lock, 2303251881Speter svn_repos_t *repos, 2304251881Speter const char *path, 2305251881Speter const char *token, 2306251881Speter const char *comment, 2307251881Speter svn_boolean_t is_dav_comment, 2308251881Speter apr_time_t expiration_date, 2309251881Speter svn_revnum_t current_rev, 2310251881Speter svn_boolean_t steal_lock, 2311251881Speter apr_pool_t *pool); 2312251881Speter 2313251881Speter 2314299742Sdim/** Like svn_fs_unlock_many(), but invoke the @a repos's pre- and 2315299742Sdim * post-unlock hooks before and after the unlocking action. 2316251881Speter * 2317299742Sdim * The pre-unlock hook is run for every path in @a targets. Those 2318299742Sdim * targets for which the pre-unlock is successful are passed to 2319299742Sdim * svn_fs_unlock_many and the post-unlock is run for those that are 2320299742Sdim * successfully unlocked. Pre-unlock hook errors are passed to @a 2321299742Sdim * lock_callback. 2322251881Speter * 2323299742Sdim * For each path in @a targets @a lock_callback will be invoked 2324299742Sdim * passing @a lock_baton and error that apply to path. The lock 2325299742Sdim * passed to the callback will be NULL. @a lock_callback can be NULL 2326299742Sdim * in which case it is not called and any errors that would have been 2327299742Sdim * passed to the callback are not reported. 2328299742Sdim * 2329299742Sdim * If an error occurs when running the post-unlock hook, return the 2330299742Sdim * original error wrapped with #SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. 2331299742Sdim * If the caller sees this error, it knows that some unlocks 2332299742Sdim * succeeded. 2333299742Sdim * 2334299742Sdim * The path passed to @a lock_callback will be allocated in @a result_pool. 2335299742Sdim * Use @a scratch_pool for temporary allocations. 2336299742Sdim * 2337299742Sdim * @note This function is not atomic. If it returns an error, some targets 2338299742Sdim * may remain locked while others may have been unlocked. 2339299742Sdim * 2340299742Sdim * @see svn_fs_unlock_many 2341299742Sdim * 2342299742Sdim * @since New in 1.9. 2343299742Sdim */ 2344299742Sdimsvn_error_t * 2345299742Sdimsvn_repos_fs_unlock_many(svn_repos_t *repos, 2346299742Sdim apr_hash_t *unlock_targets, 2347299742Sdim svn_boolean_t break_lock, 2348299742Sdim svn_fs_lock_callback_t lock_callback, 2349299742Sdim void *lock_baton, 2350299742Sdim apr_pool_t *result_pool, 2351299742Sdim apr_pool_t *scratch_pool); 2352299742Sdim 2353299742Sdim/** Similar to svn_repos_fs_unlock_many() but only unlocks a single path. 2354299742Sdim * 2355251881Speter * @since New in 1.2. 2356251881Speter */ 2357251881Spetersvn_error_t * 2358251881Spetersvn_repos_fs_unlock(svn_repos_t *repos, 2359251881Speter const char *path, 2360251881Speter const char *token, 2361251881Speter svn_boolean_t break_lock, 2362251881Speter apr_pool_t *pool); 2363251881Speter 2364251881Speter 2365251881Speter 2366251881Speter/** Look up all the locks in and under @a path in @a repos, setting @a 2367251881Speter * *locks to a hash which maps <tt>const char *</tt> paths to the 2368251881Speter * #svn_lock_t locks associated with those paths. Use @a 2369251881Speter * authz_read_func and @a authz_read_baton to "screen" all returned 2370251881Speter * locks. That is: do not return any locks on any paths that are 2371251881Speter * unreadable in HEAD, just silently omit them. 2372251881Speter * 2373251881Speter * @a depth limits the returned locks to those associated with paths 2374251881Speter * within the specified depth of @a path, and must be one of the 2375251881Speter * following values: #svn_depth_empty, #svn_depth_files, 2376251881Speter * #svn_depth_immediates, or #svn_depth_infinity. 2377251881Speter * 2378251881Speter * @since New in 1.7. 2379251881Speter */ 2380251881Spetersvn_error_t * 2381251881Spetersvn_repos_fs_get_locks2(apr_hash_t **locks, 2382251881Speter svn_repos_t *repos, 2383251881Speter const char *path, 2384251881Speter svn_depth_t depth, 2385251881Speter svn_repos_authz_func_t authz_read_func, 2386251881Speter void *authz_read_baton, 2387251881Speter apr_pool_t *pool); 2388251881Speter 2389251881Speter/** 2390251881Speter * Similar to svn_repos_fs_get_locks2(), but with @a depth always 2391251881Speter * passed as svn_depth_infinity. 2392251881Speter * 2393251881Speter * @since New in 1.2. 2394251881Speter * @deprecated Provided for backward compatibility with the 1.6 API. 2395251881Speter */ 2396251881SpeterSVN_DEPRECATED 2397251881Spetersvn_error_t * 2398251881Spetersvn_repos_fs_get_locks(apr_hash_t **locks, 2399251881Speter svn_repos_t *repos, 2400251881Speter const char *path, 2401251881Speter svn_repos_authz_func_t authz_read_func, 2402251881Speter void *authz_read_baton, 2403251881Speter apr_pool_t *pool); 2404251881Speter 2405251881Speter/** @} */ 2406251881Speter 2407299742Sdim/** @defgroup svn_repos_properties Versioned and Unversioned Properties 2408299742Sdim * 2409299742Sdim * Prop-changing and prop-reading wrappers for libsvn_fs routines. 2410299742Sdim * @{ 2411299742Sdim */ 2412299742Sdim 2413251881Speter/** 2414251881Speter * Like svn_fs_change_rev_prop2(), but validate the name and value of the 2415251881Speter * property and invoke the @a repos's pre- and post-revprop-change hooks 2416251881Speter * around the change as specified by @a use_pre_revprop_change_hook and 2417251881Speter * @a use_post_revprop_change_hook (respectively). 2418251881Speter * 2419251881Speter * @a rev is the revision whose property to change, @a name is the 2420251881Speter * name of the property, and @a new_value is the new value of the 2421251881Speter * property. If @a old_value_p is not @c NULL, then @a *old_value_p 2422251881Speter * is the expected current (preexisting) value of the property (or @c NULL 2423251881Speter * for "unset"). @a author is the authenticated username of the person 2424251881Speter * changing the property value, or NULL if not available. 2425251881Speter * 2426251881Speter * If @a authz_read_func is non-NULL, then use it (with @a 2427251881Speter * authz_read_baton) to validate the changed-paths associated with @a 2428251881Speter * rev. If the revision contains any unreadable changed paths, then 2429251881Speter * return #SVN_ERR_AUTHZ_UNREADABLE. 2430251881Speter * 2431251881Speter * Validate @a name and @a new_value like the same way 2432251881Speter * svn_repos_fs_change_node_prop() does. 2433251881Speter * 2434251881Speter * Use @a pool for temporary allocations. 2435251881Speter * 2436251881Speter * @since New in 1.7. 2437251881Speter */ 2438251881Spetersvn_error_t * 2439251881Spetersvn_repos_fs_change_rev_prop4(svn_repos_t *repos, 2440251881Speter svn_revnum_t rev, 2441251881Speter const char *author, 2442251881Speter const char *name, 2443251881Speter const svn_string_t *const *old_value_p, 2444251881Speter const svn_string_t *new_value, 2445299742Sdim svn_boolean_t use_pre_revprop_change_hook, 2446299742Sdim svn_boolean_t use_post_revprop_change_hook, 2447299742Sdim svn_repos_authz_func_t authz_read_func, 2448251881Speter void *authz_read_baton, 2449251881Speter apr_pool_t *pool); 2450251881Speter 2451251881Speter/** 2452251881Speter * Similar to svn_repos_fs_change_rev_prop4(), but with @a old_value_p always 2453251881Speter * set to @c NULL. (In other words, it is similar to 2454251881Speter * svn_fs_change_rev_prop().) 2455251881Speter * 2456251881Speter * @deprecated Provided for backward compatibility with the 1.6 API. 2457251881Speter * @since New in 1.5. 2458251881Speter */ 2459251881SpeterSVN_DEPRECATED 2460251881Spetersvn_error_t * 2461251881Spetersvn_repos_fs_change_rev_prop3(svn_repos_t *repos, 2462251881Speter svn_revnum_t rev, 2463251881Speter const char *author, 2464251881Speter const char *name, 2465251881Speter const svn_string_t *new_value, 2466299742Sdim svn_boolean_t use_pre_revprop_change_hook, 2467299742Sdim svn_boolean_t use_post_revprop_change_hook, 2468299742Sdim svn_repos_authz_func_t authz_read_func, 2469251881Speter void *authz_read_baton, 2470251881Speter apr_pool_t *pool); 2471251881Speter 2472251881Speter/** 2473251881Speter * Similar to svn_repos_fs_change_rev_prop3(), but with the @a 2474251881Speter * use_pre_revprop_change_hook and @a use_post_revprop_change_hook 2475251881Speter * always set to @c TRUE. 2476251881Speter * 2477251881Speter * @deprecated Provided for backward compatibility with the 1.4 API. 2478251881Speter */ 2479251881SpeterSVN_DEPRECATED 2480251881Spetersvn_error_t * 2481251881Spetersvn_repos_fs_change_rev_prop2(svn_repos_t *repos, 2482251881Speter svn_revnum_t rev, 2483251881Speter const char *author, 2484251881Speter const char *name, 2485251881Speter const svn_string_t *new_value, 2486299742Sdim svn_repos_authz_func_t authz_read_func, 2487251881Speter void *authz_read_baton, 2488251881Speter apr_pool_t *pool); 2489251881Speter 2490251881Speter/** 2491251881Speter * Similar to svn_repos_fs_change_rev_prop2(), but with the 2492251881Speter * @a authz_read_func parameter always NULL. 2493251881Speter * 2494251881Speter * @deprecated Provided for backward compatibility with the 1.0 API. 2495251881Speter */ 2496251881SpeterSVN_DEPRECATED 2497251881Spetersvn_error_t * 2498251881Spetersvn_repos_fs_change_rev_prop(svn_repos_t *repos, 2499251881Speter svn_revnum_t rev, 2500251881Speter const char *author, 2501251881Speter const char *name, 2502251881Speter const svn_string_t *new_value, 2503251881Speter apr_pool_t *pool); 2504251881Speter 2505251881Speter 2506251881Speter 2507251881Speter/** 2508251881Speter * Set @a *value_p to the value of the property named @a propname on 2509251881Speter * revision @a rev in the filesystem opened in @a repos. If @a rev 2510251881Speter * has no property by that name, set @a *value_p to zero. Allocate 2511251881Speter * the result in @a pool. 2512251881Speter * 2513251881Speter * If @a authz_read_func is non-NULL, then use it (with @a 2514251881Speter * authz_read_baton) to validate the changed-paths associated with @a 2515251881Speter * rev. If the changed-paths are all unreadable, then set @a *value_p 2516251881Speter * to zero unconditionally. If only some of the changed-paths are 2517251881Speter * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be 2518251881Speter * fetched, but return 0 for any other property. 2519251881Speter * 2520251881Speter * @since New in 1.1. 2521251881Speter */ 2522251881Spetersvn_error_t * 2523251881Spetersvn_repos_fs_revision_prop(svn_string_t **value_p, 2524251881Speter svn_repos_t *repos, 2525251881Speter svn_revnum_t rev, 2526251881Speter const char *propname, 2527299742Sdim svn_repos_authz_func_t authz_read_func, 2528251881Speter void *authz_read_baton, 2529251881Speter apr_pool_t *pool); 2530251881Speter 2531251881Speter 2532251881Speter/** 2533251881Speter * Set @a *table_p to the entire property list of revision @a rev in 2534251881Speter * filesystem opened in @a repos, as a hash table allocated in @a 2535251881Speter * pool. The table maps <tt>char *</tt> property names to 2536251881Speter * #svn_string_t * values; the names and values are allocated in @a 2537251881Speter * pool. 2538251881Speter * 2539251881Speter * If @a authz_read_func is non-NULL, then use it (with @a 2540251881Speter * authz_read_baton) to validate the changed-paths associated with @a 2541251881Speter * rev. If the changed-paths are all unreadable, then return an empty 2542251881Speter * hash. If only some of the changed-paths are unreadable, then return 2543251881Speter * an empty hash, except for 'svn:author' and 'svn:date' properties 2544251881Speter * (assuming those properties exist). 2545251881Speter * 2546251881Speter * @since New in 1.1. 2547251881Speter */ 2548251881Spetersvn_error_t * 2549251881Spetersvn_repos_fs_revision_proplist(apr_hash_t **table_p, 2550251881Speter svn_repos_t *repos, 2551251881Speter svn_revnum_t rev, 2552299742Sdim svn_repos_authz_func_t authz_read_func, 2553251881Speter void *authz_read_baton, 2554251881Speter apr_pool_t *pool); 2555251881Speter 2556251881Speter/** Validating wrapper for svn_fs_change_node_prop() (which see for 2557251881Speter * argument descriptions). 2558251881Speter * 2559251881Speter * If @a name's kind is not #svn_prop_regular_kind, return 2560251881Speter * #SVN_ERR_REPOS_BAD_ARGS. If @a name is an "svn:" property, validate its 2561251881Speter * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the 2562251881Speter * property. 2563251881Speter * 2564299742Sdim * @note Originally, the only properties validated were the "svn:" properties 2565299742Sdim * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. For the current 2566299742Sdim * validation rules see the private function svn_repos__validate_prop(). 2567251881Speter */ 2568251881Spetersvn_error_t * 2569251881Spetersvn_repos_fs_change_node_prop(svn_fs_root_t *root, 2570251881Speter const char *path, 2571251881Speter const char *name, 2572251881Speter const svn_string_t *value, 2573251881Speter apr_pool_t *pool); 2574251881Speter 2575299742Sdim/** 2576299742Sdim * Set @a *inherited_values to a depth-first ordered array of 2577299742Sdim * #svn_prop_inherited_item_t * structures (the path_or_url members of 2578299742Sdim * which are relative filesystem paths) representing the properties 2579299742Sdim * inherited by @a path in @a root. If no properties are inherited, 2580299742Sdim * then set @a *inherited_values to an empty array. 2581299742Sdim * 2582299742Sdim * if @a propname is NULL then retrieve all explicit and/or inherited 2583299742Sdim * properties. Otherwise retrieve only the properties named @a propname. 2584299742Sdim * 2585299742Sdim * If optional @a authz_read_func is non-NULL, then use this function 2586299742Sdim * (along with optional @a authz_read_baton) to check the readability 2587299742Sdim * of each parent path from which properties are inherited. Silently omit 2588299742Sdim * properties for unreadable parent paths. 2589299742Sdim * 2590299742Sdim * Allocate @a *inherited_props in @a result_pool. Use @a scratch_pool for 2591299742Sdim * temporary allocations. 2592299742Sdim * 2593299742Sdim * @since New in 1.8. 2594299742Sdim */ 2595299742Sdimsvn_error_t * 2596299742Sdimsvn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props, 2597299742Sdim svn_fs_root_t *root, 2598299742Sdim const char *path, 2599299742Sdim const char *propname, 2600299742Sdim svn_repos_authz_func_t authz_read_func, 2601299742Sdim void *authz_read_baton, 2602299742Sdim apr_pool_t *result_pool, 2603299742Sdim apr_pool_t *scratch_pool); 2604299742Sdim 2605251881Speter/** Validating wrapper for svn_fs_change_txn_prop() (which see for 2606251881Speter * argument descriptions). See svn_repos_fs_change_txn_props() for more 2607251881Speter * information. 2608251881Speter */ 2609251881Spetersvn_error_t * 2610251881Spetersvn_repos_fs_change_txn_prop(svn_fs_txn_t *txn, 2611251881Speter const char *name, 2612251881Speter const svn_string_t *value, 2613251881Speter apr_pool_t *pool); 2614251881Speter 2615251881Speter/** Validating wrapper for svn_fs_change_txn_props() (which see for 2616251881Speter * argument descriptions). Validate properties and their values the 2617251881Speter * same way svn_repos_fs_change_node_prop() does. 2618251881Speter * 2619251881Speter * @since New in 1.5. 2620251881Speter */ 2621251881Spetersvn_error_t * 2622251881Spetersvn_repos_fs_change_txn_props(svn_fs_txn_t *txn, 2623251881Speter const apr_array_header_t *props, 2624251881Speter apr_pool_t *pool); 2625251881Speter 2626299742Sdim/** @} */ 2627251881Speter 2628299742Sdim 2629251881Speter/* ---------------------------------------------------------------*/ 2630251881Speter 2631251881Speter/** 2632251881Speter * @defgroup svn_repos_inspection Data structures and editor things for \ 2633251881Speter * repository inspection. 2634251881Speter * @{ 2635251881Speter * 2636251881Speter * As it turns out, the svn_repos_replay2(), svn_repos_dir_delta2() and 2637251881Speter * svn_repos_begin_report3() interfaces can be extremely useful for 2638251881Speter * examining the repository, or more exactly, changes to the repository. 2639251881Speter * These drivers allows for differences between two trees to be 2640251881Speter * described using an editor. 2641251881Speter * 2642251881Speter * By using the editor obtained from svn_repos_node_editor() with one of 2643251881Speter * the drivers mentioned above, the description of how to transform one 2644251881Speter * tree into another can be used to build an in-memory linked-list tree, 2645251881Speter * which each node representing a repository node that was changed. 2646251881Speter */ 2647251881Speter 2648251881Speter/** A node in the repository. */ 2649251881Spetertypedef struct svn_repos_node_t 2650251881Speter{ 2651251881Speter /** Node type (file, dir, etc.) */ 2652251881Speter svn_node_kind_t kind; 2653251881Speter 2654251881Speter /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */ 2655251881Speter char action; 2656251881Speter 2657251881Speter /** Were there any textual mods? (files only) */ 2658251881Speter svn_boolean_t text_mod; 2659251881Speter 2660251881Speter /** Where there any property mods? */ 2661251881Speter svn_boolean_t prop_mod; 2662251881Speter 2663251881Speter /** The name of this node as it appears in its parent's entries list */ 2664251881Speter const char *name; 2665251881Speter 2666251881Speter /** The filesystem revision where this was copied from (if any) */ 2667251881Speter svn_revnum_t copyfrom_rev; 2668251881Speter 2669251881Speter /** The filesystem path where this was copied from (if any) */ 2670251881Speter const char *copyfrom_path; 2671251881Speter 2672251881Speter /** Pointer to the next sibling of this node */ 2673251881Speter struct svn_repos_node_t *sibling; 2674251881Speter 2675251881Speter /** Pointer to the first child of this node */ 2676251881Speter struct svn_repos_node_t *child; 2677251881Speter 2678251881Speter /** Pointer to the parent of this node */ 2679251881Speter struct svn_repos_node_t *parent; 2680251881Speter 2681251881Speter} svn_repos_node_t; 2682251881Speter 2683251881Speter 2684251881Speter/** Set @a *editor and @a *edit_baton to an editor that, when driven by 2685251881Speter * a driver such as svn_repos_replay2(), builds an <tt>svn_repos_node_t *</tt> 2686251881Speter * tree representing the delta from @a base_root to @a root in @a 2687251881Speter * repos's filesystem. 2688251881Speter * 2689251881Speter * The editor can also be driven by svn_repos_dir_delta2() or 2690251881Speter * svn_repos_begin_report3(), but unless you have special needs, 2691251881Speter * svn_repos_replay2() is preferred. 2692251881Speter * 2693251881Speter * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root 2694251881Speter * node afterwards. 2695251881Speter * 2696251881Speter * Note that the delta includes "bubbled-up" directories; that is, 2697251881Speter * many of the directory nodes will have no prop_mods. 2698251881Speter * 2699251881Speter * Allocate the tree and its contents in @a node_pool; do all other 2700251881Speter * allocation in @a pool. 2701251881Speter */ 2702251881Spetersvn_error_t * 2703251881Spetersvn_repos_node_editor(const svn_delta_editor_t **editor, 2704251881Speter void **edit_baton, 2705251881Speter svn_repos_t *repos, 2706251881Speter svn_fs_root_t *base_root, 2707251881Speter svn_fs_root_t *root, 2708251881Speter apr_pool_t *node_pool, 2709251881Speter apr_pool_t *pool); 2710251881Speter 2711251881Speter/** Return the root node of the linked-list tree generated by driving the 2712251881Speter * editor (associated with @a edit_baton) created by svn_repos_node_editor(). 2713251881Speter * This is only really useful if used *after* the editor drive is completed. 2714251881Speter */ 2715251881Spetersvn_repos_node_t * 2716251881Spetersvn_repos_node_from_baton(void *edit_baton); 2717251881Speter 2718299742Sdim/** 2719299742Sdim * Return repository format information for @a repos. 2720299742Sdim * 2721299742Sdim * Set @a *repos_format to the repository format number of @a repos, which is 2722299742Sdim * an integer that increases when incompatible changes are made (such as 2723299742Sdim * by #svn_repos_upgrade2). 2724299742Sdim * 2725299742Sdim * Set @a *supports_version to the version number of the minimum Subversion 2726299742Sdim * GA release that can read and write @a repos; allocate it in 2727299742Sdim * @a result_pool. Use @a scratch_pool for temporary allocations. 2728299742Sdim * 2729299742Sdim * @see svn_fs_info_format, svn_repos_capabilities 2730299742Sdim * 2731299742Sdim * @since New in 1.9. 2732299742Sdim */ 2733299742Sdimsvn_error_t * 2734299742Sdimsvn_repos_info_format(int *repos_format, 2735299742Sdim svn_version_t **supports_version, 2736299742Sdim svn_repos_t *repos, 2737299742Sdim apr_pool_t *result_pool, 2738299742Sdim apr_pool_t *scratch_pool); 2739299742Sdim 2740251881Speter/** @} */ 2741251881Speter 2742251881Speter/* ---------------------------------------------------------------*/ 2743251881Speter 2744251881Speter/** 2745299742Sdim * @defgroup svn_repos_dump_load Dumping, loading and verifying filesystem data 2746251881Speter * @{ 2747251881Speter * 2748251881Speter * The filesystem 'dump' format contains nothing but the abstract 2749251881Speter * structure of the filesystem -- independent of any internal node-id 2750251881Speter * schema or database back-end. All of the data in the dumpfile is 2751251881Speter * acquired by public function calls into svn_fs.h. Similarly, the 2752251881Speter * parser which reads the dumpfile is able to reconstruct the 2753251881Speter * filesystem using only public svn_fs.h routines. 2754251881Speter * 2755251881Speter * Thus the dump/load feature's main purpose is for *migrating* data 2756251881Speter * from one svn filesystem to another -- presumably two filesystems 2757251881Speter * which have different internal implementations. 2758251881Speter * 2759251881Speter * If you simply want to backup your filesystem, you're probably 2760251881Speter * better off using the built-in facilities of the DB backend (using 2761251881Speter * Berkeley DB's hot-backup feature, for example.) 2762251881Speter * 2763251881Speter * For a description of the dumpfile format, see 2764251881Speter * /trunk/notes/fs_dumprestore.txt. 2765251881Speter */ 2766251881Speter 2767251881Speter/* The RFC822-style headers in our dumpfile format. */ 2768251881Speter#define SVN_REPOS_DUMPFILE_MAGIC_HEADER "SVN-fs-dump-format-version" 2769251881Speter#define SVN_REPOS_DUMPFILE_FORMAT_VERSION 3 2770251881Speter#define SVN_REPOS_DUMPFILE_FORMAT_VERSION_DELTAS 3 2771251881Speter#define SVN_REPOS_DUMPFILE_UUID "UUID" 2772251881Speter#define SVN_REPOS_DUMPFILE_CONTENT_LENGTH "Content-length" 2773251881Speter 2774251881Speter#define SVN_REPOS_DUMPFILE_REVISION_NUMBER "Revision-number" 2775251881Speter 2776251881Speter#define SVN_REPOS_DUMPFILE_NODE_PATH "Node-path" 2777251881Speter#define SVN_REPOS_DUMPFILE_NODE_KIND "Node-kind" 2778251881Speter#define SVN_REPOS_DUMPFILE_NODE_ACTION "Node-action" 2779251881Speter#define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH "Node-copyfrom-path" 2780251881Speter#define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV "Node-copyfrom-rev" 2781251881Speter/** @since New in 1.6. */ 2782251881Speter#define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 "Text-copy-source-md5" 2783251881Speter/** @since New in 1.6. */ 2784251881Speter#define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1 "Text-copy-source-sha1" 2785251881Speter#define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \ 2786251881Speter SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 2787251881Speter/** @since New in 1.6. */ 2788251881Speter#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 "Text-content-md5" 2789251881Speter/** @since New in 1.6. */ 2790251881Speter#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1 "Text-content-sha1" 2791251881Speter#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM \ 2792251881Speter SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 2793251881Speter 2794251881Speter#define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH "Prop-content-length" 2795251881Speter#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH "Text-content-length" 2796251881Speter 2797251881Speter/** @since New in 1.1. */ 2798251881Speter#define SVN_REPOS_DUMPFILE_PROP_DELTA "Prop-delta" 2799251881Speter/** @since New in 1.1. */ 2800251881Speter#define SVN_REPOS_DUMPFILE_TEXT_DELTA "Text-delta" 2801251881Speter/** @since New in 1.6. */ 2802251881Speter#define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 "Text-delta-base-md5" 2803251881Speter/** @since New in 1.6. */ 2804251881Speter#define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1 "Text-delta-base-sha1" 2805251881Speter/** @since New in 1.5. */ 2806251881Speter#define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM \ 2807251881Speter SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 2808251881Speter 2809299742Sdim/** The different policies for processing the UUID in the dumpfile. */ 2810299742Sdimenum svn_repos_load_uuid 2811299742Sdim{ 2812299742Sdim /** only update uuid if the repos has no revisions. */ 2813299742Sdim svn_repos_load_uuid_default, 2814299742Sdim /** never update uuid. */ 2815299742Sdim svn_repos_load_uuid_ignore, 2816299742Sdim /** always update uuid. */ 2817299742Sdim svn_repos_load_uuid_force 2818299742Sdim}; 2819299742Sdim 2820299742Sdim/** Callback type for use with svn_repos_verify_fs3(). @a revision 2821299742Sdim * and @a verify_err are the details of a single verification failure 2822299742Sdim * that occurred during the svn_repos_verify_fs3() call. @a baton is 2823299742Sdim * the same baton given to svn_repos_verify_fs3(). @a scratch_pool is 2824299742Sdim * provided for the convenience of the implementor, who should not 2825299742Sdim * expect it to live longer than a single callback call. 2826299742Sdim * 2827299742Sdim * @a verify_err will be cleared and becomes invalid after the callback 2828299742Sdim * returns, use svn_error_dup() to preserve the error. If a callback uses 2829299742Sdim * @a verify_err as the return value or as a part of the return value, it 2830299742Sdim * should also call svn_error_dup() for @a verify_err. Implementors of this 2831299742Sdim * callback are forbidden to call svn_error_clear() for @a verify_err. 2832299742Sdim * 2833299742Sdim * @see svn_repos_verify_fs3 2834299742Sdim * 2835299742Sdim * @since New in 1.9. 2836299742Sdim */ 2837299742Sdimtypedef svn_error_t *(*svn_repos_verify_callback_t)(void *baton, 2838299742Sdim svn_revnum_t revision, 2839299742Sdim svn_error_t *verify_err, 2840299742Sdim apr_pool_t *scratch_pool); 2841299742Sdim 2842251881Speter/** 2843251881Speter * Verify the contents of the file system in @a repos. 2844251881Speter * 2845299742Sdim * Verify the revisions from @a start_rev to @a end_rev inclusive. If 2846299742Sdim * @a start_rev is #SVN_INVALID_REVNUM, start at revision 0; if @a end_rev 2847299742Sdim * is #SVN_INVALID_REVNUM, end at the head revision. @a start_rev must be 2848299742Sdim * older than or equal to @a end_rev. If revision 0 is included in the 2849299742Sdim * range, then also verify "global invariants" of the repository, as 2850299742Sdim * described in svn_fs_verify(). 2851251881Speter * 2852299742Sdim * If @a check_normalization is @c TRUE, report any name collisions 2853299742Sdim * within the same directory or svn:mergeinfo property where the names 2854299742Sdim * differ only in character representation, but are otherwise 2855299742Sdim * identical. 2856251881Speter * 2857299742Sdim * If @a metadata_only is @c TRUE, backends that have a concept of separate 2858299742Sdim * metadata verification will only perform that and skip the more expensive 2859299742Sdim * file context reconstruction and verification. For FSFS format 7+ and 2860299742Sdim * FSX, this allows for a very fast check against external corruption. 2861251881Speter * 2862299742Sdim * If @a verify_callback is not @c NULL, call it with @a verify_baton upon 2863299742Sdim * receiving an FS-specific structure failure or a revision verification 2864299742Sdim * failure. Set @c revision callback argument to #SVN_INVALID_REVNUM or 2865299742Sdim * to the revision number respectively. Set @c verify_err to svn_error_t 2866299742Sdim * describing the reason of the failure. @c verify_err will be cleared 2867299742Sdim * after the callback returns, use svn_error_dup() to preserve the error. 2868299742Sdim * If @a verify_callback returns an error different from #SVN_NO_ERROR, 2869299742Sdim * stop verifying the repository and immediately return the error from 2870299742Sdim * @a verify_callback. 2871299742Sdim * 2872299742Sdim * If @a verify_callback is @c NULL, this function returns the first 2873299742Sdim * encountered verification error or #SVN_NO_ERROR if there were no failures 2874299742Sdim * during the verification. Errors that prevent the verification process 2875299742Sdim * from continuing, such as #SVN_ERR_CANCELLED, are returned immediately 2876299742Sdim * and do not trigger an invocation of @a verify_callback. 2877299742Sdim * 2878299742Sdim * If @a notify_func is not null, then call it with @a notify_baton and 2879299742Sdim * with a notification structure in which the fields are set as follows. 2880299742Sdim * (For a warning that does not apply to a specific revision, the revision 2881299742Sdim * number is #SVN_INVALID_REVNUM.) 2882299742Sdim * 2883299742Sdim * For each FS-specific structure warning: 2884299742Sdim * @c action = svn_repos_notify_verify_rev_structure 2885299742Sdim * @c revision = the revision or #SVN_INVALID_REVNUM 2886299742Sdim * 2887299742Sdim * For each revision verification warning: 2888299742Sdim * @c action = #svn_repos_notify_warning 2889299742Sdim * @c warning and @c warning_str fields set accordingly 2890299742Sdim * ### TODO: Set @c revision = the revision? 2891299742Sdim * 2892299742Sdim * For each successfully verified revision: 2893299742Sdim * @c action = #svn_repos_notify_verify_rev_end 2894299742Sdim * @c revision = the revision 2895299742Sdim * 2896299742Sdim * At the end: 2897299742Sdim * @c action = svn_repos_notify_verify_end 2898299742Sdim * ### Do we really need a callback to tell us the function we 2899299742Sdim * called has reached its end and is about to return? 2900299742Sdim * ### Not sent, currently, if a FS structure error is found. 2901299742Sdim * 2902251881Speter * If @a cancel_func is not @c NULL, call it periodically with @a 2903251881Speter * cancel_baton as argument to see if the caller wishes to cancel the 2904251881Speter * verification. 2905251881Speter * 2906299742Sdim * Use @a scratch_pool for temporary allocation. 2907299742Sdim * 2908299742Sdim * @see svn_repos_verify_callback_t 2909299742Sdim * 2910299742Sdim * @since New in 1.9. 2911299742Sdim */ 2912299742Sdimsvn_error_t * 2913299742Sdimsvn_repos_verify_fs3(svn_repos_t *repos, 2914299742Sdim svn_revnum_t start_rev, 2915299742Sdim svn_revnum_t end_rev, 2916299742Sdim svn_boolean_t check_normalization, 2917299742Sdim svn_boolean_t metadata_only, 2918299742Sdim svn_repos_notify_func_t notify_func, 2919299742Sdim void *notify_baton, 2920299742Sdim svn_repos_verify_callback_t verify_callback, 2921299742Sdim void *verify_baton, 2922299742Sdim svn_cancel_func_t cancel, 2923299742Sdim void *cancel_baton, 2924299742Sdim apr_pool_t *scratch_pool); 2925299742Sdim 2926299742Sdim/** 2927299742Sdim * Like svn_repos_verify_fs3(), but with @a verify_callback and 2928299742Sdim * @a verify_baton set to @c NULL and with @a check_normalization 2929299742Sdim * and @a metadata_only set to @c FALSE. 2930299742Sdim * 2931251881Speter * @since New in 1.7. 2932299742Sdim * @deprecated Provided for backward compatibility with the 1.8 API. 2933251881Speter */ 2934299742SdimSVN_DEPRECATED 2935251881Spetersvn_error_t * 2936251881Spetersvn_repos_verify_fs2(svn_repos_t *repos, 2937251881Speter svn_revnum_t start_rev, 2938251881Speter svn_revnum_t end_rev, 2939251881Speter svn_repos_notify_func_t notify_func, 2940251881Speter void *notify_baton, 2941251881Speter svn_cancel_func_t cancel, 2942251881Speter void *cancel_baton, 2943251881Speter apr_pool_t *scratch_pool); 2944251881Speter 2945251881Speter/** 2946251881Speter * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of 2947299742Sdim * handling feedback via the notify_func handler. 2948251881Speter * 2949299742Sdim * If @a feedback_stream is not @c NULL, write feedback to it (lines of 2950299742Sdim * the form "* Verified revision %ld\n"). 2951299742Sdim * 2952251881Speter * @since New in 1.5. 2953251881Speter * @deprecated Provided for backward compatibility with the 1.6 API. 2954251881Speter */ 2955251881SpeterSVN_DEPRECATED 2956251881Spetersvn_error_t * 2957251881Spetersvn_repos_verify_fs(svn_repos_t *repos, 2958251881Speter svn_stream_t *feedback_stream, 2959251881Speter svn_revnum_t start_rev, 2960251881Speter svn_revnum_t end_rev, 2961251881Speter svn_cancel_func_t cancel_func, 2962251881Speter void *cancel_baton, 2963251881Speter apr_pool_t *pool); 2964251881Speter 2965251881Speter/** 2966251881Speter * Dump the contents of the filesystem within already-open @a repos into 2967299742Sdim * writable @a dumpstream. If @a dumpstream is 2968251881Speter * @c NULL, this is effectively a primitive verify. It is not complete, 2969299742Sdim * however; see instead svn_repos_verify_fs3(). 2970251881Speter * 2971299742Sdim * Begin at revision @a start_rev, and dump every revision up through 2972299742Sdim * @a end_rev. If @a start_rev is #SVN_INVALID_REVNUM, start at revision 2973299742Sdim * 0. If @a end_rev is #SVN_INVALID_REVNUM, end at the head revision. 2974251881Speter * 2975251881Speter * If @a incremental is @c TRUE, the first revision dumped will be a diff 2976251881Speter * against the previous revision (usually it looks like a full dump of 2977251881Speter * the tree). 2978251881Speter * 2979251881Speter * If @a use_deltas is @c TRUE, output only node properties which have 2980251881Speter * changed relative to the previous contents, and output text contents 2981251881Speter * as svndiff data against the previous contents. Regardless of how 2982251881Speter * this flag is set, the first revision of a non-incremental dump will 2983251881Speter * be done with full plain text. A dump with @a use_deltas set cannot 2984251881Speter * be loaded by Subversion 1.0.x. 2985251881Speter * 2986299742Sdim * If @a notify_func is not null, then call it with @a notify_baton and 2987299742Sdim * with a notification structure in which the fields are set as follows. 2988299742Sdim * (For a warning or error notification that does not apply to a specific 2989299742Sdim * revision, the revision number is #SVN_INVALID_REVNUM.) 2990251881Speter * 2991299742Sdim * For each warning: 2992299742Sdim * @c action = #svn_repos_notify_warning 2993299742Sdim * @c warning and @c warning_str fields set accordingly 2994299742Sdim * ### TODO: Set @c revision = the revision or #SVN_INVALID_REVNUM? 2995299742Sdim * 2996299742Sdim * For each successfully dumped revision: 2997299742Sdim * @c action = #svn_repos_notify_dump_rev_end 2998299742Sdim * @c revision = the revision 2999299742Sdim * 3000299742Sdim * At the end: 3001299742Sdim * @c action = svn_repos_notify_verify_end 3002299742Sdim * ### Do we really need a callback to tell us the function we 3003299742Sdim * called has reached its end and is about to return? 3004299742Sdim * 3005299742Sdim * At the end, if there were certain warnings previously: 3006299742Sdim * @c action = #svn_repos_notify_warning 3007299742Sdim * @c warning and @c warning_str fields set accordingly, 3008299742Sdim * reiterating the existence of previous warnings 3009299742Sdim * ### This is a presentation issue. Caller could do this itself. 3010299742Sdim * 3011251881Speter * If @a cancel_func is not @c NULL, it is called periodically with 3012251881Speter * @a cancel_baton as argument to see if the client wishes to cancel 3013251881Speter * the dump. 3014251881Speter * 3015299742Sdim * Use @a scratch_pool for temporary allocation. 3016299742Sdim * 3017251881Speter * @since New in 1.7. 3018251881Speter */ 3019251881Spetersvn_error_t * 3020251881Spetersvn_repos_dump_fs3(svn_repos_t *repos, 3021251881Speter svn_stream_t *dumpstream, 3022251881Speter svn_revnum_t start_rev, 3023251881Speter svn_revnum_t end_rev, 3024251881Speter svn_boolean_t incremental, 3025251881Speter svn_boolean_t use_deltas, 3026251881Speter svn_repos_notify_func_t notify_func, 3027251881Speter void *notify_baton, 3028251881Speter svn_cancel_func_t cancel_func, 3029251881Speter void *cancel_baton, 3030251881Speter apr_pool_t *scratch_pool); 3031251881Speter 3032251881Speter/** 3033251881Speter * Similar to svn_repos_dump_fs3(), but with a feedback_stream instead of 3034251881Speter * handling feedback via the notify_func handler 3035251881Speter * 3036251881Speter * @since New in 1.1. 3037251881Speter * @deprecated Provided for backward compatibility with the 1.6 API. 3038251881Speter */ 3039251881SpeterSVN_DEPRECATED 3040251881Spetersvn_error_t * 3041251881Spetersvn_repos_dump_fs2(svn_repos_t *repos, 3042251881Speter svn_stream_t *dumpstream, 3043251881Speter svn_stream_t *feedback_stream, 3044251881Speter svn_revnum_t start_rev, 3045251881Speter svn_revnum_t end_rev, 3046251881Speter svn_boolean_t incremental, 3047251881Speter svn_boolean_t use_deltas, 3048251881Speter svn_cancel_func_t cancel_func, 3049251881Speter void *cancel_baton, 3050251881Speter apr_pool_t *pool); 3051251881Speter 3052251881Speter/** 3053251881Speter * Similar to svn_repos_dump_fs2(), but with the @a use_deltas 3054251881Speter * parameter always set to @c FALSE. 3055251881Speter * 3056251881Speter * @deprecated Provided for backward compatibility with the 1.0 API. 3057251881Speter */ 3058251881SpeterSVN_DEPRECATED 3059251881Spetersvn_error_t * 3060251881Spetersvn_repos_dump_fs(svn_repos_t *repos, 3061251881Speter svn_stream_t *dumpstream, 3062251881Speter svn_stream_t *feedback_stream, 3063251881Speter svn_revnum_t start_rev, 3064251881Speter svn_revnum_t end_rev, 3065251881Speter svn_boolean_t incremental, 3066251881Speter svn_cancel_func_t cancel_func, 3067251881Speter void *cancel_baton, 3068251881Speter apr_pool_t *pool); 3069251881Speter 3070251881Speter 3071251881Speter/** 3072251881Speter * Read and parse dumpfile-formatted @a dumpstream, reconstructing 3073251881Speter * filesystem revisions in already-open @a repos, handling uuids in 3074251881Speter * accordance with @a uuid_action. Use @a pool for all allocation. 3075251881Speter * 3076251881Speter * If the dumpstream contains copy history that is unavailable in the 3077251881Speter * repository, an error will be thrown. 3078251881Speter * 3079251881Speter * The repository's UUID will be updated iff 3080251881Speter * the dumpstream contains a UUID and 3081251881Speter * @a uuid_action is not equal to #svn_repos_load_uuid_ignore and 3082251881Speter * either the repository contains no revisions or 3083251881Speter * @a uuid_action is equal to #svn_repos_load_uuid_force. 3084251881Speter * 3085251881Speter * If the dumpstream contains no UUID, then @a uuid_action is 3086251881Speter * ignored and the repository UUID is not touched. 3087251881Speter * 3088251881Speter * @a start_rev and @a end_rev act as filters, the lower and upper 3089251881Speter * (inclusive) range values of revisions in @a dumpstream which will 3090251881Speter * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 3091251881Speter * which case no revision-based filtering occurs at all), or both are 3092251881Speter * valid revisions (where @a start_rev is older than or equivalent to 3093251881Speter * @a end_rev). 3094251881Speter * 3095251881Speter * If @a parent_dir is not NULL, then the parser will reparent all the 3096251881Speter * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 3097251881Speter * must be an existing directory in the repository. 3098251881Speter * 3099251881Speter * If @a use_pre_commit_hook is set, call the repository's pre-commit 3100251881Speter * hook before committing each loaded revision. 3101251881Speter * 3102251881Speter * If @a use_post_commit_hook is set, call the repository's 3103251881Speter * post-commit hook after committing each loaded revision. 3104251881Speter * 3105251881Speter * If @a validate_props is set, then validate Subversion revision and 3106251881Speter * node properties (those in the svn: namespace) against established 3107251881Speter * rules for those things. 3108251881Speter * 3109299742Sdim * If @a ignore_dates is set, ignore any revision datestamps found in 3110299742Sdim * @a dumpstream, allowing the revisions created by the load process 3111299742Sdim * to be stamped as if they were newly created via the normal commit 3112299742Sdim * process. 3113299742Sdim * 3114251881Speter * If non-NULL, use @a notify_func and @a notify_baton to send notification 3115251881Speter * of events to the caller. 3116251881Speter * 3117251881Speter * If @a cancel_func is not @c NULL, it is called periodically with 3118251881Speter * @a cancel_baton as argument to see if the client wishes to cancel 3119251881Speter * the load. 3120251881Speter * 3121299742Sdim * @since New in 1.9. 3122299742Sdim */ 3123299742Sdimsvn_error_t * 3124299742Sdimsvn_repos_load_fs5(svn_repos_t *repos, 3125299742Sdim svn_stream_t *dumpstream, 3126299742Sdim svn_revnum_t start_rev, 3127299742Sdim svn_revnum_t end_rev, 3128299742Sdim enum svn_repos_load_uuid uuid_action, 3129299742Sdim const char *parent_dir, 3130299742Sdim svn_boolean_t use_pre_commit_hook, 3131299742Sdim svn_boolean_t use_post_commit_hook, 3132299742Sdim svn_boolean_t validate_props, 3133299742Sdim svn_boolean_t ignore_dates, 3134299742Sdim svn_repos_notify_func_t notify_func, 3135299742Sdim void *notify_baton, 3136299742Sdim svn_cancel_func_t cancel_func, 3137299742Sdim void *cancel_baton, 3138299742Sdim apr_pool_t *pool); 3139299742Sdim 3140299742Sdim/** Similar to svn_repos_load_fs5(), but with @a ignore_dates 3141299742Sdim * always passed as FALSE. 3142299742Sdim * 3143251881Speter * @since New in 1.8. 3144299742Sdim * @deprecated Provided for backward compatibility with the 1.8 API. 3145251881Speter */ 3146299742SdimSVN_DEPRECATED 3147251881Spetersvn_error_t * 3148251881Spetersvn_repos_load_fs4(svn_repos_t *repos, 3149251881Speter svn_stream_t *dumpstream, 3150251881Speter svn_revnum_t start_rev, 3151251881Speter svn_revnum_t end_rev, 3152251881Speter enum svn_repos_load_uuid uuid_action, 3153251881Speter const char *parent_dir, 3154251881Speter svn_boolean_t use_pre_commit_hook, 3155251881Speter svn_boolean_t use_post_commit_hook, 3156251881Speter svn_boolean_t validate_props, 3157251881Speter svn_repos_notify_func_t notify_func, 3158251881Speter void *notify_baton, 3159251881Speter svn_cancel_func_t cancel_func, 3160251881Speter void *cancel_baton, 3161251881Speter apr_pool_t *pool); 3162251881Speter 3163251881Speter/** Similar to svn_repos_load_fs4(), but with @a start_rev and @a 3164251881Speter * end_rev always passed as #SVN_INVALID_REVNUM. 3165251881Speter * 3166251881Speter * @since New in 1.7. 3167251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 3168251881Speter */ 3169251881SpeterSVN_DEPRECATED 3170251881Spetersvn_error_t * 3171251881Spetersvn_repos_load_fs3(svn_repos_t *repos, 3172251881Speter svn_stream_t *dumpstream, 3173251881Speter enum svn_repos_load_uuid uuid_action, 3174251881Speter const char *parent_dir, 3175251881Speter svn_boolean_t use_pre_commit_hook, 3176251881Speter svn_boolean_t use_post_commit_hook, 3177251881Speter svn_boolean_t validate_props, 3178251881Speter svn_repos_notify_func_t notify_func, 3179251881Speter void *notify_baton, 3180251881Speter svn_cancel_func_t cancel_func, 3181251881Speter void *cancel_baton, 3182251881Speter apr_pool_t *pool); 3183251881Speter 3184251881Speter/** 3185251881Speter * Similar to svn_repos_load_fs3(), but with @a feedback_stream in 3186251881Speter * place of the #svn_repos_notify_func_t and baton and with 3187251881Speter * @a validate_props always FALSE. 3188251881Speter * 3189251881Speter * @since New in 1.2. 3190251881Speter * @deprecated Provided for backward compatibility with the 1.6 API. 3191251881Speter */ 3192251881SpeterSVN_DEPRECATED 3193251881Spetersvn_error_t * 3194251881Spetersvn_repos_load_fs2(svn_repos_t *repos, 3195251881Speter svn_stream_t *dumpstream, 3196251881Speter svn_stream_t *feedback_stream, 3197251881Speter enum svn_repos_load_uuid uuid_action, 3198251881Speter const char *parent_dir, 3199251881Speter svn_boolean_t use_pre_commit_hook, 3200251881Speter svn_boolean_t use_post_commit_hook, 3201251881Speter svn_cancel_func_t cancel_func, 3202251881Speter void *cancel_baton, 3203251881Speter apr_pool_t *pool); 3204251881Speter 3205251881Speter/** 3206251881Speter * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and 3207251881Speter * @a use_post_commit_hook always @c FALSE. 3208251881Speter * 3209251881Speter * @deprecated Provided for backward compatibility with the 1.1 API. 3210251881Speter */ 3211251881SpeterSVN_DEPRECATED 3212251881Spetersvn_error_t * 3213251881Spetersvn_repos_load_fs(svn_repos_t *repos, 3214251881Speter svn_stream_t *dumpstream, 3215251881Speter svn_stream_t *feedback_stream, 3216251881Speter enum svn_repos_load_uuid uuid_action, 3217251881Speter const char *parent_dir, 3218251881Speter svn_cancel_func_t cancel_func, 3219251881Speter void *cancel_baton, 3220251881Speter apr_pool_t *pool); 3221251881Speter 3222251881Speter 3223251881Speter/** 3224251881Speter * A vtable that is driven by svn_repos_parse_dumpstream3(). 3225251881Speter * 3226251881Speter * @since New in 1.8. 3227251881Speter */ 3228251881Spetertypedef struct svn_repos_parse_fns3_t 3229251881Speter{ 3230251881Speter /** The parser has discovered a new "magic header" record within the 3231251881Speter * parsing session represented by @a parse_baton. The dump-format 3232251881Speter * version number is @a version. 3233251881Speter */ 3234251881Speter svn_error_t *(*magic_header_record)(int version, 3235251881Speter void *parse_baton, 3236251881Speter apr_pool_t *pool); 3237251881Speter 3238251881Speter /** The parser has discovered a new uuid record within the parsing 3239251881Speter * session represented by @a parse_baton. The uuid's value is 3240251881Speter * @a uuid, and it is allocated in @a pool. 3241251881Speter */ 3242251881Speter svn_error_t *(*uuid_record)(const char *uuid, 3243251881Speter void *parse_baton, 3244251881Speter apr_pool_t *pool); 3245251881Speter 3246251881Speter /** The parser has discovered a new revision record within the 3247251881Speter * parsing session represented by @a parse_baton. All the headers are 3248251881Speter * placed in @a headers (allocated in @a pool), which maps <tt>const 3249251881Speter * char *</tt> header-name ==> <tt>const char *</tt> header-value. 3250251881Speter * The @a revision_baton received back (also allocated in @a pool) 3251251881Speter * represents the revision. 3252251881Speter */ 3253251881Speter svn_error_t *(*new_revision_record)(void **revision_baton, 3254251881Speter apr_hash_t *headers, 3255251881Speter void *parse_baton, 3256251881Speter apr_pool_t *pool); 3257251881Speter 3258251881Speter /** The parser has discovered a new node record within the current 3259251881Speter * revision represented by @a revision_baton. All the headers are 3260251881Speter * placed in @a headers (as with @c new_revision_record), allocated in 3261251881Speter * @a pool. The @a node_baton received back is allocated in @a pool 3262251881Speter * and represents the node. 3263251881Speter */ 3264251881Speter svn_error_t *(*new_node_record)(void **node_baton, 3265251881Speter apr_hash_t *headers, 3266251881Speter void *revision_baton, 3267251881Speter apr_pool_t *pool); 3268251881Speter 3269251881Speter /** For a given @a revision_baton, set a property @a name to @a value. */ 3270251881Speter svn_error_t *(*set_revision_property)(void *revision_baton, 3271251881Speter const char *name, 3272251881Speter const svn_string_t *value); 3273251881Speter 3274251881Speter /** For a given @a node_baton, set a property @a name to @a value. */ 3275251881Speter svn_error_t *(*set_node_property)(void *node_baton, 3276251881Speter const char *name, 3277251881Speter const svn_string_t *value); 3278251881Speter 3279251881Speter /** For a given @a node_baton, delete property @a name. */ 3280251881Speter svn_error_t *(*delete_node_property)(void *node_baton, const char *name); 3281251881Speter 3282251881Speter /** For a given @a node_baton, remove all properties. */ 3283251881Speter svn_error_t *(*remove_node_props)(void *node_baton); 3284251881Speter 3285299742Sdim /** For a given @a node_baton, set @a stream to a writable stream 3286299742Sdim * capable of receiving the node's fulltext. The parser will write 3287299742Sdim * the fulltext to the stream and then close the stream to signal 3288299742Sdim * completion. 3289251881Speter * 3290251881Speter * If a @c NULL is returned instead of a stream, the vtable is 3291251881Speter * indicating that no text is desired, and the parser will not 3292251881Speter * attempt to send it. 3293251881Speter */ 3294251881Speter svn_error_t *(*set_fulltext)(svn_stream_t **stream, 3295251881Speter void *node_baton); 3296251881Speter 3297251881Speter /** For a given @a node_baton, set @a handler and @a handler_baton 3298251881Speter * to a window handler and baton capable of receiving a delta 3299299742Sdim * against the node's previous contents. The parser will send all 3300299742Sdim * the windows of data to this handler, and will then send a NULL 3301299742Sdim * window to signal completion. 3302251881Speter * 3303251881Speter * If a @c NULL is returned instead of a handler, the vtable is 3304251881Speter * indicating that no delta is desired, and the parser will not 3305251881Speter * attempt to send it. 3306251881Speter */ 3307251881Speter svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler, 3308251881Speter void **handler_baton, 3309251881Speter void *node_baton); 3310251881Speter 3311251881Speter /** The parser has reached the end of the current node represented by 3312251881Speter * @a node_baton, it can be freed. 3313251881Speter */ 3314251881Speter svn_error_t *(*close_node)(void *node_baton); 3315251881Speter 3316251881Speter /** The parser has reached the end of the current revision 3317251881Speter * represented by @a revision_baton. In other words, there are no more 3318251881Speter * changed nodes within the revision. The baton can be freed. 3319251881Speter */ 3320251881Speter svn_error_t *(*close_revision)(void *revision_baton); 3321251881Speter 3322251881Speter} svn_repos_parse_fns3_t; 3323251881Speter 3324251881Speter 3325251881Speter/** 3326251881Speter * Read and parse dumpfile-formatted @a stream, calling callbacks in 3327251881Speter * @a parse_fns/@a parse_baton, and using @a pool for allocations. 3328251881Speter * 3329251881Speter * If @a deltas_are_text is @c TRUE, handle text-deltas with the @a 3330251881Speter * set_fulltext callback. This is useful when manipulating a dump 3331251881Speter * stream without loading it. Otherwise handle text-deltas with the 3332251881Speter * @a apply_textdelta callback. 3333251881Speter * 3334251881Speter * If @a cancel_func is not @c NULL, it is called periodically with 3335251881Speter * @a cancel_baton as argument to see if the client wishes to cancel 3336251881Speter * the dump. 3337251881Speter * 3338251881Speter * This parser has built-in knowledge of the dumpfile format, but only 3339251881Speter * in a limited sense: 3340251881Speter * 3341251881Speter * * it recognizes the "magic" format-version header. 3342251881Speter * 3343251881Speter * * it recognizes the UUID header. 3344251881Speter * 3345251881Speter * * it recognizes revision and node records by looking for either 3346251881Speter * a REVISION_NUMBER or NODE_PATH headers. 3347251881Speter * 3348251881Speter * * it recognizes the CONTENT-LENGTH headers, so it knows if and 3349251881Speter * how to suck up the content body. 3350251881Speter * 3351251881Speter * * it knows how to parse a content body into two parts: props 3352251881Speter * and text, and pass the pieces to the vtable. 3353251881Speter * 3354251881Speter * This is enough knowledge to make it easy on vtable implementors, 3355251881Speter * but still allow expansion of the format: most headers do not have 3356251881Speter * to be handled explicitly. 3357251881Speter * 3358299742Sdim * ### [JAF] Wouldn't it be more efficient to support a start/end rev 3359299742Sdim * range here than only supporting it in receivers such as 3360299742Sdim * svn_repos_get_fs_build_parser4()? This parser could then skip over 3361299742Sdim * chunks of the input stream before the oldest required rev, and 3362299742Sdim * could stop reading entirely after the youngest required rev. 3363299742Sdim * 3364251881Speter * @since New in 1.8. 3365251881Speter */ 3366251881Spetersvn_error_t * 3367251881Spetersvn_repos_parse_dumpstream3(svn_stream_t *stream, 3368251881Speter const svn_repos_parse_fns3_t *parse_fns, 3369251881Speter void *parse_baton, 3370251881Speter svn_boolean_t deltas_are_text, 3371251881Speter svn_cancel_func_t cancel_func, 3372251881Speter void *cancel_baton, 3373251881Speter apr_pool_t *pool); 3374251881Speter 3375251881Speter 3376251881Speter/** 3377251881Speter * Set @a *parser and @a *parse_baton to a vtable parser which commits new 3378251881Speter * revisions to the fs in @a repos. The constructed parser will treat 3379251881Speter * UUID records in a manner consistent with @a uuid_action. Use @a pool 3380251881Speter * to operate on the fs. 3381251881Speter * 3382251881Speter * @a start_rev and @a end_rev act as filters, the lower and upper 3383299742Sdim * (inclusive) range values of revisions which will 3384251881Speter * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in 3385251881Speter * which case no revision-based filtering occurs at all), or both are 3386251881Speter * valid revisions (where @a start_rev is older than or equivalent to 3387299742Sdim * @a end_rev). They refer to dump stream revision numbers rather than 3388299742Sdim * committed revision numbers. 3389251881Speter * 3390299742Sdim * If @a use_history is true, then when the parser encounters a node that 3391299742Sdim * is added-with-history, it will require 'copy-from' history to exist in 3392299742Sdim * the repository at the relative (adjusted) copy-from revision and path. 3393299742Sdim * It will perform a copy from that source location, and will fail if no 3394299742Sdim * suitable source exists there. If @a use_history is false, then it will 3395299742Sdim * instead convert every copy to a plain add. 3396251881Speter * 3397299742Sdim * ### The 'use_history=FALSE' case is unused and untested in Subversion. 3398299742Sdim * It seems to me it would not work with a deltas dumpfile (a driver 3399299742Sdim * that calls the @c apply_textdelta method), as it would not have 3400299742Sdim * access to the delta base text. 3401299742Sdim * 3402299742Sdim * If @a use_pre_commit_hook is set, call the repository's pre-commit 3403299742Sdim * hook before committing each loaded revision. 3404299742Sdim * 3405299742Sdim * If @a use_post_commit_hook is set, call the repository's 3406299742Sdim * post-commit hook after committing each loaded revision. 3407299742Sdim * 3408251881Speter * If @a validate_props is set, then validate Subversion revision and 3409251881Speter * node properties (those in the svn: namespace) against established 3410251881Speter * rules for those things. 3411251881Speter * 3412299742Sdim * If @a ignore_dates is set, ignore any revision datestamps found in 3413299742Sdim * @a dumpstream, allowing the revisions created by the load process 3414299742Sdim * to be stamped as if they were newly created via the normal commit 3415299742Sdim * process. 3416299742Sdim * 3417251881Speter * If @a parent_dir is not NULL, then the parser will reparent all the 3418251881Speter * loaded nodes, from root to @a parent_dir. The directory @a parent_dir 3419251881Speter * must be an existing directory in the repository. 3420251881Speter * 3421299742Sdim * @since New in 1.9. 3422299742Sdim */ 3423299742Sdimsvn_error_t * 3424299742Sdimsvn_repos_get_fs_build_parser5(const svn_repos_parse_fns3_t **parser, 3425299742Sdim void **parse_baton, 3426299742Sdim svn_repos_t *repos, 3427299742Sdim svn_revnum_t start_rev, 3428299742Sdim svn_revnum_t end_rev, 3429299742Sdim svn_boolean_t use_history, 3430299742Sdim svn_boolean_t validate_props, 3431299742Sdim enum svn_repos_load_uuid uuid_action, 3432299742Sdim const char *parent_dir, 3433299742Sdim svn_boolean_t use_pre_commit_hook, 3434299742Sdim svn_boolean_t use_post_commit_hook, 3435299742Sdim svn_boolean_t ignore_dates, 3436299742Sdim svn_repos_notify_func_t notify_func, 3437299742Sdim void *notify_baton, 3438299742Sdim apr_pool_t *pool); 3439299742Sdim 3440299742Sdim/** 3441299742Sdim * Similar to svn_repos_get_fs_build_parser5(), but with the 3442299742Sdim * @c use_pre_commit_hook, @c use_post_commit_hook and @c ignore_dates 3443299742Sdim * arguments all false. 3444299742Sdim * 3445251881Speter * @since New in 1.8. 3446299742Sdim * @deprecated Provided for backward compatibility with the 1.8 API. 3447251881Speter */ 3448299742SdimSVN_DEPRECATED 3449251881Spetersvn_error_t * 3450251881Spetersvn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser, 3451251881Speter void **parse_baton, 3452251881Speter svn_repos_t *repos, 3453251881Speter svn_revnum_t start_rev, 3454251881Speter svn_revnum_t end_rev, 3455251881Speter svn_boolean_t use_history, 3456251881Speter svn_boolean_t validate_props, 3457251881Speter enum svn_repos_load_uuid uuid_action, 3458251881Speter const char *parent_dir, 3459251881Speter svn_repos_notify_func_t notify_func, 3460251881Speter void *notify_baton, 3461251881Speter apr_pool_t *pool); 3462251881Speter 3463251881Speter 3464299742Sdim 3465251881Speter/** 3466251881Speter * A vtable that is driven by svn_repos_parse_dumpstream2(). 3467251881Speter * Similar to #svn_repos_parse_fns3_t except that it lacks 3468299742Sdim * the magic_header_record callback. 3469251881Speter * 3470251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 3471251881Speter */ 3472251881Spetertypedef struct svn_repos_parse_fns2_t 3473251881Speter{ 3474251881Speter /** Same as #svn_repos_parse_fns3_t.new_revision_record. */ 3475251881Speter svn_error_t *(*new_revision_record)(void **revision_baton, 3476251881Speter apr_hash_t *headers, 3477251881Speter void *parse_baton, 3478251881Speter apr_pool_t *pool); 3479251881Speter /** Same as #svn_repos_parse_fns3_t.uuid_record. */ 3480251881Speter svn_error_t *(*uuid_record)(const char *uuid, 3481251881Speter void *parse_baton, 3482251881Speter apr_pool_t *pool); 3483251881Speter /** Same as #svn_repos_parse_fns3_t.new_node_record. */ 3484251881Speter svn_error_t *(*new_node_record)(void **node_baton, 3485251881Speter apr_hash_t *headers, 3486251881Speter void *revision_baton, 3487251881Speter apr_pool_t *pool); 3488251881Speter /** Same as #svn_repos_parse_fns3_t.set_revision_property. */ 3489251881Speter svn_error_t *(*set_revision_property)(void *revision_baton, 3490251881Speter const char *name, 3491251881Speter const svn_string_t *value); 3492251881Speter /** Same as #svn_repos_parse_fns3_t.set_node_property. */ 3493251881Speter svn_error_t *(*set_node_property)(void *node_baton, 3494251881Speter const char *name, 3495251881Speter const svn_string_t *value); 3496251881Speter /** Same as #svn_repos_parse_fns3_t.delete_node_property. */ 3497251881Speter svn_error_t *(*delete_node_property)(void *node_baton, 3498251881Speter const char *name); 3499251881Speter /** Same as #svn_repos_parse_fns3_t.remove_node_props. */ 3500251881Speter svn_error_t *(*remove_node_props)(void *node_baton); 3501251881Speter /** Same as #svn_repos_parse_fns3_t.set_fulltext. */ 3502251881Speter svn_error_t *(*set_fulltext)(svn_stream_t **stream, 3503251881Speter void *node_baton); 3504251881Speter /** Same as #svn_repos_parse_fns3_t.apply_textdelta. */ 3505251881Speter svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler, 3506251881Speter void **handler_baton, 3507251881Speter void *node_baton); 3508251881Speter /** Same as #svn_repos_parse_fns3_t.close_node. */ 3509251881Speter svn_error_t *(*close_node)(void *node_baton); 3510251881Speter /** Same as #svn_repos_parse_fns3_t.close_revision. */ 3511251881Speter svn_error_t *(*close_revision)(void *revision_baton); 3512251881Speter} svn_repos_parse_fns2_t; 3513251881Speter 3514251881Speter/** @deprecated Provided for backward compatibility with the 1.7 API. */ 3515251881Spetertypedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t; 3516251881Speter 3517251881Speter 3518251881Speter/** 3519251881Speter * A vtable that is driven by svn_repos_parse_dumpstream(). 3520251881Speter * Similar to #svn_repos_parse_fns2_t except that it lacks 3521251881Speter * the delete_node_property and apply_textdelta callbacks. 3522251881Speter * 3523251881Speter * @deprecated Provided for backward compatibility with the 1.0 API. 3524251881Speter */ 3525251881Spetertypedef struct svn_repos_parse_fns_t 3526251881Speter{ 3527251881Speter /** Same as #svn_repos_parse_fns2_t.new_revision_record. */ 3528251881Speter svn_error_t *(*new_revision_record)(void **revision_baton, 3529251881Speter apr_hash_t *headers, 3530251881Speter void *parse_baton, 3531251881Speter apr_pool_t *pool); 3532251881Speter /** Same as #svn_repos_parse_fns2_t.uuid_record. */ 3533251881Speter svn_error_t *(*uuid_record)(const char *uuid, 3534251881Speter void *parse_baton, 3535251881Speter apr_pool_t *pool); 3536251881Speter /** Same as #svn_repos_parse_fns2_t.new_node_record. */ 3537251881Speter svn_error_t *(*new_node_record)(void **node_baton, 3538251881Speter apr_hash_t *headers, 3539251881Speter void *revision_baton, 3540251881Speter apr_pool_t *pool); 3541251881Speter /** Same as #svn_repos_parse_fns2_t.set_revision_property. */ 3542251881Speter svn_error_t *(*set_revision_property)(void *revision_baton, 3543251881Speter const char *name, 3544251881Speter const svn_string_t *value); 3545251881Speter /** Same as #svn_repos_parse_fns2_t.set_node_property. */ 3546251881Speter svn_error_t *(*set_node_property)(void *node_baton, 3547251881Speter const char *name, 3548251881Speter const svn_string_t *value); 3549251881Speter /** Same as #svn_repos_parse_fns2_t.remove_node_props. */ 3550251881Speter svn_error_t *(*remove_node_props)(void *node_baton); 3551251881Speter /** Same as #svn_repos_parse_fns2_t.set_fulltext. */ 3552251881Speter svn_error_t *(*set_fulltext)(svn_stream_t **stream, 3553251881Speter void *node_baton); 3554251881Speter /** Same as #svn_repos_parse_fns2_t.close_node. */ 3555251881Speter svn_error_t *(*close_node)(void *node_baton); 3556251881Speter /** Same as #svn_repos_parse_fns2_t.close_revision. */ 3557251881Speter svn_error_t *(*close_revision)(void *revision_baton); 3558251881Speter} svn_repos_parser_fns_t; 3559251881Speter 3560251881Speter 3561251881Speter/** 3562251881Speter * Similar to svn_repos_parse_dumpstream3(), but uses the more limited 3563251881Speter * #svn_repos_parser_fns2_t vtable type. 3564251881Speter * 3565251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 3566251881Speter */ 3567251881SpeterSVN_DEPRECATED 3568251881Spetersvn_error_t * 3569251881Spetersvn_repos_parse_dumpstream2(svn_stream_t *stream, 3570251881Speter const svn_repos_parser_fns2_t *parse_fns, 3571251881Speter void *parse_baton, 3572251881Speter svn_cancel_func_t cancel_func, 3573251881Speter void *cancel_baton, 3574251881Speter apr_pool_t *pool); 3575251881Speter 3576251881Speter/** 3577251881Speter * Similar to svn_repos_parse_dumpstream2(), but uses the more limited 3578251881Speter * #svn_repos_parser_fns_t vtable type. 3579251881Speter * 3580251881Speter * @deprecated Provided for backward compatibility with the 1.0 API. 3581251881Speter */ 3582251881SpeterSVN_DEPRECATED 3583251881Spetersvn_error_t * 3584251881Spetersvn_repos_parse_dumpstream(svn_stream_t *stream, 3585251881Speter const svn_repos_parser_fns_t *parse_fns, 3586251881Speter void *parse_baton, 3587251881Speter svn_cancel_func_t cancel_func, 3588251881Speter void *cancel_baton, 3589251881Speter apr_pool_t *pool); 3590251881Speter 3591251881Speter/** 3592251881Speter * Similar to svn_repos_get_fs_build_parser4(), but with @a start_rev 3593251881Speter * and @a end_rev always passed as #SVN_INVALID_REVNUM, and yielding 3594251881Speter * the more limited svn_repos_parse_fns2_t. 3595251881Speter * 3596251881Speter * @since New in 1.7. 3597251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 3598251881Speter */ 3599251881SpeterSVN_DEPRECATED 3600251881Spetersvn_error_t * 3601251881Spetersvn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **parser, 3602251881Speter void **parse_baton, 3603251881Speter svn_repos_t *repos, 3604251881Speter svn_boolean_t use_history, 3605251881Speter svn_boolean_t validate_props, 3606251881Speter enum svn_repos_load_uuid uuid_action, 3607251881Speter const char *parent_dir, 3608251881Speter svn_repos_notify_func_t notify_func, 3609251881Speter void *notify_baton, 3610251881Speter apr_pool_t *pool); 3611251881Speter 3612251881Speter/** 3613251881Speter * Similar to svn_repos_get_fs_build_parser3(), but with @a outstream 3614251881Speter * in place if a #svn_repos_notify_func_t and baton and with 3615251881Speter * @a validate_props always FALSE. 3616251881Speter * 3617251881Speter * @since New in 1.1. 3618251881Speter * @deprecated Provided for backward compatibility with the 1.6 API. 3619251881Speter */ 3620251881SpeterSVN_DEPRECATED 3621251881Spetersvn_error_t * 3622251881Spetersvn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser, 3623251881Speter void **parse_baton, 3624251881Speter svn_repos_t *repos, 3625251881Speter svn_boolean_t use_history, 3626251881Speter enum svn_repos_load_uuid uuid_action, 3627251881Speter svn_stream_t *outstream, 3628251881Speter const char *parent_dir, 3629251881Speter apr_pool_t *pool); 3630251881Speter 3631251881Speter/** 3632251881Speter * Similar to svn_repos_get_fs_build_parser2(), but yields the more 3633251881Speter * limited svn_repos_parser_fns_t vtable type. 3634251881Speter * 3635251881Speter * @deprecated Provided for backward compatibility with the 1.0 API. 3636251881Speter */ 3637251881SpeterSVN_DEPRECATED 3638251881Spetersvn_error_t * 3639251881Spetersvn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser, 3640251881Speter void **parse_baton, 3641251881Speter svn_repos_t *repos, 3642251881Speter svn_boolean_t use_history, 3643251881Speter enum svn_repos_load_uuid uuid_action, 3644251881Speter svn_stream_t *outstream, 3645251881Speter const char *parent_dir, 3646251881Speter apr_pool_t *pool); 3647251881Speter 3648251881Speter 3649251881Speter/** @} */ 3650251881Speter 3651251881Speter/** A data type which stores the authz information. 3652251881Speter * 3653251881Speter * @since New in 1.3. 3654251881Speter */ 3655251881Spetertypedef struct svn_authz_t svn_authz_t; 3656251881Speter 3657251881Speter/** 3658251881Speter * Read authz configuration data from @a path (a dirent, an absolute file url 3659251881Speter * or a registry path) into @a *authz_p, allocated in @a pool. 3660251881Speter * 3661251881Speter * If @a groups_path (a dirent, an absolute file url, or a registry path) is 3662251881Speter * set, use the global groups parsed from it. 3663251881Speter * 3664251881Speter * If @a path or @a groups_path is not a valid authz rule file, then return 3665251881Speter * #SVN_ERR_AUTHZ_INVALID_CONFIG. The contents of @a *authz_p is then 3666251881Speter * undefined. If @a must_exist is TRUE, a missing authz or groups file 3667251881Speter * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error 3668251881Speter * depends on the access type). 3669251881Speter * 3670251881Speter * @since New in 1.8. 3671251881Speter */ 3672251881Spetersvn_error_t * 3673251881Spetersvn_repos_authz_read2(svn_authz_t **authz_p, 3674251881Speter const char *path, 3675251881Speter const char *groups_path, 3676251881Speter svn_boolean_t must_exist, 3677251881Speter apr_pool_t *pool); 3678251881Speter 3679251881Speter 3680251881Speter/** 3681251881Speter * Similar to svn_repos_authz_read2(), but with @a groups_path and @a 3682251881Speter * repos_root always passed as @c NULL. 3683251881Speter * 3684251881Speter * @since New in 1.3. 3685251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 3686251881Speter */ 3687251881SpeterSVN_DEPRECATED 3688251881Spetersvn_error_t * 3689251881Spetersvn_repos_authz_read(svn_authz_t **authz_p, 3690251881Speter const char *file, 3691251881Speter svn_boolean_t must_exist, 3692251881Speter apr_pool_t *pool); 3693251881Speter 3694251881Speter/** 3695251881Speter * Read authz configuration data from @a stream into @a *authz_p, 3696251881Speter * allocated in @a pool. 3697251881Speter * 3698251881Speter * If @a groups_stream is set, use the global groups parsed from it. 3699251881Speter * 3700251881Speter * @since New in 1.8. 3701251881Speter */ 3702251881Spetersvn_error_t * 3703251881Spetersvn_repos_authz_parse(svn_authz_t **authz_p, 3704251881Speter svn_stream_t *stream, 3705251881Speter svn_stream_t *groups_stream, 3706251881Speter apr_pool_t *pool); 3707251881Speter 3708251881Speter/** 3709251881Speter * Check whether @a user can access @a path in the repository @a 3710251881Speter * repos_name with the @a required_access. @a authz lists the ACLs to 3711251881Speter * check against. Set @a *access_granted to indicate if the requested 3712251881Speter * access is granted. 3713251881Speter * 3714251881Speter * If @a path is NULL, then check whether @a user has the @a 3715251881Speter * required_access anywhere in the repository. Set @a *access_granted 3716251881Speter * to TRUE if at least one path is accessible with the @a 3717251881Speter * required_access. 3718251881Speter * 3719251881Speter * For compatibility with 1.6, and earlier, @a repos_name can be NULL 3720251881Speter * in which case it is equivalent to a @a repos_name of "". 3721251881Speter * 3722251881Speter * @note Presently, @a repos_name must byte-for-byte match the repos_name 3723251881Speter * specified in the authz file; it is treated as an opaque string, and not 3724251881Speter * as a dirent. 3725251881Speter * 3726251881Speter * @since New in 1.3. 3727251881Speter */ 3728251881Spetersvn_error_t * 3729251881Spetersvn_repos_authz_check_access(svn_authz_t *authz, 3730251881Speter const char *repos_name, 3731251881Speter const char *path, 3732251881Speter const char *user, 3733251881Speter svn_repos_authz_access_t required_access, 3734251881Speter svn_boolean_t *access_granted, 3735251881Speter apr_pool_t *pool); 3736251881Speter 3737251881Speter 3738251881Speter 3739251881Speter/** Revision Access Levels 3740251881Speter * 3741251881Speter * Like most version control systems, access to versioned objects in 3742251881Speter * Subversion is determined on primarily path-based system. Users either 3743251881Speter * do or don't have the ability to read a given path. 3744251881Speter * 3745251881Speter * However, unlike many version control systems where versioned objects 3746251881Speter * maintain their own distinct version information (revision numbers, 3747251881Speter * authors, log messages, change timestamps, etc.), Subversion binds 3748251881Speter * multiple paths changed as part of a single commit operation into a 3749251881Speter * set, calls the whole thing a revision, and hangs commit metadata 3750251881Speter * (author, date, log message, etc.) off of that revision. So, commit 3751251881Speter * metadata is shared across all the paths changed as part of a given 3752251881Speter * commit operation. 3753251881Speter * 3754251881Speter * It is common (or, at least, we hope it is) for log messages to give 3755251881Speter * detailed information about changes made in the commit to which the log 3756251881Speter * message is attached. Such information might include a mention of all 3757251881Speter * the files changed, what was changed in them, and so on. But this 3758251881Speter * causes a problem when presenting information to readers who aren't 3759251881Speter * authorized to read every path in the repository. Simply knowing that 3760251881Speter * a given path exists may be a security leak, even if the user can't see 3761251881Speter * the contents of the data located at that path. 3762251881Speter * 3763251881Speter * So Subversion does what it reasonably can to prevent the leak of this 3764251881Speter * information, and does so via a staged revision access policy. A 3765251881Speter * reader can be said to have one of three levels of access to a given 3766251881Speter * revision's metadata, based solely on the reader's access rights to the 3767251881Speter * paths changed or copied in that revision: 3768251881Speter * 3769251881Speter * 'full access' -- Granted when the reader has access to all paths 3770251881Speter * changed or copied in the revision, or when no paths were 3771251881Speter * changed in the revision at all, this access level permits 3772251881Speter * full visibility of all revision property names and values, 3773251881Speter * and the full changed-paths information. 3774251881Speter * 3775251881Speter * 'no access' -- Granted when the reader does not have access to any 3776251881Speter * paths changed or copied in the revision, this access level 3777251881Speter * denies the reader access to all revision properties and all 3778251881Speter * changed-paths information. 3779251881Speter * 3780251881Speter * 'partial access' -- Granted when the reader has access to at least 3781251881Speter * one, but not all, of the paths changed or copied in the revision, 3782251881Speter * this access level permits visibility of the svn:date and 3783251881Speter * svn:author revision properties and only the paths of the 3784251881Speter * changed-paths information to which the reader has access. 3785251881Speter * 3786251881Speter */ 3787251881Speter 3788251881Speter 3789251881Speter/** An enum defining levels of revision access. 3790251881Speter * 3791251881Speter * @since New in 1.5. 3792251881Speter */ 3793251881Spetertypedef enum svn_repos_revision_access_level_t 3794251881Speter{ 3795251881Speter /** no access allowed to the revision properties and all changed-paths 3796299742Sdim * information. */ 3797251881Speter svn_repos_revision_access_none, 3798251881Speter /** access granted to some (svn:date and svn:author) revision properties and 3799251881Speter * changed-paths information on paths the read has access to. */ 3800251881Speter svn_repos_revision_access_partial, 3801251881Speter /** access granted to all revision properites and changed-paths 3802251881Speter * information. */ 3803251881Speter svn_repos_revision_access_full 3804251881Speter} 3805251881Spetersvn_repos_revision_access_level_t; 3806251881Speter 3807251881Speter 3808251881Speter/** 3809251881Speter * Set @a access to the access level granted for @a revision in @a 3810251881Speter * repos, as determined by consulting the @a authz_read_func callback 3811251881Speter * function and its associated @a authz_read_baton. 3812251881Speter * 3813251881Speter * @a authz_read_func may be @c NULL, in which case @a access will be 3814251881Speter * set to #svn_repos_revision_access_full. 3815251881Speter * 3816251881Speter * @since New in 1.5. 3817251881Speter */ 3818251881Spetersvn_error_t * 3819251881Spetersvn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level, 3820251881Speter svn_repos_t *repos, 3821251881Speter svn_revnum_t revision, 3822251881Speter svn_repos_authz_func_t authz_read_func, 3823251881Speter void *authz_read_baton, 3824251881Speter apr_pool_t *pool); 3825251881Speter 3826251881Speter 3827251881Speter#ifdef __cplusplus 3828251881Speter} 3829251881Speter#endif /* __cplusplus */ 3830251881Speter 3831251881Speter#endif /* SVN_REPOS_H */ 3832