Subversion 1.6.16

svn_repos.h

Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  * Copyright (c) 2000-2008 CollabNet.  All rights reserved.
00005  *
00006  * This software is licensed as described in the file COPYING, which
00007  * you should have received as part of this distribution.  The terms
00008  * are also available at http://subversion.tigris.org/license-1.html.
00009  * If newer versions of this license are posted there, you may use a
00010  * newer version instead, at your option.
00011  *
00012  * This software consists of voluntary contributions made by many
00013  * individuals.  For exact contribution history, see the revision
00014  * history and logs, available at http://subversion.tigris.org/.
00015  * ====================================================================
00016  * @endcopyright
00017  *
00018  * @file svn_repos.h
00019  * @brief Tools built on top of the filesystem.
00020  */
00021 
00022 #ifndef SVN_REPOS_H
00023 #define SVN_REPOS_H
00024 
00025 #include <apr_pools.h>
00026 #include <apr_hash.h>
00027 #include <apr_tables.h>
00028 #include <apr_time.h>
00029 
00030 #include "svn_types.h"
00031 #include "svn_string.h"
00032 #include "svn_delta.h"
00033 #include "svn_fs.h"
00034 #include "svn_io.h"
00035 #include "svn_version.h"
00036 #include "svn_mergeinfo.h"
00037 
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif /* __cplusplus */
00042 
00043 /* ---------------------------------------------------------------*/
00044 
00045 /**
00046  * Get libsvn_repos version information.
00047  *
00048  * @since New in 1.1.
00049  */
00050 const svn_version_t *
00051 svn_repos_version(void);
00052 
00053 
00054 
00055 /** Callback type for checking authorization on paths produced by (at
00056  * least) svn_repos_dir_delta2().
00057  *
00058  * Set @a *allowed to TRUE to indicate that some operation is
00059  * authorized for @a path in @a root, or set it to FALSE to indicate
00060  * unauthorized (presumably according to state stored in @a baton).
00061  *
00062  * Do not assume @a pool has any lifetime beyond this call.
00063  *
00064  * The exact operation being authorized depends on the callback
00065  * implementation.  For read authorization, for example, the caller
00066  * would implement an instance that does read checking, and pass it as
00067  * a parameter named [perhaps] 'authz_read_func'.  The receiver of
00068  * that parameter might also take another parameter named
00069  * 'authz_write_func', which although sharing this type, would be a
00070  * different implementation.
00071  *
00072  * @note If someday we want more sophisticated authorization states
00073  * than just yes/no, @a allowed can become an enum type.
00074  */
00075 typedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed,
00076                                                svn_fs_root_t *root,
00077                                                const char *path,
00078                                                void *baton,
00079                                                apr_pool_t *pool);
00080 
00081 
00082 /** An enum defining the kinds of access authz looks up.
00083  *
00084  * @since New in 1.3.
00085  */
00086 typedef enum
00087 {
00088   /** No access. */
00089   svn_authz_none = 0,
00090 
00091   /** Path can be read. */
00092   svn_authz_read = 1,
00093 
00094   /** Path can be altered. */
00095   svn_authz_write = 2,
00096 
00097   /** The other access credentials are recursive. */
00098   svn_authz_recursive = 4
00099 } svn_repos_authz_access_t;
00100 
00101 
00102 /** Callback type for checking authorization on paths produced by
00103  * the repository commit editor.
00104  *
00105  * Set @a *allowed to TRUE to indicate that the @a required access on
00106  * @a path in @a root is authorized, or set it to FALSE to indicate
00107  * unauthorized (presumable according to state stored in @a baton).
00108  *
00109  * If @a path is NULL, the callback should perform a global authz
00110  * lookup for the @a required access.  That is, the lookup should
00111  * check if the @a required access is granted for at least one path of
00112  * the repository, and set @a *allowed to TRUE if so.  @a root may
00113  * also be NULL if @a path is NULL.
00114  *
00115  * This callback is very similar to svn_repos_authz_func_t, with the
00116  * exception of the addition of the @a required parameter.
00117  * This is due to historical reasons: when authz was first implemented
00118  * for svn_repos_dir_delta2(), it seemed there would need only checks
00119  * for read and write operations, hence the svn_repos_authz_func_t
00120  * callback prototype and usage scenario.  But it was then realized
00121  * that lookups due to copying needed to be recursive, and that
00122  * brute-force recursive lookups didn't square with the O(1)
00123  * performances a copy operation should have.
00124  *
00125  * So a special way to ask for a recursive lookup was introduced.  The
00126  * commit editor needs this capability to retain acceptable
00127  * performance.  Instead of revving the existing callback, causing
00128  * unnecessary revving of functions that don't actually need the
00129  * extended functionality, this second, more complete callback was
00130  * introduced, for use by the commit editor.
00131  *
00132  * Some day, it would be nice to reunite these two callbacks and do
00133  * the necessary revving anyway, but for the time being, this dual
00134  * callback mechanism will do.
00135  */
00136 typedef svn_error_t *(*svn_repos_authz_callback_t)
00137   (svn_repos_authz_access_t required,
00138    svn_boolean_t *allowed,
00139    svn_fs_root_t *root,
00140    const char *path,
00141    void *baton,
00142    apr_pool_t *pool);
00143 
00144 /**
00145  * Similar to @c svn_file_rev_handler_t, but without the @a
00146  * result_of_merge parameter.
00147  *
00148  * @deprecated Provided for backward compatibility with 1.4 API.
00149  * @since New in 1.1.
00150  */
00151 typedef svn_error_t *(*svn_repos_file_rev_handler_t)
00152   (void *baton,
00153    const char *path,
00154    svn_revnum_t rev,
00155    apr_hash_t *rev_props,
00156    svn_txdelta_window_handler_t *delta_handler,
00157    void **delta_baton,
00158    apr_array_header_t *prop_diffs,
00159    apr_pool_t *pool);
00160 
00161 
00162 /** The repository object. */
00163 typedef struct svn_repos_t svn_repos_t;
00164 
00165 /* Opening and creating repositories. */
00166 
00167 
00168 /** Find the root path of the repository that contains @a path.
00169  *
00170  * If a repository was found, the path to the root of the repository
00171  * is returned, else @c NULL. The pointer to the returned path may be
00172  * equal to @a path.
00173  */
00174 const char *
00175 svn_repos_find_root_path(const char *path,
00176                          apr_pool_t *pool);
00177 
00178 /** Set @a *repos_p to a repository object for the repository at @a path.
00179  *
00180  * Allocate @a *repos_p in @a pool.
00181  *
00182  * Acquires a shared lock on the repository, and attaches a cleanup
00183  * function to @a pool to remove the lock.  If no lock can be acquired,
00184  * returns error, with undefined effect on @a *repos_p.  If an exclusive
00185  * lock is present, this blocks until it's gone.
00186  */
00187 svn_error_t *
00188 svn_repos_open(svn_repos_t **repos_p,
00189                const char *path,
00190                apr_pool_t *pool);
00191 
00192 /** Create a new Subversion repository at @a path, building the necessary
00193  * directory structure, creating the filesystem, and so on.
00194  * Return the repository object in @a *repos_p, allocated in @a pool.
00195  *
00196  * @a config is a client configuration hash of @c svn_config_t * items
00197  * keyed on config category names, and may be NULL.
00198  *
00199  * @a fs_config is passed to the filesystem, and may be NULL.
00200  *
00201  * @a unused_1 and @a unused_2 are not used and should be NULL.
00202  */
00203 svn_error_t *
00204 svn_repos_create(svn_repos_t **repos_p,
00205                  const char *path,
00206                  const char *unused_1,
00207                  const char *unused_2,
00208                  apr_hash_t *config,
00209                  apr_hash_t *fs_config,
00210                  apr_pool_t *pool);
00211 
00212 /**
00213  * Upgrade the Subversion repository (and its underlying versioned
00214  * filesystem) located in the directory @a path to the latest version
00215  * supported by this library.  If the requested upgrade is not
00216  * supported due to the current state of the repository or it
00217  * underlying filesystem, return @c SVN_ERR_REPOS_UNSUPPORTED_UPGRADE
00218  * or @c SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no
00219  * changes to the repository or filesystem.
00220  *
00221  * Acquires an exclusive lock on the repository, upgrades the
00222  * repository, and releases the lock.  If an exclusive lock can't be
00223  * acquired, returns error.
00224  *
00225  * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
00226  * returned if the lock is not immediately available.
00227  *
00228  * If @a start_callback is not NULL, it will be called with @a
00229  * start_callback_baton as argument before the upgrade starts, but
00230  * after the exclusive lock has been acquired.
00231  *
00232  * Use @a pool for necessary allocations.
00233  *
00234  * @note This functionality is provided as a convenience for
00235  * administrators wishing to make use of new Subversion functionality
00236  * without a potentially costly full repository dump/load.  As such,
00237  * the operation performs only the minimum amount of work needed to
00238  * accomplish this while maintaining the integrity of the repository.
00239  * It does *not* guarantee the most optimized repository state as a
00240  * dump and subsequent load would.
00241  *
00242  * @since New in 1.5.
00243  */
00244 svn_error_t *
00245 svn_repos_upgrade(const char *path,
00246                   svn_boolean_t nonblocking,
00247                   svn_error_t *(*start_callback)(void *baton),
00248                   void *start_callback_baton,
00249                   apr_pool_t *pool);
00250 
00251 /** Destroy the Subversion repository found at @a path, using @a pool for any
00252  * necessary allocations.
00253  */
00254 svn_error_t *
00255 svn_repos_delete(const char *path,
00256                  apr_pool_t *pool);
00257 
00258 /**
00259  * Set @a *has to TRUE if @a repos has @a capability (one of the
00260  * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set
00261  * @a *has to FALSE.
00262  *
00263  * If @a capability isn't recognized, throw @c SVN_ERR_UNKNOWN_CAPABILITY,
00264  * with the effect on @a *has undefined.
00265  *
00266  * Use @a pool for all allocation.
00267  *
00268  * @since New in 1.5.
00269  */
00270 svn_error_t *
00271 svn_repos_has_capability(svn_repos_t *repos,
00272                          svn_boolean_t *has,
00273                          const char *capability,
00274                          apr_pool_t *pool);
00275 
00276 /**
00277  * The capability of doing the right thing with merge-tracking
00278  * information, both storing it and responding to queries about it.
00279  *
00280  * @since New in 1.5.
00281  */
00282 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo"
00283 /*       *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY ***
00284  *
00285  * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to
00286  * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid
00287  * colons for their own reasons.  While this RA limitation has no
00288  * direct impact on repository capabilities, there's no reason to be
00289  * gratuitously different either.
00290  */
00291 
00292 
00293 /** Return the filesystem associated with repository object @a repos. */
00294 svn_fs_t *
00295 svn_repos_fs(svn_repos_t *repos);
00296 
00297 
00298 /** Make a hot copy of the Subversion repository found at @a src_path
00299  * to @a dst_path.
00300  *
00301  * Copy a possibly live Subversion repository from @a src_path to
00302  * @a dst_path.  If @a clean_logs is @c TRUE, perform cleanup on the
00303  * source filesystem as part of the copy operation; currently, this
00304  * means deleting copied, unused logfiles for a Berkeley DB source
00305  * repository.
00306  */
00307 svn_error_t *
00308 svn_repos_hotcopy(const char *src_path,
00309                   const char *dst_path,
00310                   svn_boolean_t clean_logs,
00311                   apr_pool_t *pool);
00312 
00313 
00314 /**
00315  * Possibly update the repository, @a repos, to use a more efficient
00316  * filesystem representation.  Use @a pool for allocations.
00317  *
00318  * @since New in 1.6.
00319  */
00320 svn_error_t *
00321 svn_repos_fs_pack(svn_repos_t *repos,
00322                   svn_fs_pack_notify_t notify_func,
00323                   void *notify_baton,
00324                   svn_cancel_func_t cancel_func,
00325                   void *cancel_baton,
00326                   apr_pool_t *pool);
00327 
00328 
00329 /**
00330  * Run database recovery procedures on the repository at @a path,
00331  * returning the database to a consistent state.  Use @a pool for all
00332  * allocation.
00333  *
00334  * Acquires an exclusive lock on the repository, recovers the
00335  * database, and releases the lock.  If an exclusive lock can't be
00336  * acquired, returns error.
00337  *
00338  * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
00339  * returned if the lock is not immediately available.
00340  *
00341  * If @a start_callback is not NULL, it will be called with @a
00342  * start_callback_baton as argument before the recovery starts, but
00343  * after the exclusive lock has been acquired.
00344  *
00345  * If @a cancel_func is not @c NULL, it is called periodically with
00346  * @a cancel_baton as argument to see if the client wishes to cancel
00347  * the recovery.
00348  *
00349  * @note On some platforms the exclusive lock does not exclude other
00350  * threads in the same process so this function should only be called
00351  * by a single threaded process, or by a multi-threaded process when
00352  * no other threads are accessing the repository.
00353  *
00354  * @since New in 1.5.
00355  */
00356 svn_error_t *
00357 svn_repos_recover3(const char *path,
00358                    svn_boolean_t nonblocking,
00359                    svn_error_t *(*start_callback)(void *baton),
00360                    void *start_callback_baton,
00361                    svn_cancel_func_t cancel_func,
00362                    void * cancel_baton,
00363                    apr_pool_t *pool);
00364 
00365 /**
00366  * Similar to svn_repos_recover3(), but without cancellation support.
00367  *
00368  * @deprecated Provided for backward compatibility with the 1.4 API.
00369  */
00370 SVN_DEPRECATED
00371 svn_error_t *
00372 svn_repos_recover2(const char *path,
00373                    svn_boolean_t nonblocking,
00374                    svn_error_t *(*start_callback)(void *baton),
00375                    void *start_callback_baton,
00376                    apr_pool_t *pool);
00377 
00378 /**
00379  * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and
00380  * with no callbacks provided.
00381  *
00382  * @deprecated Provided for backward compatibility with the 1.0 API.
00383  */
00384 SVN_DEPRECATED
00385 svn_error_t *
00386 svn_repos_recover(const char *path,
00387                   apr_pool_t *pool);
00388 
00389 /** This function is a wrapper around svn_fs_berkeley_logfiles(),
00390  * returning log file paths relative to the root of the repository.
00391  *
00392  * @copydoc svn_fs_berkeley_logfiles()
00393  */
00394 svn_error_t *
00395 svn_repos_db_logfiles(apr_array_header_t **logfiles,
00396                       const char *path,
00397                       svn_boolean_t only_unused,
00398                       apr_pool_t *pool);
00399 
00400 
00401 
00402 /* Repository Paths */
00403 
00404 /** Return the top-level repository path allocated in @a pool. */
00405 const char *
00406 svn_repos_path(svn_repos_t *repos,
00407                apr_pool_t *pool);
00408 
00409 /** Return the path to @a repos's filesystem directory, allocated in
00410  * @a pool.
00411  */
00412 const char *
00413 svn_repos_db_env(svn_repos_t *repos,
00414                  apr_pool_t *pool);
00415 
00416 /** Return path to @a repos's config directory, allocated in @a pool. */
00417 const char *
00418 svn_repos_conf_dir(svn_repos_t *repos,
00419                    apr_pool_t *pool);
00420 
00421 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */
00422 const char *
00423 svn_repos_svnserve_conf(svn_repos_t *repos,
00424                         apr_pool_t *pool);
00425 
00426 /** Return path to @a repos's lock directory, allocated in @a pool. */
00427 const char *
00428 svn_repos_lock_dir(svn_repos_t *repos,
00429                    apr_pool_t *pool);
00430 
00431 /** Return path to @a repos's db lockfile, allocated in @a pool. */
00432 const char *
00433 svn_repos_db_lockfile(svn_repos_t *repos,
00434                       apr_pool_t *pool);
00435 
00436 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */
00437 const char *
00438 svn_repos_db_logs_lockfile(svn_repos_t *repos,
00439                            apr_pool_t *pool);
00440 
00441 /** Return the path to @a repos's hook directory, allocated in @a pool. */
00442 const char *
00443 svn_repos_hook_dir(svn_repos_t *repos,
00444                    apr_pool_t *pool);
00445 
00446 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */
00447 const char *
00448 svn_repos_start_commit_hook(svn_repos_t *repos,
00449                             apr_pool_t *pool);
00450 
00451 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */
00452 const char *
00453 svn_repos_pre_commit_hook(svn_repos_t *repos,
00454                           apr_pool_t *pool);
00455 
00456 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */
00457 const char *
00458 svn_repos_post_commit_hook(svn_repos_t *repos,
00459                            apr_pool_t *pool);
00460 
00461 /** Return the path to @a repos's pre-revprop-change hook, allocated in
00462  * @a pool.
00463  */
00464 const char *
00465 svn_repos_pre_revprop_change_hook(svn_repos_t *repos,
00466                                   apr_pool_t *pool);
00467 
00468 /** Return the path to @a repos's post-revprop-change hook, allocated in
00469  * @a pool.
00470  */
00471 const char *
00472 svn_repos_post_revprop_change_hook(svn_repos_t *repos,
00473                                    apr_pool_t *pool);
00474 
00475 
00476 /** @defgroup svn_repos_lock_hooks Paths to lock hooks
00477  * @{
00478  * @since New in 1.2. */
00479 
00480 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */
00481 const char *
00482 svn_repos_pre_lock_hook(svn_repos_t *repos,
00483                         apr_pool_t *pool);
00484 
00485 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */
00486 const char *
00487 svn_repos_post_lock_hook(svn_repos_t *repos,
00488                          apr_pool_t *pool);
00489 
00490 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */
00491 const char *
00492 svn_repos_pre_unlock_hook(svn_repos_t *repos,
00493                           apr_pool_t *pool);
00494 
00495 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */
00496 const char *
00497 svn_repos_post_unlock_hook(svn_repos_t *repos,
00498                            apr_pool_t *pool);
00499 
00500 /** @} */
00501 
00502 /* ---------------------------------------------------------------*/
00503 
00504 /* Reporting the state of a working copy, for updates. */
00505 
00506 
00507 /**
00508  * Construct and return a @a report_baton that will be passed to the
00509  * other functions in this section to describe the state of a pre-existing
00510  * tree (typically, a working copy).  When the report is finished,
00511  * @a editor/@a edit_baton will be driven in such a way as to transform the
00512  * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the
00513  * reported hierarchy to @a tgt_path.
00514  *
00515  * @a fs_base is the absolute path of the node in the filesystem at which
00516  * the comparison should be rooted.  @a target is a single path component,
00517  * used to limit the scope of the report to a single entry of @a fs_base,
00518  * or "" if all of @a fs_base itself is the main subject of the report.
00519  *
00520  * @a tgt_path and @a revnum is the fs path/revision pair that is the
00521  * "target" of the delta.  @a tgt_path should be provided only when
00522  * the source and target paths of the report differ.  That is, @a tgt_path
00523  * should *only* be specified when specifying that the resultant editor
00524  * drive be one that transforms the reported hierarchy into a pristine tree
00525  * of @a tgt_path at revision @a revnum.  A @c NULL value for @a tgt_path
00526  * will indicate that the editor should be driven in such a way as to
00527  * transform the reported hierarchy to revision @a revnum, preserving the
00528  * reported hierarchy.
00529  *
00530  * @a text_deltas instructs the driver of the @a editor to enable
00531  * the generation of text deltas.
00532  *
00533  * @a ignore_ancestry instructs the driver to ignore node ancestry
00534  * when determining how to transmit differences.
00535  *
00536  * @a send_copyfrom_args instructs the driver to send 'copyfrom'
00537  * arguments to the editor's add_file() and add_directory() methods,
00538  * whenever it deems feasible.
00539  *
00540  * The @a authz_read_func and @a authz_read_baton are passed along to
00541  * svn_repos_dir_delta2(); see that function for how they are used.
00542  *
00543  * All allocation for the context and collected state will occur in
00544  * @a pool.
00545  *
00546  * @a depth is the requested depth of the editor drive.
00547  *
00548  * If @a depth is @c svn_depth_unknown, the editor will affect only the
00549  * paths reported by the individual calls to @c svn_repos_set_path3 and
00550  * @c svn_repos_link_path3.
00551  *
00552  * For example, if the reported tree is the @c A subdir of the Greek Tree
00553  * (see Subversion's test suite), at depth @c svn_depth_empty, but the
00554  * @c A/B subdir is reported at depth @c svn_depth_infinity, then
00555  * repository-side changes to @c A/mu, or underneath @c A/C and @c
00556  * A/D, would not be reflected in the editor drive, but changes
00557  * underneath @c A/B would be.
00558  *
00559  * Additionally, the editor driver will call @c add_directory and
00560  * and @c add_file for directories with an appropriate depth.  For
00561  * example, a directory reported at @c svn_depth_files will receive
00562  * file (but not directory) additions.  A directory at @c svn_depth_empty
00563  * will receive neither.
00564  *
00565  * If @a depth is @c svn_depth_files, @c svn_depth_immediates or
00566  * @c svn_depth_infinity and @a depth is greater than the reported depth
00567  * of the working copy, then the editor driver will emit editor
00568  * operations so as to upgrade the working copy to this depth.
00569  *
00570  * If @a depth is @c svn_depth_empty, @c svn_depth_files,
00571  * @c svn_depth_immediates and @a depth is lower
00572  * than or equal to the depth of the working copy, then the editor
00573  * operations will affect only paths at or above @a depth.
00574  *
00575  * @since New in 1.5.
00576  */
00577 svn_error_t *
00578 svn_repos_begin_report2(void **report_baton,
00579                         svn_revnum_t revnum,
00580                         svn_repos_t *repos,
00581                         const char *fs_base,
00582                         const char *target,
00583                         const char *tgt_path,
00584                         svn_boolean_t text_deltas,
00585                         svn_depth_t depth,
00586                         svn_boolean_t ignore_ancestry,
00587                         svn_boolean_t send_copyfrom_args,
00588                         const svn_delta_editor_t *editor,
00589                         void *edit_baton,
00590                         svn_repos_authz_func_t authz_read_func,
00591                         void *authz_read_baton,
00592                         apr_pool_t *pool);
00593 
00594 /**
00595  * The same as svn_repos_begin_report2(), but taking a boolean
00596  * @a recurse flag, and sending FALSE for @a send_copyfrom_args.
00597  *
00598  * If @a recurse is TRUE, the editor driver will drive the editor with
00599  * a depth of @c svn_depth_infinity; if FALSE, then with a depth of
00600  * @c svn_depth_files.
00601  *
00602  * @note @a username is ignored, and has been removed in a revised
00603  * version of this API.
00604  *
00605  * @deprecated Provided for backward compatibility with the 1.4 API.
00606  */
00607 SVN_DEPRECATED
00608 svn_error_t *
00609 svn_repos_begin_report(void **report_baton,
00610                        svn_revnum_t revnum,
00611                        const char *username,
00612                        svn_repos_t *repos,
00613                        const char *fs_base,
00614                        const char *target,
00615                        const char *tgt_path,
00616                        svn_boolean_t text_deltas,
00617                        svn_boolean_t recurse,
00618                        svn_boolean_t ignore_ancestry,
00619                        const svn_delta_editor_t *editor,
00620                        void *edit_baton,
00621                        svn_repos_authz_func_t authz_read_func,
00622                        void *authz_read_baton,
00623                        apr_pool_t *pool);
00624 
00625 
00626 /**
00627  * Given a @a report_baton constructed by svn_repos_begin_report2(),
00628  * record the presence of @a path, at @a revision with depth @a depth,
00629  * in the current tree.
00630  *
00631  * @a path is relative to the anchor/target used in the creation of the
00632  * @a report_baton.
00633  *
00634  * @a revision may be SVN_INVALID_REVNUM if (for example) @a path
00635  * represents a locally-added path with no revision number, or @a
00636  * depth is @c svn_depth_exclude.
00637  *
00638  * @a path may not be underneath a path on which svn_repos_set_path3()
00639  * was previously called with @c svn_depth_exclude in this report.
00640  *
00641  * The first call of this in a given report usually passes an empty
00642  * @a path; this is used to set up the correct root revision for the editor
00643  * drive.
00644  *
00645  * A depth of @c svn_depth_unknown is not allowed, and results in an
00646  * error.
00647  *
00648  * If @a start_empty is TRUE and @a path is a directory, then require the
00649  * caller to explicitly provide all the children of @a path - do not assume
00650  * that the tree also contains all the children of @a path at @a revision.
00651  * This is for 'low confidence' client reporting.
00652  *
00653  * If the caller has a lock token for @a path, then @a lock_token should
00654  * be set to that token.  Else, @a lock_token should be NULL.
00655  *
00656  * All temporary allocations are done in @a pool.
00657  *
00658  * @since New in 1.5.
00659  */
00660 svn_error_t *
00661 svn_repos_set_path3(void *report_baton,
00662                     const char *path,
00663                     svn_revnum_t revision,
00664                     svn_depth_t depth,
00665                     svn_boolean_t start_empty,
00666                     const char *lock_token,
00667                     apr_pool_t *pool);
00668 
00669 /**
00670  * Similar to svn_repos_set_path3(), but with @a depth set to
00671  * @c svn_depth_infinity.
00672  *
00673  * @deprecated Provided for backward compatibility with the 1.4 API.
00674  */
00675 SVN_DEPRECATED
00676 svn_error_t *
00677 svn_repos_set_path2(void *report_baton,
00678                     const char *path,
00679                     svn_revnum_t revision,
00680                     svn_boolean_t start_empty,
00681                     const char *lock_token,
00682                     apr_pool_t *pool);
00683 
00684 /**
00685  * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL.
00686  *
00687  * @deprecated Provided for backward compatibility with the 1.1 API.
00688  */
00689 SVN_DEPRECATED
00690 svn_error_t *
00691 svn_repos_set_path(void *report_baton,
00692                    const char *path,
00693                    svn_revnum_t revision,
00694                    svn_boolean_t start_empty,
00695                    apr_pool_t *pool);
00696 
00697 /**
00698  * Given a @a report_baton constructed by svn_repos_begin_report2(),
00699  * record the presence of @a path in the current tree, containing the contents
00700  * of @a link_path at @a revision with depth @a depth.
00701  *
00702  * A depth of @c svn_depth_unknown is not allowed, and results in an
00703  * error.
00704  *
00705  * @a path may not be underneath a path on which svn_repos_set_path3()
00706  * was previously called with @c svn_depth_exclude in this report.
00707  *
00708  * Note that while @a path is relative to the anchor/target used in the
00709  * creation of the @a report_baton, @a link_path is an absolute filesystem
00710  * path!
00711  *
00712  * If @a start_empty is TRUE and @a path is a directory, then require the
00713  * caller to explicitly provide all the children of @a path - do not assume
00714  * that the tree also contains all the children of @a link_path at
00715  * @a revision.  This is for 'low confidence' client reporting.
00716  *
00717  * If the caller has a lock token for @a link_path, then @a lock_token
00718  * should be set to that token.  Else, @a lock_token should be NULL.
00719  *
00720  * All temporary allocations are done in @a pool.
00721  *
00722  * @since New in 1.5.
00723  */
00724 svn_error_t *
00725 svn_repos_link_path3(void *report_baton,
00726                      const char *path,
00727                      const char *link_path,
00728                      svn_revnum_t revision,
00729                      svn_depth_t depth,
00730                      svn_boolean_t start_empty,
00731                      const char *lock_token,
00732                      apr_pool_t *pool);
00733 
00734 /**
00735  * Similar to svn_repos_link_path3(), but with @a depth set to
00736  * @c svn_depth_infinity.
00737  *
00738  * @deprecated Provided for backward compatibility with the 1.4 API.
00739  */
00740 SVN_DEPRECATED
00741 svn_error_t *
00742 svn_repos_link_path2(void *report_baton,
00743                      const char *path,
00744                      const char *link_path,
00745                      svn_revnum_t revision,
00746                      svn_boolean_t start_empty,
00747                      const char *lock_token,
00748                      apr_pool_t *pool);
00749 
00750 /**
00751  * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL.
00752  *
00753  * @deprecated Provided for backward compatibility with the 1.1 API.
00754  */
00755 SVN_DEPRECATED
00756 svn_error_t *
00757 svn_repos_link_path(void *report_baton,
00758                     const char *path,
00759                     const char *link_path,
00760                     svn_revnum_t revision,
00761                     svn_boolean_t start_empty,
00762                     apr_pool_t *pool);
00763 
00764 /** Given a @a report_baton constructed by svn_repos_begin_report2(),
00765  * record the non-existence of @a path in the current tree.
00766  *
00767  * @a path may not be underneath a path on which svn_repos_set_path3()
00768  * was previously called with @c svn_depth_exclude in this report.
00769  *
00770  * (This allows the reporter's driver to describe missing pieces of a
00771  * working copy, so that 'svn up' can recreate them.)
00772  *
00773  * All temporary allocations are done in @a pool.
00774  */
00775 svn_error_t *
00776 svn_repos_delete_path(void *report_baton,
00777                       const char *path,
00778                       apr_pool_t *pool);
00779 
00780 /** Given a @a report_baton constructed by svn_repos_begin_report2(),
00781  * finish the report and drive the editor as specified when the report
00782  * baton was constructed.
00783  *
00784  * If an error occurs during the driving of the editor, do NOT abort the
00785  * edit; that responsibility belongs to the caller of this function, if
00786  * it happens at all.
00787  *
00788  * After the call to this function, @a report_baton is no longer valid;
00789  * it should not be passed to any other reporting functions, including
00790  * svn_repos_abort_report().
00791  */
00792 svn_error_t *
00793 svn_repos_finish_report(void *report_baton,
00794                         apr_pool_t *pool);
00795 
00796 
00797 /** Given a @a report_baton constructed by svn_repos_begin_report2(),
00798  * abort the report.  This function can be called anytime before
00799  * svn_repos_finish_report() is called.
00800  *
00801  * After the call to this function, @a report_baton is no longer valid;
00802  * it should not be passed to any other reporting functions.
00803  */
00804 svn_error_t *
00805 svn_repos_abort_report(void *report_baton,
00806                        apr_pool_t *pool);
00807 
00808 
00809 /* ---------------------------------------------------------------*/
00810 
00811 /* The magical dir_delta update routines. */
00812 
00813 /** Use the provided @a editor and @a edit_baton to describe the changes
00814  * necessary for making a given node (and its descendants, if it is a
00815  * directory) under @a src_root look exactly like @a tgt_path under
00816  * @a tgt_root.  @a src_entry is the node to update.  If @a src_entry
00817  * is empty, then compute the difference between the entire tree
00818  * anchored at @a src_parent_dir under @a src_root and @a tgt_path
00819  * under @a tgt_root.  Else, describe the changes needed to update
00820  * only that entry in @a src_parent_dir.  Typically, callers of this
00821  * function will use a @a tgt_path that is the concatenation of @a
00822  * src_parent_dir and @a src_entry.
00823  *
00824  * @a src_root and @a tgt_root can both be either revision or transaction
00825  * roots.  If @a tgt_root is a revision, @a editor's set_target_revision()
00826  * will be called with the @a tgt_root's revision number, else it will
00827  * not be called at all.
00828  *
00829  * If @a authz_read_func is non-NULL, invoke it before any call to
00830  *
00831  *    @a editor->open_root
00832  *    @a editor->add_directory
00833  *    @a editor->open_directory
00834  *    @a editor->add_file
00835  *    @a editor->open_file
00836  *
00837  * passing @a tgt_root, the same path that would be passed to the
00838  * editor function in question, and @a authz_read_baton.  If the
00839  * @a *allowed parameter comes back TRUE, then proceed with the planned
00840  * editor call; else if FALSE, then invoke @a editor->absent_file or
00841  * @a editor->absent_directory as appropriate, except if the planned
00842  * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE.
00843  *
00844  * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to
00845  * the window handler returned by @a editor->apply_textdelta().
00846  *
00847  * If @a depth is @c svn_depth_empty, invoke @a editor calls only on
00848  * @a src_entry (or @a src_parent_dir, if @a src_entry is empty).
00849  * If @a depth is @c svn_depth_files, also invoke the editor on file
00850  * children, if any; if @c svn_depth_immediates, invoke it on
00851  * immediate subdirectories as well as files; if @c svn_depth_infinity,
00852  * recurse fully.
00853  *
00854  * If @a entry_props is @c TRUE, accompany each opened/added entry with
00855  * propchange editor calls that relay special "entry props" (this
00856  * is typically used only for working copy updates).
00857  *
00858  * @a ignore_ancestry instructs the function to ignore node ancestry
00859  * when determining how to transmit differences.
00860  *
00861  * Before completing successfully, this function calls @a editor's
00862  * close_edit(), so the caller should expect its @a edit_baton to be
00863  * invalid after its use with this function.
00864  *
00865  * Do any allocation necessary for the delta computation in @a pool.
00866  * This function's maximum memory consumption is at most roughly
00867  * proportional to the greatest depth of the tree under @a tgt_root, not
00868  * the total size of the delta.
00869  *
00870  * ### svn_repos_dir_delta2 is mostly superceded by the reporter
00871  * ### functionality (svn_repos_begin_report2 and friends).
00872  * ### svn_repos_dir_delta2 does allow the roots to be transaction
00873  * ### roots rather than just revision roots, and it has the
00874  * ### entry_props flag.  Almost all of Subversion's own code uses the
00875  * ### reporter instead; there are some stray references to the
00876  * ### svn_repos_dir_delta[2] in comments which should probably
00877  * ### actually refer to the reporter.
00878  */
00879 svn_error_t *
00880 svn_repos_dir_delta2(svn_fs_root_t *src_root,
00881                      const char *src_parent_dir,
00882                      const char *src_entry,
00883                      svn_fs_root_t *tgt_root,
00884                      const char *tgt_path,
00885                      const svn_delta_editor_t *editor,
00886                      void *edit_baton,
00887                      svn_repos_authz_func_t authz_read_func,
00888                      void *authz_read_baton,
00889                      svn_boolean_t text_deltas,
00890                      svn_depth_t depth,
00891                      svn_boolean_t entry_props,
00892                      svn_boolean_t ignore_ancestry,
00893                      apr_pool_t *pool);
00894 
00895 /**
00896  * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass
00897  * @c svn_depth_infinity for @a depth, and if @a recurse is FALSE,
00898  * pass @c svn_depth_files for @a depth.
00899  *
00900  * @deprecated Provided for backward compatibility with the 1.4 API.
00901  */
00902 SVN_DEPRECATED
00903 svn_error_t *
00904 svn_repos_dir_delta(svn_fs_root_t *src_root,
00905                     const char *src_parent_dir,
00906                     const char *src_entry,
00907                     svn_fs_root_t *tgt_root,
00908                     const char *tgt_path,
00909                     const svn_delta_editor_t *editor,
00910                     void *edit_baton,
00911                     svn_repos_authz_func_t authz_read_func,
00912                     void *authz_read_baton,
00913                     svn_boolean_t text_deltas,
00914                     svn_boolean_t recurse,
00915                     svn_boolean_t entry_props,
00916                     svn_boolean_t ignore_ancestry,
00917                     apr_pool_t *pool);
00918 
00919 
00920 /** Use the provided @a editor and @a edit_baton to describe the
00921  * skeletal changes made in a particular filesystem @a root
00922  * (revision or transaction).
00923  *
00924  * Changes will be limited to those within @a base_dir, and if
00925  * @a low_water_mark is set to something other than @c SVN_INVALID_REVNUM
00926  * it is assumed that the client has no knowledge of revisions prior to
00927  * @a low_water_mark.  Together, these two arguments define the portion of
00928  * the tree that the client is assumed to have knowledge of, and thus any
00929  * copies of data from outside that part of the tree will be sent in their
00930  * entirety, not as simple copies or deltas against a previous version.
00931  *
00932  * The @a editor passed to this function should be aware of the fact
00933  * that, if @a send_deltas is FALSE, calls to its change_dir_prop(),
00934  * change_file_prop(), and apply_textdelta() functions will not
00935  * contain meaningful data, and merely serve as indications that
00936  * properties or textual contents were changed.
00937  *
00938  * If @a send_deltas is @c TRUE, the text and property deltas for changes
00939  * will be sent, otherwise NULL text deltas and empty prop changes will be
00940  * used.
00941  *
00942  * If @a authz_read_func is non-NULL, it will be used to determine if the
00943  * user has read access to the data being accessed.  Data that the user
00944  * cannot access will be skipped.
00945  *
00946  * @note This editor driver passes SVN_INVALID_REVNUM for all
00947  * revision parameters in the editor interface except the copyfrom
00948  * parameter of the add_file() and add_directory() editor functions.
00949  *
00950  * @since New in 1.4.
00951  */
00952 svn_error_t *
00953 svn_repos_replay2(svn_fs_root_t *root,
00954                   const char *base_dir,
00955                   svn_revnum_t low_water_mark,
00956                   svn_boolean_t send_deltas,
00957                   const svn_delta_editor_t *editor,
00958                   void *edit_baton,
00959                   svn_repos_authz_func_t authz_read_func,
00960                   void *authz_read_baton,
00961                   apr_pool_t *pool);
00962 
00963 /**
00964  * Similar to svn_repos_replay2(), but with @a base_dir set to @c "",
00965  * @a low_water_mark set to @c SVN_INVALID_REVNUM, @a send_deltas
00966  * set to @c FALSE, and @a authz_read_func and @a authz_read_baton
00967  * set to @c NULL.
00968  *
00969  * @deprecated Provided for backward compatibility with the 1.3 API.
00970  */
00971 SVN_DEPRECATED
00972 svn_error_t *
00973 svn_repos_replay(svn_fs_root_t *root,
00974                  const svn_delta_editor_t *editor,
00975                  void *edit_baton,
00976                  apr_pool_t *pool);
00977 
00978 /* ---------------------------------------------------------------*/
00979 
00980 /* Making commits. */
00981 
00982 /**
00983  * Return an @a editor and @a edit_baton to commit changes to the
00984  * filesystem of @a repos, beginning at location 'rev:@a base_path',
00985  * where "rev" is the argument given to open_root().
00986  *
00987  * @a repos is a previously opened repository.  @a repos_url is the
00988  * decoded URL to the base of the repository, and is used to check
00989  * copyfrom paths.  @a txn is a filesystem transaction object to use
00990  * during the commit, or @c NULL to indicate that this function should
00991  * create (and fully manage) a new transaction.
00992  *
00993  * Store the contents of @a revprop_table, a hash mapping <tt>const
00994  * char *</tt> property names to @c svn_string_t values, as properties
00995  * of the commit transaction, including author and log message if
00996  * present.
00997  *
00998  * @note @c SVN_PROP_REVISION_DATE may be present in @a revprop_table, but
00999  * it will be overwritten when the transaction is committed.
01000  *
01001  * Iff @a authz_callback is provided, check read/write authorizations
01002  * on paths accessed by editor operations.  An operation which fails
01003  * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or
01004  * SVN_ERR_AUTHZ_UNWRITABLE.
01005  *
01006  * Calling @a (*editor)->close_edit completes the commit.
01007  *
01008  * If @a callback is non-NULL, then before @c close_edit returns (but
01009  * after the commit has succeeded) @c close_edit will invoke
01010  * @a callback with a filled-in @c svn_commit_info_t *, @a callback_baton,
01011  * and @a pool or some subpool thereof as arguments.  If @a callback
01012  * returns an error, that error will be returned from @c close_edit,
01013  * otherwise if there was a post-commit hook failure, then that error
01014  * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED.
01015  * (Note that prior to Subversion 1.6, @a callback cannot be NULL; if
01016  * you don't need a callback, pass a dummy function.)
01017  *
01018  * Calling @a (*editor)->abort_edit aborts the commit, and will also
01019  * abort the commit transaction unless @a txn was supplied (not @c
01020  * NULL).  Callers who supply their own transactions are responsible
01021  * for cleaning them up (either by committing them, or aborting them).
01022  *
01023  * @since New in 1.5.
01024  */
01025 svn_error_t *
01026 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor,
01027                              void **edit_baton,
01028                              svn_repos_t *repos,
01029                              svn_fs_txn_t *txn,
01030                              const char *repos_url,
01031                              const char *base_path,
01032                              apr_hash_t *revprop_table,
01033                              svn_commit_callback2_t callback,
01034                              void *callback_baton,
01035                              svn_repos_authz_callback_t authz_callback,
01036                              void *authz_baton,
01037                              apr_pool_t *pool);
01038 
01039 /**
01040  * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table
01041  * set to a hash containing @a user and @a log_msg as the
01042  * @c SVN_PROP_REVISION_AUTHOR and @c SVN_PROP_REVISION_LOG properties,
01043  * respectively.  @a user and @a log_msg may both be @c NULL.
01044  *
01045  * @since New in 1.4.
01046  *
01047  * @deprecated Provided for backward compatibility with the 1.4 API.
01048  */
01049 SVN_DEPRECATED
01050 svn_error_t *
01051 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor,
01052                              void **edit_baton,
01053                              svn_repos_t *repos,
01054                              svn_fs_txn_t *txn,
01055                              const char *repos_url,
01056                              const char *base_path,
01057                              const char *user,
01058                              const char *log_msg,
01059                              svn_commit_callback2_t callback,
01060                              void *callback_baton,
01061                              svn_repos_authz_callback_t authz_callback,
01062                              void *authz_baton,
01063                              apr_pool_t *pool);
01064 
01065 /**
01066  * Similar to svn_repos_get_commit_editor4(), but
01067  * uses the svn_commit_callback_t type.
01068  *
01069  * @since New in 1.3.
01070  *
01071  * @deprecated Provided for backward compatibility with the 1.3 API.
01072  */
01073 SVN_DEPRECATED
01074 svn_error_t *
01075 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor,
01076                              void **edit_baton,
01077                              svn_repos_t *repos,
01078                              svn_fs_txn_t *txn,
01079                              const char *repos_url,
01080                              const char *base_path,
01081                              const char *user,
01082                              const char *log_msg,
01083                              svn_commit_callback_t callback,
01084                              void *callback_baton,
01085                              svn_repos_authz_callback_t authz_callback,
01086                              void *authz_baton,
01087                              apr_pool_t *pool);
01088 
01089 /**
01090  * Similar to svn_repos_get_commit_editor3(), but with @a
01091  * authz_callback and @a authz_baton set to @c NULL.
01092  *
01093  * @deprecated Provided for backward compatibility with the 1.2 API.
01094  */
01095 SVN_DEPRECATED
01096 svn_error_t *
01097 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor,
01098                              void **edit_baton,
01099                              svn_repos_t *repos,
01100                              svn_fs_txn_t *txn,
01101                              const char *repos_url,
01102                              const char *base_path,
01103                              const char *user,
01104                              const char *log_msg,
01105                              svn_commit_callback_t callback,
01106                              void *callback_baton,
01107                              apr_pool_t *pool);
01108 
01109 
01110 /**
01111  * Similar to svn_repos_get_commit_editor2(), but with @a txn always
01112  * set to @c NULL.
01113  *
01114  * @deprecated Provided for backward compatibility with the 1.1 API.
01115  */
01116 SVN_DEPRECATED
01117 svn_error_t *
01118 svn_repos_get_commit_editor(const svn_delta_editor_t **editor,
01119                             void **edit_baton,
01120                             svn_repos_t *repos,
01121                             const char *repos_url,
01122                             const char *base_path,
01123                             const char *user,
01124                             const char *log_msg,
01125                             svn_commit_callback_t callback,
01126                             void *callback_baton,
01127                             apr_pool_t *pool);
01128 
01129 /* ---------------------------------------------------------------*/
01130 
01131 /* Finding particular revisions. */
01132 
01133 /** Set @a *revision to the revision number in @a repos's filesystem that was
01134  * youngest at time @a tm.
01135  */
01136 svn_error_t *
01137 svn_repos_dated_revision(svn_revnum_t *revision,
01138                          svn_repos_t *repos,
01139                          apr_time_t tm,
01140                          apr_pool_t *pool);
01141 
01142 
01143 /** Given a @a root/@a path within some filesystem, return three pieces of
01144  * information allocated in @a pool:
01145  *
01146  *    - set @a *committed_rev to the revision in which the object was
01147  *      last modified.  (In fs parlance, this is the revision in which
01148  *      the particular node-rev-id was 'created'.)
01149  *
01150  *    - set @a *committed_date to the date of said revision, or @c NULL
01151  *      if not available.
01152  *
01153  *    - set @a *last_author to the author of said revision, or @c NULL
01154  *      if not available.
01155  */
01156 svn_error_t *
01157 svn_repos_get_committed_info(svn_revnum_t *committed_rev,
01158                              const char **committed_date,
01159                              const char **last_author,
01160                              svn_fs_root_t *root,
01161                              const char *path,
01162                              apr_pool_t *pool);
01163 
01164 
01165 /**
01166  * Set @a *dirent to an @c svn_dirent_t associated with @a path in @a
01167  * root.  If @a path does not exist in @a root, set @a *dirent to
01168  * NULL.  Use @a pool for memory allocation.
01169  *
01170  * @since New in 1.2.
01171  */
01172 svn_error_t *
01173 svn_repos_stat(svn_dirent_t **dirent,
01174                svn_fs_root_t *root,
01175                const char *path,
01176                apr_pool_t *pool);
01177 
01178 
01179 /**
01180  * Given @a path which exists at revision @a start in @a fs, set
01181  * @a *deleted to the revision @a path was first deleted, within the
01182  * inclusive revision range bounded by @a start and @a end.  If @a path
01183  * does not exist at revision @a start or was not deleted within the
01184  * specified range, then set @a *deleted to SVN_INVALID_REVNUM.
01185  * Use @a pool for memory allocation.
01186  *
01187  * @since New in 1.5.
01188  */
01189 svn_error_t *
01190 svn_repos_deleted_rev(svn_fs_t *fs,
01191                       const char *path,
01192                       svn_revnum_t start,
01193                       svn_revnum_t end,
01194                       svn_revnum_t *deleted,
01195                       apr_pool_t *pool);
01196 
01197 
01198 /** Callback type for use with svn_repos_history().  @a path and @a
01199  * revision represent interesting history locations in the lifetime
01200  * of the path passed to svn_repos_history().  @a baton is the same
01201  * baton given to svn_repos_history().  @a pool is provided for the
01202  * convenience of the implementor, who should not expect it to live
01203  * longer than a single callback call.
01204  *
01205  * Signal to callback driver to stop processing/invoking this callback
01206  * by returning the @c SVN_ERR_CEASE_INVOCATION error code.
01207  *
01208  * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
01209  */
01210 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton,
01211                                                  const char *path,
01212                                                  svn_revnum_t revision,
01213                                                  apr_pool_t *pool);
01214 
01215 /**
01216  * Call @a history_func (with @a history_baton) for each interesting
01217  * history location in the lifetime of @a path in @a fs, from the
01218  * youngest of @a end and @a start to the oldest.  Stop processing if
01219  * @a history_func returns @c SVN_ERR_CEASE_INVOCATION.  Only cross
01220  * filesystem copy history if @a cross_copies is @c TRUE.  And do all
01221  * of this in @a pool.
01222  *
01223  * If @a authz_read_func is non-NULL, then use it (and @a
01224  * authz_read_baton) to verify that @a path in @a end is readable; if
01225  * not, return SVN_ERR_AUTHZ_UNREADABLE.  Also verify the readability
01226  * of every ancestral path/revision pair before pushing them at @a
01227  * history_func.  If a pair is deemed unreadable, then do not send
01228  * them; instead, immediately stop traversing history and return
01229  * SVN_NO_ERROR.
01230  *
01231  * @since New in 1.1.
01232  *
01233  * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
01234  */
01235 svn_error_t *
01236 svn_repos_history2(svn_fs_t *fs,
01237                    const char *path,
01238                    svn_repos_history_func_t history_func,
01239                    void *history_baton,
01240                    svn_repos_authz_func_t authz_read_func,
01241                    void *authz_read_baton,
01242                    svn_revnum_t start,
01243                    svn_revnum_t end,
01244                    svn_boolean_t cross_copies,
01245                    apr_pool_t *pool);
01246 
01247 /**
01248  * Similar to svn_repos_history2(), but with @a authz_read_func
01249  * and @a authz_read_baton always set to NULL.
01250  *
01251  * @deprecated Provided for backward compatibility with the 1.0 API.
01252  */
01253 SVN_DEPRECATED
01254 svn_error_t *
01255 svn_repos_history(svn_fs_t *fs,
01256                   const char *path,
01257                   svn_repos_history_func_t history_func,
01258                   void *history_baton,
01259                   svn_revnum_t start,
01260                   svn_revnum_t end,
01261                   svn_boolean_t cross_copies,
01262                   apr_pool_t *pool);
01263 
01264 
01265 /**
01266  * Set @a *locations to be a mapping of the revisions to the paths of
01267  * the file @a fs_path present at the repository in revision
01268  * @a peg_revision, where the revisions are taken out of the array
01269  * @a location_revisions.
01270  *
01271  * @a location_revisions is an array of svn_revnum_t's and @a *locations
01272  * maps 'svn_revnum_t *' to 'const char *'.
01273  *
01274  * If optional @a authz_read_func is non-NULL, then use it (and @a
01275  * authz_read_baton) to verify that the peg-object is readable.  If not,
01276  * return SVN_ERR_AUTHZ_UNREADABLE.  Also use the @a authz_read_func
01277  * to check that every path returned in the hash is readable.  If an
01278  * unreadable path is encountered, stop tracing and return
01279  * SVN_NO_ERROR.
01280  *
01281  * @a pool is used for all allocations.
01282  *
01283  * @since New in 1.1.
01284  */
01285 svn_error_t *
01286 svn_repos_trace_node_locations(svn_fs_t *fs,
01287                                apr_hash_t **locations,
01288                                const char *fs_path,
01289                                svn_revnum_t peg_revision,
01290                                apr_array_header_t *location_revisions,
01291                                svn_repos_authz_func_t authz_read_func,
01292                                void *authz_read_baton,
01293                                apr_pool_t *pool);
01294 
01295 
01296 /**
01297  * Call @a receiver and @a receiver_baton to report successive
01298  * location segments in revisions between @a start_rev and @a end_rev
01299  * (inclusive) for the line of history identified by the peg-object @a
01300  * path in @a peg_revision (and in @a repos).
01301  *
01302  * @a end_rev may be @c SVN_INVALID_REVNUM to indicate that you want
01303  * to trace the history of the object to its origin.
01304  *
01305  * @a start_rev may be @c SVN_INVALID_REVNUM to indicate "the HEAD
01306  * revision".  Otherwise, @a start_rev must be younger than @a end_rev
01307  * (unless @a end_rev is @c SVN_INVALID_REVNUM).
01308  *
01309  * @a peg_revision may be @c SVN_INVALID_REVNUM to indicate "the HEAD
01310  * revision", and must evaluate to be at least as young as @a start_rev.
01311  *
01312  * If optional @a authz_read_func is not @c NULL, then use it (and @a
01313  * authz_read_baton) to verify that the peg-object is readable.  If
01314  * not, return @c SVN_ERR_AUTHZ_UNREADABLE.  Also use the @a
01315  * authz_read_func to check that every path reported in a location
01316  * segment is readable.  If an unreadable path is encountered, report
01317  * a final (possibly truncated) location segment (if any), stop
01318  * tracing history, and return @c SVN_NO_ERROR.
01319  *
01320  * @a pool is used for all allocations.
01321  *
01322  * @since New in 1.5.
01323  */
01324 svn_error_t *
01325 svn_repos_node_location_segments(svn_repos_t *repos,
01326                                  const char *path,
01327                                  svn_revnum_t peg_revision,
01328                                  svn_revnum_t start_rev,
01329                                  svn_revnum_t end_rev,
01330                                  svn_location_segment_receiver_t receiver,
01331                                  void *receiver_baton,
01332                                  svn_repos_authz_func_t authz_read_func,
01333                                  void *authz_read_baton,
01334                                  apr_pool_t *pool);
01335 
01336 
01337 /* ### other queries we can do someday --
01338 
01339      * fetch the last revision created by <user>
01340          (once usernames become revision properties!)
01341      * fetch the last revision where <path> was modified
01342 
01343 */
01344 
01345 
01346 
01347 /* ---------------------------------------------------------------*/
01348 
01349 /* Retrieving log messages. */
01350 
01351 
01352 /**
01353  * Invoke @a receiver with @a receiver_baton on each log message from
01354  * @a start to @a end in @a repos's filesystem.  @a start may be greater
01355  * or less than @a end; this just controls whether the log messages are
01356  * processed in descending or ascending revision number order.
01357  *
01358  * If @a start or @a end is @c SVN_INVALID_REVNUM, it defaults to youngest.
01359  *
01360  * If @a paths is non-NULL and has one or more elements, then only show
01361  * revisions in which at least one of @a paths was changed (i.e., if
01362  * file, text or props changed; if dir, props or entries changed or any node
01363  * changed below it).  Each path is a <tt>const char *</tt> representing
01364  * an absolute path in the repository.  If @a paths is NULL or empty,
01365  * show all revisions regardless of what paths were changed in those
01366  * revisions.
01367  *
01368  * If @a limit is non-zero then only invoke @a receiver on the first
01369  * @a limit logs.
01370  *
01371  * If @a discover_changed_paths, then each call to @a receiver passes a
01372  * hash mapping paths committed in that revision to information about them
01373  * as the receiver's @a changed_paths argument.
01374  * Otherwise, each call to @a receiver passes NULL for @a changed_paths.
01375  *
01376  * If @a strict_node_history is set, copy history (if any exists) will
01377  * not be traversed while harvesting revision logs for each path.
01378  *
01379  * If @a include_merged_revisions is set, log information for revisions
01380  * which have been merged to @a targets will also be returned.
01381  *
01382  * If @a revprops is NULL, retrieve all revprops; else, retrieve only the
01383  * revprops named in the array (i.e. retrieve none if the array is empty).
01384  *
01385  * If any invocation of @a receiver returns error, return that error
01386  * immediately and without wrapping it.
01387  *
01388  * If @a start or @a end is a non-existent revision, return the error
01389  * @c SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver.
01390  *
01391  * If optional @a authz_read_func is non-NULL, then use this function
01392  * (along with optional @a authz_read_baton) to check the readability
01393  * of each changed-path in each revision about to be "pushed" at
01394  * @a receiver.  If a revision has some changed-paths readable and
01395  * others unreadable, unreadable paths are omitted from the
01396  * changed_paths field and only svn:author and svn:date will be
01397  * available in the revprops field.  If a revision has no
01398  * changed-paths readable at all, then all paths are omitted and no
01399  * revprops are available.
01400  *
01401  * See also the documentation for @c svn_log_entry_receiver_t.
01402  *
01403  * Use @a pool for temporary allocations.
01404  *
01405  * @since New in 1.5.
01406  */
01407 svn_error_t *
01408 svn_repos_get_logs4(svn_repos_t *repos,
01409                     const apr_array_header_t *paths,
01410                     svn_revnum_t start,
01411                     svn_revnum_t end,
01412                     int limit,
01413                     svn_boolean_t discover_changed_paths,
01414                     svn_boolean_t strict_node_history,
01415                     svn_boolean_t include_merged_revisions,
01416                     const apr_array_header_t *revprops,
01417                     svn_repos_authz_func_t authz_read_func,
01418                     void *authz_read_baton,
01419                     svn_log_entry_receiver_t receiver,
01420                     void *receiver_baton,
01421                     apr_pool_t *pool);
01422 
01423 /**
01424  * Same as svn_repos_get_logs4(), but with @a receiver being @c
01425  * svn_log_message_receiver_t instead of @c svn_log_entry_receiver_t.
01426  * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is
01427  * svn:author, svn:date, and svn:log.  If @a paths is empty, nothing
01428  * is returned.
01429  *
01430  * @since New in 1.2.
01431  * @deprecated Provided for backward compatibility with the 1.4 API.
01432  */
01433 SVN_DEPRECATED
01434 svn_error_t *
01435 svn_repos_get_logs3(svn_repos_t *repos,
01436                     const apr_array_header_t *paths,
01437                     svn_revnum_t start,
01438                     svn_revnum_t end,
01439                     int limit,
01440                     svn_boolean_t discover_changed_paths,
01441                     svn_boolean_t strict_node_history,
01442                     svn_repos_authz_func_t authz_read_func,
01443                     void *authz_read_baton,
01444                     svn_log_message_receiver_t receiver,
01445                     void *receiver_baton,
01446                     apr_pool_t *pool);
01447 
01448 
01449 /**
01450  * Same as svn_repos_get_logs3(), but with @a limit always set to 0.
01451  *
01452  * @deprecated Provided for backward compatibility with the 1.1 API.
01453  */
01454 SVN_DEPRECATED
01455 svn_error_t *
01456 svn_repos_get_logs2(svn_repos_t *repos,
01457                     const apr_array_header_t *paths,
01458                     svn_revnum_t start,
01459                     svn_revnum_t end,
01460                     svn_boolean_t discover_changed_paths,
01461                     svn_boolean_t strict_node_history,
01462                     svn_repos_authz_func_t authz_read_func,
01463                     void *authz_read_baton,
01464                     svn_log_message_receiver_t receiver,
01465                     void *receiver_baton,
01466                     apr_pool_t *pool);
01467 
01468 /**
01469  * Same as svn_repos_get_logs2(), but with @a authz_read_func and
01470  * @a authz_read_baton always set to NULL.
01471  *
01472  * @deprecated Provided for backward compatibility with the 1.0 API.
01473  */
01474 SVN_DEPRECATED
01475 svn_error_t *
01476 svn_repos_get_logs(svn_repos_t *repos,
01477                    const apr_array_header_t *paths,
01478                    svn_revnum_t start,
01479                    svn_revnum_t end,
01480                    svn_boolean_t discover_changed_paths,
01481                    svn_boolean_t strict_node_history,
01482                    svn_log_message_receiver_t receiver,
01483                    void *receiver_baton,
01484                    apr_pool_t *pool);
01485 
01486 
01487 
01488 /* ---------------------------------------------------------------*/
01489 
01490 /* Retrieving mergeinfo. */
01491 
01492 /**
01493  * Fetch the mergeinfo for @a paths at @a revision in @a repos, and
01494  * set @a *catalog to a catalog of this mergeinfo.  @a *catalog will
01495  * never be @c NULL but may be empty.
01496  *
01497  * @a inherit indicates whether explicit, explicit or inherited, or
01498  * only inherited mergeinfo for @a paths is fetched.
01499  *
01500  * If @a revision is @c SVN_INVALID_REVNUM, it defaults to youngest.
01501  *
01502  * If @a include_descendants is TRUE, then additionally return the
01503  * mergeinfo for any descendant of any element of @a paths which has
01504  * the @c SVN_PROP_MERGEINFO property explicitly set on it.  (Note
01505  * that inheritance is only taken into account for the elements in @a
01506  * paths; descendants of the elements in @a paths which get their
01507  * mergeinfo via inheritance are not included in @a *catalog.)
01508  *
01509  * If optional @a authz_read_func is non-NULL, then use this function
01510  * (along with optional @a authz_read_baton) to check the readability
01511  * of each path which mergeinfo was requested for (from @a paths).
01512  * Silently omit unreadable paths from the request for mergeinfo.
01513  *
01514  * Use @a pool for all allocations.
01515  *
01516  * @since New in 1.5.
01517  */
01518 svn_error_t *
01519 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
01520                            svn_repos_t *repos,
01521                            const apr_array_header_t *paths,
01522                            svn_revnum_t revision,
01523                            svn_mergeinfo_inheritance_t inherit,
01524                            svn_boolean_t include_descendants,
01525                            svn_repos_authz_func_t authz_read_func,
01526                            void *authz_read_baton,
01527                            apr_pool_t *pool);
01528 
01529 
01530 /* ---------------------------------------------------------------*/
01531 
01532 /* Retrieving multiple revisions of a file. */
01533 
01534 /**
01535  * Retrieve a subset of the interesting revisions of a file @a path in
01536  * @a repos as seen in revision @a end.  Invoke @a handler with
01537  * @a handler_baton as its first argument for each such revision.
01538  * @a pool is used for all allocations.  See svn_fs_history_prev() for
01539  * a discussion of interesting revisions.
01540  *
01541  * If optional @a authz_read_func is non-NULL, then use this function
01542  * (along with optional @a authz_read_baton) to check the readability
01543  * of the rev-path in each interesting revision encountered.
01544  *
01545  * Revision discovery happens from @a end to @a start, and if an
01546  * unreadable revision is encountered before @a start is reached, then
01547  * revision discovery stops and only the revisions from @a end to the
01548  * oldest readable revision are returned (So it will appear that @a
01549  * path was added without history in the latter revision).
01550  *
01551  * If there is an interesting revision of the file that is less than or
01552  * equal to start, the iteration will start at that revision.  Else, the
01553  * iteration will start at the first revision of the file in the repository,
01554  * which has to be less than or equal to end.  Note that if the function
01555  * succeeds, @a handler will have been called at least once.
01556  *
01557  * In a series of calls, the file contents for the first interesting revision
01558  * will be provided as a text delta against the empty file.  In the following
01559  * calls, the delta will be against the contents for the previous call.
01560  *
01561  * If @a include_merged_revisions is TRUE, revisions which a included as a
01562  * result of a merge between @a start and @a end will be included.
01563  *
01564  * @since New in 1.5.
01565  */
01566 svn_error_t *
01567 svn_repos_get_file_revs2(svn_repos_t *repos,
01568                          const char *path,
01569                          svn_revnum_t start,
01570                          svn_revnum_t end,
01571                          svn_boolean_t include_merged_revisions,
01572                          svn_repos_authz_func_t authz_read_func,
01573                          void *authz_read_baton,
01574                          svn_file_rev_handler_t handler,
01575                          void *handler_baton,
01576                          apr_pool_t *pool);
01577 
01578 /**
01579  * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions
01580  * set to FALSE.
01581  *
01582  * @deprecated Provided for backward compatibility with the 1.4 API.
01583  * @since New in 1.1.
01584  */
01585 SVN_DEPRECATED
01586 svn_error_t *
01587 svn_repos_get_file_revs(svn_repos_t *repos,
01588                         const char *path,
01589                         svn_revnum_t start,
01590                         svn_revnum_t end,
01591                         svn_repos_authz_func_t authz_read_func,
01592                         void *authz_read_baton,
01593                         svn_repos_file_rev_handler_t handler,
01594                         void *handler_baton,
01595                         apr_pool_t *pool);
01596 
01597 
01598 /* ---------------------------------------------------------------*/
01599 
01600 /**
01601  * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \
01602  * routines.
01603  * @{
01604  */
01605 
01606 /** Like svn_fs_commit_txn(), but invoke the @a repos's pre- and
01607  * post-commit hooks around the commit.  Use @a pool for any necessary
01608  * allocations.
01609  *
01610  * If the pre-commit hook or svn_fs_commit_txn() fails, throw the
01611  * original error to caller.  If an error occurs when running the
01612  * post-commit hook, return the original error wrapped with
01613  * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED.  If the caller sees this
01614  * error, it knows that the commit succeeded anyway.
01615  *
01616  * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn().
01617  */
01618 svn_error_t *
01619 svn_repos_fs_commit_txn(const char **conflict_p,
01620                         svn_repos_t *repos,
01621                         svn_revnum_t *new_rev,
01622                         svn_fs_txn_t *txn,
01623                         apr_pool_t *pool);
01624 
01625 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping
01626  * <tt>const char *</tt> property names to @c svn_string_t values, to
01627  * set the properties on transaction @a *txn_p.  @a repos is the
01628  * repository object which contains the filesystem.  @a rev, @a
01629  * *txn_p, and @a pool are as in svn_fs_begin_txn().
01630  *
01631  * Before a txn is created, the repository's start-commit hooks are
01632  * run; if any of them fail, no txn is created, @a *txn_p is unaffected,
01633  * and @c SVN_ERR_REPOS_HOOK_FAILURE is returned.
01634  *
01635  * @note @a revprop_table may contain an @c SVN_PROP_REVISION_DATE property,
01636  * which will be set on the transaction, but that will be overwritten
01637  * when the transaction is committed.
01638  *
01639  * @since New in 1.5.
01640  */
01641 svn_error_t *
01642 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
01643                                    svn_repos_t *repos,
01644                                    svn_revnum_t rev,
01645                                    apr_hash_t *revprop_table,
01646                                    apr_pool_t *pool);
01647 
01648 
01649 /**
01650  * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table
01651  * set to a hash containing @a author and @a log_msg as the
01652  * @c SVN_PROP_REVISION_AUTHOR and @c SVN_PROP_REVISION_LOG properties,
01653  * respectively.  @a author and @a log_msg may both be @c NULL.
01654  *
01655  * @deprecated Provided for backward compatibility with the 1.4 API.
01656  */
01657 SVN_DEPRECATED
01658 svn_error_t *
01659 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p,
01660                                   svn_repos_t *repos,
01661                                   svn_revnum_t rev,
01662                                   const char *author,
01663                                   const char *log_msg,
01664                                   apr_pool_t *pool);
01665 
01666 
01667 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding
01668  * property on transaction @a *txn_p.  @a repos is the repository object
01669  * which contains the filesystem.  @a rev, @a *txn_p, and @a pool are as in
01670  * svn_fs_begin_txn().
01671  *
01672  * ### Someday: before a txn is created, some kind of read-hook could
01673  *              be called here.
01674  */
01675 svn_error_t *
01676 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p,
01677                                   svn_repos_t *repos,
01678                                   svn_revnum_t rev,
01679                                   const char *author,
01680                                   apr_pool_t *pool);
01681 
01682 
01683 /** @defgroup svn_repos_fs_locks Repository lock wrappers
01684  * @{
01685  * @since New in 1.2. */
01686 
01687 /** Like svn_fs_lock(), but invoke the @a repos's pre- and
01688  * post-lock hooks before and after the locking action.  Use @a pool
01689  * for any necessary allocations.
01690  *
01691  * If the pre-lock hook or svn_fs_lock() fails, throw the original
01692  * error to caller.  If an error occurs when running the post-lock
01693  * hook, return the original error wrapped with
01694  * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED.  If the caller sees this
01695  * error, it knows that the lock succeeded anyway.
01696  *
01697  * The pre-lock hook may cause a different token to be used for the
01698  * lock, instead of @a token; see the pre-lock-hook documentation for
01699  * more.
01700  */
01701 svn_error_t *
01702 svn_repos_fs_lock(svn_lock_t **lock,
01703                   svn_repos_t *repos,
01704                   const char *path,
01705                   const char *token,
01706                   const char *comment,
01707                   svn_boolean_t is_dav_comment,
01708                   apr_time_t expiration_date,
01709                   svn_revnum_t current_rev,
01710                   svn_boolean_t steal_lock,
01711                   apr_pool_t *pool);
01712 
01713 
01714 /** Like svn_fs_unlock(), but invoke the @a repos's pre- and
01715  * post-unlock hooks before and after the unlocking action.  Use @a
01716  * pool for any necessary allocations.
01717  *
01718  * If the pre-unlock hook or svn_fs_unlock() fails, throw the original
01719  * error to caller.  If an error occurs when running the post-unlock
01720  * hook, return the original error wrapped with
01721  * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED.  If the caller sees this
01722  * error, it knows that the unlock succeeded anyway.
01723  */
01724 svn_error_t *
01725 svn_repos_fs_unlock(svn_repos_t *repos,
01726                     const char *path,
01727                     const char *token,
01728                     svn_boolean_t break_lock,
01729                     apr_pool_t *pool);
01730 
01731 
01732 
01733 /** Look up all the locks in and under @a path in @a repos, setting @a
01734  * *locks to a hash which maps <tt>const char *</tt> paths to the @c
01735  * svn_lock_t locks associated with those paths.  Use @a
01736  * authz_read_func and @a authz_read_baton to "screen" all returned
01737  * locks.  That is: do not return any locks on any paths that are
01738  * unreadable in HEAD, just silently omit them.
01739  */
01740 svn_error_t *
01741 svn_repos_fs_get_locks(apr_hash_t **locks,
01742                        svn_repos_t *repos,
01743                        const char *path,
01744                        svn_repos_authz_func_t authz_read_func,
01745                        void *authz_read_baton,
01746                        apr_pool_t *pool);
01747 
01748 /** @} */
01749 
01750 /**
01751  * Like svn_fs_change_rev_prop(), but validate the name and value of the
01752  * property and invoke the @a repos's pre- and post-revprop-change hooks
01753  * around the change as specified by @a use_pre_revprop_change_hook and
01754  * @a use_post_revprop_change_hook (respectively).
01755  *
01756  * @a rev is the revision whose property to change, @a name is the
01757  * name of the property, and @a new_value is the new value of the
01758  * property.   @a author is the authenticated username of the person
01759  * changing the property value, or NULL if not available.
01760  *
01761  * If @a authz_read_func is non-NULL, then use it (with @a
01762  * authz_read_baton) to validate the changed-paths associated with @a
01763  * rev.  If the revision contains any unreadable changed paths, then
01764  * return SVN_ERR_AUTHZ_UNREADABLE.
01765  *
01766  * Validate @a name and @a new_value like the same way
01767  * svn_repos_fs_change_node_prop() does.
01768  *
01769  * Use @a pool for temporary allocations.
01770  *
01771  * @since New in 1.5.
01772  */
01773 svn_error_t *
01774 svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
01775                               svn_revnum_t rev,
01776                               const char *author,
01777                               const char *name,
01778                               const svn_string_t *new_value,
01779                               svn_boolean_t
01780                               use_pre_revprop_change_hook,
01781                               svn_boolean_t
01782                               use_post_revprop_change_hook,
01783                               svn_repos_authz_func_t
01784                               authz_read_func,
01785                               void *authz_read_baton,
01786                               apr_pool_t *pool);
01787 
01788 /**
01789  * Similar to svn_repos_fs_change_rev_prop3(), but with the @a
01790  * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
01791  * always set to @c TRUE.
01792  *
01793  * @deprecated Provided for backward compatibility with the 1.4 API.
01794  */
01795 SVN_DEPRECATED
01796 svn_error_t *
01797 svn_repos_fs_change_rev_prop2(svn_repos_t *repos,
01798                               svn_revnum_t rev,
01799                               const char *author,
01800                               const char *name,
01801                               const svn_string_t *new_value,
01802                               svn_repos_authz_func_t
01803                               authz_read_func,
01804                               void *authz_read_baton,
01805                               apr_pool_t *pool);
01806 
01807 /**
01808  * Similar to svn_repos_fs_change_rev_prop2(), but with the
01809  * @a authz_read_func parameter always NULL.
01810  *
01811  * @deprecated Provided for backward compatibility with the 1.0 API.
01812  */
01813 SVN_DEPRECATED
01814 svn_error_t *
01815 svn_repos_fs_change_rev_prop(svn_repos_t *repos,
01816                              svn_revnum_t rev,
01817                              const char *author,
01818                              const char *name,
01819                              const svn_string_t *new_value,
01820                              apr_pool_t *pool);
01821 
01822 
01823 
01824 /**
01825  * Set @a *value_p to the value of the property named @a propname on
01826  * revision @a rev in the filesystem opened in @a repos.  If @a rev
01827  * has no property by that name, set @a *value_p to zero.  Allocate
01828  * the result in @a pool.
01829  *
01830  * If @a authz_read_func is non-NULL, then use it (with @a
01831  * authz_read_baton) to validate the changed-paths associated with @a
01832  * rev.  If the changed-paths are all unreadable, then set @a *value_p
01833  * to zero unconditionally.  If only some of the changed-paths are
01834  * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be
01835  * fetched, but return 0 for any other property.
01836  *
01837  * @since New in 1.1.
01838  */
01839 svn_error_t *
01840 svn_repos_fs_revision_prop(svn_string_t **value_p,
01841                            svn_repos_t *repos,
01842                            svn_revnum_t rev,
01843                            const char *propname,
01844                            svn_repos_authz_func_t
01845                            authz_read_func,
01846                            void *authz_read_baton,
01847                            apr_pool_t *pool);
01848 
01849 
01850 /**
01851  * Set @a *table_p to the entire property list of revision @a rev in
01852  * filesystem opened in @a repos, as a hash table allocated in @a
01853  * pool.  The table maps <tt>char *</tt> property names to @c
01854  * svn_string_t * values; the names and values are allocated in @a
01855  * pool.
01856  *
01857  * If @a authz_read_func is non-NULL, then use it (with @a
01858  * authz_read_baton) to validate the changed-paths associated with @a
01859  * rev.  If the changed-paths are all unreadable, then return an empty
01860  * hash. If only some of the changed-paths are unreadable, then return
01861  * an empty hash, except for 'svn:author' and 'svn:date' properties
01862  * (assuming those properties exist).
01863  *
01864  * @since New in 1.1.
01865  */
01866 svn_error_t *
01867 svn_repos_fs_revision_proplist(apr_hash_t **table_p,
01868                                svn_repos_t *repos,
01869                                svn_revnum_t rev,
01870                                svn_repos_authz_func_t
01871                                authz_read_func,
01872                                void *authz_read_baton,
01873                                apr_pool_t *pool);
01874 
01875 
01876 
01877 /* ---------------------------------------------------------------*/
01878 
01879 /* Prop-changing wrappers for libsvn_fs routines. */
01880 
01881 /* NOTE: svn_repos_fs_change_rev_prop() also exists, but is located
01882    above with the hook-related functions. */
01883 
01884 
01885 /** Validating wrapper for svn_fs_change_node_prop() (which see for
01886  * argument descriptions).
01887  *
01888  * If @a name's kind is not @c svn_prop_regular_kind, return @c
01889  * SVN_ERR_REPOS_BAD_ARGS.  If @a name is an "svn:" property, validate its
01890  * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the
01891  * property.
01892  *
01893  * @note Currently, the only properties validated are the "svn:" properties
01894  * @c SVN_PROP_REVISION_LOG and @c SVN_PROP_REVISION_DATE. This may change
01895  * in future releases.
01896  */
01897 svn_error_t *
01898 svn_repos_fs_change_node_prop(svn_fs_root_t *root,
01899                               const char *path,
01900                               const char *name,
01901                               const svn_string_t *value,
01902                               apr_pool_t *pool);
01903 
01904 /** Validating wrapper for svn_fs_change_txn_prop() (which see for
01905  * argument descriptions).  See svn_repos_fs_change_txn_props() for more
01906  * information.
01907  */
01908 svn_error_t *
01909 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn,
01910                              const char *name,
01911                              const svn_string_t *value,
01912                              apr_pool_t *pool);
01913 
01914 /** Validating wrapper for svn_fs_change_txn_props() (which see for
01915  * argument descriptions).  Validate properties and their values the
01916  * same way svn_repos_fs_change_node_prop() does.
01917  *
01918  * @since New in 1.5.
01919  */
01920 svn_error_t *
01921 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn,
01922                               apr_array_header_t *props,
01923                               apr_pool_t *pool);
01924 
01925 /** @} */
01926 
01927 /* ---------------------------------------------------------------*/
01928 
01929 /**
01930  * @defgroup svn_repos_inspection Data structures and editor things for
01931  * repository inspection.
01932  * @{
01933  *
01934  * As it turns out, the svn_repos_dir_delta2() interface can be
01935  * extremely useful for examining the repository, or more exactly,
01936  * changes to the repository.  svn_repos_dir_delta2() allows for
01937  * differences between two trees to be described using an editor.
01938  *
01939  * By using the editor obtained from svn_repos_node_editor() with
01940  * svn_repos_dir_delta2(), the description of how to transform one tree
01941  * into another can be used to build an in-memory linked-list tree,
01942  * which each node representing a repository node that was changed as a
01943  * result of having svn_repos_dir_delta2() drive that editor.
01944  */
01945 
01946 /** A node in the repository. */
01947 typedef struct svn_repos_node_t
01948 {
01949   /** Node type (file, dir, etc.) */
01950   svn_node_kind_t kind;
01951 
01952   /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */
01953   char action;
01954 
01955   /** Were there any textual mods? (files only) */
01956   svn_boolean_t text_mod;
01957 
01958   /** Where there any property mods? */
01959   svn_boolean_t prop_mod;
01960 
01961   /** The name of this node as it appears in its parent's entries list */
01962   const char *name;
01963 
01964   /** The filesystem revision where this was copied from (if any) */
01965   svn_revnum_t copyfrom_rev;
01966 
01967   /** The filesystem path where this was copied from (if any) */
01968   const char *copyfrom_path;
01969 
01970   /** Pointer to the next sibling of this node */
01971   struct svn_repos_node_t *sibling;
01972 
01973   /** Pointer to the first child of this node */
01974   struct svn_repos_node_t *child;
01975 
01976   /** Pointer to the parent of this node */
01977   struct svn_repos_node_t *parent;
01978 
01979 } svn_repos_node_t;
01980 
01981 
01982 /** Set @a *editor and @a *edit_baton to an editor that, when driven by
01983  * svn_repos_dir_delta2(), builds an <tt>svn_repos_node_t *</tt> tree
01984  * representing the delta from @a base_root to @a root in @a repos's
01985  * filesystem.
01986  *
01987  * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root
01988  * node afterwards.
01989  *
01990  * Note that the delta includes "bubbled-up" directories; that is,
01991  * many of the directory nodes will have no prop_mods.
01992  *
01993  * Allocate the tree and its contents in @a node_pool; do all other
01994  * allocation in @a pool.
01995  */
01996 svn_error_t *
01997 svn_repos_node_editor(const svn_delta_editor_t **editor,
01998                       void **edit_baton,
01999                       svn_repos_t *repos,
02000                       svn_fs_root_t *base_root,
02001                       svn_fs_root_t *root,
02002                       apr_pool_t *node_pool,
02003                       apr_pool_t *pool);
02004 
02005 /** Return the root node of the linked-list tree generated by driving
02006  * the editor created by svn_repos_node_editor() with
02007  * svn_repos_dir_delta2(), which is stored in @a edit_baton.  This is
02008  * only really useful if used *after* the editor drive is completed.
02009  */
02010 svn_repos_node_t *
02011 svn_repos_node_from_baton(void *edit_baton);
02012 
02013 /** @} */
02014 
02015 /* ---------------------------------------------------------------*/
02016 
02017 /**
02018  * @defgroup svn_repos_dump_load Dumping and loading filesystem data
02019  * @{
02020  *
02021  * The filesystem 'dump' format contains nothing but the abstract
02022  * structure of the filesystem -- independent of any internal node-id
02023  * schema or database back-end.  All of the data in the dumpfile is
02024  * acquired by public function calls into svn_fs.h.  Similarly, the
02025  * parser which reads the dumpfile is able to reconstruct the
02026  * filesystem using only public svn_fs.h routines.
02027  *
02028  * Thus the dump/load feature's main purpose is for *migrating* data
02029  * from one svn filesystem to another -- presumably two filesystems
02030  * which have different internal implementations.
02031  *
02032  * If you simply want to backup your filesystem, you're probably
02033  * better off using the built-in facilities of the DB backend (using
02034  * Berkeley DB's hot-backup feature, for example.)
02035  *
02036  * For a description of the dumpfile format, see
02037  * /trunk/notes/fs_dumprestore.txt.
02038  */
02039 
02040 /* The RFC822-style headers in our dumpfile format. */
02041 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER            "SVN-fs-dump-format-version"
02042 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION           3
02043 #define SVN_REPOS_DUMPFILE_UUID                      "UUID"
02044 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH            "Content-length"
02045 
02046 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER           "Revision-number"
02047 
02048 #define SVN_REPOS_DUMPFILE_NODE_PATH                 "Node-path"
02049 #define SVN_REPOS_DUMPFILE_NODE_KIND                 "Node-kind"
02050 #define SVN_REPOS_DUMPFILE_NODE_ACTION               "Node-action"
02051 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH        "Node-copyfrom-path"
02052 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV         "Node-copyfrom-rev"
02053 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5      "Text-copy-source-md5"
02054 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1     "Text-copy-source-sha1"
02055 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \
02056                                         SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5
02057 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5          "Text-content-md5"
02058 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1         "Text-content-sha1"
02059 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM     \
02060                                         SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5
02061 
02062 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH       "Prop-content-length"
02063 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH       "Text-content-length"
02064 
02065 /** @since New in 1.1. */
02066 #define SVN_REPOS_DUMPFILE_PROP_DELTA                "Prop-delta"
02067 /** @since New in 1.1. */
02068 #define SVN_REPOS_DUMPFILE_TEXT_DELTA                "Text-delta"
02069 /** @since New in 1.5. */
02070 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5       "Text-delta-base-md5"
02071 /** @since New in 1.6. */
02072 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1      "Text-delta-base-sha1"
02073 /** @since New in 1.6. */
02074 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM  \
02075                                         SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5
02076 
02077 /** The different "actions" attached to nodes in the dumpfile. */
02078 enum svn_node_action
02079 {
02080   svn_node_action_change,
02081   svn_node_action_add,
02082   svn_node_action_delete,
02083   svn_node_action_replace
02084 };
02085 
02086 /** The different policies for processing the UUID in the dumpfile. */
02087 enum svn_repos_load_uuid
02088 {
02089   svn_repos_load_uuid_default,
02090   svn_repos_load_uuid_ignore,
02091   svn_repos_load_uuid_force
02092 };
02093 
02094 
02095 /**
02096  * Verify the contents of the file system in @a repos.
02097  *
02098  * If @a feedback_stream is not @c NULL, write feedback to it (lines of
02099  * the form "* Verified revision %ld\n").
02100  *
02101  * If @a start_rev is @c SVN_INVALID_REVNUM, then start verifying at
02102  * revision 0.  If @a end_rev is @c SVN_INVALID_REVNUM, then verify
02103  * through the @c HEAD revision.
02104  *
02105  * If @a cancel_func is not @c NULL, call it periodically with @a
02106  * cancel_baton as argument to see if the caller wishes to cancel the
02107  * verification.
02108  *
02109  * @since New in 1.5.
02110  */
02111 svn_error_t *
02112 svn_repos_verify_fs(svn_repos_t *repos,
02113                     svn_stream_t *feedback_stream,
02114                     svn_revnum_t start_rev,
02115                     svn_revnum_t end_rev,
02116                     svn_cancel_func_t cancel_func,
02117                     void *cancel_baton,
02118                     apr_pool_t *pool);
02119 
02120 
02121 /**
02122  * Dump the contents of the filesystem within already-open @a repos into
02123  * writable @a dumpstream.  Begin at revision @a start_rev, and dump every
02124  * revision up through @a end_rev.  Use @a pool for all allocation.  If
02125  * non-@c NULL, send feedback to @a feedback_stream.  If @a dumpstream is
02126  * @c NULL, this is effectively a primitive verify.  It is not complete,
02127  * however; see svn_fs_verify instead.
02128  *
02129  * If @a start_rev is @c SVN_INVALID_REVNUM, then start dumping at revision
02130  * 0.  If @a end_rev is @c SVN_INVALID_REVNUM, then dump through the @c HEAD
02131  * revision.
02132  *
02133  * If @a incremental is @c TRUE, the first revision dumped will be a diff
02134  * against the previous revision (usually it looks like a full dump of
02135  * the tree).
02136  *
02137  * If @a use_deltas is @c TRUE, output only node properties which have
02138  * changed relative to the previous contents, and output text contents
02139  * as svndiff data against the previous contents.  Regardless of how
02140  * this flag is set, the first revision of a non-incremental dump will
02141  * be done with full plain text.  A dump with @a use_deltas set cannot
02142  * be loaded by Subversion 1.0.x.
02143  *
02144  * If @a cancel_func is not @c NULL, it is called periodically with
02145  * @a cancel_baton as argument to see if the client wishes to cancel
02146  * the dump.
02147  *
02148  * @since New in 1.1.
02149  */
02150 svn_error_t *
02151 svn_repos_dump_fs2(svn_repos_t *repos,
02152                    svn_stream_t *dumpstream,
02153                    svn_stream_t *feedback_stream,
02154                    svn_revnum_t start_rev,
02155                    svn_revnum_t end_rev,
02156                    svn_boolean_t incremental,
02157                    svn_boolean_t use_deltas,
02158                    svn_cancel_func_t cancel_func,
02159                    void *cancel_baton,
02160                    apr_pool_t *pool);
02161 
02162 
02163 /**
02164  * Similar to svn_repos_dump_fs2(), but with the @a use_deltas
02165  * parameter always set to @c FALSE.
02166  *
02167  * @deprecated Provided for backward compatibility with the 1.0 API.
02168  */
02169 SVN_DEPRECATED
02170 svn_error_t *
02171 svn_repos_dump_fs(svn_repos_t *repos,
02172                   svn_stream_t *dumpstream,
02173                   svn_stream_t *feedback_stream,
02174                   svn_revnum_t start_rev,
02175                   svn_revnum_t end_rev,
02176                   svn_boolean_t incremental,
02177                   svn_cancel_func_t cancel_func,
02178                   void *cancel_baton,
02179                   apr_pool_t *pool);
02180 
02181 
02182 /**
02183  * Read and parse dumpfile-formatted @a dumpstream, reconstructing
02184  * filesystem revisions in already-open @a repos, handling uuids
02185  * in accordance with @a uuid_action.
02186  *
02187  * Read and parse dumpfile-formatted @a dumpstream, reconstructing
02188  * filesystem revisions in already-open @a repos.  Use @a pool for all
02189  * allocation.  If non-@c NULL, send feedback to @a feedback_stream.
02190  *
02191  * If the dumpstream contains copy history that is unavailable in the
02192  * repository, an error will be thrown.
02193  *
02194  * The repository's UUID will be updated iff
02195  *   the dumpstream contains a UUID and
02196  *   @a uuid_action is not equal to @c svn_repos_load_uuid_ignore and
02197  *   either the repository contains no revisions or
02198  *          @a uuid_action is equal to @c svn_repos_load_uuid_force.
02199  *
02200  * If the dumpstream contains no UUID, then @a uuid_action is
02201  * ignored and the repository UUID is not touched.
02202  *
02203  * If @a parent_dir is not NULL, then the parser will reparent all the
02204  * loaded nodes, from root to @a parent_dir.  The directory @a parent_dir
02205  * must be an existing directory in the repository.
02206  *
02207  * If @a use_pre_commit_hook is set, call the repository's pre-commit
02208  * hook before committing each loaded revision.
02209  *
02210  * If @a use_post_commit_hook is set, call the repository's
02211  * post-commit hook after committing each loaded revision.
02212  *
02213  * If @a cancel_func is not @c NULL, it is called periodically with
02214  * @a cancel_baton as argument to see if the client wishes to cancel
02215  * the load.
02216  *
02217  * @since New in 1.2.
02218  */
02219 svn_error_t *
02220 svn_repos_load_fs2(svn_repos_t *repos,
02221                    svn_stream_t *dumpstream,
02222                    svn_stream_t *feedback_stream,
02223                    enum svn_repos_load_uuid uuid_action,
02224                    const char *parent_dir,
02225                    svn_boolean_t use_pre_commit_hook,
02226                    svn_boolean_t use_post_commit_hook,
02227                    svn_cancel_func_t cancel_func,
02228                    void *cancel_baton,
02229                    apr_pool_t *pool);
02230 
02231 /**
02232  * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and
02233  * @a use_post_commit_hook always @c FALSE.
02234  *
02235  * @deprecated Provided for backward compatibility with the 1.0 API.
02236  */
02237 SVN_DEPRECATED
02238 svn_error_t *
02239 svn_repos_load_fs(svn_repos_t *repos,
02240                   svn_stream_t *dumpstream,
02241                   svn_stream_t *feedback_stream,
02242                   enum svn_repos_load_uuid uuid_action,
02243                   const char *parent_dir,
02244                   svn_cancel_func_t cancel_func,
02245                   void *cancel_baton,
02246                   apr_pool_t *pool);
02247 
02248 
02249 /**
02250  * A vtable that is driven by svn_repos_parse_dumpstream2().
02251  *
02252  * @since New in 1.1.
02253  */
02254 typedef struct svn_repos_parse_fns2_t
02255 {
02256   /** The parser has discovered a new revision record within the
02257    * parsing session represented by @a parse_baton.  All the headers are
02258    * placed in @a headers (allocated in @a pool), which maps <tt>const
02259    * char *</tt> header-name ==> <tt>const char *</tt> header-value.
02260    * The @a revision_baton received back (also allocated in @a pool)
02261    * represents the revision.
02262    */
02263   svn_error_t *(*new_revision_record)(void **revision_baton,
02264                                       apr_hash_t *headers,
02265                                       void *parse_baton,
02266                                       apr_pool_t *pool);
02267 
02268   /** The parser has discovered a new uuid record within the parsing
02269    * session represented by @a parse_baton.  The uuid's value is
02270    * @a uuid, and it is allocated in @a pool.
02271    */
02272   svn_error_t *(*uuid_record)(const char *uuid,
02273                               void *parse_baton,
02274                               apr_pool_t *pool);
02275 
02276   /** The parser has discovered a new node record within the current
02277    * revision represented by @a revision_baton.  All the headers are
02278    * placed in @a headers (as with @c new_revision_record), allocated in
02279    * @a pool.  The @a node_baton received back is allocated in @a pool
02280    * and represents the node.
02281    */
02282   svn_error_t *(*new_node_record)(void **node_baton,
02283                                   apr_hash_t *headers,
02284                                   void *revision_baton,
02285                                   apr_pool_t *pool);
02286 
02287   /** For a given @a revision_baton, set a property @a name to @a value. */
02288   svn_error_t *(*set_revision_property)(void *revision_baton,
02289                                         const char *name,
02290                                         const svn_string_t *value);
02291 
02292   /** For a given @a node_baton, set a property @a name to @a value. */
02293   svn_error_t *(*set_node_property)(void *node_baton,
02294                                     const char *name,
02295                                     const svn_string_t *value);
02296 
02297   /** For a given @a node_baton, delete property @a name. */
02298   svn_error_t *(*delete_node_property)(void *node_baton, const char *name);
02299 
02300   /** For a given @a node_baton, remove all properties. */
02301   svn_error_t *(*remove_node_props)(void *node_baton);
02302 
02303   /** For a given @a node_baton, receive a writable @a stream capable of
02304    * receiving the node's fulltext.  After writing the fulltext, call
02305    * the stream's close() function.
02306    *
02307    * If a @c NULL is returned instead of a stream, the vtable is
02308    * indicating that no text is desired, and the parser will not
02309    * attempt to send it.
02310    */
02311   svn_error_t *(*set_fulltext)(svn_stream_t **stream,
02312                                void *node_baton);
02313 
02314   /** For a given @a node_baton, set @a handler and @a handler_baton
02315    * to a window handler and baton capable of receiving a delta
02316    * against the node's previous contents.  A NULL window will be
02317    * sent to the handler after all the windows are sent.
02318    *
02319    * If a @c NULL is returned instead of a handler, the vtable is
02320    * indicating that no delta is desired, and the parser will not
02321    * attempt to send it.
02322    */
02323   svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
02324                                   void **handler_baton,
02325                                   void *node_baton);
02326 
02327   /** The parser has reached the end of the current node represented by
02328    * @a node_baton, it can be freed.
02329    */
02330   svn_error_t *(*close_node)(void *node_baton);
02331 
02332   /** The parser has reached the end of the current revision
02333    * represented by @a revision_baton.  In other words, there are no more
02334    * changed nodes within the revision.  The baton can be freed.
02335    */
02336   svn_error_t *(*close_revision)(void *revision_baton);
02337 
02338 } svn_repos_parse_fns2_t;
02339 
02340 /** @deprecated Provided for backward compatibility with the 1.2 API. */
02341 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t;
02342 
02343 
02344 /**
02345  * Read and parse dumpfile-formatted @a stream, calling callbacks in
02346  * @a parse_fns/@a parse_baton, and using @a pool for allocations.
02347  *
02348  * If @a cancel_func is not @c NULL, it is called periodically with
02349  * @a cancel_baton as argument to see if the client wishes to cancel
02350  * the dump.
02351  *
02352  * This parser has built-in knowledge of the dumpfile format, but only
02353  * in a general sense:
02354  *
02355  *    * it recognizes revision and node records by looking for either
02356  *      a REVISION_NUMBER or NODE_PATH headers.
02357  *
02358  *    * it recognizes the CONTENT-LENGTH headers, so it knows if and
02359  *      how to suck up the content body.
02360  *
02361  *    * it knows how to parse a content body into two parts:  props
02362  *      and text, and pass the pieces to the vtable.
02363  *
02364  * This is enough knowledge to make it easy on vtable implementors,
02365  * but still allow expansion of the format:  most headers are ignored.
02366  *
02367  * @since New in 1.1.
02368  */
02369 svn_error_t *
02370 svn_repos_parse_dumpstream2(svn_stream_t *stream,
02371                             const svn_repos_parse_fns2_t *parse_fns,
02372                             void *parse_baton,
02373                             svn_cancel_func_t cancel_func,
02374                             void *cancel_baton,
02375                             apr_pool_t *pool);
02376 
02377 
02378 /**
02379  * Set @a *parser and @a *parse_baton to a vtable parser which commits new
02380  * revisions to the fs in @a repos.  The constructed parser will treat
02381  * UUID records in a manner consistent with @a uuid_action.  Use @a pool
02382  * to operate on the fs.
02383  *
02384  * If @a use_history is set, then the parser will require relative
02385  * 'copyfrom' history to exist in the repository when it encounters
02386  * nodes that are added-with-history.
02387  *
02388  * If @a parent_dir is not NULL, then the parser will reparent all the
02389  * loaded nodes, from root to @a parent_dir.  The directory @a parent_dir
02390  * must be an existing directory in the repository.
02391  *
02392  * Print all parsing feedback to @a outstream (if non-@c NULL).
02393  *
02394  *
02395  * @since New in 1.1.
02396  */
02397 svn_error_t *
02398 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser,
02399                                void **parse_baton,
02400                                svn_repos_t *repos,
02401                                svn_boolean_t use_history,
02402                                enum svn_repos_load_uuid uuid_action,
02403                                svn_stream_t *outstream,
02404                                const char *parent_dir,
02405                                apr_pool_t *pool);
02406 
02407 
02408 /**
02409  * A vtable that is driven by svn_repos_parse_dumpstream().
02410  * Similar to @c svn_repos_parse_fns2_t except that it lacks
02411  * the delete_node_property and apply_textdelta callbacks.
02412  *
02413  * @deprecated Provided for backward compatibility with the 1.0 API.
02414  */
02415 typedef struct svn_repos_parse_fns_t
02416 {
02417   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02418   svn_error_t *(*new_revision_record)(void **revision_baton,
02419                                       apr_hash_t *headers,
02420                                       void *parse_baton,
02421                                       apr_pool_t *pool);
02422   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02423   svn_error_t *(*uuid_record)(const char *uuid,
02424                               void *parse_baton,
02425                               apr_pool_t *pool);
02426   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02427   svn_error_t *(*new_node_record)(void **node_baton,
02428                                   apr_hash_t *headers,
02429                                   void *revision_baton,
02430                                   apr_pool_t *pool);
02431   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02432   svn_error_t *(*set_revision_property)(void *revision_baton,
02433                                         const char *name,
02434                                         const svn_string_t *value);
02435   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02436   svn_error_t *(*set_node_property)(void *node_baton,
02437                                     const char *name,
02438                                     const svn_string_t *value);
02439   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02440   svn_error_t *(*remove_node_props)(void *node_baton);
02441   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02442   svn_error_t *(*set_fulltext)(svn_stream_t **stream,
02443                                void *node_baton);
02444   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02445   svn_error_t *(*close_node)(void *node_baton);
02446   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02447   svn_error_t *(*close_revision)(void *revision_baton);
02448 } svn_repos_parser_fns_t;
02449 
02450 
02451 /**
02452  * Similar to svn_repos_parse_dumpstream2(), but uses the more limited
02453  * @c svn_repos_parser_fns_t vtable type.
02454  *
02455  * @deprecated Provided for backward compatibility with the 1.0 API.
02456  */
02457 SVN_DEPRECATED
02458 svn_error_t *
02459 svn_repos_parse_dumpstream(svn_stream_t *stream,
02460                            const svn_repos_parser_fns_t *parse_fns,
02461                            void *parse_baton,
02462                            svn_cancel_func_t cancel_func,
02463                            void *cancel_baton,
02464                            apr_pool_t *pool);
02465 
02466 
02467 /**
02468  * Similar to svn_repos_get_fs_build_parser2(), but yields the more
02469  * limited svn_repos_parser_fns_t vtable type.
02470  *
02471  * @deprecated Provided for backward compatibility with the 1.0 API.
02472  */
02473 SVN_DEPRECATED
02474 svn_error_t *
02475 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser,
02476                               void **parse_baton,
02477                               svn_repos_t *repos,
02478                               svn_boolean_t use_history,
02479                               enum svn_repos_load_uuid uuid_action,
02480                               svn_stream_t *outstream,
02481                               const char *parent_dir,
02482                               apr_pool_t *pool);
02483 
02484 
02485 /** @} */
02486 
02487 /** A data type which stores the authz information.
02488  *
02489  * @since New in 1.3.
02490  */
02491 typedef struct svn_authz_t svn_authz_t;
02492 
02493 /** Read authz configuration data from @a file (a file or registry
02494  * path) into @a *authz_p, allocated in @a pool.
02495  *
02496  * If @a file is not a valid authz rule file, then return
02497  * SVN_AUTHZ_INVALID_CONFIG.  The contents of @a *authz_p is then
02498  * undefined.  If @a must_exist is TRUE, a missing authz file is also
02499  * an error.
02500  *
02501  * @since New in 1.3.
02502  */
02503 svn_error_t *
02504 svn_repos_authz_read(svn_authz_t **authz_p,
02505                      const char *file,
02506                      svn_boolean_t must_exist,
02507                      apr_pool_t *pool);
02508 
02509 /**
02510  * Check whether @a user can access @a path in the repository @a
02511  * repos_name with the @a required_access.  @a authz lists the ACLs to
02512  * check against.  Set @a *access_granted to indicate if the requested
02513  * access is granted.
02514  *
02515  * If @a path is NULL, then check whether @a user has the @a
02516  * required_access anywhere in the repository.  Set @a *access_granted
02517  * to TRUE if at least one path is accessible with the @a
02518  * required_access.
02519  *
02520  * @since New in 1.3.
02521  */
02522 svn_error_t *
02523 svn_repos_authz_check_access(svn_authz_t *authz,
02524                              const char *repos_name,
02525                              const char *path,
02526                              const char *user,
02527                              svn_repos_authz_access_t required_access,
02528                              svn_boolean_t *access_granted,
02529                              apr_pool_t *pool);
02530 
02531 
02532 
02533 /** Revision Access Levels
02534  *
02535  * Like most version control systems, access to versioned objects in
02536  * Subversion is determined on primarily path-based system.  Users either
02537  * do or don't have the ability to read a given path.
02538  *
02539  * However, unlike many version control systems where versioned objects
02540  * maintain their own distinct version information (revision numbers,
02541  * authors, log messages, change timestamps, etc.), Subversion binds
02542  * multiple paths changed as part of a single commit operation into a
02543  * set, calls the whole thing a revision, and hangs commit metadata
02544  * (author, date, log message, etc.) off of that revision.  So, commit
02545  * metadata is shared across all the paths changed as part of a given
02546  * commit operation.
02547  *
02548  * It is common (or, at least, we hope it is) for log messages to give
02549  * detailed information about changes made in the commit to which the log
02550  * message is attached.  Such information might include a mention of all
02551  * the files changed, what was changed in them, and so on.  But this
02552  * causes a problem when presenting information to readers who aren't
02553  * authorized to read every path in the repository.  Simply knowing that
02554  * a given path exists may be a security leak, even if the user can't see
02555  * the contents of the data located at that path.
02556  *
02557  * So Subversion does what it reasonably can to prevent the leak of this
02558  * information, and does so via a staged revision access policy.  A
02559  * reader can be said to have one of three levels of access to a given
02560  * revision's metadata, based solely on the reader's access rights to the
02561  * paths changed or copied in that revision:
02562  *
02563  *   'full access' -- Granted when the reader has access to all paths
02564  *      changed or copied in the revision, or when no paths were
02565  *      changed in the revision at all, this access level permits
02566  *      full visibility of all revision property names and values,
02567  *      and the full changed-paths information.
02568  *
02569  *   'no access' -- Granted when the reader does not have access to any
02570  *      paths changed or copied in the revision, this access level
02571  *      denies the reader access to all revision properties and all
02572  *      changed-paths information.
02573  *
02574  *   'partial access' -- Granted when the reader has access to at least
02575  *      one, but not all, of the paths changed or copied in the revision,
02576  *      this access level permits visibility of the svn:date and
02577  *      svn:author revision properties and only the paths of the
02578  *      changed-paths information to which the reader has access.
02579  *
02580  */
02581 
02582 
02583 /** An enum defining levels of revision access.
02584  *
02585  * @since New in 1.5.
02586  */
02587 typedef enum
02588 {
02589   svn_repos_revision_access_none,
02590   svn_repos_revision_access_partial,
02591   svn_repos_revision_access_full
02592 }
02593 svn_repos_revision_access_level_t;
02594 
02595 
02596 /**
02597  * Set @a access to the access level granted for @a revision in @a
02598  * repos, as determined by consulting the @a authz_read_func callback
02599  * function and its associated @a authz_read_baton.
02600  *
02601  * @a authz_read_func may be @c NULL, in which case @a access will be
02602  * set to @c svn_repos_revision_access_full.
02603  *
02604  * @since New in 1.5.
02605  */
02606 svn_error_t *
02607 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level,
02608                                 svn_repos_t *repos,
02609                                 svn_revnum_t revision,
02610                                 svn_repos_authz_func_t authz_read_func,
02611                                 void *authz_read_baton,
02612                                 apr_pool_t *pool);
02613 
02614 
02615 
02616 /** Capabilities **/
02617 
02618 /**
02619  * Store in @a repos the client-reported capabilities @a capabilities,
02620  * which must be allocated in memory at least as long-lived as @a repos.
02621  *
02622  * The elements of @a capabilities are 'const char *', a subset of
02623  * the constants beginning with @c SVN_RA_CAPABILITY_.
02624  * @a capabilities is not copied, so changing it later will affect
02625  * what is remembered by @a repos.
02626  *
02627  * @note The capabilities are passed along to the start-commit hook;
02628  * see that hook's template for details.
02629  *
02630  * @note As of Subversion 1.5, there are no error conditions defined,
02631  * so this always returns SVN_NO_ERROR.  In future releases it may
02632  * return error, however, so callers should check.
02633  *
02634  * @since New in 1.5.
02635  */
02636 svn_error_t *
02637 svn_repos_remember_client_capabilities(svn_repos_t *repos,
02638                                        apr_array_header_t *capabilities);
02639 
02640 
02641 
02642 #ifdef __cplusplus
02643 }
02644 #endif /* __cplusplus */
02645 
02646 #endif /* SVN_REPOS_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines