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

Generated on Tue Aug 4 16:57:47 2015 for Subversion by  doxygen 1.4.7