svn_repos.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_repos.h
00024  * @brief Tools built on top of the filesystem.
00025  */
00026 
00027 #ifndef SVN_REPOS_H
00028 #define SVN_REPOS_H
00029 
00030 #include <apr_pools.h>
00031 #include <apr_hash.h>
00032 #include <apr_tables.h>
00033 #include <apr_time.h>
00034 
00035 #include "svn_types.h"
00036 #include "svn_string.h"
00037 #include "svn_delta.h"
00038 #include "svn_fs.h"
00039 #include "svn_io.h"
00040 #include "svn_mergeinfo.h"
00041 
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif /* __cplusplus */
00046 
00047 /* ---------------------------------------------------------------*/
00048 
00049 /**
00050  * Get libsvn_repos version information.
00051  *
00052  * @since New in 1.1.
00053  */
00054 const svn_version_t *
00055 svn_repos_version(void);
00056 
00057 
00058 /* Some useful enums.  They need to be declared here for the notification
00059    system to pick them up. */
00060 /** The different "actions" attached to nodes in the dumpfile. */
00061 enum svn_node_action
00062 {
00063   svn_node_action_change,
00064   svn_node_action_add,
00065   svn_node_action_delete,
00066   svn_node_action_replace
00067 };
00068 
00069 
00070 /** @defgroup svn_repos_authz_callbacks Repository authorization callbacks
00071  * @{
00072  */
00073 
00074 /** Callback type for checking authorization on a path.
00075  *
00076  * Set @a *allowed to TRUE to indicate that some operation is
00077  * authorized for @a path in @a root, or set it to FALSE to indicate
00078  * unauthorized (presumably according to state stored in @a baton).
00079  *
00080  * Do not assume @a pool has any lifetime beyond this call.
00081  *
00082  * The exact operation being authorized depends on the callback
00083  * implementation.  For read authorization, for example, the caller
00084  * would implement an instance that does read checking, and pass it as
00085  * a parameter named [perhaps] 'authz_read_func'.  The receiver of
00086  * that parameter might also take another parameter named
00087  * 'authz_write_func', which although sharing this type, would be a
00088  * different implementation.
00089  *
00090  * @note If someday we want more sophisticated authorization states
00091  * than just yes/no, @a allowed can become an enum type.
00092  */
00093 typedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed,
00094                                                svn_fs_root_t *root,
00095                                                const char *path,
00096                                                void *baton,
00097                                                apr_pool_t *pool);
00098 
00099 
00100 /** An enum defining the kinds of access authz looks up.
00101  *
00102  * @since New in 1.3.
00103  */
00104 typedef enum svn_repos_authz_access_t
00105 {
00106   /** No access. */
00107   svn_authz_none = 0,
00108 
00109   /** Path can be read. */
00110   svn_authz_read = 1,
00111 
00112   /** Path can be altered. */
00113   svn_authz_write = 2,
00114 
00115   /** The other access credentials are recursive. */
00116   svn_authz_recursive = 4
00117 } svn_repos_authz_access_t;
00118 
00119 
00120 /** Callback type for checking authorization on paths produced by
00121  * the repository commit editor.
00122  *
00123  * Set @a *allowed to TRUE to indicate that the @a required access on
00124  * @a path in @a root is authorized, or set it to FALSE to indicate
00125  * unauthorized (presumable according to state stored in @a baton).
00126  *
00127  * If @a path is NULL, the callback should perform a global authz
00128  * lookup for the @a required access.  That is, the lookup should
00129  * check if the @a required access is granted for at least one path of
00130  * the repository, and set @a *allowed to TRUE if so.  @a root may
00131  * also be NULL if @a path is NULL.
00132  *
00133  * This callback is very similar to svn_repos_authz_func_t, with the
00134  * exception of the addition of the @a required parameter.
00135  * This is due to historical reasons: when authz was first implemented
00136  * for svn_repos_dir_delta2(), it seemed there would need only checks
00137  * for read and write operations, hence the svn_repos_authz_func_t
00138  * callback prototype and usage scenario.  But it was then realized
00139  * that lookups due to copying needed to be recursive, and that
00140  * brute-force recursive lookups didn't square with the O(1)
00141  * performances a copy operation should have.
00142  *
00143  * So a special way to ask for a recursive lookup was introduced.  The
00144  * commit editor needs this capability to retain acceptable
00145  * performance.  Instead of revving the existing callback, causing
00146  * unnecessary revving of functions that don't actually need the
00147  * extended functionality, this second, more complete callback was
00148  * introduced, for use by the commit editor.
00149  *
00150  * Some day, it would be nice to reunite these two callbacks and do
00151  * the necessary revving anyway, but for the time being, this dual
00152  * callback mechanism will do.
00153  */
00154 typedef svn_error_t *(*svn_repos_authz_callback_t)
00155   (svn_repos_authz_access_t required,
00156    svn_boolean_t *allowed,
00157    svn_fs_root_t *root,
00158    const char *path,
00159    void *baton,
00160    apr_pool_t *pool);
00161 
00162 /** @} */
00163 
00164 
00165 /** @defgroup svn_repos_notifications Repository notifications
00166  * @{
00167  */
00168 
00169 /* Notification system. */
00170 
00171 /** The type of action occurring.
00172  *
00173  * @since New in 1.7.
00174  */
00175 typedef enum svn_repos_notify_action_t
00176 {
00177   /** A warning message is waiting. */
00178   svn_repos_notify_warning = 0,
00179 
00180   /** A revision has finished being dumped. */
00181   svn_repos_notify_dump_rev_end,
00182 
00183   /** A revision has finished being verified. */
00184   svn_repos_notify_verify_rev_end,
00185 
00186   /** All revisions have finished being dumped. */
00187   svn_repos_notify_dump_end,
00188 
00189   /** All revisions have finished being verified. */
00190   svn_repos_notify_verify_end,
00191 
00192   /** packing of an FSFS shard has commenced */
00193   svn_repos_notify_pack_shard_start,
00194 
00195   /** packing of an FSFS shard is completed */
00196   svn_repos_notify_pack_shard_end,
00197 
00198   /** packing of the shard revprops has commenced */
00199   svn_repos_notify_pack_shard_start_revprop,
00200 
00201   /** packing of the shard revprops has completed */
00202   svn_repos_notify_pack_shard_end_revprop,
00203 
00204   /** A revision has begun loading */
00205   svn_repos_notify_load_txn_start,
00206 
00207   /** A revision has finished loading */
00208   svn_repos_notify_load_txn_committed,
00209 
00210   /** A node has begun loading */
00211   svn_repos_notify_load_node_start,
00212 
00213   /** A node has finished loading */
00214   svn_repos_notify_load_node_done,
00215 
00216   /** A copied node has been encountered */
00217   svn_repos_notify_load_copied_node,
00218 
00219   /** Mergeinfo has been normalized */
00220   svn_repos_notify_load_normalized_mergeinfo,
00221 
00222   /** The operation has acquired a mutex for the repo. */
00223   svn_repos_notify_mutex_acquired,
00224 
00225   /** Recover has started. */
00226   svn_repos_notify_recover_start,
00227 
00228   /** Upgrade has started. */
00229   svn_repos_notify_upgrade_start,
00230 
00231   /** A revision was skipped during loading. @since New in 1.8. */
00232   svn_repos_notify_load_skipped_rev,
00233 
00234   /** The structure of a revision is being verified.  @since New in 1.8. */
00235   svn_repos_notify_verify_rev_structure,
00236 
00237   /** A revision is found with corruption/errors. @since New in 1.9. */
00238   svn_repos_notify_failure,
00239 
00240   /** A revprop shard got packed. @since New in 1.9. */
00241   svn_repos_notify_pack_revprops,
00242 
00243   /** A non-packed revprop shard got removed. @since New in 1.9. */
00244   svn_repos_notify_cleanup_revprops,
00245 
00246   /** The repository format got bumped. @since New in 1.9. */
00247   svn_repos_notify_format_bumped,
00248 
00249   /** A revision range was copied. @since New in 1.9. */
00250   svn_repos_notify_hotcopy_rev_range
00251 } svn_repos_notify_action_t;
00252 
00253 /** The type of warning occurring.
00254  *
00255  * @since New in 1.7.
00256  */
00257 typedef enum svn_repos_notify_warning_t
00258 {
00259   /** Referencing copy source data from a revision earlier than the
00260    * first revision dumped. */
00261   svn_repos_notify_warning_found_old_reference,
00262 
00263   /** An #SVN_PROP_MERGEINFO property's encoded mergeinfo references a
00264    * revision earlier than the first revision dumped. */
00265   svn_repos_notify_warning_found_old_mergeinfo,
00266 
00267   /** Found an invalid path in the filesystem.
00268    * @see svn_fs.h:"Directory entry names and directory paths" */
00269   /* ### TODO(doxygen): make that a proper doxygen link */
00270   /* See svn_fs__path_valid(). */
00271   svn_repos_notify_warning_invalid_fspath,
00272 
00273   /**
00274    * Detected a name collision. Reported when the names of two or more
00275    * entries in the same directory differ only in character
00276    * representation (normalization), but are otherwise identical.
00277    *
00278    * @since New in 1.9.
00279    */
00280   svn_repos_notify_warning_name_collision,
00281 
00282   /**
00283    * Detected a mergeinfo path collision. Reported when the paths in
00284    * two or more entries in the same svn:mergeinfo property differ
00285    * only in character representation (normalization), but are
00286    * otherwise identical.
00287    *
00288    * @since New in 1.9.
00289    */
00290   svn_repos_notify_warning_mergeinfo_collision,
00291 
00292   /**
00293    * Detected invalid mergeinfo.
00294    *
00295    * @since New in 1.9.
00296    */
00297   svn_repos_notify_warning_invalid_mergeinfo
00298 } svn_repos_notify_warning_t;
00299 
00300 /**
00301  * Structure used by #svn_repos_notify_func_t.
00302  *
00303  * The only field guaranteed to be populated is @c action.  Other fields are
00304  * dependent upon the @c action.  (See individual fields for more information.)
00305  *
00306  * @note Callers of notification functions should use
00307  * svn_repos_notify_create() to create structures of this type to allow for
00308  * future extensibility.
00309  *
00310  * @since New in 1.7.
00311  */
00312 typedef struct svn_repos_notify_t
00313 {
00314   /** Action that describes what happened in the repository. */
00315   svn_repos_notify_action_t action;
00316 
00317   /** For #svn_repos_notify_dump_rev_end and #svn_repos_notify_verify_rev_end,
00318    * the revision which just completed.
00319    * For #svn_fs_upgrade_format_bumped, the new format version. */
00320   svn_revnum_t revision;
00321 
00322   /** For #svn_repos_notify_warning, the warning message. */
00323   const char *warning_str;
00324   /** For #svn_repos_notify_warning, the warning type. */
00325   svn_repos_notify_warning_t warning;
00326 
00327   /** For #svn_repos_notify_pack_shard_start,
00328       #svn_repos_notify_pack_shard_end,
00329       #svn_repos_notify_pack_revprops,
00330       #svn_repos_notify_cleanup_revprops
00331       #svn_repos_notify_pack_shard_start_revprop, and
00332       #svn_repos_notify_pack_shard_end_revprop, the shard processed. */
00333   apr_int64_t shard;
00334 
00335   /** For #svn_repos_notify_load_txn_committed, the revision committed. */
00336   svn_revnum_t new_revision;
00337 
00338   /** For #svn_repos_notify_load_txn_committed, the source revision, if
00339       different from @a new_revision, otherwise #SVN_INVALID_REVNUM.
00340       For #svn_repos_notify_load_txn_start and
00341       #svn_repos_notify_load_skipped_rev, the source revision. */
00342   svn_revnum_t old_revision;
00343 
00344   /** For #svn_repos_notify_load_node_start, the action being taken on the
00345       node. */
00346   enum svn_node_action node_action;
00347 
00348   /** For #svn_repos_notify_load_node_start, the path of the node. */
00349   const char *path;
00350 
00351   /** For #svn_repos_notify_failure, this error chain indicates what
00352       went wrong during verification.
00353       @since New in 1.9. */
00354   svn_error_t *err;
00355 
00356   /** For #svn_repos_notify_hotcopy_rev_range, the start of the copied
00357       revision range.
00358       @since New in 1.9. */
00359   svn_revnum_t start_revision;
00360 
00361   /** For #svn_repos_notify_hotcopy_rev_range, the end of the copied
00362       revision range (might be the same as @a start_revision).
00363       @since New in 1.9. */
00364   svn_revnum_t end_revision;
00365 
00366   /* NOTE: Add new fields at the end to preserve binary compatibility.
00367      Also, if you add fields here, you have to update
00368      svn_repos_notify_create(). */
00369 } svn_repos_notify_t;
00370 
00371 /** Callback for providing notification from the repository.
00372  * Returns @c void.  Justification: success of an operation is not dependent
00373  * upon successful notification of that operation.
00374  *
00375  * @since New in 1.7. */
00376 typedef void (*svn_repos_notify_func_t)(void *baton,
00377                                         const svn_repos_notify_t *notify,
00378                                         apr_pool_t *scratch_pool);
00379 
00380 /**
00381  * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize
00382  * and return it.
00383  *
00384  * @since New in 1.7.
00385  */
00386 svn_repos_notify_t *
00387 svn_repos_notify_create(svn_repos_notify_action_t action,
00388                         apr_pool_t *result_pool);
00389 
00390 /** @} */
00391 
00392 
00393 /** The repository object. */
00394 typedef struct svn_repos_t svn_repos_t;
00395 
00396 /* Opening and creating repositories. */
00397 
00398 
00399 /** Find the root path of the repository that contains @a path.
00400  *
00401  * If a repository was found, the path to the root of the repository
00402  * is returned, else @c NULL. The pointer to the returned path may be
00403  * equal to @a path.
00404  */
00405 const char *
00406 svn_repos_find_root_path(const char *path,
00407                          apr_pool_t *pool);
00408 
00409 /** Set @a *repos_p to a repository object for the repository at @a path.
00410  *
00411  * Allocate @a *repos_p in @a result_pool.
00412  *
00413  * Acquires a shared lock on the repository, and attaches a cleanup
00414  * function to @a result_pool to remove the lock.  If no lock can be acquired,
00415  * returns error, with undefined effect on @a *repos_p.  If an exclusive
00416  * lock is present, this blocks until it's gone.  @a fs_config will be
00417  * passed to the filesystem initialization function and may be @c NULL.
00418  *
00419  * Use @a scratch_pool for temporary allocations.
00420  *
00421  * @since New in 1.9.
00422  */
00423 svn_error_t *
00424 svn_repos_open3(svn_repos_t **repos_p,
00425                 const char *path,
00426                 apr_hash_t *fs_config,
00427                 apr_pool_t *result_pool,
00428                 apr_pool_t *scratch_pool);
00429 
00430 /** Similar to svn_repos_open3() but without @a scratch_pool.
00431  *
00432  * @deprecated Provided for backward compatibility with 1.8 API.
00433  * @since New in 1.7.
00434  */
00435 SVN_DEPRECATED
00436 svn_error_t *
00437 svn_repos_open2(svn_repos_t **repos_p,
00438                 const char *path,
00439                 apr_hash_t *fs_config,
00440                 apr_pool_t *pool);
00441 
00442 /** Similar to svn_repos_open2() with @a fs_config set to NULL.
00443  *
00444  * @deprecated Provided for backward compatibility with 1.6 API.
00445  */
00446 SVN_DEPRECATED
00447 svn_error_t *
00448 svn_repos_open(svn_repos_t **repos_p,
00449                const char *path,
00450                apr_pool_t *pool);
00451 
00452 /** Create a new Subversion repository at @a path, building the necessary
00453  * directory structure, creating the filesystem, and so on.
00454  * Return the repository object in @a *repos_p, allocated in @a pool.
00455  *
00456  * @a config is a client configuration hash of #svn_config_t * items
00457  * keyed on config category names, and may be NULL.
00458  *
00459  * @a fs_config is passed to the filesystem, and may be NULL.
00460  *
00461  * @a unused_1 and @a unused_2 are not used and should be NULL.
00462  */
00463 svn_error_t *
00464 svn_repos_create(svn_repos_t **repos_p,
00465                  const char *path,
00466                  const char *unused_1,
00467                  const char *unused_2,
00468                  apr_hash_t *config,
00469                  apr_hash_t *fs_config,
00470                  apr_pool_t *pool);
00471 
00472 /**
00473  * Upgrade the Subversion repository (and its underlying versioned
00474  * filesystem) located in the directory @a path to the latest version
00475  * supported by this library.  If the requested upgrade is not
00476  * supported due to the current state of the repository or it
00477  * underlying filesystem, return #SVN_ERR_REPOS_UNSUPPORTED_UPGRADE
00478  * or #SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no
00479  * changes to the repository or filesystem.
00480  *
00481  * Acquires an exclusive lock on the repository, upgrades the
00482  * repository, and releases the lock.  If an exclusive lock can't be
00483  * acquired, returns error.
00484  *
00485  * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
00486  * returned if the lock is not immediately available.
00487  *
00488  * If @a start_callback is not NULL, it will be called with @a
00489  * start_callback_baton as argument before the upgrade starts, but
00490  * after the exclusive lock has been acquired.
00491  *
00492  * Use @a pool for necessary allocations.
00493  *
00494  * @note This functionality is provided as a convenience for
00495  * administrators wishing to make use of new Subversion functionality
00496  * without a potentially costly full repository dump/load.  As such,
00497  * the operation performs only the minimum amount of work needed to
00498  * accomplish this while maintaining the integrity of the repository.
00499  * It does *not* guarantee the most optimized repository state as a
00500  * dump and subsequent load would.
00501  *
00502  * @note On some platforms the exclusive lock does not exclude other
00503  * threads in the same process so this function should only be called
00504  * by a single threaded process, or by a multi-threaded process when
00505  * no other threads are accessing the repository.
00506  *
00507  * @since New in 1.7.
00508  */
00509 svn_error_t *
00510 svn_repos_upgrade2(const char *path,
00511                    svn_boolean_t nonblocking,
00512                    svn_repos_notify_func_t notify_func,
00513                    void *notify_baton,
00514                    apr_pool_t *pool);
00515 
00516 /**
00517  * Similar to svn_repos_upgrade2(), but with @a start_callback and baton,
00518  * rather than a notify_callback / baton
00519  *
00520  * @since New in 1.5.
00521  * @deprecated Provided for backward compatibility with the 1.6 API.
00522  */
00523 SVN_DEPRECATED
00524 svn_error_t *
00525 svn_repos_upgrade(const char *path,
00526                   svn_boolean_t nonblocking,
00527                   svn_error_t *(*start_callback)(void *baton),
00528                   void *start_callback_baton,
00529                   apr_pool_t *pool);
00530 
00531 /** Destroy the Subversion repository found at @a path, using @a pool for any
00532  * necessary allocations.
00533  */
00534 svn_error_t *
00535 svn_repos_delete(const char *path,
00536                  apr_pool_t *pool);
00537 
00538 
00539 /** @defgroup svn_repos_capabilities Repository capabilities
00540  * @{
00541  */
00542 
00543 /**
00544  * Set @a *has to TRUE if @a repos has @a capability (one of the
00545  * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set
00546  * @a *has to FALSE.
00547  *
00548  * If @a capability isn't recognized, throw #SVN_ERR_UNKNOWN_CAPABILITY,
00549  * with the effect on @a *has undefined.
00550  *
00551  * Use @a pool for all allocation.
00552  *
00553  * @since New in 1.5.
00554  */
00555 svn_error_t *
00556 svn_repos_has_capability(svn_repos_t *repos,
00557                          svn_boolean_t *has,
00558                          const char *capability,
00559                          apr_pool_t *pool);
00560 
00561 /**
00562  * Return a set of @a capabilities supported by the running Subversion
00563  * library and by @a repos.  (Capabilities supported by this version of
00564  * Subversion but not by @a repos are not listed.  This may happen when
00565  * svn_repos_upgrade2() has not been called after a software upgrade.)
00566  *
00567  * The set is represented as a hash whose const char * keys are the set
00568  * members.  The values are not defined.
00569  *
00570  * Allocate @a capabilities in @a result_pool and use @a scratch_pool for
00571  * temporary allocations.
00572  *
00573  * @see svn_repos_info_format
00574  *
00575  * @since New in 1.9.
00576  */
00577 svn_error_t *
00578 svn_repos_capabilities(apr_hash_t **capabilities,
00579                        svn_repos_t *repos,
00580                        apr_pool_t *result_pool,
00581                        apr_pool_t *scratch_pool);
00582 
00583 /**
00584  * The capability of doing the right thing with merge-tracking
00585  * information, both storing it and responding to queries about it.
00586  *
00587  * @since New in 1.5.
00588  */
00589 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo"
00590 /*       *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY ***
00591  *
00592  * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to
00593  * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid
00594  * colons for their own reasons.  While this RA limitation has no
00595  * direct impact on repository capabilities, there's no reason to be
00596  * gratuitously different either.
00597  *
00598  * If you add a capability, update svn_repos_capabilities().
00599  */
00600 
00601 /** @} */
00602 
00603 
00604 /**
00605  * Store in @a repos the client-reported capabilities @a capabilities,
00606  * which must be allocated in memory at least as long-lived as @a repos.
00607  *
00608  * The elements of @a capabilities are 'const char *', a subset of
00609  * the constants beginning with @c SVN_RA_CAPABILITY_.
00610  * @a capabilities is not copied, so changing it later will affect
00611  * what is remembered by @a repos.
00612  *
00613  * @note The capabilities are passed along to the start-commit hook;
00614  * see that hook's template for details.
00615  *
00616  * @note As of Subversion 1.5, there are no error conditions defined,
00617  * so this always returns SVN_NO_ERROR.  In future releases it may
00618  * return error, however, so callers should check.
00619  *
00620  * @since New in 1.5.
00621  */
00622 svn_error_t *
00623 svn_repos_remember_client_capabilities(svn_repos_t *repos,
00624                                        const apr_array_header_t *capabilities);
00625 
00626 
00627 /** Return the filesystem associated with repository object @a repos. */
00628 svn_fs_t *
00629 svn_repos_fs(svn_repos_t *repos);
00630 
00631 /** Return the type of filesystem associated with repository object
00632  * @a repos allocated in @a result_pool.
00633  *
00634  * @see #svn_fs_backend_names
00635  *
00636  * @since New in 1.9.
00637  */
00638 const char *
00639 svn_repos_fs_type(svn_repos_t *repos,
00640                   apr_pool_t *result_pool);
00641 
00642 /** Make a hot copy of the Subversion repository found at @a src_path
00643  * to @a dst_path.
00644  *
00645  * Copy a possibly live Subversion repository from @a src_path to
00646  * @a dst_path.  If @a clean_logs is @c TRUE, perform cleanup on the
00647  * source filesystem as part of the copy operation; currently, this
00648  * means deleting copied, unused logfiles for a Berkeley DB source
00649  * repository.
00650  *
00651  * If @a incremental is TRUE, make an effort to not re-copy information
00652  * already present in the destination. If incremental hotcopy is not
00653  * implemented by the filesystem backend, raise SVN_ERR_UNSUPPORTED_FEATURE.
00654  *
00655  * For each revision range copied, the @a notify_func function will be
00656  * called with the @a notify_baton and a notification structure containing
00657  * appropriate values in @c start_revision and @c end_revision (both
00658  * inclusive). @c start_revision might be equal to @c end_revision in
00659  * case the copied range consists of a single revision.  Currently, this
00660  * notification is not triggered by the BDB backend. @a notify_func
00661  * may be @c NULL if this notification is not required.
00662  *
00663  * The optional @a cancel_func callback will be invoked with
00664  * @a cancel_baton as usual to allow the user to preempt this potentially
00665  * lengthy operation.
00666  * 
00667  * Use @a scratch_pool for temporary allocations.
00668  *
00669  * @since New in 1.9.
00670  */
00671 svn_error_t *
00672 svn_repos_hotcopy3(const char *src_path,
00673                    const char *dst_path,
00674                    svn_boolean_t clean_logs,
00675                    svn_boolean_t incremental,
00676                    svn_repos_notify_func_t notify_func,
00677                    void *notify_baton,
00678                    svn_cancel_func_t cancel_func,
00679                    void *cancel_baton,
00680                    apr_pool_t *scratch_pool);
00681 
00682 /**
00683  * Like svn_repos_hotcopy3(), but with @a notify_func and @a notify_baton
00684  * always passed as @c NULL.
00685  *
00686  * @since New in 1.8.
00687  * @deprecated Provided for backward compatibility with the 1.8 API.
00688  */
00689 SVN_DEPRECATED
00690 svn_error_t *
00691 svn_repos_hotcopy2(const char *src_path,
00692                    const char *dst_path,
00693                    svn_boolean_t clean_logs,
00694                    svn_boolean_t incremental,
00695                    svn_cancel_func_t cancel_func,
00696                    void *cancel_baton,
00697                    apr_pool_t *pool);
00698 
00699 /**
00700  * Like svn_repos_hotcopy2(), but with @a incremental always passed as
00701  * @c FALSE and without cancellation support.
00702  *
00703  * @deprecated Provided for backward compatibility with the 1.6 API.
00704  */
00705 SVN_DEPRECATED
00706 svn_error_t *
00707 svn_repos_hotcopy(const char *src_path,
00708                   const char *dst_path,
00709                   svn_boolean_t clean_logs,
00710                   apr_pool_t *pool);
00711 
00712 
00713 /**
00714  * Possibly update the repository, @a repos, to use a more efficient
00715  * filesystem representation.  Use @a pool for allocations.
00716  *
00717  * @since New in 1.7.
00718  */
00719 svn_error_t *
00720 svn_repos_fs_pack2(svn_repos_t *repos,
00721                    svn_repos_notify_func_t notify_func,
00722                    void *notify_baton,
00723                    svn_cancel_func_t cancel_func,
00724                    void *cancel_baton,
00725                    apr_pool_t *pool);
00726 
00727 /**
00728  * Similar to svn_repos_fs_pack2(), but with a #svn_fs_pack_notify_t instead
00729  * of a #svn_repos_notify_t.
00730  *
00731  * @since New in 1.6.
00732  * @deprecated Provided for backward compatibility with the 1.6 API.
00733  */
00734 SVN_DEPRECATED
00735 svn_error_t *
00736 svn_repos_fs_pack(svn_repos_t *repos,
00737                   svn_fs_pack_notify_t notify_func,
00738                   void *notify_baton,
00739                   svn_cancel_func_t cancel_func,
00740                   void *cancel_baton,
00741                   apr_pool_t *pool);
00742 
00743 /**
00744  * Run database recovery procedures on the repository at @a path,
00745  * returning the database to a consistent state.  Use @a pool for all
00746  * allocation.
00747  *
00748  * Acquires an exclusive lock on the repository, recovers the
00749  * database, and releases the lock.  If an exclusive lock can't be
00750  * acquired, returns error.
00751  *
00752  * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
00753  * returned if the lock is not immediately available.
00754  *
00755  * If @a notify_func is not NULL, it will be called with @a
00756  * notify_baton as argument before the recovery starts, but
00757  * after the exclusive lock has been acquired.
00758  *
00759  * If @a cancel_func is not @c NULL, it is called periodically with
00760  * @a cancel_baton as argument to see if the client wishes to cancel
00761  * the recovery.
00762  *
00763  * @note On some platforms the exclusive lock does not exclude other
00764  * threads in the same process so this function should only be called
00765  * by a single threaded process, or by a multi-threaded process when
00766  * no other threads are accessing the repository.
00767  *
00768  * @since New in 1.7.
00769  */
00770 svn_error_t *
00771 svn_repos_recover4(const char *path,
00772                    svn_boolean_t nonblocking,
00773                    svn_repos_notify_func_t notify_func,
00774                    void *notify_baton,
00775                    svn_cancel_func_t cancel_func,
00776                    void * cancel_baton,
00777                    apr_pool_t *pool);
00778 
00779 /**
00780  * Similar to svn_repos_recover4(), but with @a start callback in place of
00781  * the notify_func / baton.
00782  *
00783  * @since New in 1.5.
00784  * @deprecated Provided for backward compatibility with the 1.6 API.
00785  */
00786 SVN_DEPRECATED
00787 svn_error_t *
00788 svn_repos_recover3(const char *path,
00789                    svn_boolean_t nonblocking,
00790                    svn_error_t *(*start_callback)(void *baton),
00791                    void *start_callback_baton,
00792                    svn_cancel_func_t cancel_func,
00793                    void * cancel_baton,
00794                    apr_pool_t *pool);
00795 
00796 /**
00797  * Similar to svn_repos_recover3(), but without cancellation support.
00798  *
00799  * @deprecated Provided for backward compatibility with the 1.4 API.
00800  */
00801 SVN_DEPRECATED
00802 svn_error_t *
00803 svn_repos_recover2(const char *path,
00804                    svn_boolean_t nonblocking,
00805                    svn_error_t *(*start_callback)(void *baton),
00806                    void *start_callback_baton,
00807                    apr_pool_t *pool);
00808 
00809 /**
00810  * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and
00811  * with no callbacks provided.
00812  *
00813  * @deprecated Provided for backward compatibility with the 1.0 API.
00814  */
00815 SVN_DEPRECATED
00816 svn_error_t *
00817 svn_repos_recover(const char *path,
00818                   apr_pool_t *pool);
00819 
00820 /**
00821  * Callback for svn_repos_freeze.
00822  *
00823  * @since New in 1.8.
00824  */
00825 typedef svn_error_t *(*svn_repos_freeze_func_t)(void *baton, apr_pool_t *pool);
00826 
00827 /**
00828  * Take an exclusive lock on each of the repositories in @a paths to
00829  * prevent commits and then while holding all the locks invoke @a
00830  * freeze_func passing @a freeze_baton.  Each repository may be readable by
00831  * Subversion while frozen, or may be unreadable, depending on which
00832  * FS backend the repository uses.  Repositories are locked in the
00833  * order in which they are specified in the array.
00834  *
00835  * @note @a freeze_func must not, directly or indirectly, call any function
00836  * that attempts to take out a lock on the underlying repository.  These
00837  * include functions for packing, hotcopying, setting revprops and commits.
00838  * Attempts to do so may result in a deadlock.
00839  *
00840  * @note On some platforms the exclusive lock does not exclude other
00841  * threads in the same process so this function should only be called
00842  * by a single threaded process, or by a multi-threaded process when
00843  * no other threads are accessing the repositories.
00844  *
00845  * @since New in 1.8.
00846  */
00847 svn_error_t *
00848 svn_repos_freeze(apr_array_header_t *paths,
00849                  svn_repos_freeze_func_t freeze_func,
00850                  void *freeze_baton,
00851                  apr_pool_t *pool);
00852 
00853 /** This function is a wrapper around svn_fs_berkeley_logfiles(),
00854  * returning log file paths relative to the root of the repository.
00855  *
00856  * @copydoc svn_fs_berkeley_logfiles()
00857  */
00858 svn_error_t *
00859 svn_repos_db_logfiles(apr_array_header_t **logfiles,
00860                       const char *path,
00861                       svn_boolean_t only_unused,
00862                       apr_pool_t *pool);
00863 
00864 
00865 
00866 /* Repository Paths */
00867 
00868 /** Return the top-level repository path allocated in @a pool. */
00869 const char *
00870 svn_repos_path(svn_repos_t *repos,
00871                apr_pool_t *pool);
00872 
00873 /** Return the path to @a repos's filesystem directory, allocated in
00874  * @a pool.
00875  */
00876 const char *
00877 svn_repos_db_env(svn_repos_t *repos,
00878                  apr_pool_t *pool);
00879 
00880 /** Return path to @a repos's config directory, allocated in @a pool. */
00881 const char *
00882 svn_repos_conf_dir(svn_repos_t *repos,
00883                    apr_pool_t *pool);
00884 
00885 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */
00886 const char *
00887 svn_repos_svnserve_conf(svn_repos_t *repos,
00888                         apr_pool_t *pool);
00889 
00890 /** Return path to @a repos's lock directory, allocated in @a pool. */
00891 const char *
00892 svn_repos_lock_dir(svn_repos_t *repos,
00893                    apr_pool_t *pool);
00894 
00895 /** Return path to @a repos's db lockfile, allocated in @a pool. */
00896 const char *
00897 svn_repos_db_lockfile(svn_repos_t *repos,
00898                       apr_pool_t *pool);
00899 
00900 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */
00901 const char *
00902 svn_repos_db_logs_lockfile(svn_repos_t *repos,
00903                            apr_pool_t *pool);
00904 
00905 /** Return the path to @a repos's hook directory, allocated in @a pool. */
00906 const char *
00907 svn_repos_hook_dir(svn_repos_t *repos,
00908                    apr_pool_t *pool);
00909 
00910 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */
00911 const char *
00912 svn_repos_start_commit_hook(svn_repos_t *repos,
00913                             apr_pool_t *pool);
00914 
00915 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */
00916 const char *
00917 svn_repos_pre_commit_hook(svn_repos_t *repos,
00918                           apr_pool_t *pool);
00919 
00920 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */
00921 const char *
00922 svn_repos_post_commit_hook(svn_repos_t *repos,
00923                            apr_pool_t *pool);
00924 
00925 /** Return the path to @a repos's pre-revprop-change hook, allocated in
00926  * @a pool.
00927  */
00928 const char *
00929 svn_repos_pre_revprop_change_hook(svn_repos_t *repos,
00930                                   apr_pool_t *pool);
00931 
00932 /** Return the path to @a repos's post-revprop-change hook, allocated in
00933  * @a pool.
00934  */
00935 const char *
00936 svn_repos_post_revprop_change_hook(svn_repos_t *repos,
00937                                    apr_pool_t *pool);
00938 
00939 
00940 /** @defgroup svn_repos_lock_hooks Paths to lock hooks
00941  * @{
00942  * @since New in 1.2. */
00943 
00944 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */
00945 const char *
00946 svn_repos_pre_lock_hook(svn_repos_t *repos,
00947                         apr_pool_t *pool);
00948 
00949 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */
00950 const char *
00951 svn_repos_post_lock_hook(svn_repos_t *repos,
00952                          apr_pool_t *pool);
00953 
00954 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */
00955 const char *
00956 svn_repos_pre_unlock_hook(svn_repos_t *repos,
00957                           apr_pool_t *pool);
00958 
00959 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */
00960 const char *
00961 svn_repos_post_unlock_hook(svn_repos_t *repos,
00962                            apr_pool_t *pool);
00963 
00964 /** Specify that Subversion should consult the configuration file
00965  * located at @a hooks_env_path to determine how to setup the
00966  * environment for hook scripts invoked for the repository @a repos.
00967  * As a special case, if @a hooks_env_path is @c NULL, look for the
00968  * file in its default location within the repository disk structure.
00969  * If @a hooks_env_path is not absolute, it specifies a path relative
00970  * to the parent of the file's default location.
00971  *
00972  * Use @a scratch_pool for temporary allocations.
00973  *
00974  * If this function is not called, or if the specified configuration
00975  * file does not define any environment variables, hooks will run in
00976  * an empty environment.
00977  *
00978  * @since New in 1.8.
00979  */
00980 svn_error_t *
00981 svn_repos_hooks_setenv(svn_repos_t *repos,
00982                        const char *hooks_env_path,
00983                        apr_pool_t *scratch_pool);
00984 
00985 /** @} */
00986 
00987 /* ---------------------------------------------------------------*/
00988 
00989 /* Reporting the state of a working copy, for updates. */
00990 
00991 
00992 /**
00993  * Construct and return a @a report_baton that will be passed to the
00994  * other functions in this section to describe the state of a pre-existing
00995  * tree (typically, a working copy).  When the report is finished,
00996  * @a editor/@a edit_baton will be driven in such a way as to transform the
00997  * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the
00998  * reported hierarchy to @a tgt_path.
00999  *
01000  * @a fs_base is the absolute path of the node in the filesystem at which
01001  * the comparison should be rooted.  @a target is a single path component,
01002  * used to limit the scope of the report to a single entry of @a fs_base,
01003  * or "" if all of @a fs_base itself is the main subject of the report.
01004  *
01005  * @a tgt_path and @a revnum is the fs path/revision pair that is the
01006  * "target" of the delta.  @a tgt_path should be provided only when
01007  * the source and target paths of the report differ.  That is, @a tgt_path
01008  * should *only* be specified when specifying that the resultant editor
01009  * drive be one that transforms the reported hierarchy into a pristine tree
01010  * of @a tgt_path at revision @a revnum.  A @c NULL value for @a tgt_path
01011  * will indicate that the editor should be driven in such a way as to
01012  * transform the reported hierarchy to revision @a revnum, preserving the
01013  * reported hierarchy.
01014  *
01015  * @a text_deltas instructs the driver of the @a editor to enable
01016  * the generation of text deltas.
01017  *
01018  * @a ignore_ancestry instructs the driver to ignore node ancestry
01019  * when determining how to transmit differences.
01020  *
01021  * @a send_copyfrom_args instructs the driver to send 'copyfrom'
01022  * arguments to the editor's add_file() and add_directory() methods,
01023  * whenever it deems feasible.
01024  *
01025  * Use @a authz_read_func and @a authz_read_baton (if not @c NULL) to
01026  * avoid sending data through @a editor/@a edit_baton which is not
01027  * authorized for transmission.
01028  *
01029  * @a zero_copy_limit controls the maximum size (in bytes) at which
01030  * data blocks may be sent using the zero-copy code path.  On that
01031  * path, a number of in-memory copy operations have been eliminated to
01032  * maximize throughput.  However, until the whole block has been
01033  * pushed to the network stack, other clients block, so be careful
01034  * when using larger values here.  Pass 0 for @a zero_copy_limit to
01035  * disable this optimization altogether.
01036  *
01037  * @note Never activate this optimization if @a editor might access
01038  * any FSFS data structures (and, hence, caches).  So, it is basically
01039  * safe for networked editors only.
01040  *
01041  * All allocation for the context and collected state will occur in
01042  * @a pool.
01043  *
01044  * @a depth is the requested depth of the editor drive.
01045  *
01046  * If @a depth is #svn_depth_unknown, the editor will affect only the
01047  * paths reported by the individual calls to svn_repos_set_path3() and
01048  * svn_repos_link_path3().
01049  *
01050  * For example, if the reported tree is the @c A subdir of the Greek Tree
01051  * (see Subversion's test suite), at depth #svn_depth_empty, but the
01052  * @c A/B subdir is reported at depth #svn_depth_infinity, then
01053  * repository-side changes to @c A/mu, or underneath @c A/C and @c
01054  * A/D, would not be reflected in the editor drive, but changes
01055  * underneath @c A/B would be.
01056  *
01057  * Additionally, the editor driver will call @c add_directory and
01058  * and @c add_file for directories with an appropriate depth.  For
01059  * example, a directory reported at #svn_depth_files will receive
01060  * file (but not directory) additions.  A directory at #svn_depth_empty
01061  * will receive neither.
01062  *
01063  * If @a depth is #svn_depth_files, #svn_depth_immediates or
01064  * #svn_depth_infinity and @a depth is greater than the reported depth
01065  * of the working copy, then the editor driver will emit editor
01066  * operations so as to upgrade the working copy to this depth.
01067  *
01068  * If @a depth is #svn_depth_empty, #svn_depth_files,
01069  * #svn_depth_immediates and @a depth is lower
01070  * than or equal to the depth of the working copy, then the editor
01071  * operations will affect only paths at or above @a depth.
01072  *
01073  * @since New in 1.8.
01074  */
01075 svn_error_t *
01076 svn_repos_begin_report3(void **report_baton,
01077                         svn_revnum_t revnum,
01078                         svn_repos_t *repos,
01079                         const char *fs_base,
01080                         const char *target,
01081                         const char *tgt_path,
01082                         svn_boolean_t text_deltas,
01083                         svn_depth_t depth,
01084                         svn_boolean_t ignore_ancestry,
01085                         svn_boolean_t send_copyfrom_args,
01086                         const svn_delta_editor_t *editor,
01087                         void *edit_baton,
01088                         svn_repos_authz_func_t authz_read_func,
01089                         void *authz_read_baton,
01090                         apr_size_t zero_copy_limit,
01091                         apr_pool_t *pool);
01092 
01093 /**
01094  * The same as svn_repos_begin_report3(), but with @a zero_copy_limit
01095  * always passed as 0.
01096  *
01097  * @since New in 1.5.
01098  * @deprecated Provided for backward compatibility with the 1.7 API.
01099  */
01100 SVN_DEPRECATED
01101 svn_error_t *
01102 svn_repos_begin_report2(void **report_baton,
01103                         svn_revnum_t revnum,
01104                         svn_repos_t *repos,
01105                         const char *fs_base,
01106                         const char *target,
01107                         const char *tgt_path,
01108                         svn_boolean_t text_deltas,
01109                         svn_depth_t depth,
01110                         svn_boolean_t ignore_ancestry,
01111                         svn_boolean_t send_copyfrom_args,
01112                         const svn_delta_editor_t *editor,
01113                         void *edit_baton,
01114                         svn_repos_authz_func_t authz_read_func,
01115                         void *authz_read_baton,
01116                         apr_pool_t *pool);
01117 
01118 /**
01119  * The same as svn_repos_begin_report2(), but taking a boolean
01120  * @a recurse flag, and sending FALSE for @a send_copyfrom_args.
01121  *
01122  * If @a recurse is TRUE, the editor driver will drive the editor with
01123  * a depth of #svn_depth_infinity; if FALSE, then with a depth of
01124  * #svn_depth_files.
01125  *
01126  * @note @a username is ignored, and has been removed in a revised
01127  * version of this API.
01128  *
01129  * @deprecated Provided for backward compatibility with the 1.4 API.
01130  */
01131 SVN_DEPRECATED
01132 svn_error_t *
01133 svn_repos_begin_report(void **report_baton,
01134                        svn_revnum_t revnum,
01135                        const char *username,
01136                        svn_repos_t *repos,
01137                        const char *fs_base,
01138                        const char *target,
01139                        const char *tgt_path,
01140                        svn_boolean_t text_deltas,
01141                        svn_boolean_t recurse,
01142                        svn_boolean_t ignore_ancestry,
01143                        const svn_delta_editor_t *editor,
01144                        void *edit_baton,
01145                        svn_repos_authz_func_t authz_read_func,
01146                        void *authz_read_baton,
01147                        apr_pool_t *pool);
01148 
01149 
01150 /**
01151  * Given a @a report_baton constructed by svn_repos_begin_report3(),
01152  * record the presence of @a path, at @a revision with depth @a depth,
01153  * in the current tree.
01154  *
01155  * @a path is relative to the anchor/target used in the creation of the
01156  * @a report_baton.
01157  *
01158  * @a revision may be SVN_INVALID_REVNUM if (for example) @a path
01159  * represents a locally-added path with no revision number, or @a
01160  * depth is #svn_depth_exclude.
01161  *
01162  * @a path may not be underneath a path on which svn_repos_set_path3()
01163  * was previously called with #svn_depth_exclude in this report.
01164  *
01165  * The first call of this in a given report usually passes an empty
01166  * @a path; this is used to set up the correct root revision for the editor
01167  * drive.
01168  *
01169  * A depth of #svn_depth_unknown is not allowed, and results in an
01170  * error.
01171  *
01172  * If @a start_empty is TRUE and @a path is a directory, then require the
01173  * caller to explicitly provide all the children of @a path - do not assume
01174  * that the tree also contains all the children of @a path at @a revision.
01175  * This is for 'low confidence' client reporting.
01176  *
01177  * If the caller has a lock token for @a path, then @a lock_token should
01178  * be set to that token.  Else, @a lock_token should be NULL.
01179  *
01180  * All temporary allocations are done in @a pool.
01181  *
01182  * @since New in 1.5.
01183  */
01184 svn_error_t *
01185 svn_repos_set_path3(void *report_baton,
01186                     const char *path,
01187                     svn_revnum_t revision,
01188                     svn_depth_t depth,
01189                     svn_boolean_t start_empty,
01190                     const char *lock_token,
01191                     apr_pool_t *pool);
01192 
01193 /**
01194  * Similar to svn_repos_set_path3(), but with @a depth set to
01195  * #svn_depth_infinity.
01196  *
01197  * @deprecated Provided for backward compatibility with the 1.4 API.
01198  */
01199 SVN_DEPRECATED
01200 svn_error_t *
01201 svn_repos_set_path2(void *report_baton,
01202                     const char *path,
01203                     svn_revnum_t revision,
01204                     svn_boolean_t start_empty,
01205                     const char *lock_token,
01206                     apr_pool_t *pool);
01207 
01208 /**
01209  * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL.
01210  *
01211  * @deprecated Provided for backward compatibility with the 1.1 API.
01212  */
01213 SVN_DEPRECATED
01214 svn_error_t *
01215 svn_repos_set_path(void *report_baton,
01216                    const char *path,
01217                    svn_revnum_t revision,
01218                    svn_boolean_t start_empty,
01219                    apr_pool_t *pool);
01220 
01221 /**
01222  * Given a @a report_baton constructed by svn_repos_begin_report3(),
01223  * record the presence of @a path in the current tree, containing the contents
01224  * of @a link_path at @a revision with depth @a depth.
01225  *
01226  * A depth of #svn_depth_unknown is not allowed, and results in an
01227  * error.
01228  *
01229  * @a path may not be underneath a path on which svn_repos_set_path3()
01230  * was previously called with #svn_depth_exclude in this report.
01231  *
01232  * Note that while @a path is relative to the anchor/target used in the
01233  * creation of the @a report_baton, @a link_path is an absolute filesystem
01234  * path!
01235  *
01236  * If @a start_empty is TRUE and @a path is a directory, then require the
01237  * caller to explicitly provide all the children of @a path - do not assume
01238  * that the tree also contains all the children of @a link_path at
01239  * @a revision.  This is for 'low confidence' client reporting.
01240  *
01241  * If the caller has a lock token for @a link_path, then @a lock_token
01242  * should be set to that token.  Else, @a lock_token should be NULL.
01243  *
01244  * All temporary allocations are done in @a pool.
01245  *
01246  * @since New in 1.5.
01247  */
01248 svn_error_t *
01249 svn_repos_link_path3(void *report_baton,
01250                      const char *path,
01251                      const char *link_path,
01252                      svn_revnum_t revision,
01253                      svn_depth_t depth,
01254                      svn_boolean_t start_empty,
01255                      const char *lock_token,
01256                      apr_pool_t *pool);
01257 
01258 /**
01259  * Similar to svn_repos_link_path3(), but with @a depth set to
01260  * #svn_depth_infinity.
01261  *
01262  * @deprecated Provided for backward compatibility with the 1.4 API.
01263  */
01264 SVN_DEPRECATED
01265 svn_error_t *
01266 svn_repos_link_path2(void *report_baton,
01267                      const char *path,
01268                      const char *link_path,
01269                      svn_revnum_t revision,
01270                      svn_boolean_t start_empty,
01271                      const char *lock_token,
01272                      apr_pool_t *pool);
01273 
01274 /**
01275  * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL.
01276  *
01277  * @deprecated Provided for backward compatibility with the 1.1 API.
01278  */
01279 SVN_DEPRECATED
01280 svn_error_t *
01281 svn_repos_link_path(void *report_baton,
01282                     const char *path,
01283                     const char *link_path,
01284                     svn_revnum_t revision,
01285                     svn_boolean_t start_empty,
01286                     apr_pool_t *pool);
01287 
01288 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
01289  * record the non-existence of @a path in the current tree.
01290  *
01291  * @a path may not be underneath a path on which svn_repos_set_path3()
01292  * was previously called with #svn_depth_exclude in this report.
01293  *
01294  * (This allows the reporter's driver to describe missing pieces of a
01295  * working copy, so that 'svn up' can recreate them.)
01296  *
01297  * All temporary allocations are done in @a pool.
01298  */
01299 svn_error_t *
01300 svn_repos_delete_path(void *report_baton,
01301                       const char *path,
01302                       apr_pool_t *pool);
01303 
01304 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
01305  * finish the report and drive the editor as specified when the report
01306  * baton was constructed.
01307  *
01308  * If an error occurs during the driving of the editor, do NOT abort the
01309  * edit; that responsibility belongs to the caller of this function, if
01310  * it happens at all.
01311  *
01312  * After the call to this function, @a report_baton is no longer valid;
01313  * it should not be passed to any other reporting functions, including
01314  * svn_repos_abort_report(), even if this function returns an error.
01315  */
01316 svn_error_t *
01317 svn_repos_finish_report(void *report_baton,
01318                         apr_pool_t *pool);
01319 
01320 
01321 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
01322  * abort the report.  This function can be called anytime before
01323  * svn_repos_finish_report() is called.
01324  *
01325  * After the call to this function, @a report_baton is no longer valid;
01326  * it should not be passed to any other reporting functions.
01327  */
01328 svn_error_t *
01329 svn_repos_abort_report(void *report_baton,
01330                        apr_pool_t *pool);
01331 
01332 
01333 /* ---------------------------------------------------------------*/
01334 
01335 /* The magical dir_delta update routines. */
01336 
01337 /** Use the provided @a editor and @a edit_baton to describe the changes
01338  * necessary for making a given node (and its descendants, if it is a
01339  * directory) under @a src_root look exactly like @a tgt_path under
01340  * @a tgt_root.  @a src_entry is the node to update.  If @a src_entry
01341  * is empty, then compute the difference between the entire tree
01342  * anchored at @a src_parent_dir under @a src_root and @a tgt_path
01343  * under @a tgt_root.  Else, describe the changes needed to update
01344  * only that entry in @a src_parent_dir.  Typically, callers of this
01345  * function will use a @a tgt_path that is the concatenation of @a
01346  * src_parent_dir and @a src_entry.
01347  *
01348  * @a src_root and @a tgt_root can both be either revision or transaction
01349  * roots.  If @a tgt_root is a revision, @a editor's set_target_revision()
01350  * will be called with the @a tgt_root's revision number, else it will
01351  * not be called at all.
01352  *
01353  * If @a authz_read_func is non-NULL, invoke it before any call to
01354  *
01355  *    @a editor->open_root
01356  *    @a editor->add_directory
01357  *    @a editor->open_directory
01358  *    @a editor->add_file
01359  *    @a editor->open_file
01360  *
01361  * passing @a tgt_root, the same path that would be passed to the
01362  * editor function in question, and @a authz_read_baton.  If the
01363  * @a *allowed parameter comes back TRUE, then proceed with the planned
01364  * editor call; else if FALSE, then invoke @a editor->absent_file or
01365  * @a editor->absent_directory as appropriate, except if the planned
01366  * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE.
01367  *
01368  * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to
01369  * the window handler returned by @a editor->apply_textdelta().
01370  *
01371  * If @a depth is #svn_depth_empty, invoke @a editor calls only on
01372  * @a src_entry (or @a src_parent_dir, if @a src_entry is empty).
01373  * If @a depth is #svn_depth_files, also invoke the editor on file
01374  * children, if any; if #svn_depth_immediates, invoke it on
01375  * immediate subdirectories as well as files; if #svn_depth_infinity,
01376  * recurse fully.
01377  *
01378  * If @a entry_props is @c TRUE, accompany each opened/added entry with
01379  * propchange editor calls that relay special "entry props" (this
01380  * is typically used only for working copy updates).
01381  *
01382  * @a ignore_ancestry instructs the function to ignore node ancestry
01383  * when determining how to transmit differences.
01384  *
01385  * Before completing successfully, this function calls @a editor's
01386  * close_edit(), so the caller should expect its @a edit_baton to be
01387  * invalid after its use with this function.
01388  *
01389  * Do any allocation necessary for the delta computation in @a pool.
01390  * This function's maximum memory consumption is at most roughly
01391  * proportional to the greatest depth of the tree under @a tgt_root, not
01392  * the total size of the delta.
01393  *
01394  * ### svn_repos_dir_delta2 is mostly superseded by the reporter
01395  * ### functionality (svn_repos_begin_report3 and friends).
01396  * ### svn_repos_dir_delta2 does allow the roots to be transaction
01397  * ### roots rather than just revision roots, and it has the
01398  * ### entry_props flag.  Almost all of Subversion's own code uses the
01399  * ### reporter instead; there are some stray references to the
01400  * ### svn_repos_dir_delta[2] in comments which should probably
01401  * ### actually refer to the reporter.
01402  *
01403  * @since New in 1.5.
01404  */
01405 svn_error_t *
01406 svn_repos_dir_delta2(svn_fs_root_t *src_root,
01407                      const char *src_parent_dir,
01408                      const char *src_entry,
01409                      svn_fs_root_t *tgt_root,
01410                      const char *tgt_path,
01411                      const svn_delta_editor_t *editor,
01412                      void *edit_baton,
01413                      svn_repos_authz_func_t authz_read_func,
01414                      void *authz_read_baton,
01415                      svn_boolean_t text_deltas,
01416                      svn_depth_t depth,
01417                      svn_boolean_t entry_props,
01418                      svn_boolean_t ignore_ancestry,
01419                      apr_pool_t *pool);
01420 
01421 /**
01422  * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass
01423  * #svn_depth_infinity for @a depth, and if @a recurse is FALSE,
01424  * pass #svn_depth_files for @a depth.
01425  *
01426  * @deprecated Provided for backward compatibility with the 1.4 API.
01427  */
01428 SVN_DEPRECATED
01429 svn_error_t *
01430 svn_repos_dir_delta(svn_fs_root_t *src_root,
01431                     const char *src_parent_dir,
01432                     const char *src_entry,
01433                     svn_fs_root_t *tgt_root,
01434                     const char *tgt_path,
01435                     const svn_delta_editor_t *editor,
01436                     void *edit_baton,
01437                     svn_repos_authz_func_t authz_read_func,
01438                     void *authz_read_baton,
01439                     svn_boolean_t text_deltas,
01440                     svn_boolean_t recurse,
01441                     svn_boolean_t entry_props,
01442                     svn_boolean_t ignore_ancestry,
01443                     apr_pool_t *pool);
01444 
01445 
01446 /** Use the provided @a editor and @a edit_baton to describe the
01447  * skeletal changes made in a particular filesystem @a root
01448  * (revision or transaction).
01449  *
01450  * Changes will be limited to those within @a base_dir, and if
01451  * @a low_water_mark is set to something other than #SVN_INVALID_REVNUM
01452  * it is assumed that the client has no knowledge of revisions prior to
01453  * @a low_water_mark.  Together, these two arguments define the portion of
01454  * the tree that the client is assumed to have knowledge of, and thus any
01455  * copies of data from outside that part of the tree will be sent in their
01456  * entirety, not as simple copies or deltas against a previous version.
01457  *
01458  * The @a editor passed to this function should be aware of the fact
01459  * that, if @a send_deltas is FALSE, calls to its change_dir_prop(),
01460  * change_file_prop(), and apply_textdelta() functions will not
01461  * contain meaningful data, and merely serve as indications that
01462  * properties or textual contents were changed.
01463  *
01464  * If @a send_deltas is @c TRUE, the text and property deltas for changes
01465  * will be sent, otherwise NULL text deltas and empty prop changes will be
01466  * used.
01467  *
01468  * If @a authz_read_func is non-NULL, it will be used to determine if the
01469  * user has read access to the data being accessed.  Data that the user
01470  * cannot access will be skipped.
01471  *
01472  * @note This editor driver passes SVN_INVALID_REVNUM for all
01473  * revision parameters in the editor interface except the copyfrom
01474  * parameter of the add_file() and add_directory() editor functions.
01475  *
01476  * @since New in 1.4.
01477  */
01478 svn_error_t *
01479 svn_repos_replay2(svn_fs_root_t *root,
01480                   const char *base_dir,
01481                   svn_revnum_t low_water_mark,
01482                   svn_boolean_t send_deltas,
01483                   const svn_delta_editor_t *editor,
01484                   void *edit_baton,
01485                   svn_repos_authz_func_t authz_read_func,
01486                   void *authz_read_baton,
01487                   apr_pool_t *pool);
01488 
01489 /**
01490  * Similar to svn_repos_replay2(), but with @a base_dir set to @c "",
01491  * @a low_water_mark set to #SVN_INVALID_REVNUM, @a send_deltas
01492  * set to @c FALSE, and @a authz_read_func and @a authz_read_baton
01493  * set to @c NULL.
01494  *
01495  * @deprecated Provided for backward compatibility with the 1.3 API.
01496  */
01497 SVN_DEPRECATED
01498 svn_error_t *
01499 svn_repos_replay(svn_fs_root_t *root,
01500                  const svn_delta_editor_t *editor,
01501                  void *edit_baton,
01502                  apr_pool_t *pool);
01503 
01504 /* ---------------------------------------------------------------*/
01505 
01506 /* Making commits. */
01507 
01508 /**
01509  * Return an @a editor and @a edit_baton to commit changes to the
01510  * filesystem of @a repos, beginning at location 'rev:@a base_path',
01511  * where "rev" is the argument given to open_root().
01512  *
01513  * @a repos is a previously opened repository.  @a repos_url_decoded is the
01514  * decoded URL to the base of the repository, and is used to check
01515  * copyfrom paths.  @a txn is a filesystem transaction object to use
01516  * during the commit, or @c NULL to indicate that this function should
01517  * create (and fully manage) a new transaction.
01518  *
01519  * Store the contents of @a revprop_table, a hash mapping <tt>const
01520  * char *</tt> property names to #svn_string_t values, as properties
01521  * of the commit transaction, including author and log message if
01522  * present.
01523  *
01524  * @note #SVN_PROP_REVISION_DATE may be present in @a revprop_table, but
01525  * it will be overwritten when the transaction is committed.
01526  *
01527  * Iff @a authz_callback is provided, check read/write authorizations
01528  * on paths accessed by editor operations.  An operation which fails
01529  * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or
01530  * SVN_ERR_AUTHZ_UNWRITABLE.
01531  *
01532  * Calling @a (*editor)->close_edit completes the commit.
01533  *
01534  * If @a commit_callback is non-NULL, then before @c close_edit returns (but
01535  * after the commit has succeeded) @c close_edit will invoke
01536  * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton,
01537  * and @a pool or some subpool thereof as arguments.  The @c repos_root field
01538  * of the #svn_commit_info_t is @c NULL.  If @a commit_callback
01539  * returns an error, that error will be returned from @c close_edit,
01540  * otherwise if there was a post-commit hook failure, then that error
01541  * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED.
01542  * (Note that prior to Subversion 1.6, @a commit_callback cannot be @c NULL;
01543  * if you don't need a callback, pass a dummy function.)
01544  *
01545  * Calling @a (*editor)->abort_edit aborts the commit, and will also
01546  * abort the commit transaction unless @a txn was supplied (not @c
01547  * NULL).  Callers who supply their own transactions are responsible
01548  * for cleaning them up (either by committing them, or aborting them).
01549  *
01550  * @since New in 1.5. Since 1.6, @a commit_callback can be @c NULL.
01551  *
01552  * @note Yes, @a repos_url_decoded is a <em>decoded</em> URL.  We realize
01553  * that's sorta wonky.  Sorry about that.
01554  *
01555  * @note Like most commit editors, the returned editor requires that the
01556  * @c copyfrom_path parameter passed to its @c add_file and @c add_directory
01557  * methods is a full, URI-encoded URL, not a relative path.
01558  */
01559 svn_error_t *
01560 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor,
01561                              void **edit_baton,
01562                              svn_repos_t *repos,
01563                              svn_fs_txn_t *txn,
01564                              const char *repos_url_decoded,
01565                              const char *base_path,
01566                              apr_hash_t *revprop_table,
01567                              svn_commit_callback2_t commit_callback,
01568                              void *commit_baton,
01569                              svn_repos_authz_callback_t authz_callback,
01570                              void *authz_baton,
01571                              apr_pool_t *pool);
01572 
01573 /**
01574  * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table
01575  * set to a hash containing @a user and @a log_msg as the
01576  * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
01577  * respectively.  @a user and @a log_msg may both be @c NULL.
01578  *
01579  * @since New in 1.4.
01580  *
01581  * @deprecated Provided for backward compatibility with the 1.4 API.
01582  */
01583 SVN_DEPRECATED
01584 svn_error_t *
01585 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor,
01586                              void **edit_baton,
01587                              svn_repos_t *repos,
01588                              svn_fs_txn_t *txn,
01589                              const char *repos_url,
01590                              const char *base_path,
01591                              const char *user,
01592                              const char *log_msg,
01593                              svn_commit_callback2_t commit_callback,
01594                              void *commit_baton,
01595                              svn_repos_authz_callback_t authz_callback,
01596                              void *authz_baton,
01597                              apr_pool_t *pool);
01598 
01599 /**
01600  * Similar to svn_repos_get_commit_editor4(), but
01601  * uses the svn_commit_callback_t type.
01602  *
01603  * @since New in 1.3.
01604  *
01605  * @deprecated Provided for backward compatibility with the 1.3 API.
01606  */
01607 SVN_DEPRECATED
01608 svn_error_t *
01609 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor,
01610                              void **edit_baton,
01611                              svn_repos_t *repos,
01612                              svn_fs_txn_t *txn,
01613                              const char *repos_url,
01614                              const char *base_path,
01615                              const char *user,
01616                              const char *log_msg,
01617                              svn_commit_callback_t callback,
01618                              void *callback_baton,
01619                              svn_repos_authz_callback_t authz_callback,
01620                              void *authz_baton,
01621                              apr_pool_t *pool);
01622 
01623 /**
01624  * Similar to svn_repos_get_commit_editor3(), but with @a
01625  * authz_callback and @a authz_baton set to @c NULL.
01626  *
01627  * @deprecated Provided for backward compatibility with the 1.2 API.
01628  */
01629 SVN_DEPRECATED
01630 svn_error_t *
01631 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor,
01632                              void **edit_baton,
01633                              svn_repos_t *repos,
01634                              svn_fs_txn_t *txn,
01635                              const char *repos_url,
01636                              const char *base_path,
01637                              const char *user,
01638                              const char *log_msg,
01639                              svn_commit_callback_t callback,
01640                              void *callback_baton,
01641                              apr_pool_t *pool);
01642 
01643 
01644 /**
01645  * Similar to svn_repos_get_commit_editor2(), but with @a txn always
01646  * set to @c NULL.
01647  *
01648  * @deprecated Provided for backward compatibility with the 1.1 API.
01649  */
01650 SVN_DEPRECATED
01651 svn_error_t *
01652 svn_repos_get_commit_editor(const svn_delta_editor_t **editor,
01653                             void **edit_baton,
01654                             svn_repos_t *repos,
01655                             const char *repos_url,
01656                             const char *base_path,
01657                             const char *user,
01658                             const char *log_msg,
01659                             svn_commit_callback_t callback,
01660                             void *callback_baton,
01661                             apr_pool_t *pool);
01662 
01663 /* ---------------------------------------------------------------*/
01664 
01665 /* Finding particular revisions. */
01666 
01667 /** Set @a *revision to the revision number in @a repos's filesystem that was
01668  * youngest at time @a tm.
01669  */
01670 svn_error_t *
01671 svn_repos_dated_revision(svn_revnum_t *revision,
01672                          svn_repos_t *repos,
01673                          apr_time_t tm,
01674                          apr_pool_t *pool);
01675 
01676 
01677 /** Given a @a root/@a path within some filesystem, return three pieces of
01678  * information allocated in @a pool:
01679  *
01680  *    - set @a *committed_rev to the revision in which the object was
01681  *      last modified.  (In fs parlance, this is the revision in which
01682  *      the particular node-rev-id was 'created'.)
01683  *
01684  *    - set @a *committed_date to the date of said revision, or @c NULL
01685  *      if not available.
01686  *
01687  *    - set @a *last_author to the author of said revision, or @c NULL
01688  *      if not available.
01689  */
01690 svn_error_t *
01691 svn_repos_get_committed_info(svn_revnum_t *committed_rev,
01692                              const char **committed_date,
01693                              const char **last_author,
01694                              svn_fs_root_t *root,
01695                              const char *path,
01696                              apr_pool_t *pool);
01697 
01698 
01699 /**
01700  * Set @a *dirent to an #svn_dirent_t associated with @a path in @a
01701  * root.  If @a path does not exist in @a root, set @a *dirent to
01702  * NULL.  Use @a pool for memory allocation.
01703  *
01704  * @since New in 1.2.
01705  */
01706 svn_error_t *
01707 svn_repos_stat(svn_dirent_t **dirent,
01708                svn_fs_root_t *root,
01709                const char *path,
01710                apr_pool_t *pool);
01711 
01712 
01713 /**
01714  * Given @a path which exists at revision @a start in @a fs, set
01715  * @a *deleted to the revision @a path was first deleted, within the
01716  * inclusive revision range bounded by @a start and @a end.  If @a path
01717  * does not exist at revision @a start or was not deleted within the
01718  * specified range, then set @a *deleted to SVN_INVALID_REVNUM.
01719  * Use @a pool for memory allocation.
01720  *
01721  * @since New in 1.5.
01722  */
01723 svn_error_t *
01724 svn_repos_deleted_rev(svn_fs_t *fs,
01725                       const char *path,
01726                       svn_revnum_t start,
01727                       svn_revnum_t end,
01728                       svn_revnum_t *deleted,
01729                       apr_pool_t *pool);
01730 
01731 
01732 /** Callback type for use with svn_repos_history().  @a path and @a
01733  * revision represent interesting history locations in the lifetime
01734  * of the path passed to svn_repos_history().  @a baton is the same
01735  * baton given to svn_repos_history().  @a pool is provided for the
01736  * convenience of the implementor, who should not expect it to live
01737  * longer than a single callback call.
01738  *
01739  * Signal to callback driver to stop processing/invoking this callback
01740  * by returning the #SVN_ERR_CEASE_INVOCATION error code.
01741  *
01742  * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
01743  */
01744 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton,
01745                                                  const char *path,
01746                                                  svn_revnum_t revision,
01747                                                  apr_pool_t *pool);
01748 
01749 /**
01750  * Call @a history_func (with @a history_baton) for each interesting
01751  * history location in the lifetime of @a path in @a fs, from the
01752  * youngest of @a end and @a start to the oldest.  Stop processing if
01753  * @a history_func returns #SVN_ERR_CEASE_INVOCATION.  Only cross
01754  * filesystem copy history if @a cross_copies is @c TRUE.  And do all
01755  * of this in @a pool.
01756  *
01757  * If @a authz_read_func is non-NULL, then use it (and @a
01758  * authz_read_baton) to verify that @a path in @a end is readable; if
01759  * not, return SVN_ERR_AUTHZ_UNREADABLE.  Also verify the readability
01760  * of every ancestral path/revision pair before pushing them at @a
01761  * history_func.  If a pair is deemed unreadable, then do not send
01762  * them; instead, immediately stop traversing history and return
01763  * SVN_NO_ERROR.
01764  *
01765  * @since New in 1.1.
01766  *
01767  * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
01768  */
01769 svn_error_t *
01770 svn_repos_history2(svn_fs_t *fs,
01771                    const char *path,
01772                    svn_repos_history_func_t history_func,
01773                    void *history_baton,
01774                    svn_repos_authz_func_t authz_read_func,
01775                    void *authz_read_baton,
01776                    svn_revnum_t start,
01777                    svn_revnum_t end,
01778                    svn_boolean_t cross_copies,
01779                    apr_pool_t *pool);
01780 
01781 /**
01782  * Similar to svn_repos_history2(), but with @a authz_read_func
01783  * and @a authz_read_baton always set to NULL.
01784  *
01785  * @deprecated Provided for backward compatibility with the 1.0 API.
01786  */
01787 SVN_DEPRECATED
01788 svn_error_t *
01789 svn_repos_history(svn_fs_t *fs,
01790                   const char *path,
01791                   svn_repos_history_func_t history_func,
01792                   void *history_baton,
01793                   svn_revnum_t start,
01794                   svn_revnum_t end,
01795                   svn_boolean_t cross_copies,
01796                   apr_pool_t *pool);
01797 
01798 
01799 /**
01800  * Set @a *locations to be a mapping of the revisions to the paths of
01801  * the file @a fs_path present at the repository in revision
01802  * @a peg_revision, where the revisions are taken out of the array
01803  * @a location_revisions.
01804  *
01805  * @a location_revisions is an array of svn_revnum_t's and @a *locations
01806  * maps 'svn_revnum_t *' to 'const char *'.
01807  *
01808  * If optional @a authz_read_func is non-NULL, then use it (and @a
01809  * authz_read_baton) to verify that the peg-object is readable.  If not,
01810  * return SVN_ERR_AUTHZ_UNREADABLE.  Also use the @a authz_read_func
01811  * to check that every path returned in the hash is readable.  If an
01812  * unreadable path is encountered, stop tracing and return
01813  * SVN_NO_ERROR.
01814  *
01815  * @a pool is used for all allocations.
01816  *
01817  * @since New in 1.1.
01818  */
01819 svn_error_t *
01820 svn_repos_trace_node_locations(svn_fs_t *fs,
01821                                apr_hash_t **locations,
01822                                const char *fs_path,
01823                                svn_revnum_t peg_revision,
01824                                const apr_array_header_t *location_revisions,
01825                                svn_repos_authz_func_t authz_read_func,
01826                                void *authz_read_baton,
01827                                apr_pool_t *pool);
01828 
01829 
01830 /**
01831  * Call @a receiver and @a receiver_baton to report successive
01832  * location segments in revisions between @a start_rev and @a end_rev
01833  * (inclusive) for the line of history identified by the peg-object @a
01834  * path in @a peg_revision (and in @a repos).
01835  *
01836  * @a end_rev may be #SVN_INVALID_REVNUM to indicate that you want
01837  * to trace the history of the object to its origin.
01838  *
01839  * @a start_rev may be #SVN_INVALID_REVNUM to indicate "the HEAD
01840  * revision".  Otherwise, @a start_rev must be younger than @a end_rev
01841  * (unless @a end_rev is #SVN_INVALID_REVNUM).
01842  *
01843  * @a peg_revision may be #SVN_INVALID_REVNUM to indicate "the HEAD
01844  * revision", and must evaluate to be at least as young as @a start_rev.
01845  *
01846  * If optional @a authz_read_func is not @c NULL, then use it (and @a
01847  * authz_read_baton) to verify that the peg-object is readable.  If
01848  * not, return #SVN_ERR_AUTHZ_UNREADABLE.  Also use the @a
01849  * authz_read_func to check that every path reported in a location
01850  * segment is readable.  If an unreadable path is encountered, report
01851  * a final (possibly truncated) location segment (if any), stop
01852  * tracing history, and return #SVN_NO_ERROR.
01853  *
01854  * @a pool is used for all allocations.
01855  *
01856  * @since New in 1.5.
01857  */
01858 svn_error_t *
01859 svn_repos_node_location_segments(svn_repos_t *repos,
01860                                  const char *path,
01861                                  svn_revnum_t peg_revision,
01862                                  svn_revnum_t start_rev,
01863                                  svn_revnum_t end_rev,
01864                                  svn_location_segment_receiver_t receiver,
01865                                  void *receiver_baton,
01866                                  svn_repos_authz_func_t authz_read_func,
01867                                  void *authz_read_baton,
01868                                  apr_pool_t *pool);
01869 
01870 
01871 /* ---------------------------------------------------------------*/
01872 
01873 /* Retrieving log messages. */
01874 
01875 
01876 /**
01877  * Invoke @a receiver with @a receiver_baton on each log message from
01878  * @a start to @a end in @a repos's filesystem.  @a start may be greater
01879  * or less than @a end; this just controls whether the log messages are
01880  * processed in descending or ascending revision number order.
01881  *
01882  * If @a start or @a end is #SVN_INVALID_REVNUM, it defaults to youngest.
01883  *
01884  * If @a paths is non-NULL and has one or more elements, then only show
01885  * revisions in which at least one of @a paths was changed (i.e., if
01886  * file, text or props changed; if dir, props or entries changed or any node
01887  * changed below it).  Each path is a <tt>const char *</tt> representing
01888  * an absolute path in the repository.  If @a paths is NULL or empty,
01889  * show all revisions regardless of what paths were changed in those
01890  * revisions.
01891  *
01892  * If @a limit is greater than zero then only invoke @a receiver on the first
01893  * @a limit logs.
01894  *
01895  * If @a discover_changed_paths, then each call to @a receiver passes a
01896  * hash mapping paths committed in that revision to information about them
01897  * as the receiver's @a changed_paths argument.
01898  * Otherwise, each call to @a receiver passes NULL for @a changed_paths.
01899  *
01900  * If @a strict_node_history is set, copy history (if any exists) will
01901  * not be traversed while harvesting revision logs for each path.
01902  *
01903  * If @a include_merged_revisions is set, log information for revisions
01904  * which have been merged to @a paths will also be returned, unless these
01905  * revisions are already part of @a start to @a end in @a repos's
01906  * filesystem, as limited by @a paths. In the latter case those revisions
01907  * are skipped and @a receiver is not invoked.
01908  *
01909  * If @a revprops is NULL, retrieve all revision properties; else, retrieve
01910  * only the revision properties named by the (const char *) array elements
01911  * (i.e. retrieve none if the array is empty).
01912  *
01913  * If any invocation of @a receiver returns error, return that error
01914  * immediately and without wrapping it.
01915  *
01916  * If @a start or @a end is a non-existent revision, return the error
01917  * #SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver.
01918  *
01919  * If optional @a authz_read_func is non-NULL, then use this function
01920  * (along with optional @a authz_read_baton) to check the readability
01921  * of each changed-path in each revision about to be "pushed" at
01922  * @a receiver.  If a revision has some changed-paths readable and
01923  * others unreadable, unreadable paths are omitted from the
01924  * changed_paths field and only svn:author and svn:date will be
01925  * available in the revprops field.  If a revision has no
01926  * changed-paths readable at all, then all paths are omitted and no
01927  * revprops are available.
01928  *
01929  * See also the documentation for #svn_log_entry_receiver_t.
01930  *
01931  * Use @a pool for temporary allocations.
01932  *
01933  * @since New in 1.5.
01934  */
01935 svn_error_t *
01936 svn_repos_get_logs4(svn_repos_t *repos,
01937                     const apr_array_header_t *paths,
01938                     svn_revnum_t start,
01939                     svn_revnum_t end,
01940                     int limit,
01941                     svn_boolean_t discover_changed_paths,
01942                     svn_boolean_t strict_node_history,
01943                     svn_boolean_t include_merged_revisions,
01944                     const apr_array_header_t *revprops,
01945                     svn_repos_authz_func_t authz_read_func,
01946                     void *authz_read_baton,
01947                     svn_log_entry_receiver_t receiver,
01948                     void *receiver_baton,
01949                     apr_pool_t *pool);
01950 
01951 /**
01952  * Same as svn_repos_get_logs4(), but with @a receiver being
01953  * #svn_log_message_receiver_t instead of #svn_log_entry_receiver_t.
01954  * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is
01955  * svn:author, svn:date, and svn:log.  If @a paths is empty, nothing
01956  * is returned.
01957  *
01958  * @since New in 1.2.
01959  * @deprecated Provided for backward compatibility with the 1.4 API.
01960  */
01961 SVN_DEPRECATED
01962 svn_error_t *
01963 svn_repos_get_logs3(svn_repos_t *repos,
01964                     const apr_array_header_t *paths,
01965                     svn_revnum_t start,
01966                     svn_revnum_t end,
01967                     int limit,
01968                     svn_boolean_t discover_changed_paths,
01969                     svn_boolean_t strict_node_history,
01970                     svn_repos_authz_func_t authz_read_func,
01971                     void *authz_read_baton,
01972                     svn_log_message_receiver_t receiver,
01973                     void *receiver_baton,
01974                     apr_pool_t *pool);
01975 
01976 
01977 /**
01978  * Same as svn_repos_get_logs3(), but with @a limit always set to 0.
01979  *
01980  * @deprecated Provided for backward compatibility with the 1.1 API.
01981  */
01982 SVN_DEPRECATED
01983 svn_error_t *
01984 svn_repos_get_logs2(svn_repos_t *repos,
01985                     const apr_array_header_t *paths,
01986                     svn_revnum_t start,
01987                     svn_revnum_t end,
01988                     svn_boolean_t discover_changed_paths,
01989                     svn_boolean_t strict_node_history,
01990                     svn_repos_authz_func_t authz_read_func,
01991                     void *authz_read_baton,
01992                     svn_log_message_receiver_t receiver,
01993                     void *receiver_baton,
01994                     apr_pool_t *pool);
01995 
01996 /**
01997  * Same as svn_repos_get_logs2(), but with @a authz_read_func and
01998  * @a authz_read_baton always set to NULL.
01999  *
02000  * @deprecated Provided for backward compatibility with the 1.0 API.
02001  */
02002 SVN_DEPRECATED
02003 svn_error_t *
02004 svn_repos_get_logs(svn_repos_t *repos,
02005                    const apr_array_header_t *paths,
02006                    svn_revnum_t start,
02007                    svn_revnum_t end,
02008                    svn_boolean_t discover_changed_paths,
02009                    svn_boolean_t strict_node_history,
02010                    svn_log_message_receiver_t receiver,
02011                    void *receiver_baton,
02012                    apr_pool_t *pool);
02013 
02014 
02015 
02016 /* ---------------------------------------------------------------*/
02017 
02018 /* Retrieving mergeinfo. */
02019 
02020 /**
02021  * Fetch the mergeinfo for @a paths at @a revision in @a repos, and
02022  * set @a *catalog to a catalog of this mergeinfo.  @a *catalog will
02023  * never be @c NULL but may be empty.
02024  *
02025  * The paths in @a paths, and the keys of @a catalog, start with '/'.
02026  *
02027  * @a inherit indicates whether explicit, explicit or inherited, or
02028  * only inherited mergeinfo for @a paths is fetched.
02029  *
02030  * If @a revision is #SVN_INVALID_REVNUM, it defaults to youngest.
02031  *
02032  * If @a include_descendants is TRUE, then additionally return the
02033  * mergeinfo for any descendant of any element of @a paths which has
02034  * the #SVN_PROP_MERGEINFO property explicitly set on it.  (Note
02035  * that inheritance is only taken into account for the elements in @a
02036  * paths; descendants of the elements in @a paths which get their
02037  * mergeinfo via inheritance are not included in @a *catalog.)
02038  *
02039  * If optional @a authz_read_func is non-NULL, then use this function
02040  * (along with optional @a authz_read_baton) to check the readability
02041  * of each path which mergeinfo was requested for (from @a paths).
02042  * Silently omit unreadable paths from the request for mergeinfo.
02043  *
02044  * Use @a pool for all allocations.
02045  *
02046  * @since New in 1.5.
02047  */
02048 svn_error_t *
02049 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
02050                            svn_repos_t *repos,
02051                            const apr_array_header_t *paths,
02052                            svn_revnum_t revision,
02053                            svn_mergeinfo_inheritance_t inherit,
02054                            svn_boolean_t include_descendants,
02055                            svn_repos_authz_func_t authz_read_func,
02056                            void *authz_read_baton,
02057                            apr_pool_t *pool);
02058 
02059 
02060 /* ---------------------------------------------------------------*/
02061 
02062 /* Retrieving multiple revisions of a file. */
02063 
02064 /**
02065  * Retrieve a subset of the interesting revisions of a file @a path in
02066  * @a repos as seen in revision @a end.  Invoke @a handler with
02067  * @a handler_baton as its first argument for each such revision.
02068  * @a pool is used for all allocations.  See svn_fs_history_prev() for
02069  * a discussion of interesting revisions.
02070  *
02071  * If optional @a authz_read_func is non-NULL, then use this function
02072  * (along with optional @a authz_read_baton) to check the readability
02073  * of the rev-path in each interesting revision encountered.
02074  *
02075  * Revision discovery happens from @a end to @a start, and if an
02076  * unreadable revision is encountered before @a start is reached, then
02077  * revision discovery stops and only the revisions from @a end to the
02078  * oldest readable revision are returned (So it will appear that @a
02079  * path was added without history in the latter revision).
02080  *
02081  * If there is an interesting revision of the file that is less than or
02082  * equal to start, the iteration will start at that revision.  Else, the
02083  * iteration will start at the first revision of the file in the repository,
02084  * which has to be less than or equal to end.  Note that if the function
02085  * succeeds, @a handler will have been called at least once.
02086  *
02087  * In a series of calls, the file contents for the first interesting revision
02088  * will be provided as a text delta against the empty file.  In the following
02089  * calls, the delta will be against the contents for the previous call.
02090  *
02091  * If @a include_merged_revisions is TRUE, revisions which a included as a
02092  * result of a merge between @a start and @a end will be included.
02093  *
02094  * Since Subversion 1.8 this function has been enabled to support reversion
02095  * the revision range for @a include_merged_revision @c FALSE reporting by
02096  * switching @a start with @a end.
02097  *
02098  * @note Prior to Subversion 1.9, this function may request delta handlers
02099  * from @a handler even for empty text deltas.  Starting with 1.9, the
02100  * delta handler / baton return arguments passed to @a handler will be
02101  * #NULL unless there is an actual difference in the file contents between
02102  * the current and the previous call.
02103  *
02104  * @since New in 1.5.
02105  */
02106 svn_error_t *
02107 svn_repos_get_file_revs2(svn_repos_t *repos,
02108                          const char *path,
02109                          svn_revnum_t start,
02110                          svn_revnum_t end,
02111                          svn_boolean_t include_merged_revisions,
02112                          svn_repos_authz_func_t authz_read_func,
02113                          void *authz_read_baton,
02114                          svn_file_rev_handler_t handler,
02115                          void *handler_baton,
02116                          apr_pool_t *pool);
02117 
02118 /**
02119  * Similar to #svn_file_rev_handler_t, but without the @a
02120  * result_of_merge parameter.
02121  *
02122  * @deprecated Provided for backward compatibility with 1.4 API.
02123  * @since New in 1.1.
02124  */
02125 typedef svn_error_t *(*svn_repos_file_rev_handler_t)
02126   (void *baton,
02127    const char *path,
02128    svn_revnum_t rev,
02129    apr_hash_t *rev_props,
02130    svn_txdelta_window_handler_t *delta_handler,
02131    void **delta_baton,
02132    apr_array_header_t *prop_diffs,
02133    apr_pool_t *pool);
02134 
02135 /**
02136  * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions
02137  * set to FALSE.
02138  *
02139  * @deprecated Provided for backward compatibility with the 1.4 API.
02140  * @since New in 1.1.
02141  */
02142 SVN_DEPRECATED
02143 svn_error_t *
02144 svn_repos_get_file_revs(svn_repos_t *repos,
02145                         const char *path,
02146                         svn_revnum_t start,
02147                         svn_revnum_t end,
02148                         svn_repos_authz_func_t authz_read_func,
02149                         void *authz_read_baton,
02150                         svn_repos_file_rev_handler_t handler,
02151                         void *handler_baton,
02152                         apr_pool_t *pool);
02153 
02154 
02155 /* ---------------------------------------------------------------*/
02156 
02157 /**
02158  * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \
02159  * routines.
02160  * @{
02161  */
02162 
02163 /** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and
02164  * post-commit hooks around the commit.  Use @a pool for any necessary
02165  * allocations.
02166  *
02167  * If the pre-commit hook fails, do not attempt to commit the
02168  * transaction and throw the original error to the caller.
02169  *
02170  * A successful commit is indicated by a valid revision value in @a
02171  * *new_rev, not if svn_fs_commit_txn() returns an error, which can
02172  * occur during its post commit FS processing.  If the transaction was
02173  * not committed, then return the associated error and do not execute
02174  * the post-commit hook.
02175  *
02176  * If the commit succeeds the post-commit hook is executed.  If the
02177  * post-commit hook returns an error, always wrap it with
02178  * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to
02179  * find the post-commit hook error in the returned error chain.  If
02180  * both svn_fs_commit_txn() and the post-commit hook return errors,
02181  * then svn_fs_commit_txn()'s error is the parent error and the
02182  * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child
02183  * error.
02184  *
02185  * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn().
02186  */
02187 svn_error_t *
02188 svn_repos_fs_commit_txn(const char **conflict_p,
02189                         svn_repos_t *repos,
02190                         svn_revnum_t *new_rev,
02191                         svn_fs_txn_t *txn,
02192                         apr_pool_t *pool);
02193 
02194 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping
02195  * <tt>const char *</tt> property names to #svn_string_t values, to
02196  * set the properties on transaction @a *txn_p.  @a repos is the
02197  * repository object which contains the filesystem.  @a rev, @a
02198  * *txn_p, and @a pool are as in svn_fs_begin_txn().
02199  *
02200  * Before a txn is created, the repository's start-commit hooks are
02201  * run; if any of them fail, no txn is created, @a *txn_p is unaffected,
02202  * and #SVN_ERR_REPOS_HOOK_FAILURE is returned.
02203  *
02204  * @note @a revprop_table may contain an #SVN_PROP_REVISION_DATE property,
02205  * which will be set on the transaction, but that will be overwritten
02206  * when the transaction is committed.
02207  *
02208  * @since New in 1.5.
02209  */
02210 svn_error_t *
02211 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
02212                                    svn_repos_t *repos,
02213                                    svn_revnum_t rev,
02214                                    apr_hash_t *revprop_table,
02215                                    apr_pool_t *pool);
02216 
02217 
02218 /**
02219  * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table
02220  * set to a hash containing @a author and @a log_msg as the
02221  * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
02222  * respectively.  @a author and @a log_msg may both be @c NULL.
02223  *
02224  * @deprecated Provided for backward compatibility with the 1.4 API.
02225  */
02226 SVN_DEPRECATED
02227 svn_error_t *
02228 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p,
02229                                   svn_repos_t *repos,
02230                                   svn_revnum_t rev,
02231                                   const char *author,
02232                                   const char *log_msg,
02233                                   apr_pool_t *pool);
02234 
02235 
02236 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding
02237  * property on transaction @a *txn_p.  @a repos is the repository object
02238  * which contains the filesystem.  @a rev, @a *txn_p, and @a pool are as in
02239  * svn_fs_begin_txn().
02240  *
02241  * ### Someday: before a txn is created, some kind of read-hook could
02242  *              be called here.
02243  *
02244  * @note This function was never fully implemented, nor used. Ignore it.
02245  * @deprecated Provided for backward compatibility with the 1.7 API.
02246  */
02247 SVN_DEPRECATED
02248 svn_error_t *
02249 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p,
02250                                   svn_repos_t *repos,
02251                                   svn_revnum_t rev,
02252                                   const char *author,
02253                                   apr_pool_t *pool);
02254 
02255 
02256 /** @} */
02257 
02258 /** @defgroup svn_repos_fs_locks Repository lock wrappers
02259  * @{
02260  */
02261 
02262 /** Like svn_fs_lock_many(), but invoke the @a repos's pre- and
02263  * post-lock hooks before and after the locking action.
02264  *
02265  * The pre-lock is run for every path in @a targets. Those targets for
02266  * which the pre-lock is successful are passed to svn_fs_lock_many and
02267  * the post-lock is run for those that are successfully locked.
02268  * Pre-lock hook errors are passed to @a lock_callback.
02269  *
02270  * For each path in @a targets @a lock_callback will be invoked
02271  * passing @a lock_baton and the lock and error that apply to path.
02272  * @a lock_callback can be NULL in which case it is not called and any
02273  * errors that would have been passed to the callback are not reported.
02274  *
02275  * If an error occurs when running the post-lock hook the error is
02276  * returned wrapped with #SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED.  If the
02277  * caller sees this error, it knows that some locks succeeded.
02278  *
02279  * The pre-lock hook may cause a different token to be used for the
02280  * lock, instead of the token supplied; see the pre-lock-hook
02281  * documentation for more.
02282  *
02283  * The lock and path passed to @a lock_callback will be allocated in
02284  * @a result_pool.  Use @a scratch_pool for temporary allocations.
02285  *
02286  * @note This function is not atomic.  If it returns an error, some targets
02287  * may remain unlocked while others may have been locked.
02288  *
02289  * @see svn_fs_lock_many
02290  *
02291  * @since New in 1.9.
02292  */
02293 svn_error_t *
02294 svn_repos_fs_lock_many(svn_repos_t *repos,
02295                        apr_hash_t *lock_targets,
02296                        const char *comment,
02297                        svn_boolean_t is_dav_comment,
02298                        apr_time_t expiration_date,
02299                        svn_boolean_t steal_lock,
02300                        svn_fs_lock_callback_t lock_callback,
02301                        void *lock_baton,
02302                        apr_pool_t *result_pool,
02303                        apr_pool_t *scratch_pool);
02304 
02305 /** Similar to svn_repos_fs_lock_many() but locks only a single path.
02306  *
02307  * @since New in 1.2.
02308  */
02309 svn_error_t *
02310 svn_repos_fs_lock(svn_lock_t **lock,
02311                   svn_repos_t *repos,
02312                   const char *path,
02313                   const char *token,
02314                   const char *comment,
02315                   svn_boolean_t is_dav_comment,
02316                   apr_time_t expiration_date,
02317                   svn_revnum_t current_rev,
02318                   svn_boolean_t steal_lock,
02319                   apr_pool_t *pool);
02320 
02321 
02322 /** Like svn_fs_unlock_many(), but invoke the @a repos's pre- and
02323  * post-unlock hooks before and after the unlocking action.
02324  *
02325  * The pre-unlock hook is run for every path in @a targets. Those
02326  * targets for which the pre-unlock is successful are passed to
02327  * svn_fs_unlock_many and the post-unlock is run for those that are
02328  * successfully unlocked. Pre-unlock hook errors are passed to @a
02329  * lock_callback.
02330  *
02331  * For each path in @a targets @a lock_callback will be invoked
02332  * passing @a lock_baton and error that apply to path.  The lock
02333  * passed to the callback will be NULL.  @a lock_callback can be NULL
02334  * in which case it is not called and any errors that would have been
02335  * passed to the callback are not reported.
02336  *
02337  * If an error occurs when running the post-unlock hook, return the
02338  * original error wrapped with #SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED.
02339  * If the caller sees this error, it knows that some unlocks
02340  * succeeded.
02341  *
02342  * The path passed to @a lock_callback will be allocated in @a result_pool.
02343  * Use @a scratch_pool for temporary allocations.
02344  *
02345  * @note This function is not atomic.  If it returns an error, some targets
02346  * may remain locked while others may have been unlocked.
02347  *
02348  * @see svn_fs_unlock_many
02349  *
02350  * @since New in 1.9.
02351  */
02352 svn_error_t *
02353 svn_repos_fs_unlock_many(svn_repos_t *repos,
02354                          apr_hash_t *unlock_targets,
02355                          svn_boolean_t break_lock,
02356                          svn_fs_lock_callback_t lock_callback,
02357                          void *lock_baton,
02358                          apr_pool_t *result_pool,
02359                          apr_pool_t *scratch_pool);
02360 
02361 /** Similar to svn_repos_fs_unlock_many() but only unlocks a single path.
02362  *
02363  * @since New in 1.2.
02364  */
02365 svn_error_t *
02366 svn_repos_fs_unlock(svn_repos_t *repos,
02367                     const char *path,
02368                     const char *token,
02369                     svn_boolean_t break_lock,
02370                     apr_pool_t *pool);
02371 
02372 
02373 
02374 /** Look up all the locks in and under @a path in @a repos, setting @a
02375  * *locks to a hash which maps <tt>const char *</tt> paths to the
02376  * #svn_lock_t locks associated with those paths.  Use @a
02377  * authz_read_func and @a authz_read_baton to "screen" all returned
02378  * locks.  That is: do not return any locks on any paths that are
02379  * unreadable in HEAD, just silently omit them.
02380  *
02381  * @a depth limits the returned locks to those associated with paths
02382  * within the specified depth of @a path, and must be one of the
02383  * following values:  #svn_depth_empty, #svn_depth_files,
02384  * #svn_depth_immediates, or #svn_depth_infinity.
02385  *
02386  * @since New in 1.7.
02387  */
02388 svn_error_t *
02389 svn_repos_fs_get_locks2(apr_hash_t **locks,
02390                         svn_repos_t *repos,
02391                         const char *path,
02392                         svn_depth_t depth,
02393                         svn_repos_authz_func_t authz_read_func,
02394                         void *authz_read_baton,
02395                         apr_pool_t *pool);
02396 
02397 /**
02398  * Similar to svn_repos_fs_get_locks2(), but with @a depth always
02399  * passed as svn_depth_infinity.
02400  *
02401  * @since New in 1.2.
02402  * @deprecated Provided for backward compatibility with the 1.6 API.
02403  */
02404 SVN_DEPRECATED
02405 svn_error_t *
02406 svn_repos_fs_get_locks(apr_hash_t **locks,
02407                        svn_repos_t *repos,
02408                        const char *path,
02409                        svn_repos_authz_func_t authz_read_func,
02410                        void *authz_read_baton,
02411                        apr_pool_t *pool);
02412 
02413 /** @} */
02414 
02415 /** @defgroup svn_repos_properties Versioned and Unversioned Properties
02416  *
02417  * Prop-changing and prop-reading wrappers for libsvn_fs routines.
02418  * @{
02419  */
02420 
02421 /**
02422  * Like svn_fs_change_rev_prop2(), but validate the name and value of the
02423  * property and invoke the @a repos's pre- and post-revprop-change hooks
02424  * around the change as specified by @a use_pre_revprop_change_hook and
02425  * @a use_post_revprop_change_hook (respectively).
02426  *
02427  * @a rev is the revision whose property to change, @a name is the
02428  * name of the property, and @a new_value is the new value of the
02429  * property.   If @a old_value_p is not @c NULL, then @a *old_value_p
02430  * is the expected current (preexisting) value of the property (or @c NULL
02431  * for "unset").  @a author is the authenticated username of the person
02432  * changing the property value, or NULL if not available.
02433  *
02434  * If @a authz_read_func is non-NULL, then use it (with @a
02435  * authz_read_baton) to validate the changed-paths associated with @a
02436  * rev.  If the revision contains any unreadable changed paths, then
02437  * return #SVN_ERR_AUTHZ_UNREADABLE.
02438  *
02439  * Validate @a name and @a new_value like the same way
02440  * svn_repos_fs_change_node_prop() does.
02441  *
02442  * Use @a pool for temporary allocations.
02443  *
02444  * @since New in 1.7.
02445  */
02446 svn_error_t *
02447 svn_repos_fs_change_rev_prop4(svn_repos_t *repos,
02448                               svn_revnum_t rev,
02449                               const char *author,
02450                               const char *name,
02451                               const svn_string_t *const *old_value_p,
02452                               const svn_string_t *new_value,
02453                               svn_boolean_t use_pre_revprop_change_hook,
02454                               svn_boolean_t use_post_revprop_change_hook,
02455                               svn_repos_authz_func_t authz_read_func,
02456                               void *authz_read_baton,
02457                               apr_pool_t *pool);
02458 
02459 /**
02460  * Similar to svn_repos_fs_change_rev_prop4(), but with @a old_value_p always
02461  * set to @c NULL.  (In other words, it is similar to
02462  * svn_fs_change_rev_prop().)
02463  *
02464  * @deprecated Provided for backward compatibility with the 1.6 API.
02465  * @since New in 1.5.
02466  */
02467 SVN_DEPRECATED
02468 svn_error_t *
02469 svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
02470                               svn_revnum_t rev,
02471                               const char *author,
02472                               const char *name,
02473                               const svn_string_t *new_value,
02474                               svn_boolean_t use_pre_revprop_change_hook,
02475                               svn_boolean_t use_post_revprop_change_hook,
02476                               svn_repos_authz_func_t authz_read_func,
02477                               void *authz_read_baton,
02478                               apr_pool_t *pool);
02479 
02480 /**
02481  * Similar to svn_repos_fs_change_rev_prop3(), but with the @a
02482  * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
02483  * always set to @c TRUE.
02484  *
02485  * @deprecated Provided for backward compatibility with the 1.4 API.
02486  */
02487 SVN_DEPRECATED
02488 svn_error_t *
02489 svn_repos_fs_change_rev_prop2(svn_repos_t *repos,
02490                               svn_revnum_t rev,
02491                               const char *author,
02492                               const char *name,
02493                               const svn_string_t *new_value,
02494                               svn_repos_authz_func_t authz_read_func,
02495                               void *authz_read_baton,
02496                               apr_pool_t *pool);
02497 
02498 /**
02499  * Similar to svn_repos_fs_change_rev_prop2(), but with the
02500  * @a authz_read_func parameter always NULL.
02501  *
02502  * @deprecated Provided for backward compatibility with the 1.0 API.
02503  */
02504 SVN_DEPRECATED
02505 svn_error_t *
02506 svn_repos_fs_change_rev_prop(svn_repos_t *repos,
02507                              svn_revnum_t rev,
02508                              const char *author,
02509                              const char *name,
02510                              const svn_string_t *new_value,
02511                              apr_pool_t *pool);
02512 
02513 
02514 
02515 /**
02516  * Set @a *value_p to the value of the property named @a propname on
02517  * revision @a rev in the filesystem opened in @a repos.  If @a rev
02518  * has no property by that name, set @a *value_p to zero.  Allocate
02519  * the result in @a pool.
02520  *
02521  * If @a authz_read_func is non-NULL, then use it (with @a
02522  * authz_read_baton) to validate the changed-paths associated with @a
02523  * rev.  If the changed-paths are all unreadable, then set @a *value_p
02524  * to zero unconditionally.  If only some of the changed-paths are
02525  * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be
02526  * fetched, but return 0 for any other property.
02527  *
02528  * @since New in 1.1.
02529  */
02530 svn_error_t *
02531 svn_repos_fs_revision_prop(svn_string_t **value_p,
02532                            svn_repos_t *repos,
02533                            svn_revnum_t rev,
02534                            const char *propname,
02535                            svn_repos_authz_func_t authz_read_func,
02536                            void *authz_read_baton,
02537                            apr_pool_t *pool);
02538 
02539 
02540 /**
02541  * Set @a *table_p to the entire property list of revision @a rev in
02542  * filesystem opened in @a repos, as a hash table allocated in @a
02543  * pool.  The table maps <tt>char *</tt> property names to
02544  * #svn_string_t * values; the names and values are allocated in @a
02545  * pool.
02546  *
02547  * If @a authz_read_func is non-NULL, then use it (with @a
02548  * authz_read_baton) to validate the changed-paths associated with @a
02549  * rev.  If the changed-paths are all unreadable, then return an empty
02550  * hash. If only some of the changed-paths are unreadable, then return
02551  * an empty hash, except for 'svn:author' and 'svn:date' properties
02552  * (assuming those properties exist).
02553  *
02554  * @since New in 1.1.
02555  */
02556 svn_error_t *
02557 svn_repos_fs_revision_proplist(apr_hash_t **table_p,
02558                                svn_repos_t *repos,
02559                                svn_revnum_t rev,
02560                                svn_repos_authz_func_t authz_read_func,
02561                                void *authz_read_baton,
02562                                apr_pool_t *pool);
02563 
02564 /** Validating wrapper for svn_fs_change_node_prop() (which see for
02565  * argument descriptions).
02566  *
02567  * If @a name's kind is not #svn_prop_regular_kind, return
02568  * #SVN_ERR_REPOS_BAD_ARGS.  If @a name is an "svn:" property, validate its
02569  * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the
02570  * property.
02571  *
02572  * @note Originally, the only properties validated were the "svn:" properties
02573  * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. For the current
02574  * validation rules see the private function svn_repos__validate_prop().
02575  */
02576 svn_error_t *
02577 svn_repos_fs_change_node_prop(svn_fs_root_t *root,
02578                               const char *path,
02579                               const char *name,
02580                               const svn_string_t *value,
02581                               apr_pool_t *pool);
02582 
02583 /**
02584  * Set @a *inherited_values to a depth-first ordered array of
02585  * #svn_prop_inherited_item_t * structures (the path_or_url members of
02586  * which are relative filesystem paths) representing the properties
02587  * inherited by @a path in @a root.  If no properties are inherited,
02588  * then set @a *inherited_values to an empty array.
02589  *
02590  * if @a propname is NULL then retrieve all explicit and/or inherited
02591  * properties.  Otherwise retrieve only the properties named @a propname.
02592  *
02593  * If optional @a authz_read_func is non-NULL, then use this function
02594  * (along with optional @a authz_read_baton) to check the readability
02595  * of each parent path from which properties are inherited. Silently omit
02596  * properties for unreadable parent paths.
02597  *
02598  * Allocate @a *inherited_props in @a result_pool.  Use @a scratch_pool for
02599  * temporary allocations.
02600  *
02601  * @since New in 1.8.
02602  */
02603 svn_error_t *
02604 svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props,
02605                                  svn_fs_root_t *root,
02606                                  const char *path,
02607                                  const char *propname,
02608                                  svn_repos_authz_func_t authz_read_func,
02609                                  void *authz_read_baton,
02610                                  apr_pool_t *result_pool,
02611                                  apr_pool_t *scratch_pool);
02612 
02613 /** Validating wrapper for svn_fs_change_txn_prop() (which see for
02614  * argument descriptions).  See svn_repos_fs_change_txn_props() for more
02615  * information.
02616  */
02617 svn_error_t *
02618 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn,
02619                              const char *name,
02620                              const svn_string_t *value,
02621                              apr_pool_t *pool);
02622 
02623 /** Validating wrapper for svn_fs_change_txn_props() (which see for
02624  * argument descriptions).  Validate properties and their values the
02625  * same way svn_repos_fs_change_node_prop() does.
02626  *
02627  * @since New in 1.5.
02628  */
02629 svn_error_t *
02630 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn,
02631                               const apr_array_header_t *props,
02632                               apr_pool_t *pool);
02633 
02634 /** @} */
02635 
02636 
02637 /* ---------------------------------------------------------------*/
02638 
02639 /**
02640  * @defgroup svn_repos_inspection Data structures and editor things for \
02641  * repository inspection.
02642  * @{
02643  *
02644  * As it turns out, the svn_repos_replay2(), svn_repos_dir_delta2() and
02645  * svn_repos_begin_report3() interfaces can be extremely useful for
02646  * examining the repository, or more exactly, changes to the repository.
02647  * These drivers allows for differences between two trees to be
02648  * described using an editor.
02649  *
02650  * By using the editor obtained from svn_repos_node_editor() with one of
02651  * the drivers mentioned above, the description of how to transform one
02652  * tree into another can be used to build an in-memory linked-list tree,
02653  * which each node representing a repository node that was changed.
02654  */
02655 
02656 /** A node in the repository. */
02657 typedef struct svn_repos_node_t
02658 {
02659   /** Node type (file, dir, etc.) */
02660   svn_node_kind_t kind;
02661 
02662   /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */
02663   char action;
02664 
02665   /** Were there any textual mods? (files only) */
02666   svn_boolean_t text_mod;
02667 
02668   /** Where there any property mods? */
02669   svn_boolean_t prop_mod;
02670 
02671   /** The name of this node as it appears in its parent's entries list */
02672   const char *name;
02673 
02674   /** The filesystem revision where this was copied from (if any) */
02675   svn_revnum_t copyfrom_rev;
02676 
02677   /** The filesystem path where this was copied from (if any) */
02678   const char *copyfrom_path;
02679 
02680   /** Pointer to the next sibling of this node */
02681   struct svn_repos_node_t *sibling;
02682 
02683   /** Pointer to the first child of this node */
02684   struct svn_repos_node_t *child;
02685 
02686   /** Pointer to the parent of this node */
02687   struct svn_repos_node_t *parent;
02688 
02689 } svn_repos_node_t;
02690 
02691 
02692 /** Set @a *editor and @a *edit_baton to an editor that, when driven by
02693  * a driver such as svn_repos_replay2(), builds an <tt>svn_repos_node_t *</tt>
02694  * tree representing the delta from @a base_root to @a root in @a
02695  * repos's filesystem.
02696  *
02697  * The editor can also be driven by svn_repos_dir_delta2() or
02698  * svn_repos_begin_report3(), but unless you have special needs,
02699  * svn_repos_replay2() is preferred.
02700  *
02701  * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root
02702  * node afterwards.
02703  *
02704  * Note that the delta includes "bubbled-up" directories; that is,
02705  * many of the directory nodes will have no prop_mods.
02706  *
02707  * Allocate the tree and its contents in @a node_pool; do all other
02708  * allocation in @a pool.
02709  */
02710 svn_error_t *
02711 svn_repos_node_editor(const svn_delta_editor_t **editor,
02712                       void **edit_baton,
02713                       svn_repos_t *repos,
02714                       svn_fs_root_t *base_root,
02715                       svn_fs_root_t *root,
02716                       apr_pool_t *node_pool,
02717                       apr_pool_t *pool);
02718 
02719 /** Return the root node of the linked-list tree generated by driving the
02720  * editor (associated with @a edit_baton) created by svn_repos_node_editor().
02721  * This is only really useful if used *after* the editor drive is completed.
02722  */
02723 svn_repos_node_t *
02724 svn_repos_node_from_baton(void *edit_baton);
02725 
02726 /**
02727  * Return repository format information for @a repos.
02728  *
02729  * Set @a *repos_format to the repository format number of @a repos, which is
02730  * an integer that increases when incompatible changes are made (such as
02731  * by #svn_repos_upgrade2).
02732  *
02733  * Set @a *supports_version to the version number of the minimum Subversion
02734  * GA release that can read and write @a repos; allocate it in
02735  * @a result_pool.  Use @a scratch_pool for temporary allocations.
02736  *
02737  * @see svn_fs_info_format, svn_repos_capabilities
02738  *
02739  * @since New in 1.9.
02740  */
02741 svn_error_t *
02742 svn_repos_info_format(int *repos_format,
02743                       svn_version_t **supports_version,
02744                       svn_repos_t *repos,
02745                       apr_pool_t *result_pool,
02746                       apr_pool_t *scratch_pool);
02747 
02748 /** @} */
02749 
02750 /* ---------------------------------------------------------------*/
02751 
02752 /**
02753  * @defgroup svn_repos_dump_load Dumping, loading and verifying filesystem data
02754  * @{
02755  *
02756  * The filesystem 'dump' format contains nothing but the abstract
02757  * structure of the filesystem -- independent of any internal node-id
02758  * schema or database back-end.  All of the data in the dumpfile is
02759  * acquired by public function calls into svn_fs.h.  Similarly, the
02760  * parser which reads the dumpfile is able to reconstruct the
02761  * filesystem using only public svn_fs.h routines.
02762  *
02763  * Thus the dump/load feature's main purpose is for *migrating* data
02764  * from one svn filesystem to another -- presumably two filesystems
02765  * which have different internal implementations.
02766  *
02767  * If you simply want to backup your filesystem, you're probably
02768  * better off using the built-in facilities of the DB backend (using
02769  * Berkeley DB's hot-backup feature, for example.)
02770  *
02771  * For a description of the dumpfile format, see
02772  * /trunk/notes/fs_dumprestore.txt.
02773  */
02774 
02775 /* The RFC822-style headers in our dumpfile format. */
02776 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER            "SVN-fs-dump-format-version"
02777 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION           3
02778 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION_DELTAS    3
02779 #define SVN_REPOS_DUMPFILE_UUID                      "UUID"
02780 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH            "Content-length"
02781 
02782 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER           "Revision-number"
02783 
02784 #define SVN_REPOS_DUMPFILE_NODE_PATH                 "Node-path"
02785 #define SVN_REPOS_DUMPFILE_NODE_KIND                 "Node-kind"
02786 #define SVN_REPOS_DUMPFILE_NODE_ACTION               "Node-action"
02787 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH        "Node-copyfrom-path"
02788 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV         "Node-copyfrom-rev"
02789 /** @since New in 1.6. */
02790 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5      "Text-copy-source-md5"
02791 /** @since New in 1.6. */
02792 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1     "Text-copy-source-sha1"
02793 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \
02794                                         SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5
02795 /** @since New in 1.6. */
02796 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5          "Text-content-md5"
02797 /** @since New in 1.6. */
02798 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1         "Text-content-sha1"
02799 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM     \
02800                                         SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5
02801 
02802 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH       "Prop-content-length"
02803 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH       "Text-content-length"
02804 
02805 /** @since New in 1.1. */
02806 #define SVN_REPOS_DUMPFILE_PROP_DELTA                "Prop-delta"
02807 /** @since New in 1.1. */
02808 #define SVN_REPOS_DUMPFILE_TEXT_DELTA                "Text-delta"
02809 /** @since New in 1.6. */
02810 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5       "Text-delta-base-md5"
02811 /** @since New in 1.6. */
02812 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1      "Text-delta-base-sha1"
02813 /** @since New in 1.5. */
02814 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM  \
02815                                         SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5
02816 
02817 /** The different policies for processing the UUID in the dumpfile. */
02818 enum svn_repos_load_uuid
02819 {
02820   /** only update uuid if the repos has no revisions. */
02821   svn_repos_load_uuid_default,
02822   /** never update uuid. */
02823   svn_repos_load_uuid_ignore,
02824   /** always update uuid. */
02825   svn_repos_load_uuid_force
02826 };
02827 
02828 /**
02829  * Verify the contents of the file system in @a repos.
02830  *
02831  * Verify the revisions from @a start_rev to @a end_rev inclusive.  If
02832  * @a start_rev is #SVN_INVALID_REVNUM, start at revision 0; if @a end_rev
02833  * is #SVN_INVALID_REVNUM, end at the head revision.  @a start_rev must be
02834  * older than or equal to @a end_rev.  If revision 0 is included in the
02835  * range, then also verify "global invariants" of the repository, as
02836  * described in svn_fs_verify().
02837  *
02838  * When a failure is found, if @a keep_going is @c TRUE then continue
02839  * verification from the next revision, otherwise stop.
02840  *
02841  * If @a check_normalization is @c TRUE, report any name collisions
02842  * within the same directory or svn:mergeinfo property where the names
02843  * differ only in character representation, but are otherwise
02844  * identical.
02845  *
02846  * If @a metadata_only is @c TRUE, backends that have a concept of separate
02847  * metadata verification will only perform that and skip the more expensive
02848  * file context reconstruction and verification.  For FSFS format 7+ and
02849  * FSX, this allows for a very fast check against external corruption.
02850  *
02851  * If @a notify_func is not null, then call it with @a notify_baton and
02852  * with a notification structure in which the fields are set as follows.
02853  * (For a warning or error notification that does not apply to a specific
02854  * revision, the revision number is #SVN_INVALID_REVNUM.)
02855  *
02856  *   For each FS-specific structure warning:
02857  *      @c action = svn_repos_notify_verify_rev_structure
02858  *      @c revision = the revision or #SVN_INVALID_REVNUM
02859  *
02860  *   For a FS-specific structure failure:
02861  *      @c action = #svn_repos_notify_failure
02862  *      @c revision = #SVN_INVALID_REVNUM
02863  *      @c err = the corresponding error chain
02864  *
02865  *   For each revision verification failure:
02866  *      @c action = #svn_repos_notify_failure
02867  *      @c revision = the revision
02868  *      @c err = the corresponding error chain
02869  *
02870  *   For each revision verification warning:
02871  *      @c action = #svn_repos_notify_warning
02872  *      @c warning and @c warning_str fields set accordingly
02873  *        ### TODO: Set @c revision = the revision?
02874  *
02875  *   For each successfully verified revision:
02876  *      @c action = #svn_repos_notify_verify_rev_end
02877  *      @c revision = the revision
02878  *
02879  *   At the end:
02880  *      @c action = svn_repos_notify_verify_end
02881  *        ### Do we really need a callback to tell us the function we
02882  *            called has reached its end and is about to return?
02883  *        ### Not sent, currently, if a FS structure error is found.
02884  *
02885  * If @a cancel_func is not @c NULL, call it periodically with @a
02886  * cancel_baton as argument to see if the caller wishes to cancel the
02887  * verification.
02888  *
02889  * Use @a scratch_pool for temporary allocation.
02890  *
02891  * Return an error if there were any failures during verification, or
02892  * #SVN_NO_ERROR if there were no failures.  A failure means an event that,
02893  * if a notification callback were provided, would send a notification
02894  * with @c action = #svn_repos_notify_failure.
02895  *
02896  * @since New in 1.9.
02897  */
02898 svn_error_t *
02899 svn_repos_verify_fs3(svn_repos_t *repos,
02900                      svn_revnum_t start_rev,
02901                      svn_revnum_t end_rev,
02902                      svn_boolean_t keep_going,
02903                      svn_boolean_t check_normalization,
02904                      svn_boolean_t metadata_only,
02905                      svn_repos_notify_func_t notify_func,
02906                      void *notify_baton,
02907                      svn_cancel_func_t cancel,
02908                      void *cancel_baton,
02909                      apr_pool_t *scratch_pool);
02910 
02911 /**
02912  * Like svn_repos_verify_fs3(), but with @a keep_going,
02913  * @a check_normalization and @a metadata_only set to @c FALSE.
02914  *
02915  * @since New in 1.7.
02916  * @deprecated Provided for backward compatibility with the 1.8 API.
02917  */
02918 SVN_DEPRECATED
02919 svn_error_t *
02920 svn_repos_verify_fs2(svn_repos_t *repos,
02921                      svn_revnum_t start_rev,
02922                      svn_revnum_t end_rev,
02923                      svn_repos_notify_func_t notify_func,
02924                      void *notify_baton,
02925                      svn_cancel_func_t cancel,
02926                      void *cancel_baton,
02927                      apr_pool_t *scratch_pool);
02928 
02929 /**
02930  * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of
02931  * handling feedback via the notify_func handler.
02932  *
02933  * If @a feedback_stream is not @c NULL, write feedback to it (lines of
02934  * the form "* Verified revision %ld\n").
02935  *
02936  * @since New in 1.5.
02937  * @deprecated Provided for backward compatibility with the 1.6 API.
02938  */
02939 SVN_DEPRECATED
02940 svn_error_t *
02941 svn_repos_verify_fs(svn_repos_t *repos,
02942                     svn_stream_t *feedback_stream,
02943                     svn_revnum_t start_rev,
02944                     svn_revnum_t end_rev,
02945                     svn_cancel_func_t cancel_func,
02946                     void *cancel_baton,
02947                     apr_pool_t *pool);
02948 
02949 /**
02950  * Dump the contents of the filesystem within already-open @a repos into
02951  * writable @a dumpstream.  If @a dumpstream is
02952  * @c NULL, this is effectively a primitive verify.  It is not complete,
02953  * however; see instead svn_repos_verify_fs3().
02954  *
02955  * Begin at revision @a start_rev, and dump every revision up through
02956  * @a end_rev.  If @a start_rev is #SVN_INVALID_REVNUM, start at revision
02957  * 0.  If @a end_rev is #SVN_INVALID_REVNUM, end at the head revision.
02958  *
02959  * If @a incremental is @c TRUE, the first revision dumped will be a diff
02960  * against the previous revision (usually it looks like a full dump of
02961  * the tree).
02962  *
02963  * If @a use_deltas is @c TRUE, output only node properties which have
02964  * changed relative to the previous contents, and output text contents
02965  * as svndiff data against the previous contents.  Regardless of how
02966  * this flag is set, the first revision of a non-incremental dump will
02967  * be done with full plain text.  A dump with @a use_deltas set cannot
02968  * be loaded by Subversion 1.0.x.
02969  *
02970  * If @a notify_func is not null, then call it with @a notify_baton and
02971  * with a notification structure in which the fields are set as follows.
02972  * (For a warning or error notification that does not apply to a specific
02973  * revision, the revision number is #SVN_INVALID_REVNUM.)
02974  *
02975  *   For each warning:
02976  *      @c action = #svn_repos_notify_warning
02977  *      @c warning and @c warning_str fields set accordingly
02978  *        ### TODO: Set @c revision = the revision or #SVN_INVALID_REVNUM?
02979  *
02980  *   For each successfully dumped revision:
02981  *      @c action = #svn_repos_notify_dump_rev_end
02982  *      @c revision = the revision
02983  *
02984  *   At the end:
02985  *      @c action = svn_repos_notify_verify_end
02986  *        ### Do we really need a callback to tell us the function we
02987  *            called has reached its end and is about to return?
02988  *
02989  *   At the end, if there were certain warnings previously:
02990  *      @c action = #svn_repos_notify_warning
02991  *      @c warning and @c warning_str fields set accordingly,
02992  *            reiterating the existence of previous warnings
02993  *        ### This is a presentation issue. Caller could do this itself.
02994  *
02995  * If @a cancel_func is not @c NULL, it is called periodically with
02996  * @a cancel_baton as argument to see if the client wishes to cancel
02997  * the dump.
02998  *
02999  * Use @a scratch_pool for temporary allocation.
03000  *
03001  * @since New in 1.7.
03002  */
03003 svn_error_t *
03004 svn_repos_dump_fs3(svn_repos_t *repos,
03005                    svn_stream_t *dumpstream,
03006                    svn_revnum_t start_rev,
03007                    svn_revnum_t end_rev,
03008                    svn_boolean_t incremental,
03009                    svn_boolean_t use_deltas,
03010                    svn_repos_notify_func_t notify_func,
03011                    void *notify_baton,
03012                    svn_cancel_func_t cancel_func,
03013                    void *cancel_baton,
03014                    apr_pool_t *scratch_pool);
03015 
03016 /**
03017  * Similar to svn_repos_dump_fs3(), but with a feedback_stream instead of
03018  * handling feedback via the notify_func handler
03019  *
03020  * @since New in 1.1.
03021  * @deprecated Provided for backward compatibility with the 1.6 API.
03022  */
03023 SVN_DEPRECATED
03024 svn_error_t *
03025 svn_repos_dump_fs2(svn_repos_t *repos,
03026                    svn_stream_t *dumpstream,
03027                    svn_stream_t *feedback_stream,
03028                    svn_revnum_t start_rev,
03029                    svn_revnum_t end_rev,
03030                    svn_boolean_t incremental,
03031                    svn_boolean_t use_deltas,
03032                    svn_cancel_func_t cancel_func,
03033                    void *cancel_baton,
03034                    apr_pool_t *pool);
03035 
03036 /**
03037  * Similar to svn_repos_dump_fs2(), but with the @a use_deltas
03038  * parameter always set to @c FALSE.
03039  *
03040  * @deprecated Provided for backward compatibility with the 1.0 API.
03041  */
03042 SVN_DEPRECATED
03043 svn_error_t *
03044 svn_repos_dump_fs(svn_repos_t *repos,
03045                   svn_stream_t *dumpstream,
03046                   svn_stream_t *feedback_stream,
03047                   svn_revnum_t start_rev,
03048                   svn_revnum_t end_rev,
03049                   svn_boolean_t incremental,
03050                   svn_cancel_func_t cancel_func,
03051                   void *cancel_baton,
03052                   apr_pool_t *pool);
03053 
03054 
03055 /**
03056  * Read and parse dumpfile-formatted @a dumpstream, reconstructing
03057  * filesystem revisions in already-open @a repos, handling uuids in
03058  * accordance with @a uuid_action.  Use @a pool for all allocation.
03059  *
03060  * If the dumpstream contains copy history that is unavailable in the
03061  * repository, an error will be thrown.
03062  *
03063  * The repository's UUID will be updated iff
03064  *   the dumpstream contains a UUID and
03065  *   @a uuid_action is not equal to #svn_repos_load_uuid_ignore and
03066  *   either the repository contains no revisions or
03067  *          @a uuid_action is equal to #svn_repos_load_uuid_force.
03068  *
03069  * If the dumpstream contains no UUID, then @a uuid_action is
03070  * ignored and the repository UUID is not touched.
03071  *
03072  * @a start_rev and @a end_rev act as filters, the lower and upper
03073  * (inclusive) range values of revisions in @a dumpstream which will
03074  * be loaded.  Either both of these values are #SVN_INVALID_REVNUM (in
03075  * which case no revision-based filtering occurs at all), or both are
03076  * valid revisions (where @a start_rev is older than or equivalent to
03077  * @a end_rev).
03078  *
03079  * If @a parent_dir is not NULL, then the parser will reparent all the
03080  * loaded nodes, from root to @a parent_dir.  The directory @a parent_dir
03081  * must be an existing directory in the repository.
03082  *
03083  * If @a use_pre_commit_hook is set, call the repository's pre-commit
03084  * hook before committing each loaded revision.
03085  *
03086  * If @a use_post_commit_hook is set, call the repository's
03087  * post-commit hook after committing each loaded revision.
03088  *
03089  * If @a validate_props is set, then validate Subversion revision and
03090  * node properties (those in the svn: namespace) against established
03091  * rules for those things.
03092  *
03093  * If @a ignore_dates is set, ignore any revision datestamps found in
03094  * @a dumpstream, allowing the revisions created by the load process
03095  * to be stamped as if they were newly created via the normal commit
03096  * process.
03097  *
03098  * If non-NULL, use @a notify_func and @a notify_baton to send notification
03099  * of events to the caller.
03100  *
03101  * If @a cancel_func is not @c NULL, it is called periodically with
03102  * @a cancel_baton as argument to see if the client wishes to cancel
03103  * the load.
03104  *
03105  * @since New in 1.9.
03106  */
03107 svn_error_t *
03108 svn_repos_load_fs5(svn_repos_t *repos,
03109                    svn_stream_t *dumpstream,
03110                    svn_revnum_t start_rev,
03111                    svn_revnum_t end_rev,
03112                    enum svn_repos_load_uuid uuid_action,
03113                    const char *parent_dir,
03114                    svn_boolean_t use_pre_commit_hook,
03115                    svn_boolean_t use_post_commit_hook,
03116                    svn_boolean_t validate_props,
03117                    svn_boolean_t ignore_dates,
03118                    svn_repos_notify_func_t notify_func,
03119                    void *notify_baton,
03120                    svn_cancel_func_t cancel_func,
03121                    void *cancel_baton,
03122                    apr_pool_t *pool);
03123 
03124 /** Similar to svn_repos_load_fs5(), but with @a ignore_dates
03125  * always passed as FALSE.
03126  *
03127  * @since New in 1.8.
03128  * @deprecated Provided for backward compatibility with the 1.8 API.
03129  */
03130 SVN_DEPRECATED
03131 svn_error_t *
03132 svn_repos_load_fs4(svn_repos_t *repos,
03133                    svn_stream_t *dumpstream,
03134                    svn_revnum_t start_rev,
03135                    svn_revnum_t end_rev,
03136                    enum svn_repos_load_uuid uuid_action,
03137                    const char *parent_dir,
03138                    svn_boolean_t use_pre_commit_hook,
03139                    svn_boolean_t use_post_commit_hook,
03140                    svn_boolean_t validate_props,
03141                    svn_repos_notify_func_t notify_func,
03142                    void *notify_baton,
03143                    svn_cancel_func_t cancel_func,
03144                    void *cancel_baton,
03145                    apr_pool_t *pool);
03146 
03147 /** Similar to svn_repos_load_fs4(), but with @a start_rev and @a
03148  * end_rev always passed as #SVN_INVALID_REVNUM.
03149  *
03150  * @since New in 1.7.
03151  * @deprecated Provided for backward compatibility with the 1.7 API.
03152  */
03153 SVN_DEPRECATED
03154 svn_error_t *
03155 svn_repos_load_fs3(svn_repos_t *repos,
03156                    svn_stream_t *dumpstream,
03157                    enum svn_repos_load_uuid uuid_action,
03158                    const char *parent_dir,
03159                    svn_boolean_t use_pre_commit_hook,
03160                    svn_boolean_t use_post_commit_hook,
03161                    svn_boolean_t validate_props,
03162                    svn_repos_notify_func_t notify_func,
03163                    void *notify_baton,
03164                    svn_cancel_func_t cancel_func,
03165                    void *cancel_baton,
03166                    apr_pool_t *pool);
03167 
03168 /**
03169  * Similar to svn_repos_load_fs3(), but with @a feedback_stream in
03170  * place of the #svn_repos_notify_func_t and baton and with
03171  * @a validate_props always FALSE.
03172  *
03173  * @since New in 1.2.
03174  * @deprecated Provided for backward compatibility with the 1.6 API.
03175  */
03176 SVN_DEPRECATED
03177 svn_error_t *
03178 svn_repos_load_fs2(svn_repos_t *repos,
03179                    svn_stream_t *dumpstream,
03180                    svn_stream_t *feedback_stream,
03181                    enum svn_repos_load_uuid uuid_action,
03182                    const char *parent_dir,
03183                    svn_boolean_t use_pre_commit_hook,
03184                    svn_boolean_t use_post_commit_hook,
03185                    svn_cancel_func_t cancel_func,
03186                    void *cancel_baton,
03187                    apr_pool_t *pool);
03188 
03189 /**
03190  * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and
03191  * @a use_post_commit_hook always @c FALSE.
03192  *
03193  * @deprecated Provided for backward compatibility with the 1.1 API.
03194  */
03195 SVN_DEPRECATED
03196 svn_error_t *
03197 svn_repos_load_fs(svn_repos_t *repos,
03198                   svn_stream_t *dumpstream,
03199                   svn_stream_t *feedback_stream,
03200                   enum svn_repos_load_uuid uuid_action,
03201                   const char *parent_dir,
03202                   svn_cancel_func_t cancel_func,
03203                   void *cancel_baton,
03204                   apr_pool_t *pool);
03205 
03206 
03207 /**
03208  * A vtable that is driven by svn_repos_parse_dumpstream3().
03209  *
03210  * @since New in 1.8.
03211  */
03212 typedef struct svn_repos_parse_fns3_t
03213 {
03214   /** The parser has discovered a new "magic header" record within the
03215    * parsing session represented by @a parse_baton.  The dump-format
03216    * version number is @a version.
03217    */
03218   svn_error_t *(*magic_header_record)(int version,
03219                                       void *parse_baton,
03220                                       apr_pool_t *pool);
03221 
03222   /** The parser has discovered a new uuid record within the parsing
03223    * session represented by @a parse_baton.  The uuid's value is
03224    * @a uuid, and it is allocated in @a pool.
03225    */
03226   svn_error_t *(*uuid_record)(const char *uuid,
03227                               void *parse_baton,
03228                               apr_pool_t *pool);
03229 
03230   /** The parser has discovered a new revision record within the
03231    * parsing session represented by @a parse_baton.  All the headers are
03232    * placed in @a headers (allocated in @a pool), which maps <tt>const
03233    * char *</tt> header-name ==> <tt>const char *</tt> header-value.
03234    * The @a revision_baton received back (also allocated in @a pool)
03235    * represents the revision.
03236    */
03237   svn_error_t *(*new_revision_record)(void **revision_baton,
03238                                       apr_hash_t *headers,
03239                                       void *parse_baton,
03240                                       apr_pool_t *pool);
03241 
03242   /** The parser has discovered a new node record within the current
03243    * revision represented by @a revision_baton.  All the headers are
03244    * placed in @a headers (as with @c new_revision_record), allocated in
03245    * @a pool.  The @a node_baton received back is allocated in @a pool
03246    * and represents the node.
03247    */
03248   svn_error_t *(*new_node_record)(void **node_baton,
03249                                   apr_hash_t *headers,
03250                                   void *revision_baton,
03251                                   apr_pool_t *pool);
03252 
03253   /** For a given @a revision_baton, set a property @a name to @a value. */
03254   svn_error_t *(*set_revision_property)(void *revision_baton,
03255                                         const char *name,
03256                                         const svn_string_t *value);
03257 
03258   /** For a given @a node_baton, set a property @a name to @a value. */
03259   svn_error_t *(*set_node_property)(void *node_baton,
03260                                     const char *name,
03261                                     const svn_string_t *value);
03262 
03263   /** For a given @a node_baton, delete property @a name. */
03264   svn_error_t *(*delete_node_property)(void *node_baton, const char *name);
03265 
03266   /** For a given @a node_baton, remove all properties. */
03267   svn_error_t *(*remove_node_props)(void *node_baton);
03268 
03269   /** For a given @a node_baton, set @a stream to a writable stream
03270    * capable of receiving the node's fulltext.  The parser will write
03271    * the fulltext to the stream and then close the stream to signal
03272    * completion.
03273    *
03274    * If a @c NULL is returned instead of a stream, the vtable is
03275    * indicating that no text is desired, and the parser will not
03276    * attempt to send it.
03277    */
03278   svn_error_t *(*set_fulltext)(svn_stream_t **stream,
03279                                void *node_baton);
03280 
03281   /** For a given @a node_baton, set @a handler and @a handler_baton
03282    * to a window handler and baton capable of receiving a delta
03283    * against the node's previous contents.  The parser will send all
03284    * the windows of data to this handler, and will then send a NULL
03285    * window to signal completion.
03286    *
03287    * If a @c NULL is returned instead of a handler, the vtable is
03288    * indicating that no delta is desired, and the parser will not
03289    * attempt to send it.
03290    */
03291   svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
03292                                   void **handler_baton,
03293                                   void *node_baton);
03294 
03295   /** The parser has reached the end of the current node represented by
03296    * @a node_baton, it can be freed.
03297    */
03298   svn_error_t *(*close_node)(void *node_baton);
03299 
03300   /** The parser has reached the end of the current revision
03301    * represented by @a revision_baton.  In other words, there are no more
03302    * changed nodes within the revision.  The baton can be freed.
03303    */
03304   svn_error_t *(*close_revision)(void *revision_baton);
03305 
03306 } svn_repos_parse_fns3_t;
03307 
03308 
03309 /**
03310  * Read and parse dumpfile-formatted @a stream, calling callbacks in
03311  * @a parse_fns/@a parse_baton, and using @a pool for allocations.
03312  *
03313  * If @a deltas_are_text is @c TRUE, handle text-deltas with the @a
03314  * set_fulltext callback.  This is useful when manipulating a dump
03315  * stream without loading it.  Otherwise handle text-deltas with the
03316  * @a apply_textdelta callback.
03317  *
03318  * If @a cancel_func is not @c NULL, it is called periodically with
03319  * @a cancel_baton as argument to see if the client wishes to cancel
03320  * the dump.
03321  *
03322  * This parser has built-in knowledge of the dumpfile format, but only
03323  * in a limited sense:
03324  *
03325  *    * it recognizes the "magic" format-version header.
03326  *
03327  *    * it recognizes the UUID header.
03328  *
03329  *    * it recognizes revision and node records by looking for either
03330  *      a REVISION_NUMBER or NODE_PATH headers.
03331  *
03332  *    * it recognizes the CONTENT-LENGTH headers, so it knows if and
03333  *      how to suck up the content body.
03334  *
03335  *    * it knows how to parse a content body into two parts:  props
03336  *      and text, and pass the pieces to the vtable.
03337  *
03338  * This is enough knowledge to make it easy on vtable implementors,
03339  * but still allow expansion of the format: most headers do not have
03340  * to be handled explicitly.
03341  *
03342  * ### [JAF] Wouldn't it be more efficient to support a start/end rev
03343  *     range here than only supporting it in receivers such as
03344  *     svn_repos_get_fs_build_parser4()? This parser could then skip over
03345  *     chunks of the input stream before the oldest required rev, and
03346  *     could stop reading entirely after the youngest required rev.
03347  *
03348  * @since New in 1.8.
03349  */
03350 svn_error_t *
03351 svn_repos_parse_dumpstream3(svn_stream_t *stream,
03352                             const svn_repos_parse_fns3_t *parse_fns,
03353                             void *parse_baton,
03354                             svn_boolean_t deltas_are_text,
03355                             svn_cancel_func_t cancel_func,
03356                             void *cancel_baton,
03357                             apr_pool_t *pool);
03358 
03359 
03360 /**
03361  * Set @a *parser and @a *parse_baton to a vtable parser which commits new
03362  * revisions to the fs in @a repos.  The constructed parser will treat
03363  * UUID records in a manner consistent with @a uuid_action.  Use @a pool
03364  * to operate on the fs.
03365  *
03366  * @a start_rev and @a end_rev act as filters, the lower and upper
03367  * (inclusive) range values of revisions which will
03368  * be loaded.  Either both of these values are #SVN_INVALID_REVNUM (in
03369  * which case no revision-based filtering occurs at all), or both are
03370  * valid revisions (where @a start_rev is older than or equivalent to
03371  * @a end_rev).  They refer to dump stream revision numbers rather than
03372  * committed revision numbers.
03373  *
03374  * If @a use_history is true, then when the parser encounters a node that
03375  * is added-with-history, it will require 'copy-from' history to exist in
03376  * the repository at the relative (adjusted) copy-from revision and path.
03377  * It will perform a copy from that source location, and will fail if no
03378  * suitable source exists there. If @a use_history is false, then it will
03379  * instead convert every copy to a plain add.
03380  *
03381  * ### The 'use_history=FALSE' case is unused and untested in Subversion.
03382  *     It seems to me it would not work with a deltas dumpfile (a driver
03383  *     that calls the @c apply_textdelta method), as it would not have
03384  *     access to the delta base text.
03385  *
03386  * If @a use_pre_commit_hook is set, call the repository's pre-commit
03387  * hook before committing each loaded revision.
03388  *
03389  * If @a use_post_commit_hook is set, call the repository's
03390  * post-commit hook after committing each loaded revision.
03391  *
03392  * If @a validate_props is set, then validate Subversion revision and
03393  * node properties (those in the svn: namespace) against established
03394  * rules for those things.
03395  *
03396  * If @a ignore_dates is set, ignore any revision datestamps found in
03397  * @a dumpstream, allowing the revisions created by the load process
03398  * to be stamped as if they were newly created via the normal commit
03399  * process.
03400  *
03401  * If @a parent_dir is not NULL, then the parser will reparent all the
03402  * loaded nodes, from root to @a parent_dir.  The directory @a parent_dir
03403  * must be an existing directory in the repository.
03404  *
03405  * @since New in 1.9.
03406  */
03407 svn_error_t *
03408 svn_repos_get_fs_build_parser5(const svn_repos_parse_fns3_t **callbacks,
03409                                void **parse_baton,
03410                                svn_repos_t *repos,
03411                                svn_revnum_t start_rev,
03412                                svn_revnum_t end_rev,
03413                                svn_boolean_t use_history,
03414                                svn_boolean_t validate_props,
03415                                enum svn_repos_load_uuid uuid_action,
03416                                const char *parent_dir,
03417                                svn_boolean_t use_pre_commit_hook,
03418                                svn_boolean_t use_post_commit_hook,
03419                                svn_boolean_t ignore_dates,
03420                                svn_repos_notify_func_t notify_func,
03421                                void *notify_baton,
03422                                apr_pool_t *pool);
03423 
03424 /**
03425  * Similar to svn_repos_get_fs_build_parser5(), but with the
03426  * @c use_pre_commit_hook, @c use_post_commit_hook and @c ignore_dates
03427  * arguments all false.
03428  *
03429  * @since New in 1.8.
03430  * @deprecated Provided for backward compatibility with the 1.8 API.
03431  */
03432 SVN_DEPRECATED
03433 svn_error_t *
03434 svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser,
03435                                void **parse_baton,
03436                                svn_repos_t *repos,
03437                                svn_revnum_t start_rev,
03438                                svn_revnum_t end_rev,
03439                                svn_boolean_t use_history,
03440                                svn_boolean_t validate_props,
03441                                enum svn_repos_load_uuid uuid_action,
03442                                const char *parent_dir,
03443                                svn_repos_notify_func_t notify_func,
03444                                void *notify_baton,
03445                                apr_pool_t *pool);
03446 
03447 
03448 
03449 /**
03450  * A vtable that is driven by svn_repos_parse_dumpstream2().
03451  * Similar to #svn_repos_parse_fns3_t except that it lacks
03452  * the magic_header_record callback.
03453  *
03454  * @deprecated Provided for backward compatibility with the 1.7 API.
03455  */
03456 typedef struct svn_repos_parse_fns2_t
03457 {
03458   /** Same as #svn_repos_parse_fns3_t.new_revision_record. */
03459   svn_error_t *(*new_revision_record)(void **revision_baton,
03460                                       apr_hash_t *headers,
03461                                       void *parse_baton,
03462                                       apr_pool_t *pool);
03463   /** Same as #svn_repos_parse_fns3_t.uuid_record. */
03464   svn_error_t *(*uuid_record)(const char *uuid,
03465                               void *parse_baton,
03466                               apr_pool_t *pool);
03467   /** Same as #svn_repos_parse_fns3_t.new_node_record. */
03468   svn_error_t *(*new_node_record)(void **node_baton,
03469                                   apr_hash_t *headers,
03470                                   void *revision_baton,
03471                                   apr_pool_t *pool);
03472   /** Same as #svn_repos_parse_fns3_t.set_revision_property. */
03473   svn_error_t *(*set_revision_property)(void *revision_baton,
03474                                         const char *name,
03475                                         const svn_string_t *value);
03476   /** Same as #svn_repos_parse_fns3_t.set_node_property. */
03477   svn_error_t *(*set_node_property)(void *node_baton,
03478                                     const char *name,
03479                                     const svn_string_t *value);
03480   /** Same as #svn_repos_parse_fns3_t.delete_node_property. */
03481   svn_error_t *(*delete_node_property)(void *node_baton,
03482                                        const char *name);
03483   /** Same as #svn_repos_parse_fns3_t.remove_node_props. */
03484   svn_error_t *(*remove_node_props)(void *node_baton);
03485   /** Same as #svn_repos_parse_fns3_t.set_fulltext. */
03486   svn_error_t *(*set_fulltext)(svn_stream_t **stream,
03487                                void *node_baton);
03488   /** Same as #svn_repos_parse_fns3_t.apply_textdelta. */
03489   svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
03490                                   void **handler_baton,
03491                                   void *node_baton);
03492   /** Same as #svn_repos_parse_fns3_t.close_node. */
03493   svn_error_t *(*close_node)(void *node_baton);
03494   /** Same as #svn_repos_parse_fns3_t.close_revision. */
03495   svn_error_t *(*close_revision)(void *revision_baton);
03496 } svn_repos_parse_fns2_t;
03497 
03498 /** @deprecated Provided for backward compatibility with the 1.7 API. */
03499 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t;
03500 
03501 
03502 /**
03503  * A vtable that is driven by svn_repos_parse_dumpstream().
03504  * Similar to #svn_repos_parse_fns2_t except that it lacks
03505  * the delete_node_property and apply_textdelta callbacks.
03506  *
03507  * @deprecated Provided for backward compatibility with the 1.0 API.
03508  */
03509 typedef struct svn_repos_parse_fns_t
03510 {
03511   /** Same as #svn_repos_parse_fns2_t.new_revision_record. */
03512   svn_error_t *(*new_revision_record)(void **revision_baton,
03513                                       apr_hash_t *headers,
03514                                       void *parse_baton,
03515                                       apr_pool_t *pool);
03516   /** Same as #svn_repos_parse_fns2_t.uuid_record. */
03517   svn_error_t *(*uuid_record)(const char *uuid,
03518                               void *parse_baton,
03519                               apr_pool_t *pool);
03520   /** Same as #svn_repos_parse_fns2_t.new_node_record. */
03521   svn_error_t *(*new_node_record)(void **node_baton,
03522                                   apr_hash_t *headers,
03523                                   void *revision_baton,
03524                                   apr_pool_t *pool);
03525   /** Same as #svn_repos_parse_fns2_t.set_revision_property. */
03526   svn_error_t *(*set_revision_property)(void *revision_baton,
03527                                         const char *name,
03528                                         const svn_string_t *value);
03529   /** Same as #svn_repos_parse_fns2_t.set_node_property. */
03530   svn_error_t *(*set_node_property)(void *node_baton,
03531                                     const char *name,
03532                                     const svn_string_t *value);
03533   /** Same as #svn_repos_parse_fns2_t.remove_node_props. */
03534   svn_error_t *(*remove_node_props)(void *node_baton);
03535   /** Same as #svn_repos_parse_fns2_t.set_fulltext. */
03536   svn_error_t *(*set_fulltext)(svn_stream_t **stream,
03537                                void *node_baton);
03538   /** Same as #svn_repos_parse_fns2_t.close_node. */
03539   svn_error_t *(*close_node)(void *node_baton);
03540   /** Same as #svn_repos_parse_fns2_t.close_revision. */
03541   svn_error_t *(*close_revision)(void *revision_baton);
03542 } svn_repos_parser_fns_t;
03543 
03544 
03545 /**
03546  * Similar to svn_repos_parse_dumpstream3(), but uses the more limited
03547  * #svn_repos_parser_fns2_t vtable type.
03548  *
03549  * @deprecated Provided for backward compatibility with the 1.7 API.
03550  */
03551 SVN_DEPRECATED
03552 svn_error_t *
03553 svn_repos_parse_dumpstream2(svn_stream_t *stream,
03554                             const svn_repos_parser_fns2_t *parse_fns,
03555                             void *parse_baton,
03556                             svn_cancel_func_t cancel_func,
03557                             void *cancel_baton,
03558                             apr_pool_t *pool);
03559 
03560 /**
03561  * Similar to svn_repos_parse_dumpstream2(), but uses the more limited
03562  * #svn_repos_parser_fns_t vtable type.
03563  *
03564  * @deprecated Provided for backward compatibility with the 1.0 API.
03565  */
03566 SVN_DEPRECATED
03567 svn_error_t *
03568 svn_repos_parse_dumpstream(svn_stream_t *stream,
03569                            const svn_repos_parser_fns_t *parse_fns,
03570                            void *parse_baton,
03571                            svn_cancel_func_t cancel_func,
03572                            void *cancel_baton,
03573                            apr_pool_t *pool);
03574 
03575 /**
03576  * Similar to svn_repos_get_fs_build_parser4(), but with @a start_rev
03577  * and @a end_rev always passed as #SVN_INVALID_REVNUM, and yielding
03578  * the more limited svn_repos_parse_fns2_t.
03579  *
03580  * @since New in 1.7.
03581  * @deprecated Provided for backward compatibility with the 1.7 API.
03582  */
03583 SVN_DEPRECATED
03584 svn_error_t *
03585 svn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **parser,
03586                                void **parse_baton,
03587                                svn_repos_t *repos,
03588                                svn_boolean_t use_history,
03589                                svn_boolean_t validate_props,
03590                                enum svn_repos_load_uuid uuid_action,
03591                                const char *parent_dir,
03592                                svn_repos_notify_func_t notify_func,
03593                                void *notify_baton,
03594                                apr_pool_t *pool);
03595 
03596 /**
03597  * Similar to svn_repos_get_fs_build_parser3(), but with @a outstream
03598  * in place if a #svn_repos_notify_func_t and baton and with
03599  * @a validate_props always FALSE.
03600  *
03601  * @since New in 1.1.
03602  * @deprecated Provided for backward compatibility with the 1.6 API.
03603  */
03604 SVN_DEPRECATED
03605 svn_error_t *
03606 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser,
03607                                void **parse_baton,
03608                                svn_repos_t *repos,
03609                                svn_boolean_t use_history,
03610                                enum svn_repos_load_uuid uuid_action,
03611                                svn_stream_t *outstream,
03612                                const char *parent_dir,
03613                                apr_pool_t *pool);
03614 
03615 /**
03616  * Similar to svn_repos_get_fs_build_parser2(), but yields the more
03617  * limited svn_repos_parser_fns_t vtable type.
03618  *
03619  * @deprecated Provided for backward compatibility with the 1.0 API.
03620  */
03621 SVN_DEPRECATED
03622 svn_error_t *
03623 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser,
03624                               void **parse_baton,
03625                               svn_repos_t *repos,
03626                               svn_boolean_t use_history,
03627                               enum svn_repos_load_uuid uuid_action,
03628                               svn_stream_t *outstream,
03629                               const char *parent_dir,
03630                               apr_pool_t *pool);
03631 
03632 
03633 /** @} */
03634 
03635 /** A data type which stores the authz information.
03636  *
03637  * @since New in 1.3.
03638  */
03639 typedef struct svn_authz_t svn_authz_t;
03640 
03641 /**
03642  * Read authz configuration data from @a path (a dirent, an absolute file url
03643  * or a registry path) into @a *authz_p, allocated in @a pool.
03644  *
03645  * If @a groups_path (a dirent, an absolute file url, or a registry path) is
03646  * set, use the global groups parsed from it.
03647  *
03648  * If @a path or @a groups_path is not a valid authz rule file, then return
03649  * #SVN_ERR_AUTHZ_INVALID_CONFIG.  The contents of @a *authz_p is then
03650  * undefined.  If @a must_exist is TRUE, a missing authz or groups file
03651  * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error
03652  * depends on the access type).
03653  *
03654  * @since New in 1.8.
03655  */
03656 svn_error_t *
03657 svn_repos_authz_read2(svn_authz_t **authz_p,
03658                       const char *path,
03659                       const char *groups_path,
03660                       svn_boolean_t must_exist,
03661                       apr_pool_t *pool);
03662 
03663 
03664 /**
03665  * Similar to svn_repos_authz_read2(), but with @a groups_path and @a
03666  * repos_root always passed as @c NULL.
03667  *
03668  * @since New in 1.3.
03669  * @deprecated Provided for backward compatibility with the 1.7 API.
03670  */
03671 SVN_DEPRECATED
03672 svn_error_t *
03673 svn_repos_authz_read(svn_authz_t **authz_p,
03674                      const char *file,
03675                      svn_boolean_t must_exist,
03676                      apr_pool_t *pool);
03677 
03678 /**
03679  * Read authz configuration data from @a stream into @a *authz_p,
03680  * allocated in @a pool.
03681  *
03682  * If @a groups_stream is set, use the global groups parsed from it.
03683  *
03684  * @since New in 1.8.
03685  */
03686 svn_error_t *
03687 svn_repos_authz_parse(svn_authz_t **authz_p,
03688                       svn_stream_t *stream,
03689                       svn_stream_t *groups_stream,
03690                       apr_pool_t *pool);
03691 
03692 /**
03693  * Check whether @a user can access @a path in the repository @a
03694  * repos_name with the @a required_access.  @a authz lists the ACLs to
03695  * check against.  Set @a *access_granted to indicate if the requested
03696  * access is granted.
03697  *
03698  * If @a path is NULL, then check whether @a user has the @a
03699  * required_access anywhere in the repository.  Set @a *access_granted
03700  * to TRUE if at least one path is accessible with the @a
03701  * required_access.
03702  *
03703  * For compatibility with 1.6, and earlier, @a repos_name can be NULL
03704  * in which case it is equivalent to a @a repos_name of "".
03705  *
03706  * @note Presently, @a repos_name must byte-for-byte match the repos_name
03707  * specified in the authz file; it is treated as an opaque string, and not
03708  * as a dirent.
03709  *
03710  * @since New in 1.3.
03711  */
03712 svn_error_t *
03713 svn_repos_authz_check_access(svn_authz_t *authz,
03714                              const char *repos_name,
03715                              const char *path,
03716                              const char *user,
03717                              svn_repos_authz_access_t required_access,
03718                              svn_boolean_t *access_granted,
03719                              apr_pool_t *pool);
03720 
03721 
03722 
03723 /** Revision Access Levels
03724  *
03725  * Like most version control systems, access to versioned objects in
03726  * Subversion is determined on primarily path-based system.  Users either
03727  * do or don't have the ability to read a given path.
03728  *
03729  * However, unlike many version control systems where versioned objects
03730  * maintain their own distinct version information (revision numbers,
03731  * authors, log messages, change timestamps, etc.), Subversion binds
03732  * multiple paths changed as part of a single commit operation into a
03733  * set, calls the whole thing a revision, and hangs commit metadata
03734  * (author, date, log message, etc.) off of that revision.  So, commit
03735  * metadata is shared across all the paths changed as part of a given
03736  * commit operation.
03737  *
03738  * It is common (or, at least, we hope it is) for log messages to give
03739  * detailed information about changes made in the commit to which the log
03740  * message is attached.  Such information might include a mention of all
03741  * the files changed, what was changed in them, and so on.  But this
03742  * causes a problem when presenting information to readers who aren't
03743  * authorized to read every path in the repository.  Simply knowing that
03744  * a given path exists may be a security leak, even if the user can't see
03745  * the contents of the data located at that path.
03746  *
03747  * So Subversion does what it reasonably can to prevent the leak of this
03748  * information, and does so via a staged revision access policy.  A
03749  * reader can be said to have one of three levels of access to a given
03750  * revision's metadata, based solely on the reader's access rights to the
03751  * paths changed or copied in that revision:
03752  *
03753  *   'full access' -- Granted when the reader has access to all paths
03754  *      changed or copied in the revision, or when no paths were
03755  *      changed in the revision at all, this access level permits
03756  *      full visibility of all revision property names and values,
03757  *      and the full changed-paths information.
03758  *
03759  *   'no access' -- Granted when the reader does not have access to any
03760  *      paths changed or copied in the revision, this access level
03761  *      denies the reader access to all revision properties and all
03762  *      changed-paths information.
03763  *
03764  *   'partial access' -- Granted when the reader has access to at least
03765  *      one, but not all, of the paths changed or copied in the revision,
03766  *      this access level permits visibility of the svn:date and
03767  *      svn:author revision properties and only the paths of the
03768  *      changed-paths information to which the reader has access.
03769  *
03770  */
03771 
03772 
03773 /** An enum defining levels of revision access.
03774  *
03775  * @since New in 1.5.
03776  */
03777 typedef enum svn_repos_revision_access_level_t
03778 {
03779   /** no access allowed to the revision properties and all changed-paths
03780    * information. */
03781   svn_repos_revision_access_none,
03782   /** access granted to some (svn:date and svn:author) revision properties and
03783    * changed-paths information on paths the read has access to. */
03784   svn_repos_revision_access_partial,
03785   /** access granted to all revision properites and changed-paths
03786    * information. */
03787   svn_repos_revision_access_full
03788 }
03789 svn_repos_revision_access_level_t;
03790 
03791 
03792 /**
03793  * Set @a access to the access level granted for @a revision in @a
03794  * repos, as determined by consulting the @a authz_read_func callback
03795  * function and its associated @a authz_read_baton.
03796  *
03797  * @a authz_read_func may be @c NULL, in which case @a access will be
03798  * set to #svn_repos_revision_access_full.
03799  *
03800  * @since New in 1.5.
03801  */
03802 svn_error_t *
03803 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level,
03804                                 svn_repos_t *repos,
03805                                 svn_revnum_t revision,
03806                                 svn_repos_authz_func_t authz_read_func,
03807                                 void *authz_read_baton,
03808                                 apr_pool_t *pool);
03809 
03810 
03811 #ifdef __cplusplus
03812 }
03813 #endif /* __cplusplus */
03814 
03815 #endif /* SVN_REPOS_H */

Generated on Mon Jun 1 14:47:29 2015 for Subversion by  doxygen 1.4.7