svn_fs.h

Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  *    Licensed to the Apache Software Foundation (ASF) under one
00005  *    or more contributor license agreements.  See the NOTICE file
00006  *    distributed with this work for additional information
00007  *    regarding copyright ownership.  The ASF licenses this file
00008  *    to you under the Apache License, Version 2.0 (the
00009  *    "License"); you may not use this file except in compliance
00010  *    with the License.  You may obtain a copy of the License at
00011  *
00012  *      http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  *    Unless required by applicable law or agreed to in writing,
00015  *    software distributed under the License is distributed on an
00016  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00017  *    KIND, either express or implied.  See the License for the
00018  *    specific language governing permissions and limitations
00019  *    under the License.
00020  * ====================================================================
00021  * @endcopyright
00022  *
00023  * @file svn_fs.h
00024  * @brief Interface to the Subversion filesystem.
00025  */
00026 
00027 #ifndef SVN_FS_H
00028 #define SVN_FS_H
00029 
00030 #include <apr.h>
00031 #include <apr_pools.h>
00032 #include <apr_hash.h>
00033 #include <apr_tables.h>
00034 #include <apr_time.h>    /* for apr_time_t */
00035 
00036 #include "svn_types.h"
00037 #include "svn_string.h"
00038 #include "svn_delta.h"
00039 #include "svn_io.h"
00040 #include "svn_mergeinfo.h"
00041 #include "svn_checksum.h"
00042 
00043 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif /* __cplusplus */
00047 
00048 
00049 /**
00050  * Get libsvn_fs version information.
00051  *
00052  * @since New in 1.1.
00053  */
00054 const svn_version_t *
00055 svn_fs_version(void);
00056 
00057 /**
00058  * @defgroup fs_handling Filesystem interaction subsystem
00059  * @{
00060  */
00061 
00062 /* Opening and creating filesystems.  */
00063 
00064 
00065 /** An object representing a Subversion filesystem.  */
00066 typedef struct svn_fs_t svn_fs_t;
00067 
00068 
00069 /**
00070  * @name Filesystem configuration options
00071  * @{
00072  */
00073 #define SVN_FS_CONFIG_BDB_TXN_NOSYNC            "bdb-txn-nosync"
00074 #define SVN_FS_CONFIG_BDB_LOG_AUTOREMOVE        "bdb-log-autoremove"
00075 
00076 /** Enable / disable text delta caching for a FSFS repository.
00077  *
00078  * @since New in 1.7.
00079  */
00080 #define SVN_FS_CONFIG_FSFS_CACHE_DELTAS         "fsfs-cache-deltas"
00081 
00082 /** Enable / disable full-text caching for a FSFS repository.
00083  *
00084  * @since New in 1.7.
00085  */
00086 #define SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS      "fsfs-cache-fulltexts"
00087 
00088 /** Enable / disable revprop caching for a FSFS repository.
00089  *
00090  * "2" is allowed, too and means "enable if efficient",
00091  * i.e. this will not create warning at runtime if there
00092  * if no efficient support for revprop caching.
00093  *
00094  * @since New in 1.8.
00095  */
00096 #define SVN_FS_CONFIG_FSFS_CACHE_REVPROPS       "fsfs-cache-revprops"
00097 
00098 /** Select the cache namespace.  If you potentially share the cache with
00099  * another FS object for the same repository, objects read through one FS
00100  * will not need to be read again for the other.  In most cases, that is
00101  * a very desirable behavior and the default is, therefore, an empty
00102  * namespace.
00103  *
00104  * If you want to be sure that your FS instance will actually read all
00105  * requested data at least once, you need to specify a separate namespace
00106  * for it.  All repository verification code, for instance, should use
00107  * some GUID here that is different each time you open an FS instance.
00108  *
00109  * @since New in 1.8.
00110  */
00111 #define SVN_FS_CONFIG_FSFS_CACHE_NS             "fsfs-cache-namespace"
00112 
00113 /* Note to maintainers: if you add further SVN_FS_CONFIG_FSFS_CACHE_* knobs,
00114    update fs_fs.c:verify_as_revision_before_current_plus_plus(). */
00115 
00116 /* See also svn_fs_type(). */
00117 /** @since New in 1.1. */
00118 #define SVN_FS_CONFIG_FS_TYPE                   "fs-type"
00119 /** @since New in 1.1. */
00120 #define SVN_FS_TYPE_BDB                         "bdb"
00121 /** @since New in 1.1. */
00122 #define SVN_FS_TYPE_FSFS                        "fsfs"
00123 
00124 /** Create repository format compatible with Subversion versions
00125  * earlier than 1.4.
00126  *
00127  *  @since New in 1.4.
00128  */
00129 #define SVN_FS_CONFIG_PRE_1_4_COMPATIBLE        "pre-1.4-compatible"
00130 
00131 /** Create repository format compatible with Subversion versions
00132  * earlier than 1.5.
00133  *
00134  * @since New in 1.5.
00135  */
00136 #define SVN_FS_CONFIG_PRE_1_5_COMPATIBLE        "pre-1.5-compatible"
00137 
00138 /** Create repository format compatible with Subversion versions
00139  * earlier than 1.6.
00140  *
00141  * @since New in 1.6.
00142  */
00143 #define SVN_FS_CONFIG_PRE_1_6_COMPATIBLE        "pre-1.6-compatible"
00144 
00145 /** Create repository format compatible with Subversion versions
00146  * earlier than 1.8.
00147  *
00148  * @since New in 1.8.
00149  */
00150 #define SVN_FS_CONFIG_PRE_1_8_COMPATIBLE        "pre-1.8-compatible"
00151 /** @} */
00152 
00153 
00154 /**
00155  * Callers should invoke this function to initialize global state in
00156  * the FS library before creating FS objects.  If this function is
00157  * invoked, no FS objects may be created in another thread at the same
00158  * time as this invocation, and the provided @a pool must last longer
00159  * than any FS object created subsequently.
00160  *
00161  * If this function is not called, the FS library will make a best
00162  * effort to bootstrap a mutex for protecting data common to FS
00163  * objects; however, there is a small window of failure.  Also, a
00164  * small amount of data will be leaked if the Subversion FS library is
00165  * dynamically unloaded, and using the bdb FS can potentially segfault
00166  * or invoke other undefined behavior if this function is not called
00167  * with an appropriate pool (such as the pool the module was loaded into)
00168  * when loaded dynamically.
00169  *
00170  * If this function is called multiple times before the pool passed to
00171  * the first call is destroyed or cleared, the later calls will have
00172  * no effect.
00173  *
00174  * @since New in 1.2.
00175  */
00176 svn_error_t *
00177 svn_fs_initialize(apr_pool_t *pool);
00178 
00179 
00180 /** The type of a warning callback function.  @a baton is the value specified
00181  * in the call to svn_fs_set_warning_func(); the filesystem passes it through
00182  * to the callback.  @a err contains the warning message.
00183  *
00184  * The callback function should not clear the error that is passed to it;
00185  * its caller should do that.
00186  */
00187 typedef void (*svn_fs_warning_callback_t)(void *baton, svn_error_t *err);
00188 
00189 
00190 /** Provide a callback function, @a warning, that @a fs should use to
00191  * report (non-fatal) errors.  To print an error, the filesystem will call
00192  * @a warning, passing it @a warning_baton and the error.
00193  *
00194  * By default, this is set to a function that will crash the process.
00195  * Dumping to @c stderr or <tt>/dev/tty</tt> is not acceptable default
00196  * behavior for server processes, since those may both be equivalent to
00197  * <tt>/dev/null</tt>.
00198  */
00199 void
00200 svn_fs_set_warning_func(svn_fs_t *fs,
00201                         svn_fs_warning_callback_t warning,
00202                         void *warning_baton);
00203 
00204 
00205 
00206 /**
00207  * Create a new, empty Subversion filesystem, stored in the directory
00208  * @a path, and return a pointer to it in @a *fs_p.  @a path must not
00209  * currently exist, but its parent must exist.  If @a fs_config is not
00210  * @c NULL, the options it contains modify the behavior of the
00211  * filesystem.  The interpretation of @a fs_config is specific to the
00212  * filesystem back-end.  The new filesystem may be closed by
00213  * destroying @a pool.
00214  *
00215  * @note The lifetime of @a fs_config must not be shorter than @a
00216  * pool's. It's a good idea to allocate @a fs_config from @a pool or
00217  * one of its ancestors.
00218  *
00219  * If @a fs_config contains a value for #SVN_FS_CONFIG_FS_TYPE, that
00220  * value determines the filesystem type for the new filesystem.
00221  * Currently defined values are:
00222  *
00223  *   SVN_FS_TYPE_BDB   Berkeley-DB implementation
00224  *   SVN_FS_TYPE_FSFS  Native-filesystem implementation
00225  *
00226  * If @a fs_config is @c NULL or does not contain a value for
00227  * #SVN_FS_CONFIG_FS_TYPE then the default filesystem type will be used.
00228  * This will typically be BDB for version 1.1 and FSFS for later versions,
00229  * though the caller should not rely upon any particular default if they
00230  * wish to ensure that a filesystem of a specific type is created.
00231  *
00232  * @since New in 1.1.
00233  */
00234 svn_error_t *
00235 svn_fs_create(svn_fs_t **fs_p,
00236               const char *path,
00237               apr_hash_t *fs_config,
00238               apr_pool_t *pool);
00239 
00240 /**
00241  * Open a Subversion filesystem located in the directory @a path, and
00242  * return a pointer to it in @a *fs_p.  If @a fs_config is not @c
00243  * NULL, the options it contains modify the behavior of the
00244  * filesystem.  The interpretation of @a fs_config is specific to the
00245  * filesystem back-end.  The opened filesystem may be closed by
00246  * destroying @a pool.
00247  *
00248  * @note The lifetime of @a fs_config must not be shorter than @a
00249  * pool's. It's a good idea to allocate @a fs_config from @a pool or
00250  * one of its ancestors.
00251  *
00252  * Only one thread may operate on any given filesystem object at once.
00253  * Two threads may access the same filesystem simultaneously only if
00254  * they open separate filesystem objects.
00255  *
00256  * @note You probably don't want to use this directly.  Take a look at
00257  * svn_repos_open2() instead.
00258  *
00259  * @since New in 1.1.
00260  */
00261 svn_error_t *
00262 svn_fs_open(svn_fs_t **fs_p,
00263             const char *path,
00264             apr_hash_t *fs_config,
00265             apr_pool_t *pool);
00266 
00267 /**
00268  * Upgrade the Subversion filesystem located in the directory @a path
00269  * to the latest version supported by this library.  Return
00270  * #SVN_ERR_FS_UNSUPPORTED_UPGRADE and make no changes to the
00271  * filesystem if the requested upgrade is not supported.  Use @a pool
00272  * for necessary allocations.
00273  *
00274  * @note You probably don't want to use this directly.  Take a look at
00275  * svn_repos_upgrade() instead.
00276  *
00277  * @since New in 1.5.
00278  */
00279 svn_error_t *
00280 svn_fs_upgrade(const char *path,
00281                apr_pool_t *pool);
00282 
00283 /**
00284  * Callback function type for progress notification.
00285  *
00286  * @a revision is the number of the revision currently begin processed,
00287  * #SVN_INVALID_REVNUM if the current stage is not linked to any specific
00288  * revision. @a baton is the callback baton.
00289  *
00290  * @since New in 1.8.
00291  */
00292 typedef void (*svn_fs_progress_notify_func_t)(svn_revnum_t revision,
00293                                               void *baton,
00294                                               apr_pool_t *pool);
00295 
00296 /**
00297  * Return, in @a *fs_type, a string identifying the back-end type of
00298  * the Subversion filesystem located in @a path.  Allocate @a *fs_type
00299  * in @a pool.
00300  *
00301  * The string should be equal to one of the @c SVN_FS_TYPE_* defined
00302  * constants, unless the filesystem is a new back-end type added in
00303  * a later version of Subversion.
00304  *
00305  * In general, the type should make no difference in the filesystem's
00306  * semantics, but there are a few situations (such as backups) where
00307  * it might matter.
00308  *
00309  * @since New in 1.3.
00310  */
00311 svn_error_t *
00312 svn_fs_type(const char **fs_type,
00313             const char *path,
00314             apr_pool_t *pool);
00315 
00316 /**
00317  * Return the path to @a fs's repository, allocated in @a pool.
00318  * @note This is just what was passed to svn_fs_create() or
00319  * svn_fs_open() -- might be absolute, might not.
00320  *
00321  * @since New in 1.1.
00322  */
00323 const char *
00324 svn_fs_path(svn_fs_t *fs,
00325             apr_pool_t *pool);
00326 
00327 /**
00328  * Return a shallow copy of the configuration parameters used to open
00329  * @a fs, allocated in @a pool.  It may be @c NULL.  The contents of the
00330  * hash contents remains valid only for @a fs's lifetime.
00331  * 
00332  * @note This is just what was passed to svn_fs_create() or svn_fs_open().
00333  * You may not modify it.
00334  *
00335  * @since New in 1.8.
00336  */
00337 apr_hash_t *
00338 svn_fs_config(svn_fs_t *fs,
00339               apr_pool_t *pool);
00340 
00341 /**
00342  * Delete the filesystem at @a path.
00343  *
00344  * @note: Deleting a filesystem that has an open svn_fs_t is not
00345  * supported.  Clear/destroy all pools used to create/open @a path.
00346  * See issue 4264.
00347  *
00348  * @since New in 1.1.
00349  */
00350 svn_error_t *
00351 svn_fs_delete_fs(const char *path,
00352                  apr_pool_t *pool);
00353 
00354 /**
00355  * Copy a possibly live Subversion filesystem from @a src_path to
00356  * @a dest_path.  If @a clean is @c TRUE, perform cleanup on the
00357  * source filesystem as part of the copy operation; currently, this
00358  * means deleting copied, unused logfiles for a Berkeley DB source
00359  * filesystem.
00360  *
00361  * If @a incremental is TRUE, make an effort to avoid re-copying
00362  * information already present in the destination where possible.  If
00363  * incremental hotcopy is not implemented, raise
00364  * #SVN_ERR_UNSUPPORTED_FEATURE.
00365  *
00366  * Use @a scratch_pool for temporary allocations.
00367  *
00368  * @since New in 1.8.
00369  */
00370 svn_error_t *
00371 svn_fs_hotcopy2(const char *src_path,
00372                 const char *dest_path,
00373                 svn_boolean_t clean,
00374                 svn_boolean_t incremental,
00375                 svn_cancel_func_t cancel_func,
00376                 void *cancel_baton,
00377                 apr_pool_t *scratch_pool);
00378 
00379 /**
00380  * Like svn_fs_hotcopy2(), but with @a incremental always passed as @c
00381  * TRUE and without cancellation support.
00382  *
00383  * @deprecated Provided for backward compatibility with the 1.7 API.
00384  * @since New in 1.1.
00385  */
00386 SVN_DEPRECATED
00387 svn_error_t *
00388 svn_fs_hotcopy(const char *src_path,
00389                const char *dest_path,
00390                svn_boolean_t clean,
00391                apr_pool_t *pool);
00392 
00393 /** Perform any necessary non-catastrophic recovery on the Subversion
00394  * filesystem located at @a path.
00395  *
00396  * If @a cancel_func is not @c NULL, it is called periodically with
00397  * @a cancel_baton as argument to see if the client wishes to cancel
00398  * recovery.  BDB filesystems do not currently support cancellation.
00399  *
00400  * Do any necessary allocation within @a pool.
00401  *
00402  * For FSFS filesystems, recovery is currently limited to recreating
00403  * the db/current file, and does not require exclusive access.
00404  *
00405  * For BDB filesystems, recovery requires exclusive access, and is
00406  * described in detail below.
00407  *
00408  * After an unexpected server exit, due to a server crash or a system
00409  * crash, a Subversion filesystem based on Berkeley DB needs to run
00410  * recovery procedures to bring the database back into a consistent
00411  * state and release any locks that were held by the deceased process.
00412  * The recovery procedures require exclusive access to the database
00413  * --- while they execute, no other process or thread may access the
00414  * database.
00415  *
00416  * In a server with multiple worker processes, like Apache, if a
00417  * worker process accessing the filesystem dies, you must stop the
00418  * other worker processes, and run recovery.  Then, the other worker
00419  * processes can re-open the database and resume work.
00420  *
00421  * If the server exited cleanly, there is no need to run recovery, but
00422  * there is no harm in it, either, and it take very little time.  So
00423  * it's a fine idea to run recovery when the server process starts,
00424  * before it begins handling any requests.
00425  *
00426  * @since New in 1.5.
00427  */
00428 svn_error_t *
00429 svn_fs_recover(const char *path,
00430                svn_cancel_func_t cancel_func,
00431                void *cancel_baton,
00432                apr_pool_t *pool);
00433 
00434 
00435 /**
00436  * Callback for svn_fs_freeze().
00437  *
00438  * @since New in 1.8.
00439  */
00440 typedef svn_error_t *(*svn_fs_freeze_func_t)(void *baton, apr_pool_t *pool);
00441 
00442 /**
00443  * Take an exclusive lock on @a fs to prevent commits and then invoke
00444  * @a freeze_func passing @a freeze_baton.
00445  *
00446  * @note The BDB backend doesn't implement this feature so most
00447  * callers should not call this function directly but should use the
00448  * higher level svn_repos_freeze() instead.
00449  *
00450  * @see svn_repos_freeze()
00451  *
00452  * @since New in 1.8.
00453  */
00454 svn_error_t *
00455 svn_fs_freeze(svn_fs_t *fs,
00456               svn_fs_freeze_func_t freeze_func,
00457               void *freeze_baton,
00458               apr_pool_t *pool);
00459 
00460 
00461 /** Subversion filesystems based on Berkeley DB.
00462  *
00463  * The following functions are specific to Berkeley DB filesystems.
00464  *
00465  * @defgroup svn_fs_bdb Berkeley DB filesystems
00466  * @{
00467  */
00468 
00469 /** Register an error handling function for Berkeley DB error messages.
00470  *
00471  * @deprecated Provided for backward compatibility with the 1.2 API.
00472  *
00473  * Despite being first declared deprecated in Subversion 1.3, this API
00474  * is redundant in versions 1.1 and 1.2 as well.
00475  *
00476  * Berkeley DB's error codes are seldom sufficiently informative to allow
00477  * adequate troubleshooting.  Berkeley DB provides extra messages through
00478  * a callback function - if an error occurs, the @a handler will be called
00479  * with two strings: an error message prefix, which will be zero, and
00480  * an error message.  @a handler might print it out, log it somewhere,
00481  * etc.
00482  *
00483  * Subversion 1.1 and later install their own handler internally, and
00484  * wrap the messages from Berkeley DB into the standard svn_error_t object,
00485  * making any information gained through this interface redundant.
00486  *
00487  * It is only worth using this function if your program will be used
00488  * with Subversion 1.0.
00489  *
00490  * This function connects to the Berkeley DB @c DBENV->set_errcall interface.
00491  * Since that interface supports only a single callback, Subversion's internal
00492  * callback is registered with Berkeley DB, and will forward notifications to
00493  * a user provided callback after performing its own processing.
00494  */
00495 SVN_DEPRECATED
00496 svn_error_t *
00497 svn_fs_set_berkeley_errcall(svn_fs_t *fs,
00498                             void (*handler)(const char *errpfx,
00499                                             char *msg));
00500 
00501 /** Set @a *logfiles to an array of <tt>const char *</tt> log file names
00502  * of Berkeley DB-based Subversion filesystem.
00503  *
00504  * If @a only_unused is @c TRUE, set @a *logfiles to an array which
00505  * contains only the names of Berkeley DB log files no longer in use
00506  * by the filesystem.  Otherwise, all log files (used and unused) are
00507  * returned.
00508 
00509  * This function wraps the Berkeley DB 'log_archive' function
00510  * called by the db_archive binary.  Repository administrators may
00511  * want to run this function periodically and delete the unused log
00512  * files, as a way of reclaiming disk space.
00513  */
00514 svn_error_t *
00515 svn_fs_berkeley_logfiles(apr_array_header_t **logfiles,
00516                          const char *path,
00517                          svn_boolean_t only_unused,
00518                          apr_pool_t *pool);
00519 
00520 
00521 /**
00522  * The following functions are similar to their generic counterparts.
00523  *
00524  * In Subversion 1.2 and earlier, they only work on Berkeley DB filesystems.
00525  * In Subversion 1.3 and later, they perform largely as aliases for their
00526  * generic counterparts (with the exception of recover, which only gained
00527  * a generic counterpart in 1.5).
00528  *
00529  * @defgroup svn_fs_bdb_deprecated Berkeley DB filesystem compatibility
00530  * @{
00531  */
00532 
00533 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00534 SVN_DEPRECATED
00535 svn_fs_t *
00536 svn_fs_new(apr_hash_t *fs_config,
00537            apr_pool_t *pool);
00538 
00539 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00540 SVN_DEPRECATED
00541 svn_error_t *
00542 svn_fs_create_berkeley(svn_fs_t *fs,
00543                        const char *path);
00544 
00545 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00546 SVN_DEPRECATED
00547 svn_error_t *
00548 svn_fs_open_berkeley(svn_fs_t *fs,
00549                      const char *path);
00550 
00551 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00552 SVN_DEPRECATED
00553 const char *
00554 svn_fs_berkeley_path(svn_fs_t *fs,
00555                      apr_pool_t *pool);
00556 
00557 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00558 SVN_DEPRECATED
00559 svn_error_t *
00560 svn_fs_delete_berkeley(const char *path,
00561                        apr_pool_t *pool);
00562 
00563 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00564 SVN_DEPRECATED
00565 svn_error_t *
00566 svn_fs_hotcopy_berkeley(const char *src_path,
00567                         const char *dest_path,
00568                         svn_boolean_t clean_logs,
00569                         apr_pool_t *pool);
00570 
00571 /** @deprecated Provided for backward compatibility with the 1.4 API. */
00572 SVN_DEPRECATED
00573 svn_error_t *
00574 svn_fs_berkeley_recover(const char *path,
00575                         apr_pool_t *pool);
00576 /** @} */
00577 
00578 /** @} */
00579 
00580 
00581 /** Filesystem Access Contexts.
00582  *
00583  * @since New in 1.2.
00584  *
00585  * At certain times, filesystem functions need access to temporary
00586  * user data.  For example, which user is changing a file?  If the
00587  * file is locked, has an appropriate lock-token been supplied?
00588  *
00589  * This temporary user data is stored in an "access context" object,
00590  * and the access context is then connected to the filesystem object.
00591  * Whenever a filesystem function requires information, it can pull
00592  * things out of the context as needed.
00593  *
00594  * @defgroup svn_fs_access_ctx Filesystem access contexts
00595  * @{
00596  */
00597 
00598 /** An opaque object representing temporary user data. */
00599 typedef struct svn_fs_access_t svn_fs_access_t;
00600 
00601 
00602 /** Set @a *access_ctx to a new #svn_fs_access_t object representing
00603  *  @a username, allocated in @a pool.  @a username is presumed to
00604  *  have been authenticated by the caller.
00605  *
00606  *  Make a deep copy of @a username.
00607  */
00608 svn_error_t *
00609 svn_fs_create_access(svn_fs_access_t **access_ctx,
00610                      const char *username,
00611                      apr_pool_t *pool);
00612 
00613 
00614 /** Associate @a access_ctx with an open @a fs.
00615  *
00616  * This function can be run multiple times on the same open
00617  * filesystem, in order to change the filesystem access context for
00618  * different filesystem operations.  Pass a NULL value for @a
00619  * access_ctx to disassociate the current access context from the
00620  * filesystem.
00621  */
00622 svn_error_t *
00623 svn_fs_set_access(svn_fs_t *fs,
00624                   svn_fs_access_t *access_ctx);
00625 
00626 
00627 /** Set @a *access_ctx to the current @a fs access context, or NULL if
00628  * there is no current fs access context.
00629  */
00630 svn_error_t *
00631 svn_fs_get_access(svn_fs_access_t **access_ctx,
00632                   svn_fs_t *fs);
00633 
00634 
00635 /** Accessors for the access context: */
00636 
00637 /** Set @a *username to the name represented by @a access_ctx. */
00638 svn_error_t *
00639 svn_fs_access_get_username(const char **username,
00640                            svn_fs_access_t *access_ctx);
00641 
00642 
00643 /** Push a lock-token @a token associated with path @a path into the
00644  * context @a access_ctx.  The context remembers all tokens it
00645  * receives, and makes them available to fs functions.  The token and
00646  * path are not duplicated into @a access_ctx's pool; make sure the
00647  * token's lifetime is at least as long as @a access_ctx.
00648  *
00649  * @since New in 1.6. */
00650 svn_error_t *
00651 svn_fs_access_add_lock_token2(svn_fs_access_t *access_ctx,
00652                               const char *path,
00653                               const char *token);
00654 
00655 /**
00656  * Same as svn_fs_access_add_lock_token2(), but with @a path set to value 1.
00657  *
00658  * @deprecated Provided for backward compatibility with the 1.5 API.
00659  */
00660 SVN_DEPRECATED
00661 svn_error_t *
00662 svn_fs_access_add_lock_token(svn_fs_access_t *access_ctx,
00663                              const char *token);
00664 
00665 /** @} */
00666 
00667 
00668 /** Filesystem Nodes and Node-Revisions.
00669  *
00670  * In a Subversion filesystem, a `node' corresponds roughly to an
00671  * `inode' in a Unix filesystem:
00672  * - A node is either a file or a directory.
00673  * - A node's contents change over time.
00674  * - When you change a node's contents, it's still the same node; it's
00675  *   just been changed.  So a node's identity isn't bound to a specific
00676  *   set of contents.
00677  * - If you rename a node, it's still the same node, just under a
00678  *   different name.  So a node's identity isn't bound to a particular
00679  *   filename.
00680  *
00681  * A `node revision' refers to one particular version of a node's contents,
00682  * that existed over a specific period of time (one or more repository
00683  * revisions).  Changing a node's contents always creates a new revision of
00684  * that node, which is to say creates a new `node revision'.  Once created,
00685  * a node revision's contents never change.
00686  *
00687  * When we create a node, its initial contents are the initial revision of
00688  * the node.  As users make changes to the node over time, we create new
00689  * revisions of that same node.  When a user commits a change that deletes
00690  * a file from the filesystem, we don't delete the node, or any revision
00691  * of it --- those stick around to allow us to recreate prior revisions of
00692  * the filesystem.  Instead, we just remove the reference to the node
00693  * from the directory.
00694  *
00695  * Each node revision is a part of exactly one node, and appears only once
00696  * in the history of that node.  It is uniquely identified by a node
00697  * revision id, #svn_fs_id_t.  Its node revision id also identifies which
00698  * node it is a part of.
00699  *
00700  * @note: Often when we talk about `the node' within the context of a single
00701  * revision (or transaction), we implicitly mean `the node as it appears in
00702  * this revision (or transaction)', or in other words `the node revision'.
00703  *
00704  * @note: Commonly, a node revision will have the same content as some other
00705  * node revisions in the same node and in different nodes.  The FS libraries
00706  * allow different node revisions to share the same data without storing a
00707  * separate copy of the data.
00708  *
00709  * @defgroup svn_fs_nodes Filesystem nodes
00710  * @{
00711  */
00712 
00713 /** An object representing a node-revision id.  */
00714 typedef struct svn_fs_id_t svn_fs_id_t;
00715 
00716 
00717 /** Return -1, 0, or 1 if node revisions @a a and @a b are respectively
00718  * unrelated, equivalent, or otherwise related (part of the same node).
00719  */
00720 int
00721 svn_fs_compare_ids(const svn_fs_id_t *a,
00722                    const svn_fs_id_t *b);
00723 
00724 
00725 
00726 /** Return TRUE if node revisions @a id1 and @a id2 are related (part of the
00727  * same node), else return FALSE.
00728  */
00729 svn_boolean_t
00730 svn_fs_check_related(const svn_fs_id_t *id1,
00731                      const svn_fs_id_t *id2);
00732 
00733 
00734 /**
00735  * @note This function is not guaranteed to work with all filesystem
00736  * types.  There is currently no un-deprecated equivalent; contact the
00737  * Subversion developers if you have a need for it.
00738  *
00739  * @deprecated Provided for backward compatibility with the 1.0 API.
00740  */
00741 SVN_DEPRECATED
00742 svn_fs_id_t *
00743 svn_fs_parse_id(const char *data,
00744                 apr_size_t len,
00745                 apr_pool_t *pool);
00746 
00747 
00748 /** Return a Subversion string containing the unparsed form of the
00749  * node revision id @a id.  Allocate the string containing the
00750  * unparsed form in @a pool.
00751  */
00752 svn_string_t *
00753 svn_fs_unparse_id(const svn_fs_id_t *id,
00754                   apr_pool_t *pool);
00755 
00756 /** @} */
00757 
00758 
00759 /** Filesystem Transactions.
00760  *
00761  * To make a change to a Subversion filesystem:
00762  * - Create a transaction object, using svn_fs_begin_txn().
00763  * - Call svn_fs_txn_root(), to get the transaction's root directory.
00764  * - Make whatever changes you like in that tree.
00765  * - Commit the transaction, using svn_fs_commit_txn().
00766  *
00767  * The filesystem implementation guarantees that your commit will
00768  * either:
00769  * - succeed completely, so that all of the changes are committed to
00770  *   create a new revision of the filesystem, or
00771  * - fail completely, leaving the filesystem unchanged.
00772  *
00773  * Until you commit the transaction, any changes you make are
00774  * invisible.  Only when your commit succeeds do they become visible
00775  * to the outside world, as a new revision of the filesystem.
00776  *
00777  * If you begin a transaction, and then decide you don't want to make
00778  * the change after all (say, because your net connection with the
00779  * client disappeared before the change was complete), you can call
00780  * svn_fs_abort_txn(), to cancel the entire transaction; this
00781  * leaves the filesystem unchanged.
00782  *
00783  * The only way to change the contents of files or directories, or
00784  * their properties, is by making a transaction and creating a new
00785  * revision, as described above.  Once a revision has been committed, it
00786  * never changes again; the filesystem interface provides no means to
00787  * go back and edit the contents of an old revision.  Once history has
00788  * been recorded, it is set in stone.  Clients depend on this property
00789  * to do updates and commits reliably; proxies depend on this property
00790  * to cache changes accurately; and so on.
00791  *
00792  * There are two kinds of nodes in the filesystem: mutable, and
00793  * immutable.  Revisions in the filesystem consist entirely of
00794  * immutable nodes, whose contents never change.  A transaction in
00795  * progress, which the user is still constructing, uses mutable nodes
00796  * for those nodes which have been changed so far, and refers to
00797  * immutable nodes from existing revisions for portions of the tree
00798  * which haven't been changed yet in that transaction.
00799  *
00800  * Immutable nodes, as part of revisions, never refer to mutable
00801  * nodes, which are part of uncommitted transactions.  Mutable nodes
00802  * may refer to immutable nodes, or other mutable nodes.
00803  *
00804  * Note that the terms "immutable" and "mutable" describe whether or
00805  * not the nodes have been changed as part of a transaction --- not
00806  * the permissions on the nodes they refer to.  Even if you aren't
00807  * authorized to modify the filesystem's root directory, you might be
00808  * authorized to change some descendant of the root; doing so would
00809  * create a new mutable copy of the root directory.  Mutability refers
00810  * to the role of the node: part of an existing revision, or part of a
00811  * new one.  This is independent of your authorization to make changes
00812  * to a given node.
00813  *
00814  * Transactions are actually persistent objects, stored in the
00815  * database.  You can open a filesystem, begin a transaction, and
00816  * close the filesystem, and then a separate process could open the
00817  * filesystem, pick up the same transaction, and continue work on it.
00818  * When a transaction is successfully committed, it is removed from
00819  * the database.
00820  *
00821  * Every transaction is assigned a name.  You can open a transaction
00822  * by name, and resume work on it, or find out the name of a
00823  * transaction you already have open.  You can also list all the
00824  * transactions currently present in the database.
00825  *
00826  * You may assign properties to transactions; these are name/value
00827  * pairs.  When you commit a transaction, all of its properties become
00828  * unversioned revision properties of the new revision.  (There is one
00829  * exception: the svn:date property will be automatically set on new
00830  * transactions to the date that the transaction was created, and will
00831  * be overwritten when the transaction is committed by the current
00832  * time; changes to a transaction's svn:date property will not affect
00833  * its committed value.)
00834  *
00835  * Transaction names are guaranteed to contain only letters (upper-
00836  * and lower-case), digits, `-', and `.', from the ASCII character
00837  * set.
00838  *
00839  * The Subversion filesystem will make a best effort to not reuse
00840  * transaction names.  The Berkeley DB backend generates transaction
00841  * names using a sequence, or a counter, which is stored in the BDB
00842  * database.  Each new transaction increments the counter.  The
00843  * current value of the counter is not serialized into a filesystem
00844  * dump file, so dumping and restoring the repository will reset the
00845  * sequence and reuse transaction names.  The FSFS backend generates a
00846  * transaction name using the hostname, process ID and current time in
00847  * microseconds since 00:00:00 January 1, 1970 UTC.  So it is
00848  * extremely unlikely that a transaction name will be reused.
00849  *
00850  * @defgroup svn_fs_txns Filesystem transactions
00851  * @{
00852  */
00853 
00854 /** The type of a Subversion transaction object.  */
00855 typedef struct svn_fs_txn_t svn_fs_txn_t;
00856 
00857 
00858 /** @defgroup svn_fs_begin_txn2_flags Bitmask flags for svn_fs_begin_txn2()
00859  * @since New in 1.2.
00860  * @{ */
00861 
00862 /** Do on-the-fly out-of-dateness checks.  That is, an fs routine may
00863  * throw error if a caller tries to edit an out-of-date item in the
00864  * transaction.
00865  *
00866  * @warning ### Not yet implemented.
00867  */
00868 #define SVN_FS_TXN_CHECK_OOD                     0x00001
00869 
00870 /** Do on-the-fly lock checks.  That is, an fs routine may throw error
00871  * if a caller tries to edit a locked item without having rights to the lock.
00872  */
00873 #define SVN_FS_TXN_CHECK_LOCKS                   0x00002
00874 
00875 /** @} */
00876 
00877 /**
00878  * Begin a new transaction on the filesystem @a fs, based on existing
00879  * revision @a rev.  Set @a *txn_p to a pointer to the new transaction.
00880  * When committed, this transaction will create a new revision.
00881  *
00882  * Allocate the new transaction in @a pool; when @a pool is freed, the new
00883  * transaction will be closed (neither committed nor aborted).
00884  *
00885  * @a flags determines transaction enforcement behaviors, and is composed
00886  * from the constants SVN_FS_TXN_* (#SVN_FS_TXN_CHECK_OOD etc.).
00887  *
00888  * @note If you're building a txn for committing, you probably
00889  * don't want to call this directly.  Instead, call
00890  * svn_repos_fs_begin_txn_for_commit(), which honors the
00891  * repository's hook configurations.
00892  *
00893  * @since New in 1.2.
00894  */
00895 svn_error_t *
00896 svn_fs_begin_txn2(svn_fs_txn_t **txn_p,
00897                   svn_fs_t *fs,
00898                   svn_revnum_t rev,
00899                   apr_uint32_t flags,
00900                   apr_pool_t *pool);
00901 
00902 
00903 /**
00904  * Same as svn_fs_begin_txn2(), but with @a flags set to 0.
00905  *
00906  * @deprecated Provided for backward compatibility with the 1.1 API.
00907  */
00908 SVN_DEPRECATED
00909 svn_error_t *
00910 svn_fs_begin_txn(svn_fs_txn_t **txn_p,
00911                  svn_fs_t *fs,
00912                  svn_revnum_t rev,
00913                  apr_pool_t *pool);
00914 
00915 
00916 
00917 /** Commit @a txn.
00918  *
00919  * @note You usually don't want to call this directly.
00920  * Instead, call svn_repos_fs_commit_txn(), which honors the
00921  * repository's hook configurations.
00922  *
00923  * If the transaction conflicts with other changes committed to the
00924  * repository, return an #SVN_ERR_FS_CONFLICT error.  Otherwise, create
00925  * a new filesystem revision containing the changes made in @a txn,
00926  * storing that new revision number in @a *new_rev, and return zero.
00927  *
00928  * If @a conflict_p is non-zero, use it to provide details on any
00929  * conflicts encountered merging @a txn with the most recent committed
00930  * revisions.  If a conflict occurs, set @a *conflict_p to the path of
00931  * the conflict in @a txn, allocated within @a pool;
00932  * otherwise, set @a *conflict_p to NULL.
00933  *
00934  * If the commit succeeds, @a txn is invalid.
00935  *
00936  * If the commit fails for any reason, @a *new_rev is an invalid
00937  * revision number, an error other than #SVN_NO_ERROR is returned and
00938  * @a txn is still valid; you can make more operations to resolve the
00939  * conflict, or call svn_fs_abort_txn() to abort the transaction.
00940  *
00941  * @note Success or failure of the commit of @a txn is determined by
00942  * examining the value of @a *new_rev upon this function's return.  If
00943  * the value is a valid revision number, the commit was successful,
00944  * even though a non-@c NULL function return value may indicate that
00945  * something else went wrong in post commit FS processing.
00946  *
00947  * @note See api-errata/1.8/fs001.txt for information on how this
00948  * function was documented in versions prior to 1.8.
00949  *
00950  * ### need to document this better. there are four combinations of
00951  * ### return values:
00952  * ### 1) err=NULL. conflict=NULL. new_rev is valid
00953  * ### 2) err=SVN_ERR_FS_CONFLICT. conflict is set. new_rev=SVN_INVALID_REVNUM
00954  * ### 3) err=!NULL. conflict=NULL. new_rev is valid
00955  * ### 4) err=!NULL. conflict=NULL. new_rev=SVN_INVALID_REVNUM
00956  * ###
00957  * ### some invariants:
00958  * ###   *conflict_p will be non-NULL IFF SVN_ERR_FS_CONFLICT
00959  * ###   if *conflict_p is set (and SVN_ERR_FS_CONFLICT), then new_rev
00960  * ###     will always be SVN_INVALID_REVNUM
00961  * ###   *conflict_p will always be initialized to NULL, or to a valid
00962  * ###     conflict string
00963  * ###   *new_rev will always be initialized to SVN_INVALID_REVNUM, or
00964  * ###     to a valid, committed revision number
00965  */
00966 svn_error_t *
00967 svn_fs_commit_txn(const char **conflict_p,
00968                   svn_revnum_t *new_rev,
00969                   svn_fs_txn_t *txn,
00970                   apr_pool_t *pool);
00971 
00972 
00973 /** Abort the transaction @a txn.  Any changes made in @a txn are
00974  * discarded, and the filesystem is left unchanged.  Use @a pool for
00975  * any necessary allocations.
00976  *
00977  * @note This function first sets the state of @a txn to "dead", and
00978  * then attempts to purge it and any related data from the filesystem.
00979  * If some part of the cleanup process fails, @a txn and some portion
00980  * of its data may remain in the database after this function returns.
00981  * Use svn_fs_purge_txn() to retry the transaction cleanup.
00982  */
00983 svn_error_t *
00984 svn_fs_abort_txn(svn_fs_txn_t *txn,
00985                  apr_pool_t *pool);
00986 
00987 
00988 /** Cleanup the dead transaction in @a fs whose ID is @a txn_id.  Use
00989  * @a pool for all allocations.  If the transaction is not yet dead,
00990  * the error #SVN_ERR_FS_TRANSACTION_NOT_DEAD is returned.  (The
00991  * caller probably forgot to abort the transaction, or the cleanup
00992  * step of that abort failed for some reason.)
00993  */
00994 svn_error_t *
00995 svn_fs_purge_txn(svn_fs_t *fs,
00996                  const char *txn_id,
00997                  apr_pool_t *pool);
00998 
00999 
01000 /** Set @a *name_p to the name of the transaction @a txn, as a
01001  * NULL-terminated string.  Allocate the name in @a pool.
01002  */
01003 svn_error_t *
01004 svn_fs_txn_name(const char **name_p,
01005                 svn_fs_txn_t *txn,
01006                 apr_pool_t *pool);
01007 
01008 /** Return @a txn's base revision. */
01009 svn_revnum_t
01010 svn_fs_txn_base_revision(svn_fs_txn_t *txn);
01011 
01012 
01013 
01014 /** Open the transaction named @a name in the filesystem @a fs.  Set @a *txn
01015  * to the transaction.
01016  *
01017  * If there is no such transaction, #SVN_ERR_FS_NO_SUCH_TRANSACTION is
01018  * the error returned.
01019  *
01020  * Allocate the new transaction in @a pool; when @a pool is freed, the new
01021  * transaction will be closed (neither committed nor aborted).
01022  */
01023 svn_error_t *
01024 svn_fs_open_txn(svn_fs_txn_t **txn,
01025                 svn_fs_t *fs,
01026                 const char *name,
01027                 apr_pool_t *pool);
01028 
01029 
01030 /** Set @a *names_p to an array of <tt>const char *</tt> ids which are the
01031  * names of all the currently active transactions in the filesystem @a fs.
01032  * Allocate the array in @a pool.
01033  */
01034 svn_error_t *
01035 svn_fs_list_transactions(apr_array_header_t **names_p,
01036                          svn_fs_t *fs,
01037                          apr_pool_t *pool);
01038 
01039 /* Transaction properties */
01040 
01041 /** Set @a *value_p to the value of the property named @a propname on
01042  * transaction @a txn.  If @a txn has no property by that name, set
01043  * @a *value_p to zero.  Allocate the result in @a pool.
01044  */
01045 svn_error_t *
01046 svn_fs_txn_prop(svn_string_t **value_p,
01047                 svn_fs_txn_t *txn,
01048                 const char *propname,
01049                 apr_pool_t *pool);
01050 
01051 
01052 /** Set @a *table_p to the entire property list of transaction @a txn, as
01053  * an APR hash table allocated in @a pool.  The resulting table maps property
01054  * names to pointers to #svn_string_t objects containing the property value.
01055  */
01056 svn_error_t *
01057 svn_fs_txn_proplist(apr_hash_t **table_p,
01058                     svn_fs_txn_t *txn,
01059                     apr_pool_t *pool);
01060 
01061 
01062 /** Change a transactions @a txn's property's value, or add/delete a
01063  * property.  @a name is the name of the property to change, and @a value
01064  * is the new value of the property, or zero if the property should be
01065  * removed altogether.  Do any necessary temporary allocation in @a pool.
01066  */
01067 svn_error_t *
01068 svn_fs_change_txn_prop(svn_fs_txn_t *txn,
01069                        const char *name,
01070                        const svn_string_t *value,
01071                        apr_pool_t *pool);
01072 
01073 
01074 /** Change, add, and/or delete transaction property values in
01075  * transaction @a txn.  @a props is an array of <tt>svn_prop_t</tt>
01076  * elements.  This is equivalent to calling svn_fs_change_txn_prop()
01077  * multiple times with the @c name and @c value fields of each
01078  * successive <tt>svn_prop_t</tt>, but may be more efficient.
01079  * (Properties not mentioned are left alone.)  Do any necessary
01080  * temporary allocation in @a pool.
01081  *
01082  * @since New in 1.5.
01083  */
01084 svn_error_t *
01085 svn_fs_change_txn_props(svn_fs_txn_t *txn,
01086                         const apr_array_header_t *props,
01087                         apr_pool_t *pool);
01088 
01089 /** @} */
01090 
01091 
01092 /** Roots.
01093  *
01094  * An #svn_fs_root_t object represents the root directory of some
01095  * revision or transaction in a filesystem.  To refer to particular
01096  * node or node revision, you provide a root, and a directory path
01097  * relative to that root.
01098  *
01099  * @defgroup svn_fs_roots Filesystem roots
01100  * @{
01101  */
01102 
01103 /** The Filesystem Root object. */
01104 typedef struct svn_fs_root_t svn_fs_root_t;
01105 
01106 
01107 /** Set @a *root_p to the root directory of revision @a rev in filesystem @a fs.
01108  * Allocate @a *root_p in a private subpool of @a pool; the root can be
01109  * destroyed earlier than @a pool by calling #svn_fs_close_root.
01110  */
01111 svn_error_t *
01112 svn_fs_revision_root(svn_fs_root_t **root_p,
01113                      svn_fs_t *fs,
01114                      svn_revnum_t rev,
01115                      apr_pool_t *pool);
01116 
01117 
01118 /** Set @a *root_p to the root directory of @a txn.  Allocate @a *root_p in a
01119  * private subpool of @a pool; the root can be destroyed earlier than @a pool by
01120  * calling #svn_fs_close_root.
01121  */
01122 svn_error_t *
01123 svn_fs_txn_root(svn_fs_root_t **root_p,
01124                 svn_fs_txn_t *txn,
01125                 apr_pool_t *pool);
01126 
01127 
01128 /** Free the root directory @a root; this only needs to be used if you want to
01129  * free the memory associated with @a root earlier than the time you destroy
01130  * the pool passed to the function that created it (svn_fs_revision_root() or
01131  * svn_fs_txn_root()).
01132  */
01133 void
01134 svn_fs_close_root(svn_fs_root_t *root);
01135 
01136 
01137 /** Return the filesystem to which @a root belongs.  */
01138 svn_fs_t *
01139 svn_fs_root_fs(svn_fs_root_t *root);
01140 
01141 
01142 /** Return @c TRUE iff @a root is a transaction root.  */
01143 svn_boolean_t
01144 svn_fs_is_txn_root(svn_fs_root_t *root);
01145 
01146 /** Return @c TRUE iff @a root is a revision root.  */
01147 svn_boolean_t
01148 svn_fs_is_revision_root(svn_fs_root_t *root);
01149 
01150 
01151 /** If @a root is the root of a transaction, return the name of the
01152  * transaction, allocated in @a pool; otherwise, return NULL.
01153  */
01154 const char *
01155 svn_fs_txn_root_name(svn_fs_root_t *root,
01156                      apr_pool_t *pool);
01157 
01158 /** If @a root is the root of a transaction, return the number of the
01159  * revision on which is was based when created.  Otherwise, return
01160  * #SVN_INVALID_REVNUM.
01161  *
01162  * @since New in 1.5.
01163  */
01164 svn_revnum_t
01165 svn_fs_txn_root_base_revision(svn_fs_root_t *root);
01166 
01167 /** If @a root is the root of a revision, return the revision number.
01168  * Otherwise, return #SVN_INVALID_REVNUM.
01169  */
01170 svn_revnum_t
01171 svn_fs_revision_root_revision(svn_fs_root_t *root);
01172 
01173 /** @} */
01174 
01175 
01176 /** Directory entry names and directory paths.
01177  *
01178  * Here are the rules for directory entry names, and directory paths:
01179  *
01180  * A directory entry name is a Unicode string encoded in UTF-8, and
01181  * may not contain the NULL character (U+0000).  The name should be in
01182  * Unicode canonical decomposition and ordering.  No directory entry
01183  * may be named '.', '..', or the empty string.  Given a directory
01184  * entry name which fails to meet these requirements, a filesystem
01185  * function returns an SVN_ERR_FS_PATH_SYNTAX error.
01186  *
01187  * A directory path is a sequence of zero or more directory entry
01188  * names, separated by slash characters (U+002f), and possibly ending
01189  * with slash characters.  Sequences of two or more consecutive slash
01190  * characters are treated as if they were a single slash.  If a path
01191  * ends with a slash, it refers to the same node it would without the
01192  * slash, but that node must be a directory, or else the function
01193  * returns an SVN_ERR_FS_NOT_DIRECTORY error.
01194  *
01195  * A path consisting of the empty string, or a string containing only
01196  * slashes, refers to the root directory.
01197  *
01198  * @defgroup svn_fs_directories Filesystem directories
01199  * @{
01200  */
01201 
01202 
01203 
01204 /** The kind of change that occurred on the path. */
01205 typedef enum svn_fs_path_change_kind_t
01206 {
01207   /** path modified in txn */
01208   svn_fs_path_change_modify = 0,
01209 
01210   /** path added in txn */
01211   svn_fs_path_change_add,
01212 
01213   /** path removed in txn */
01214   svn_fs_path_change_delete,
01215 
01216   /** path removed and re-added in txn */
01217   svn_fs_path_change_replace,
01218 
01219   /** ignore all previous change items for path (internal-use only) */
01220   svn_fs_path_change_reset
01221 
01222 } svn_fs_path_change_kind_t;
01223 
01224 /** Change descriptor.
01225  *
01226  * @note Fields may be added to the end of this structure in future
01227  * versions.  Therefore, to preserve binary compatibility, users
01228  * should not directly allocate structures of this type.
01229  *
01230  * @since New in 1.6. */
01231 typedef struct svn_fs_path_change2_t
01232 {
01233   /** node revision id of changed path */
01234   const svn_fs_id_t *node_rev_id;
01235 
01236   /** kind of change */
01237   svn_fs_path_change_kind_t change_kind;
01238 
01239   /** were there text mods? */
01240   svn_boolean_t text_mod;
01241 
01242   /** were there property mods? */
01243   svn_boolean_t prop_mod;
01244 
01245   /** what node kind is the path?
01246       (Note: it is legal for this to be #svn_node_unknown.) */
01247   svn_node_kind_t node_kind;
01248 
01249   /** Copyfrom revision and path; this is only valid if copyfrom_known
01250    * is true. */
01251   svn_boolean_t copyfrom_known;
01252   svn_revnum_t copyfrom_rev;
01253   const char *copyfrom_path;
01254 
01255   /* NOTE! Please update svn_fs_path_change2_create() when adding new
01256      fields here. */
01257 } svn_fs_path_change2_t;
01258 
01259 
01260 /** Similar to #svn_fs_path_change2_t, but without kind and copyfrom
01261  * information.
01262  *
01263  * @deprecated Provided for backwards compatibility with the 1.5 API.
01264  */
01265 
01266 typedef struct svn_fs_path_change_t
01267 {
01268   /** node revision id of changed path */
01269   const svn_fs_id_t *node_rev_id;
01270 
01271   /** kind of change */
01272   svn_fs_path_change_kind_t change_kind;
01273 
01274   /** were there text mods? */
01275   svn_boolean_t text_mod;
01276 
01277   /** were there property mods? */
01278   svn_boolean_t prop_mod;
01279 
01280 } svn_fs_path_change_t;
01281 
01282 /**
01283  * Allocate an #svn_fs_path_change2_t structure in @a pool, initialize and
01284  * return it.
01285  *
01286  * Set the @c node_rev_id field of the created struct to @a node_rev_id, and
01287  * @c change_kind to @a change_kind.  Set all other fields to their
01288  * @c _unknown, @c NULL or invalid value, respectively.
01289  *
01290  * @since New in 1.6.
01291  */
01292 svn_fs_path_change2_t *
01293 svn_fs_path_change2_create(const svn_fs_id_t *node_rev_id,
01294                            svn_fs_path_change_kind_t change_kind,
01295                            apr_pool_t *pool);
01296 
01297 /** Determine what has changed under a @a root.
01298  *
01299  * Allocate and return a hash @a *changed_paths2_p containing descriptions
01300  * of the paths changed under @a root.  The hash is keyed with
01301  * <tt>const char *</tt> paths, and has #svn_fs_path_change2_t * values.
01302  *
01303  * Callers can assume that this function takes time proportional to
01304  * the amount of data output, and does not need to do tree crawls;
01305  * however, it is possible that some of the @c node_kind fields in the
01306  * #svn_fs_path_change2_t * values will be #svn_node_unknown or
01307  * that and some of the @c copyfrom_known fields will be FALSE.
01308  *
01309  * Use @a pool for all allocations, including the hash and its values.
01310  *
01311  * @since New in 1.6.
01312  */
01313 svn_error_t *
01314 svn_fs_paths_changed2(apr_hash_t **changed_paths2_p,
01315                       svn_fs_root_t *root,
01316                       apr_pool_t *pool);
01317 
01318 
01319 /** Same as svn_fs_paths_changed2(), only with #svn_fs_path_change_t * values
01320  * in the hash (and thus no kind or copyfrom data).
01321  *
01322  * @deprecated Provided for backward compatibility with the 1.5 API.
01323  */
01324 SVN_DEPRECATED
01325 svn_error_t *
01326 svn_fs_paths_changed(apr_hash_t **changed_paths_p,
01327                      svn_fs_root_t *root,
01328                      apr_pool_t *pool);
01329 
01330 /** @} */
01331 
01332 
01333 /* Operations appropriate to all kinds of nodes.  */
01334 
01335 /** Set @a *kind_p to the type of node present at @a path under @a
01336  * root.  If @a path does not exist under @a root, set @a *kind_p to
01337  * #svn_node_none.  Use @a pool for temporary allocation.
01338  */
01339 svn_error_t *
01340 svn_fs_check_path(svn_node_kind_t *kind_p,
01341                   svn_fs_root_t *root,
01342                   const char *path,
01343                   apr_pool_t *pool);
01344 
01345 
01346 /** An opaque node history object. */
01347 typedef struct svn_fs_history_t svn_fs_history_t;
01348 
01349 
01350 /** Set @a *history_p to an opaque node history object which
01351  * represents @a path under @a root.  @a root must be a revision root.
01352  * Use @a pool for all allocations.
01353  */
01354 svn_error_t *
01355 svn_fs_node_history(svn_fs_history_t **history_p,
01356                     svn_fs_root_t *root,
01357                     const char *path,
01358                     apr_pool_t *pool);
01359 
01360 
01361 /** Set @a *prev_history_p to an opaque node history object which
01362  * represents the previous (or "next oldest") interesting history
01363  * location for the filesystem node represented by @a history, or @c
01364  * NULL if no such previous history exists.  If @a cross_copies is @c
01365  * FALSE, also return @c NULL if stepping backwards in history to @a
01366  * *prev_history_p would cross a filesystem copy operation.
01367  *
01368  * @note If this is the first call to svn_fs_history_prev() for the @a
01369  * history object, it could return a history object whose location is
01370  * the same as the original.  This will happen if the original
01371  * location was an interesting one (where the node was modified, or
01372  * took place in a copy event).  This behavior allows looping callers
01373  * to avoid the calling svn_fs_history_location() on the object
01374  * returned by svn_fs_node_history(), and instead go ahead and begin
01375  * calling svn_fs_history_prev().
01376  *
01377  * @note This function uses node-id ancestry alone to determine
01378  * modifiedness, and therefore does NOT claim that in any of the
01379  * returned revisions file contents changed, properties changed,
01380  * directory entries lists changed, etc.
01381  *
01382  * @note The revisions returned for @a path will be older than or
01383  * the same age as the revision of that path in @a root.  That is, if
01384  * @a root is a revision root based on revision X, and @a path was
01385  * modified in some revision(s) younger than X, those revisions
01386  * younger than X will not be included for @a path.  */
01387 svn_error_t *
01388 svn_fs_history_prev(svn_fs_history_t **prev_history_p,
01389                     svn_fs_history_t *history,
01390                     svn_boolean_t cross_copies,
01391                     apr_pool_t *pool);
01392 
01393 
01394 /** Set @a *path and @a *revision to the path and revision,
01395  * respectively, of the @a history object.  Use @a pool for all
01396  * allocations.
01397  */
01398 svn_error_t *
01399 svn_fs_history_location(const char **path,
01400                         svn_revnum_t *revision,
01401                         svn_fs_history_t *history,
01402                         apr_pool_t *pool);
01403 
01404 
01405 /** Set @a *is_dir to @c TRUE iff @a path in @a root is a directory.
01406  * Do any necessary temporary allocation in @a pool.
01407  */
01408 svn_error_t *
01409 svn_fs_is_dir(svn_boolean_t *is_dir,
01410               svn_fs_root_t *root,
01411               const char *path,
01412               apr_pool_t *pool);
01413 
01414 
01415 /** Set @a *is_file to @c TRUE iff @a path in @a root is a file.
01416  * Do any necessary temporary allocation in @a pool.
01417  */
01418 svn_error_t *
01419 svn_fs_is_file(svn_boolean_t *is_file,
01420                svn_fs_root_t *root,
01421                const char *path,
01422                apr_pool_t *pool);
01423 
01424 
01425 /** Get the id of a node.
01426  *
01427  * Set @a *id_p to the node revision ID of @a path in @a root, allocated in
01428  * @a pool.
01429  *
01430  * If @a root is the root of a transaction, keep in mind that other
01431  * changes to the transaction can change which node @a path refers to,
01432  * and even whether the path exists at all.
01433  */
01434 svn_error_t *
01435 svn_fs_node_id(const svn_fs_id_t **id_p,
01436                svn_fs_root_t *root,
01437                const char *path,
01438                apr_pool_t *pool);
01439 
01440 /** Set @a *revision to the revision in which @a path under @a root was
01441  * created.  Use @a pool for any temporary allocations.  @a *revision will
01442  * be set to #SVN_INVALID_REVNUM for uncommitted nodes (i.e. modified nodes
01443  * under a transaction root).  Note that the root of an unmodified transaction
01444  * is not itself considered to be modified; in that case, return the revision
01445  * upon which the transaction was based.
01446  */
01447 svn_error_t *
01448 svn_fs_node_created_rev(svn_revnum_t *revision,
01449                         svn_fs_root_t *root,
01450                         const char *path,
01451                         apr_pool_t *pool);
01452 
01453 /** Set @a *revision to the revision in which the line of history
01454  * represented by @a path under @a root originated.  Use @a pool for
01455  * any temporary allocations.  If @a root is a transaction root, @a
01456  * *revision will be set to #SVN_INVALID_REVNUM for any nodes newly
01457  * added in that transaction (brand new files or directories created
01458  * using #svn_fs_make_dir or #svn_fs_make_file).
01459  *
01460  * @since New in 1.5.
01461  */
01462 svn_error_t *
01463 svn_fs_node_origin_rev(svn_revnum_t *revision,
01464                        svn_fs_root_t *root,
01465                        const char *path,
01466                        apr_pool_t *pool);
01467 
01468 /** Set @a *created_path to the path at which @a path under @a root was
01469  * created.  Use @a pool for all allocations.  Callers may use this
01470  * function in conjunction with svn_fs_node_created_rev() to perform a
01471  * reverse lookup of the mapping of (path, revision) -> node-id that
01472  * svn_fs_node_id() performs.
01473  */
01474 svn_error_t *
01475 svn_fs_node_created_path(const char **created_path,
01476                          svn_fs_root_t *root,
01477                          const char *path,
01478                          apr_pool_t *pool);
01479 
01480 
01481 /** Set @a *value_p to the value of the property named @a propname of
01482  * @a path in @a root.  If the node has no property by that name, set
01483  * @a *value_p to zero.  Allocate the result in @a pool.
01484  */
01485 svn_error_t *
01486 svn_fs_node_prop(svn_string_t **value_p,
01487                  svn_fs_root_t *root,
01488                  const char *path,
01489                  const char *propname,
01490                  apr_pool_t *pool);
01491 
01492 
01493 /** Set @a *table_p to the entire property list of @a path in @a root,
01494  * as an APR hash table allocated in @a pool.  The resulting table maps
01495  * property names to pointers to #svn_string_t objects containing the
01496  * property value.
01497  */
01498 svn_error_t *
01499 svn_fs_node_proplist(apr_hash_t **table_p,
01500                      svn_fs_root_t *root,
01501                      const char *path,
01502                      apr_pool_t *pool);
01503 
01504 
01505 /** Change a node's property's value, or add/delete a property.
01506  *
01507  * - @a root and @a path indicate the node whose property should change.
01508  *   @a root must be the root of a transaction, not the root of a revision.
01509  * - @a name is the name of the property to change.
01510  * - @a value is the new value of the property, or zero if the property should
01511  *   be removed altogether.
01512  * Do any necessary temporary allocation in @a pool.
01513  */
01514 svn_error_t *
01515 svn_fs_change_node_prop(svn_fs_root_t *root,
01516                         const char *path,
01517                         const char *name,
01518                         const svn_string_t *value,
01519                         apr_pool_t *pool);
01520 
01521 
01522 /** Determine if the properties of two path/root combinations are different.
01523  *
01524  * Set @a *changed_p to 1 if the properties at @a path1 under @a root1 differ
01525  * from those at @a path2 under @a root2, or set it to 0 if they are the
01526  * same.  Both paths must exist under their respective roots, and both
01527  * roots must be in the same filesystem.
01528  */
01529 svn_error_t *
01530 svn_fs_props_changed(svn_boolean_t *changed_p,
01531                      svn_fs_root_t *root1,
01532                      const char *path1,
01533                      svn_fs_root_t *root2,
01534                      const char *path2,
01535                      apr_pool_t *pool);
01536 
01537 
01538 /** Discover a node's copy ancestry, if any.
01539  *
01540  * If the node at @a path in @a root was copied from some other node, set
01541  * @a *rev_p and @a *path_p to the revision and path (expressed as an
01542  * absolute filesystem path) of the other node, allocating @a *path_p
01543  * in @a pool.
01544  *
01545  * Else if there is no copy ancestry for the node, set @a *rev_p to
01546  * #SVN_INVALID_REVNUM and @a *path_p to NULL.
01547  *
01548  * If an error is returned, the values of @a *rev_p and @a *path_p are
01549  * undefined, but otherwise, if one of them is set as described above,
01550  * you may assume the other is set correspondingly.
01551  *
01552  * @a root may be a revision root or a transaction root.
01553  *
01554  * Notes:
01555  *    - Copy ancestry does not descend.  After copying directory D to
01556  *      E, E will have copy ancestry referring to D, but E's children
01557  *      may not.  See also svn_fs_copy().
01558  *
01559  *    - Copy ancestry *under* a copy is preserved.  That is, if you
01560  *      copy /A/D/G/pi to /A/D/G/pi2, and then copy /A/D/G to /G, then
01561  *      /G/pi2 will still have copy ancestry pointing to /A/D/G/pi.
01562  *      We don't know if this is a feature or a bug yet; if it turns
01563  *      out to be a bug, then the fix is to make svn_fs_copied_from()
01564  *      observe the following logic, which currently callers may
01565  *      choose to follow themselves: if node X has copy history, but
01566  *      its ancestor A also has copy history, then you may ignore X's
01567  *      history if X's revision-of-origin is earlier than A's --
01568  *      because that would mean that X's copy history was preserved in
01569  *      a copy-under-a-copy scenario.  If X's revision-of-origin is
01570  *      the same as A's, then it was copied under A during the same
01571  *      transaction that created A.  (X's revision-of-origin cannot be
01572  *      greater than A's, if X has copy history.)  @todo See how
01573  *      people like this, it can always be hidden behind the curtain
01574  *      if necessary.
01575  *
01576  *    - Copy ancestry is not stored as a regular subversion property
01577  *      because it is not inherited.  Copying foo to bar results in a
01578  *      revision of bar with copy ancestry; but committing a text
01579  *      change to bar right after that results in a new revision of
01580  *      bar without copy ancestry.
01581  */
01582 svn_error_t *
01583 svn_fs_copied_from(svn_revnum_t *rev_p,
01584                    const char **path_p,
01585                    svn_fs_root_t *root,
01586                    const char *path,
01587                    apr_pool_t *pool);
01588 
01589 
01590 /** Set @a *root_p and @a *path_p to the revision root and path of the
01591  * destination of the most recent copy event that caused @a path to
01592  * exist where it does in @a root, or to NULL if no such copy exists.
01593  *
01594  * @a *path_p might be a parent of @a path, rather than @a path
01595  * itself.  However, it will always be the deepest relevant path.
01596  * That is, if a copy occurs underneath another copy in the same txn,
01597  * this function makes sure to set @a *path_p to the longest copy
01598  * destination path that is still a parent of or equal to @a path.
01599  *
01600  * Values returned in @a *root_p and @a *path_p will be allocated
01601  * from @a pool.
01602  *
01603  * @since New in 1.3.
01604  */
01605 svn_error_t *
01606 svn_fs_closest_copy(svn_fs_root_t **root_p,
01607                     const char **path_p,
01608                     svn_fs_root_t *root,
01609                     const char *path,
01610                     apr_pool_t *pool);
01611 
01612 
01613 /** Retrieve mergeinfo for multiple nodes.
01614  *
01615  * @a *catalog is a catalog for @a paths.  It will never be @c NULL,
01616  * but may be empty.
01617  *
01618  * @a root is revision root to use when looking up paths.
01619  *
01620  * @a paths are the paths you are requesting information for.
01621  *
01622  * @a inherit indicates whether to retrieve explicit,
01623  * explicit-or-inherited, or only inherited mergeinfo.
01624  *
01625  * If @a adjust_inherited_mergeinfo is @c TRUE, then any inherited
01626  * mergeinfo returned in @a *catalog is normalized to represent the
01627  * inherited mergeinfo on the path which inherits it.  If
01628  * @a adjust_inherited_mergeinfo is @c FALSE, then any inherited
01629  * mergeinfo is the raw explicit mergeinfo from the nearest parent
01630  * of the path with explicit mergeinfo, unadjusted for the path-wise
01631  * difference between the path and its parent.  This may include
01632  * non-inheritable mergeinfo.
01633  *
01634  * If @a include_descendants is TRUE, then additionally return the
01635  * mergeinfo for any descendant of any element of @a paths which has
01636  * the #SVN_PROP_MERGEINFO property explicitly set on it.  (Note
01637  * that inheritance is only taken into account for the elements in @a
01638  * paths; descendants of the elements in @a paths which get their
01639  * mergeinfo via inheritance are not included in @a *catalog.)
01640  *
01641  * Allocate @a *catalog in result_pool.  Do any necessary temporary
01642  * allocations in @a scratch_pool.
01643  *
01644  * @since New in 1.8.
01645  */
01646 svn_error_t *
01647 svn_fs_get_mergeinfo2(svn_mergeinfo_catalog_t *catalog,
01648                       svn_fs_root_t *root,
01649                       const apr_array_header_t *paths,
01650                       svn_mergeinfo_inheritance_t inherit,
01651                       svn_boolean_t include_descendants,
01652                       svn_boolean_t adjust_inherited_mergeinfo,
01653                       apr_pool_t *result_pool,
01654                       apr_pool_t *scratch_pool);
01655 
01656 /**
01657  * Same as svn_fs_get_mergeinfo2(), but with @a adjust_inherited_mergeinfo
01658  * set always set to @c TRUE and with only one pool.
01659  *
01660  * @deprecated Provided for backward compatibility with the 1.5 API.
01661  */
01662 SVN_DEPRECATED
01663 svn_error_t *
01664 svn_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
01665                      svn_fs_root_t *root,
01666                      const apr_array_header_t *paths,
01667                      svn_mergeinfo_inheritance_t inherit,
01668                      svn_boolean_t include_descendants,
01669                      apr_pool_t *pool);
01670 
01671 /** Merge changes between two nodes into a third node.
01672  *
01673  * Given nodes @a source and @a target, and a common ancestor @a ancestor,
01674  * modify @a target to contain all the changes made between @a ancestor and
01675  * @a source, as well as the changes made between @a ancestor and @a target.
01676  * @a target_root must be the root of a transaction, not a revision.
01677  *
01678  * @a source, @a target, and @a ancestor are generally directories; this
01679  * function recursively merges the directories' contents.  If they are
01680  * files, this function simply returns an error whenever @a source,
01681  * @a target, and @a ancestor are all distinct node revisions.
01682  *
01683  * If there are differences between @a ancestor and @a source that conflict
01684  * with changes between @a ancestor and @a target, this function returns an
01685  * #SVN_ERR_FS_CONFLICT error.
01686  *
01687  * If the merge is successful, @a target is left in the merged state, and
01688  * the base root of @a target's txn is set to the root node of @a source.
01689  * If an error is returned (whether for conflict or otherwise), @a target
01690  * is left unaffected.
01691  *
01692  * If @a conflict_p is non-NULL, then: a conflict error sets @a *conflict_p
01693  * to the name of the node in @a target which couldn't be merged,
01694  * otherwise, success sets @a *conflict_p to NULL.
01695  *
01696  * Do any necessary temporary allocation in @a pool.
01697  */
01698 svn_error_t *
01699 svn_fs_merge(const char **conflict_p,
01700              svn_fs_root_t *source_root,
01701              const char *source_path,
01702              svn_fs_root_t *target_root,
01703              const char *target_path,
01704              svn_fs_root_t *ancestor_root,
01705              const char *ancestor_path,
01706              apr_pool_t *pool);
01707 
01708 
01709 
01710 /* Directories.  */
01711 
01712 
01713 /** The type of a Subversion directory entry.  */
01714 typedef struct svn_fs_dirent_t
01715 {
01716 
01717   /** The name of this directory entry.  */
01718   const char *name;
01719 
01720   /** The node revision ID it names.  */
01721   const svn_fs_id_t *id;
01722 
01723   /** The node kind. */
01724   svn_node_kind_t kind;
01725 
01726 } svn_fs_dirent_t;
01727 
01728 
01729 /** Set @a *entries_p to a newly allocated APR hash table containing the
01730  * entries of the directory at @a path in @a root.  The keys of the table
01731  * are entry names, as byte strings, excluding the final NULL
01732  * character; the table's values are pointers to #svn_fs_dirent_t
01733  * structures.  Allocate the table and its contents in @a pool.
01734  */
01735 svn_error_t *
01736 svn_fs_dir_entries(apr_hash_t **entries_p,
01737                    svn_fs_root_t *root,
01738                    const char *path,
01739                    apr_pool_t *pool);
01740 
01741 
01742 /** Create a new directory named @a path in @a root.  The new directory has
01743  * no entries, and no properties.  @a root must be the root of a transaction,
01744  * not a revision.
01745  *
01746  * Do any necessary temporary allocation in @a pool.
01747  */
01748 svn_error_t *
01749 svn_fs_make_dir(svn_fs_root_t *root,
01750                 const char *path,
01751                 apr_pool_t *pool);
01752 
01753 
01754 /** Delete the node named @a path in @a root.  If the node being deleted is
01755  * a directory, its contents will be deleted recursively.  @a root must be
01756  * the root of a transaction, not of a revision.  Use @a pool for
01757  * temporary allocation.
01758  *
01759  * If return #SVN_ERR_FS_NO_SUCH_ENTRY, then the basename of @a path is
01760  * missing from its parent, that is, the final target of the deletion
01761  * is missing.
01762  *
01763  * Attempting to remove the root dir also results in an error,
01764  * #SVN_ERR_FS_ROOT_DIR, even if the dir is empty.
01765  */
01766 svn_error_t *
01767 svn_fs_delete(svn_fs_root_t *root,
01768               const char *path,
01769               apr_pool_t *pool);
01770 
01771 
01772 /** Create a copy of @a from_path in @a from_root named @a to_path in
01773  * @a to_root.  If @a from_path in @a from_root is a directory, copy the
01774  * tree it refers to recursively.
01775  *
01776  * The copy will remember its source; use svn_fs_copied_from() to
01777  * access this information.
01778  *
01779  * @a to_root must be the root of a transaction; @a from_root must be the
01780  * root of a revision.  (Requiring @a from_root to be the root of a
01781  * revision makes the implementation trivial: there is no detectable
01782  * difference (modulo node revision ID's) between copying @a from and
01783  * simply adding a reference to it.  So the operation takes place in
01784  * constant time.  However, there's no reason not to extend this to
01785  * mutable nodes --- it's just more code.)  Further, @a to_root and @a
01786  * from_root must represent the same filesystem.
01787  *
01788  * @note To do a copy without preserving copy history, use
01789  * svn_fs_revision_link().
01790  *
01791  * Do any necessary temporary allocation in @a pool.
01792  */
01793 svn_error_t *
01794 svn_fs_copy(svn_fs_root_t *from_root,
01795             const char *from_path,
01796             svn_fs_root_t *to_root,
01797             const char *to_path,
01798             apr_pool_t *pool);
01799 
01800 
01801 /** Like svn_fs_copy(), but doesn't record copy history, and preserves
01802  * the PATH.  You cannot use svn_fs_copied_from() later to find out
01803  * where this copy came from.
01804  *
01805  * Use svn_fs_revision_link() in situations where you don't care
01806  * about the copy history, and where @a to_path and @a from_path are
01807  * the same, because it is cheaper than svn_fs_copy().
01808  */
01809 svn_error_t *
01810 svn_fs_revision_link(svn_fs_root_t *from_root,
01811                      svn_fs_root_t *to_root,
01812                      const char *path,
01813                      apr_pool_t *pool);
01814 
01815 /* Files.  */
01816 
01817 /** Set @a *length_p to the length of the file @a path in @a root, in bytes.
01818  * Do any necessary temporary allocation in @a pool.
01819  */
01820 svn_error_t *
01821 svn_fs_file_length(svn_filesize_t *length_p,
01822                    svn_fs_root_t *root,
01823                    const char *path,
01824                    apr_pool_t *pool);
01825 
01826 
01827 /** Set @a *checksum to the checksum of type @a kind for the file @a path.
01828  * @a *checksum will be allocated out of @a pool, which will also be used
01829  * for temporary allocations.
01830  *
01831  * If the filesystem does not have a prerecorded checksum of @a kind for
01832  * @a path, and @a force is not TRUE, do not calculate a checksum
01833  * dynamically, just put NULL into @a checksum.  (By convention, the NULL
01834  * checksum is considered to match any checksum.)
01835  *
01836  * Notes:
01837  *
01838  * You might wonder, why do we only provide this interface for file
01839  * contents, and not for properties or directories?
01840  *
01841  * The answer is that property lists and directory entry lists are
01842  * essentially data structures, not text.  We serialize them for
01843  * transmission, but there is no guarantee that the consumer will
01844  * parse them into the same form, or even the same order, as the
01845  * producer.  It's difficult to find a checksumming method that
01846  * reaches the same result given such variation in input.  (I suppose
01847  * we could calculate an independent MD5 sum for each propname and
01848  * value, and XOR them together; same with directory entry names.
01849  * Maybe that's the solution?)  Anyway, for now we punt.  The most
01850  * important data, and the only data that goes through svndiff
01851  * processing, is file contents, so that's what we provide
01852  * checksumming for.
01853  *
01854  * Internally, of course, the filesystem checksums everything, because
01855  * it has access to the lowest level storage forms: strings behind
01856  * representations.
01857  *
01858  * @since New in 1.6.
01859  */
01860 svn_error_t *
01861 svn_fs_file_checksum(svn_checksum_t **checksum,
01862                      svn_checksum_kind_t kind,
01863                      svn_fs_root_t *root,
01864                      const char *path,
01865                      svn_boolean_t force,
01866                      apr_pool_t *pool);
01867 
01868 /**
01869  * Same as svn_fs_file_checksum(), only always put the MD5 checksum of file
01870  * @a path into @a digest, which should point to @c APR_MD5_DIGESTSIZE bytes
01871  * of storage.  If the checksum doesn't exist, put all 0's into @a digest.
01872  *
01873  * @deprecated Provided for backward compatibility with the 1.5 API.
01874  */
01875 SVN_DEPRECATED
01876 svn_error_t *
01877 svn_fs_file_md5_checksum(unsigned char digest[],
01878                          svn_fs_root_t *root,
01879                          const char *path,
01880                          apr_pool_t *pool);
01881 
01882 
01883 /** Set @a *contents to a readable generic stream that will yield the
01884  * contents of the file @a path in @a root.  Allocate the stream in
01885  * @a pool.  You can only use @a *contents for as long as the underlying
01886  * filesystem is open.  If @a path is not a file, return
01887  * #SVN_ERR_FS_NOT_FILE.
01888  *
01889  * If @a root is the root of a transaction, it is possible that the
01890  * contents of the file @a path will change between calls to
01891  * svn_fs_file_contents().  In that case, the result of reading from
01892  * @a *contents is undefined.
01893  *
01894  * ### @todo kff: I am worried about lifetime issues with this pool vs
01895  * the trail created farther down the call stack.  Trace this function
01896  * to investigate...
01897  */
01898 svn_error_t *
01899 svn_fs_file_contents(svn_stream_t **contents,
01900                      svn_fs_root_t *root,
01901                      const char *path,
01902                      apr_pool_t *pool);
01903 
01904 /**
01905  * Callback function type used with svn_fs_try_process_file_contents()
01906  * that delivers the immutable, non-NULL @a contents of @a len bytes.
01907  * @a baton is an implementation-specific closure.
01908  *
01909  * Use @a scratch_pool for allocations.
01910  *
01911  * @since New in 1.8.
01912  */
01913 typedef svn_error_t *
01914 (*svn_fs_process_contents_func_t)(const unsigned char *contents,
01915                                   apr_size_t len,
01916                                   void *baton,
01917                                   apr_pool_t *scratch_pool);
01918 
01919 /** Efficiently deliver the contents of the file @a path in @a root
01920  * via @a processor (with @a baton), setting @a *success to @c TRUE
01921  * upon doing so.  Use @a pool for allocations.
01922  *
01923  * This function is intended to support zero copy data processing.  It may
01924  * not be implemented for all data backends or not applicable for certain
01925  * content.  In that case, @a *success will always be @c FALSE.  Also, this
01926  * is a best-effort function which means that there is no guarantee that
01927  * @a processor gets called at all for some content.
01928  *
01929  * @note @a processor is expected to be relatively short function with
01930  * at most O(content size) runtime.
01931  *
01932  * @since New in 1.8.
01933  */
01934 svn_error_t *
01935 svn_fs_try_process_file_contents(svn_boolean_t *success,
01936                                  svn_fs_root_t *root,
01937                                  const char *path,
01938                                  svn_fs_process_contents_func_t processor,
01939                                  void* baton,
01940                                  apr_pool_t *pool);
01941 
01942 /** Create a new file named @a path in @a root.  The file's initial contents
01943  * are the empty string, and it has no properties.  @a root must be the
01944  * root of a transaction, not a revision.
01945  *
01946  * Do any necessary temporary allocation in @a pool.
01947  */
01948 svn_error_t *
01949 svn_fs_make_file(svn_fs_root_t *root,
01950                  const char *path,
01951                  apr_pool_t *pool);
01952 
01953 
01954 /** Apply a text delta to the file @a path in @a root.  @a root must be the
01955  * root of a transaction, not a revision.
01956  *
01957  * Set @a *contents_p to a function ready to receive text delta windows
01958  * describing how to change the file's contents, relative to its
01959  * current contents.  Set @a *contents_baton_p to a baton to pass to
01960  * @a *contents_p.
01961  *
01962  * If @a path does not exist in @a root, return an error.  (You cannot use
01963  * this routine to create new files;  use svn_fs_make_file() to create
01964  * an empty file first.)
01965  *
01966  * @a base_checksum is the hex MD5 digest for the base text against
01967  * which the delta is to be applied; it is ignored if NULL, and may be
01968  * ignored even if not NULL.  If it is not ignored, it must match the
01969  * checksum of the base text against which svndiff data is being
01970  * applied; if not, svn_fs_apply_textdelta() or the @a *contents_p call
01971  * which detects the mismatch will return the error
01972  * #SVN_ERR_CHECKSUM_MISMATCH (if there is no base text, there may
01973  * still be an error if @a base_checksum is neither NULL nor the
01974  * checksum of the empty string).
01975  *
01976  * @a result_checksum is the hex MD5 digest for the fulltext that
01977  * results from this delta application.  It is ignored if NULL, but if
01978  * not NULL, it must match the checksum of the result; if it does not,
01979  * then the @a *contents_p call which detects the mismatch will return
01980  * the error #SVN_ERR_CHECKSUM_MISMATCH.
01981  *
01982  * The caller must send all delta windows including the terminating
01983  * NULL window to @a *contents_p before making further changes to the
01984  * transaction.
01985  *
01986  * Do temporary allocation in @a pool.
01987  */
01988 svn_error_t *
01989 svn_fs_apply_textdelta(svn_txdelta_window_handler_t *contents_p,
01990                        void **contents_baton_p,
01991                        svn_fs_root_t *root,
01992                        const char *path,
01993                        const char *base_checksum,
01994                        const char *result_checksum,
01995                        apr_pool_t *pool);
01996 
01997 
01998 /** Write data directly to the file @a path in @a root.  @a root must be the
01999  * root of a transaction, not a revision.
02000  *
02001  * Set @a *contents_p to a stream ready to receive full textual data.
02002  * When the caller closes this stream, the data replaces the previous
02003  * contents of the file.  The caller must write all file data and close
02004  * the stream before making further changes to the transaction.
02005  *
02006  * If @a path does not exist in @a root, return an error.  (You cannot use
02007  * this routine to create new files;  use svn_fs_make_file() to create
02008  * an empty file first.)
02009  *
02010  * @a result_checksum is the hex MD5 digest for the final fulltext
02011  * written to the stream.  It is ignored if NULL, but if not null, it
02012  * must match the checksum of the result; if it does not, then the @a
02013  * *contents_p call which detects the mismatch will return the error
02014  * #SVN_ERR_CHECKSUM_MISMATCH.
02015  *
02016  * Do any necessary temporary allocation in @a pool.
02017  *
02018  * ### This is like svn_fs_apply_textdelta(), but takes the text
02019  * straight.  It is currently used only by the loader, see
02020  * libsvn_repos/load.c.  It should accept a checksum, of course, which
02021  * would come from an (optional) header in the dump file.  See
02022  * http://subversion.tigris.org/issues/show_bug.cgi?id=1102 for more.
02023  */
02024 svn_error_t *
02025 svn_fs_apply_text(svn_stream_t **contents_p,
02026                   svn_fs_root_t *root,
02027                   const char *path,
02028                   const char *result_checksum,
02029                   apr_pool_t *pool);
02030 
02031 
02032 /** Check if the contents of two root/path combos have changed.
02033  *
02034  * Set @a *changed_p to 1 if the contents at @a path1 under @a root1 differ
02035  * from those at @a path2 under @a root2, or set it to 0 if they are the
02036  * same.  Both paths must exist under their respective roots, and both
02037  * roots must be in the same filesystem.
02038  */
02039 svn_error_t *
02040 svn_fs_contents_changed(svn_boolean_t *changed_p,
02041                         svn_fs_root_t *root1,
02042                         const char *path1,
02043                         svn_fs_root_t *root2,
02044                         const char *path2,
02045                         apr_pool_t *pool);
02046 
02047 
02048 
02049 /* Filesystem revisions.  */
02050 
02051 
02052 /** Set @a *youngest_p to the number of the youngest revision in filesystem
02053  * @a fs.  Use @a pool for all temporary allocation.
02054  *
02055  * The oldest revision in any filesystem is numbered zero.
02056  */
02057 svn_error_t *
02058 svn_fs_youngest_rev(svn_revnum_t *youngest_p,
02059                     svn_fs_t *fs,
02060                     apr_pool_t *pool);
02061 
02062 
02063 /** Provide filesystem @a fs the opportunity to compress storage relating to
02064  * associated with  @a revision in filesystem @a fs.  Use @a pool for all
02065  * allocations.
02066  *
02067  * @note This can be a time-consuming process, depending the breadth
02068  * of the changes made in @a revision, and the depth of the history of
02069  * those changed paths.  This may also be a no op.
02070  */
02071 svn_error_t *
02072 svn_fs_deltify_revision(svn_fs_t *fs,
02073                         svn_revnum_t revision,
02074                         apr_pool_t *pool);
02075 
02076 
02077 /** Set @a *value_p to the value of the property named @a propname on
02078  * revision @a rev in the filesystem @a fs.  If @a rev has no property by
02079  * that name, set @a *value_p to zero.  Allocate the result in @a pool.
02080  */
02081 svn_error_t *
02082 svn_fs_revision_prop(svn_string_t **value_p,
02083                      svn_fs_t *fs,
02084                      svn_revnum_t rev,
02085                      const char *propname,
02086                      apr_pool_t *pool);
02087 
02088 
02089 /** Set @a *table_p to the entire property list of revision @a rev in
02090  * filesystem @a fs, as an APR hash table allocated in @a pool.  The table
02091  * maps <tt>char *</tt> property names to #svn_string_t * values; the names
02092  * and values are allocated in @a pool.
02093  */
02094 svn_error_t *
02095 svn_fs_revision_proplist(apr_hash_t **table_p,
02096                          svn_fs_t *fs,
02097                          svn_revnum_t rev,
02098                          apr_pool_t *pool);
02099 
02100 
02101 /** Change a revision's property's value, or add/delete a property.
02102  *
02103  * - @a fs is a filesystem, and @a rev is the revision in that filesystem
02104  *   whose property should change.
02105  * - @a name is the name of the property to change.
02106  * - if @a old_value_p is not @c NULL, then changing the property will fail with
02107  *   error #SVN_ERR_FS_PROP_BASEVALUE_MISMATCH if the present value of the
02108  *   property is not @a *old_value_p.  (This is an atomic test-and-set).
02109  *   @a *old_value_p may be @c NULL, representing that the property must be not
02110  *   already set.
02111  * - @a value is the new value of the property, or zero if the property should
02112  *   be removed altogether.
02113  *
02114  * Note that revision properties are non-historied --- you can change
02115  * them after the revision has been committed.  They are not protected
02116  * via transactions.
02117  *
02118  * Do any necessary temporary allocation in @a pool.
02119  *
02120  * @since New in 1.7.
02121  */
02122 svn_error_t *
02123 svn_fs_change_rev_prop2(svn_fs_t *fs,
02124                         svn_revnum_t rev,
02125                         const char *name,
02126                         const svn_string_t *const *old_value_p,
02127                         const svn_string_t *value,
02128                         apr_pool_t *pool);
02129 
02130 
02131 /**
02132  * Similar to svn_fs_change_rev_prop2(), but with @a old_value_p passed as
02133  * @c NULL.
02134  *
02135  * @deprecated Provided for backward compatibility with the 1.6 API.
02136  */
02137 SVN_DEPRECATED
02138 svn_error_t *
02139 svn_fs_change_rev_prop(svn_fs_t *fs,
02140                        svn_revnum_t rev,
02141                        const char *name,
02142                        const svn_string_t *value,
02143                        apr_pool_t *pool);
02144 
02145 
02146 
02147 /* Computing deltas.  */
02148 
02149 
02150 /** Set @a *stream_p to a pointer to a delta stream that will turn the
02151  * contents of the file @a source into the contents of the file @a target.
02152  * If @a source_root is zero, use a file with zero length as the source.
02153  *
02154  * This function does not compare the two files' properties.
02155  *
02156  * Allocate @a *stream_p, and do any necessary temporary allocation, in
02157  * @a pool.
02158  */
02159 svn_error_t *
02160 svn_fs_get_file_delta_stream(svn_txdelta_stream_t **stream_p,
02161                              svn_fs_root_t *source_root,
02162                              const char *source_path,
02163                              svn_fs_root_t *target_root,
02164                              const char *target_path,
02165                              apr_pool_t *pool);
02166 
02167 
02168 
02169 /* UUID manipulation. */
02170 
02171 /** Populate @a *uuid with the UUID associated with @a fs.  Allocate
02172     @a *uuid in @a pool.  */
02173 svn_error_t *
02174 svn_fs_get_uuid(svn_fs_t *fs,
02175                 const char **uuid,
02176                 apr_pool_t *pool);
02177 
02178 
02179 /** If not @c NULL, associate @a *uuid with @a fs.  Otherwise (if @a
02180  * uuid is @c NULL), generate a new UUID for @a fs.  Use @a pool for
02181  * any scratch work.
02182  */
02183 svn_error_t *
02184 svn_fs_set_uuid(svn_fs_t *fs,
02185                 const char *uuid,
02186                 apr_pool_t *pool);
02187 
02188 
02189 /* Non-historical properties.  */
02190 
02191 /* [[Yes, do tell.]] */
02192 
02193 
02194 
02195 /** @defgroup svn_fs_locks Filesystem locks
02196  * @{
02197  * @since New in 1.2. */
02198 
02199 /** A lock represents one user's exclusive right to modify a path in a
02200  * filesystem.  In order to create or destroy a lock, a username must
02201  * be associated with the filesystem's access context (see
02202  * #svn_fs_access_t).
02203  *
02204  * When a lock is created, a 'lock-token' is returned.  The lock-token
02205  * is a unique URI that represents the lock (treated as an opaque
02206  * string by the client), and is required to make further use of the
02207  * lock (including removal of the lock.)  A lock-token can also be
02208  * queried to return a svn_lock_t structure that describes the details
02209  * of the lock.  lock-tokens must not contain any newline character,
02210  * mainly due to the serialization for tokens for pre-commit hook.
02211  *
02212  * Locks are not secret; anyone can view existing locks in a
02213  * filesystem.  Locks are not omnipotent: they can broken and stolen
02214  * by people who don't "own" the lock.  (Though admins can tailor a
02215  * custom break/steal policy via libsvn_repos pre-lock hook script.)
02216  *
02217  * Locks can be created with an optional expiration date.  If a lock
02218  * has an expiration date, then the act of fetching/reading it might
02219  * cause it to automatically expire, returning either nothing or an
02220  * expiration error (depending on the API).
02221  */
02222 
02223 
02224 /** Lock @a path in @a fs, and set @a *lock to a lock
02225  * representing the new lock, allocated in @a pool.
02226  *
02227  * @warning You may prefer to use svn_repos_fs_lock() instead,
02228  * which see.
02229  *
02230  * @a fs must have a username associated with it (see
02231  * #svn_fs_access_t), else return #SVN_ERR_FS_NO_USER.  Set the
02232  * 'owner' field in the new lock to the fs username.
02233  *
02234  * @a comment is optional: it's either an xml-escapable UTF8 string
02235  * which describes the lock, or it is @c NULL.
02236  *
02237  * @a is_dav_comment describes whether the comment was created by a
02238  * generic DAV client; only mod_dav_svn's autoversioning feature needs
02239  * to use it.  If in doubt, pass 0.
02240  *
02241  * If path is already locked, then return #SVN_ERR_FS_PATH_ALREADY_LOCKED,
02242  * unless @a steal_lock is TRUE, in which case "steal" the existing
02243  * lock, even if the FS access-context's username does not match the
02244  * current lock's owner: delete the existing lock on @a path, and
02245  * create a new one.
02246  *
02247  * @a token is a lock token such as can be generated using
02248  * svn_fs_generate_lock_token() (indicating that the caller wants to
02249  * dictate the lock token used), or it is @c NULL (indicating that the
02250  * caller wishes to have a new token generated by this function).  If
02251  * @a token is not @c NULL, and represents an existing lock, then @a
02252  * path must match the path associated with that existing lock.
02253  *
02254  * If @a expiration_date is zero, then create a non-expiring lock.
02255  * Else, the lock will expire at @a expiration_date.
02256  *
02257  * If @a current_rev is a valid revnum, then do an out-of-dateness
02258  * check.  If the revnum is less than the last-changed-revision of @a
02259  * path (or if @a path doesn't exist in HEAD), return
02260  * #SVN_ERR_FS_OUT_OF_DATE.
02261  *
02262  * @note At this time, only files can be locked.
02263  */
02264 svn_error_t *
02265 svn_fs_lock(svn_lock_t **lock,
02266             svn_fs_t *fs,
02267             const char *path,
02268             const char *token,
02269             const char *comment,
02270             svn_boolean_t is_dav_comment,
02271             apr_time_t expiration_date,
02272             svn_revnum_t current_rev,
02273             svn_boolean_t steal_lock,
02274             apr_pool_t *pool);
02275 
02276 
02277 /** Generate a unique lock-token using @a fs. Return in @a *token,
02278  * allocated in @a pool.
02279  *
02280  * This can be used in to populate lock->token before calling
02281  * svn_fs_attach_lock().
02282  */
02283 svn_error_t *
02284 svn_fs_generate_lock_token(const char **token,
02285                            svn_fs_t *fs,
02286                            apr_pool_t *pool);
02287 
02288 
02289 /** Remove the lock on @a path represented by @a token in @a fs.
02290  *
02291  * If @a token doesn't point to a lock, return #SVN_ERR_FS_BAD_LOCK_TOKEN.
02292  * If @a token points to an expired lock, return #SVN_ERR_FS_LOCK_EXPIRED.
02293  * If @a fs has no username associated with it, return #SVN_ERR_FS_NO_USER
02294  * unless @a break_lock is specified.
02295  *
02296  * If @a token points to a lock, but the username of @a fs's access
02297  * context doesn't match the lock's owner, return
02298  * #SVN_ERR_FS_LOCK_OWNER_MISMATCH.  If @a break_lock is TRUE, however, don't
02299  * return error;  allow the lock to be "broken" in any case.  In the latter
02300  * case, @a token shall be @c NULL.
02301  *
02302  * Use @a pool for temporary allocations.
02303  */
02304 svn_error_t *
02305 svn_fs_unlock(svn_fs_t *fs,
02306               const char *path,
02307               const char *token,
02308               svn_boolean_t break_lock,
02309               apr_pool_t *pool);
02310 
02311 
02312 /** If @a path is locked in @a fs, set @a *lock to an svn_lock_t which
02313  *  represents the lock, allocated in @a pool.
02314  *
02315  * If @a path is not locked, set @a *lock to NULL.
02316  */
02317 svn_error_t *
02318 svn_fs_get_lock(svn_lock_t **lock,
02319                 svn_fs_t *fs,
02320                 const char *path,
02321                 apr_pool_t *pool);
02322 
02323 
02324 /** The type of a lock discovery callback function.  @a baton is the
02325  * value specified in the call to svn_fs_get_locks(); the filesystem
02326  * passes it through to the callback.  @a lock is a lock structure.
02327  * @a pool is a temporary subpool for use by the callback
02328  * implementation -- it is cleared after invocation of the callback.
02329  */
02330 typedef svn_error_t *(*svn_fs_get_locks_callback_t)(void *baton,
02331                                                     svn_lock_t *lock,
02332                                                     apr_pool_t *pool);
02333 
02334 
02335 /** Report locks on or below @a path in @a fs using the @a
02336  * get_locks_func / @a get_locks_baton.  Use @a pool for necessary
02337  * allocations.
02338  *
02339  * @a depth limits the reported locks to those associated with paths
02340  * within the specified depth of @a path, and must be one of the
02341  * following values:  #svn_depth_empty, #svn_depth_files,
02342  * #svn_depth_immediates, or #svn_depth_infinity.
02343  *
02344  * If the @a get_locks_func callback implementation returns an error,
02345  * lock iteration will terminate and that error will be returned by
02346  * this function.
02347  *
02348  * @note Over the course of this function's invocation, locks might be
02349  * added, removed, or modified by concurrent processes.  Callers need
02350  * to anticipate and gracefully handle the transience of this
02351  * information.
02352  *
02353  * @since New in 1.7.
02354  */
02355 svn_error_t *
02356 svn_fs_get_locks2(svn_fs_t *fs,
02357                   const char *path,
02358                   svn_depth_t depth,
02359                   svn_fs_get_locks_callback_t get_locks_func,
02360                   void *get_locks_baton,
02361                   apr_pool_t *pool);
02362 
02363 /** Similar to svn_fs_get_locks2(), but with @a depth always passed as
02364  * svn_depth_infinity, and with the following known problem (which is
02365  * not present in svn_fs_get_locks2()):
02366  *
02367  * @note On Berkeley-DB-backed filesystems in Subversion 1.6 and
02368  * prior, the @a get_locks_func callback will be invoked from within a
02369  * Berkeley-DB transaction trail.  Implementors of the callback are,
02370  * as a result, forbidden from calling any svn_fs API functions which
02371  * might themselves attempt to start a new Berkeley DB transaction
02372  * (which is most of this svn_fs API).  Yes, this is a nasty
02373  * implementation detail to have to be aware of.
02374  *
02375  * @deprecated Provided for backward compatibility with the 1.6 API.
02376  */
02377 SVN_DEPRECATED
02378 svn_error_t *
02379 svn_fs_get_locks(svn_fs_t *fs,
02380                  const char *path,
02381                  svn_fs_get_locks_callback_t get_locks_func,
02382                  void *get_locks_baton,
02383                  apr_pool_t *pool);
02384 
02385 /** @} */
02386 
02387 /**
02388  * Append a textual list of all available FS modules to the stringbuf
02389  * @a output.  Third-party modules are only included if repository
02390  * access has caused them to be loaded.
02391  *
02392  * @since New in 1.2.
02393  */
02394 svn_error_t *
02395 svn_fs_print_modules(svn_stringbuf_t *output,
02396                      apr_pool_t *pool);
02397 
02398 
02399 /** The kind of action being taken by 'pack'. */
02400 typedef enum svn_fs_pack_notify_action_t
02401 {
02402   /** packing of the shard has commenced */
02403   svn_fs_pack_notify_start = 0,
02404 
02405   /** packing of the shard is completed */
02406   svn_fs_pack_notify_end,
02407 
02408   /** packing of the shard revprops has commenced
02409       @since New in 1.7. */
02410   svn_fs_pack_notify_start_revprop,
02411 
02412   /** packing of the shard revprops has completed
02413       @since New in 1.7. */
02414   svn_fs_pack_notify_end_revprop
02415 
02416 } svn_fs_pack_notify_action_t;
02417 
02418 /** The type of a pack notification function.  @a shard is the shard being
02419  * acted upon; @a action is the type of action being performed.  @a baton is
02420  * the corresponding baton for the notification function, and @a pool can
02421  * be used for temporary allocations, but will be cleared between invocations.
02422  */
02423 typedef svn_error_t *(*svn_fs_pack_notify_t)(void *baton,
02424                                              apr_int64_t shard,
02425                                              svn_fs_pack_notify_action_t action,
02426                                              apr_pool_t *pool);
02427 
02428 /**
02429  * Possibly update the filesystem located in the directory @a path
02430  * to use disk space more efficiently.
02431  *
02432  * @since New in 1.6.
02433  */
02434 svn_error_t *
02435 svn_fs_pack(const char *db_path,
02436             svn_fs_pack_notify_t notify_func,
02437             void *notify_baton,
02438             svn_cancel_func_t cancel_func,
02439             void *cancel_baton,
02440             apr_pool_t *pool);
02441 
02442 
02443 /**
02444  * Perform backend-specific data consistency and correctness validations
02445  * to the Subversion filesystem (mainly the meta-data) located in the
02446  * directory @a path.  Use the backend-specific configuration @a fs_config
02447  * when opening the filesystem.  @a NULL is valid for all backends.
02448  * Use @a scratch_pool for temporary allocations.
02449  *
02450  * @a start and @a end define the (minimum) range of revisions to check.
02451  * If @a start is #SVN_INVALID_REVNUM, it defaults to @c r0.  Likewise,
02452  * @a end will default to the current youngest repository revision when
02453  * given as #SVN_INVALID_REVNUM.  Since meta data checks may have to touch
02454  * other revisions as well, you may receive notifications for revisions
02455  * outside the specified range.   In fact, it is perfectly legal for a FS
02456  * implementation to always check all revisions.
02457  *
02458  * Global invariants are only guaranteed to get verified when @a r0 has
02459  * been included in the range of revisions to check.
02460  *
02461  * The optional @a notify_func callback is only a general feedback that
02462  * the operation is still in process but may be called in random revisions
02463  * order and more than once for the same revision, i.e. r2, r1, r2 would
02464  * be a valid sequence.
02465  *
02466  * The optional @a cancel_func callback will be invoked as usual to allow
02467  * the user to preempt this potentially lengthy operation.
02468  *
02469  * @note You probably don't want to use this directly.  Take a look at
02470  * svn_repos_verify_fs2() instead, which does non-backend-specific
02471  * verifications as well.
02472  *
02473  * @note To ensure a full verification using all tests and covering all
02474  * revisions, you must call this function *and* #svn_fs_verify_root.
02475  *
02476  * @note Implementors, please do tests that can be done efficiently for
02477  * a single revision in #svn_fs_verify_root.  This function is meant for
02478  * global checks or tests that require an expensive context setup.
02479  *
02480  * @see svn_repos_verify_fs2()
02481  * @see svn_fs_verify_root()
02482  *
02483  * @since New in 1.8.
02484  */
02485 svn_error_t *
02486 svn_fs_verify(const char *path,
02487               apr_hash_t *fs_config,
02488               svn_revnum_t start,
02489               svn_revnum_t end,
02490               svn_fs_progress_notify_func_t notify_func,
02491               void *notify_baton,
02492               svn_cancel_func_t cancel_func,
02493               void *cancel_baton,
02494               apr_pool_t *scratch_pool);
02495 
02496 /**
02497  * Perform backend-specific data consistency and correctness validations
02498  * of @a root in the Subversion filesystem @a fs.  @a root is typically
02499  * a revision root (see svn_fs_revision_root()), but may be a
02500  * transaction root.  Use @a scratch_pool for temporary allocations.
02501  *
02502  * @note You probably don't want to use this directly.  Take a look at
02503  * svn_repos_verify_fs2() instead, which does non-backend-specific
02504  * verifications as well.
02505  *
02506  * @note To ensure a full verification using all available tests and
02507  * covering all revisions, you must call both this function and
02508  * #svn_fs_verify.
02509  *
02510  * @note Implementors, please perform tests that cannot be done
02511  * efficiently for a single revision in #svn_fs_verify.  This function
02512  * is intended for local checks that don't require an expensive context
02513  * setup.
02514  *
02515  * @see svn_repos_verify_fs2()
02516  * @see svn_fs_verify()
02517  *
02518  * @since New in 1.8.
02519  */
02520 svn_error_t *
02521 svn_fs_verify_root(svn_fs_root_t *root,
02522                    apr_pool_t *scratch_pool);
02523 
02524 /** @} */
02525 
02526 #ifdef __cplusplus
02527 }
02528 #endif /* __cplusplus */
02529 
02530 #endif /* SVN_FS_H */

Generated on Thu Dec 1 13:50:05 2016 for Subversion by  doxygen 1.4.7