• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

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 paths will also be returned, unless these
01381  * revisions are already part of @a start to @a end in @a repos's
01382  * filesystem, as limted by @a paths. In the latter case those revisions
01383  * are skipped and @a receiver is not invoked.
01384  *
01385  * If @a revprops is NULL, retrieve all revprops; else, retrieve only the
01386  * revprops named in the array (i.e. retrieve none if the array is empty).
01387  *
01388  * If any invocation of @a receiver returns error, return that error
01389  * immediately and without wrapping it.
01390  *
01391  * If @a start or @a end is a non-existent revision, return the error
01392  * @c SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver.
01393  *
01394  * If optional @a authz_read_func is non-NULL, then use this function
01395  * (along with optional @a authz_read_baton) to check the readability
01396  * of each changed-path in each revision about to be "pushed" at
01397  * @a receiver.  If a revision has some changed-paths readable and
01398  * others unreadable, unreadable paths are omitted from the
01399  * changed_paths field and only svn:author and svn:date will be
01400  * available in the revprops field.  If a revision has no
01401  * changed-paths readable at all, then all paths are omitted and no
01402  * revprops are available.
01403  *
01404  * See also the documentation for @c svn_log_entry_receiver_t.
01405  *
01406  * Use @a pool for temporary allocations.
01407  *
01408  * @since New in 1.5.
01409  */
01410 svn_error_t *
01411 svn_repos_get_logs4(svn_repos_t *repos,
01412                     const apr_array_header_t *paths,
01413                     svn_revnum_t start,
01414                     svn_revnum_t end,
01415                     int limit,
01416                     svn_boolean_t discover_changed_paths,
01417                     svn_boolean_t strict_node_history,
01418                     svn_boolean_t include_merged_revisions,
01419                     const apr_array_header_t *revprops,
01420                     svn_repos_authz_func_t authz_read_func,
01421                     void *authz_read_baton,
01422                     svn_log_entry_receiver_t receiver,
01423                     void *receiver_baton,
01424                     apr_pool_t *pool);
01425 
01426 /**
01427  * Same as svn_repos_get_logs4(), but with @a receiver being @c
01428  * svn_log_message_receiver_t instead of @c svn_log_entry_receiver_t.
01429  * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is
01430  * svn:author, svn:date, and svn:log.  If @a paths is empty, nothing
01431  * is returned.
01432  *
01433  * @since New in 1.2.
01434  * @deprecated Provided for backward compatibility with the 1.4 API.
01435  */
01436 SVN_DEPRECATED
01437 svn_error_t *
01438 svn_repos_get_logs3(svn_repos_t *repos,
01439                     const apr_array_header_t *paths,
01440                     svn_revnum_t start,
01441                     svn_revnum_t end,
01442                     int limit,
01443                     svn_boolean_t discover_changed_paths,
01444                     svn_boolean_t strict_node_history,
01445                     svn_repos_authz_func_t authz_read_func,
01446                     void *authz_read_baton,
01447                     svn_log_message_receiver_t receiver,
01448                     void *receiver_baton,
01449                     apr_pool_t *pool);
01450 
01451 
01452 /**
01453  * Same as svn_repos_get_logs3(), but with @a limit always set to 0.
01454  *
01455  * @deprecated Provided for backward compatibility with the 1.1 API.
01456  */
01457 SVN_DEPRECATED
01458 svn_error_t *
01459 svn_repos_get_logs2(svn_repos_t *repos,
01460                     const apr_array_header_t *paths,
01461                     svn_revnum_t start,
01462                     svn_revnum_t end,
01463                     svn_boolean_t discover_changed_paths,
01464                     svn_boolean_t strict_node_history,
01465                     svn_repos_authz_func_t authz_read_func,
01466                     void *authz_read_baton,
01467                     svn_log_message_receiver_t receiver,
01468                     void *receiver_baton,
01469                     apr_pool_t *pool);
01470 
01471 /**
01472  * Same as svn_repos_get_logs2(), but with @a authz_read_func and
01473  * @a authz_read_baton always set to NULL.
01474  *
01475  * @deprecated Provided for backward compatibility with the 1.0 API.
01476  */
01477 SVN_DEPRECATED
01478 svn_error_t *
01479 svn_repos_get_logs(svn_repos_t *repos,
01480                    const apr_array_header_t *paths,
01481                    svn_revnum_t start,
01482                    svn_revnum_t end,
01483                    svn_boolean_t discover_changed_paths,
01484                    svn_boolean_t strict_node_history,
01485                    svn_log_message_receiver_t receiver,
01486                    void *receiver_baton,
01487                    apr_pool_t *pool);
01488 
01489 
01490 
01491 /* ---------------------------------------------------------------*/
01492 
01493 /* Retrieving mergeinfo. */
01494 
01495 /**
01496  * Fetch the mergeinfo for @a paths at @a revision in @a repos, and
01497  * set @a *catalog to a catalog of this mergeinfo.  @a *catalog will
01498  * never be @c NULL but may be empty.
01499  *
01500  * @a inherit indicates whether explicit, explicit or inherited, or
01501  * only inherited mergeinfo for @a paths is fetched.
01502  *
01503  * If @a revision is @c SVN_INVALID_REVNUM, it defaults to youngest.
01504  *
01505  * If @a include_descendants is TRUE, then additionally return the
01506  * mergeinfo for any descendant of any element of @a paths which has
01507  * the @c SVN_PROP_MERGEINFO property explicitly set on it.  (Note
01508  * that inheritance is only taken into account for the elements in @a
01509  * paths; descendants of the elements in @a paths which get their
01510  * mergeinfo via inheritance are not included in @a *catalog.)
01511  *
01512  * If optional @a authz_read_func is non-NULL, then use this function
01513  * (along with optional @a authz_read_baton) to check the readability
01514  * of each path which mergeinfo was requested for (from @a paths).
01515  * Silently omit unreadable paths from the request for mergeinfo.
01516  *
01517  * Use @a pool for all allocations.
01518  *
01519  * @since New in 1.5.
01520  */
01521 svn_error_t *
01522 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
01523                            svn_repos_t *repos,
01524                            const apr_array_header_t *paths,
01525                            svn_revnum_t revision,
01526                            svn_mergeinfo_inheritance_t inherit,
01527                            svn_boolean_t include_descendants,
01528                            svn_repos_authz_func_t authz_read_func,
01529                            void *authz_read_baton,
01530                            apr_pool_t *pool);
01531 
01532 
01533 /* ---------------------------------------------------------------*/
01534 
01535 /* Retrieving multiple revisions of a file. */
01536 
01537 /**
01538  * Retrieve a subset of the interesting revisions of a file @a path in
01539  * @a repos as seen in revision @a end.  Invoke @a handler with
01540  * @a handler_baton as its first argument for each such revision.
01541  * @a pool is used for all allocations.  See svn_fs_history_prev() for
01542  * a discussion of interesting revisions.
01543  *
01544  * If optional @a authz_read_func is non-NULL, then use this function
01545  * (along with optional @a authz_read_baton) to check the readability
01546  * of the rev-path in each interesting revision encountered.
01547  *
01548  * Revision discovery happens from @a end to @a start, and if an
01549  * unreadable revision is encountered before @a start is reached, then
01550  * revision discovery stops and only the revisions from @a end to the
01551  * oldest readable revision are returned (So it will appear that @a
01552  * path was added without history in the latter revision).
01553  *
01554  * If there is an interesting revision of the file that is less than or
01555  * equal to start, the iteration will start at that revision.  Else, the
01556  * iteration will start at the first revision of the file in the repository,
01557  * which has to be less than or equal to end.  Note that if the function
01558  * succeeds, @a handler will have been called at least once.
01559  *
01560  * In a series of calls, the file contents for the first interesting revision
01561  * will be provided as a text delta against the empty file.  In the following
01562  * calls, the delta will be against the contents for the previous call.
01563  *
01564  * If @a include_merged_revisions is TRUE, revisions which a included as a
01565  * result of a merge between @a start and @a end will be included.
01566  *
01567  * @since New in 1.5.
01568  */
01569 svn_error_t *
01570 svn_repos_get_file_revs2(svn_repos_t *repos,
01571                          const char *path,
01572                          svn_revnum_t start,
01573                          svn_revnum_t end,
01574                          svn_boolean_t include_merged_revisions,
01575                          svn_repos_authz_func_t authz_read_func,
01576                          void *authz_read_baton,
01577                          svn_file_rev_handler_t handler,
01578                          void *handler_baton,
01579                          apr_pool_t *pool);
01580 
01581 /**
01582  * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions
01583  * set to FALSE.
01584  *
01585  * @deprecated Provided for backward compatibility with the 1.4 API.
01586  * @since New in 1.1.
01587  */
01588 SVN_DEPRECATED
01589 svn_error_t *
01590 svn_repos_get_file_revs(svn_repos_t *repos,
01591                         const char *path,
01592                         svn_revnum_t start,
01593                         svn_revnum_t end,
01594                         svn_repos_authz_func_t authz_read_func,
01595                         void *authz_read_baton,
01596                         svn_repos_file_rev_handler_t handler,
01597                         void *handler_baton,
01598                         apr_pool_t *pool);
01599 
01600 
01601 /* ---------------------------------------------------------------*/
01602 
01603 /**
01604  * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \
01605  * routines.
01606  * @{
01607  */
01608 
01609 /** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and
01610  * post-commit hooks around the commit.  Use @a pool for any necessary
01611  * allocations.
01612  *
01613  * If the pre-commit hook fails, do not attempt to commit the
01614  * transaction and throw the original error to the caller.
01615  *
01616  * A successful commit is indicated by a valid revision value in @a
01617  * *new_rev, not if svn_fs_commit_txn() returns an error, which can
01618  * occur during its post commit FS processing.  If the transaction was
01619  * not committed, then return the associated error and do not execute
01620  * the post-commit hook.
01621  *
01622  * If the commit succeeds the post-commit hook is executed.  If the
01623  * post-commit hook returns an error, always wrap it with
01624  * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to
01625  * find the post-commit hook error in the returned error chain.  If
01626  * both svn_fs_commit_txn() and the post-commit hook return errors,
01627  * then svn_fs_commit_txn()'s error is the parent error and the
01628  * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child
01629  * error.
01630  *
01631  * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn().
01632  */
01633 svn_error_t *
01634 svn_repos_fs_commit_txn(const char **conflict_p,
01635                         svn_repos_t *repos,
01636                         svn_revnum_t *new_rev,
01637                         svn_fs_txn_t *txn,
01638                         apr_pool_t *pool);
01639 
01640 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping
01641  * <tt>const char *</tt> property names to @c svn_string_t values, to
01642  * set the properties on transaction @a *txn_p.  @a repos is the
01643  * repository object which contains the filesystem.  @a rev, @a
01644  * *txn_p, and @a pool are as in svn_fs_begin_txn().
01645  *
01646  * Before a txn is created, the repository's start-commit hooks are
01647  * run; if any of them fail, no txn is created, @a *txn_p is unaffected,
01648  * and @c SVN_ERR_REPOS_HOOK_FAILURE is returned.
01649  *
01650  * @note @a revprop_table may contain an @c SVN_PROP_REVISION_DATE property,
01651  * which will be set on the transaction, but that will be overwritten
01652  * when the transaction is committed.
01653  *
01654  * @since New in 1.5.
01655  */
01656 svn_error_t *
01657 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
01658                                    svn_repos_t *repos,
01659                                    svn_revnum_t rev,
01660                                    apr_hash_t *revprop_table,
01661                                    apr_pool_t *pool);
01662 
01663 
01664 /**
01665  * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table
01666  * set to a hash containing @a author and @a log_msg as the
01667  * @c SVN_PROP_REVISION_AUTHOR and @c SVN_PROP_REVISION_LOG properties,
01668  * respectively.  @a author and @a log_msg may both be @c NULL.
01669  *
01670  * @deprecated Provided for backward compatibility with the 1.4 API.
01671  */
01672 SVN_DEPRECATED
01673 svn_error_t *
01674 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p,
01675                                   svn_repos_t *repos,
01676                                   svn_revnum_t rev,
01677                                   const char *author,
01678                                   const char *log_msg,
01679                                   apr_pool_t *pool);
01680 
01681 
01682 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding
01683  * property on transaction @a *txn_p.  @a repos is the repository object
01684  * which contains the filesystem.  @a rev, @a *txn_p, and @a pool are as in
01685  * svn_fs_begin_txn().
01686  *
01687  * ### Someday: before a txn is created, some kind of read-hook could
01688  *              be called here.
01689  */
01690 svn_error_t *
01691 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p,
01692                                   svn_repos_t *repos,
01693                                   svn_revnum_t rev,
01694                                   const char *author,
01695                                   apr_pool_t *pool);
01696 
01697 
01698 /** @defgroup svn_repos_fs_locks Repository lock wrappers
01699  * @{
01700  * @since New in 1.2. */
01701 
01702 /** Like svn_fs_lock(), but invoke the @a repos's pre- and
01703  * post-lock hooks before and after the locking action.  Use @a pool
01704  * for any necessary allocations.
01705  *
01706  * If the pre-lock hook or svn_fs_lock() fails, throw the original
01707  * error to caller.  If an error occurs when running the post-lock
01708  * hook, return the original error wrapped with
01709  * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED.  If the caller sees this
01710  * error, it knows that the lock succeeded anyway.
01711  *
01712  * The pre-lock hook may cause a different token to be used for the
01713  * lock, instead of @a token; see the pre-lock-hook documentation for
01714  * more.
01715  */
01716 svn_error_t *
01717 svn_repos_fs_lock(svn_lock_t **lock,
01718                   svn_repos_t *repos,
01719                   const char *path,
01720                   const char *token,
01721                   const char *comment,
01722                   svn_boolean_t is_dav_comment,
01723                   apr_time_t expiration_date,
01724                   svn_revnum_t current_rev,
01725                   svn_boolean_t steal_lock,
01726                   apr_pool_t *pool);
01727 
01728 
01729 /** Like svn_fs_unlock(), but invoke the @a repos's pre- and
01730  * post-unlock hooks before and after the unlocking action.  Use @a
01731  * pool for any necessary allocations.
01732  *
01733  * If the pre-unlock hook or svn_fs_unlock() fails, throw the original
01734  * error to caller.  If an error occurs when running the post-unlock
01735  * hook, return the original error wrapped with
01736  * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED.  If the caller sees this
01737  * error, it knows that the unlock succeeded anyway.
01738  */
01739 svn_error_t *
01740 svn_repos_fs_unlock(svn_repos_t *repos,
01741                     const char *path,
01742                     const char *token,
01743                     svn_boolean_t break_lock,
01744                     apr_pool_t *pool);
01745 
01746 
01747 
01748 /** Look up all the locks in and under @a path in @a repos, setting @a
01749  * *locks to a hash which maps <tt>const char *</tt> paths to the @c
01750  * svn_lock_t locks associated with those paths.  Use @a
01751  * authz_read_func and @a authz_read_baton to "screen" all returned
01752  * locks.  That is: do not return any locks on any paths that are
01753  * unreadable in HEAD, just silently omit them.
01754  */
01755 svn_error_t *
01756 svn_repos_fs_get_locks(apr_hash_t **locks,
01757                        svn_repos_t *repos,
01758                        const char *path,
01759                        svn_repos_authz_func_t authz_read_func,
01760                        void *authz_read_baton,
01761                        apr_pool_t *pool);
01762 
01763 /** @} */
01764 
01765 /**
01766  * Like svn_fs_change_rev_prop(), but validate the name and value of the
01767  * property and invoke the @a repos's pre- and post-revprop-change hooks
01768  * around the change as specified by @a use_pre_revprop_change_hook and
01769  * @a use_post_revprop_change_hook (respectively).
01770  *
01771  * @a rev is the revision whose property to change, @a name is the
01772  * name of the property, and @a new_value is the new value of the
01773  * property.   @a author is the authenticated username of the person
01774  * changing the property value, or NULL if not available.
01775  *
01776  * If @a authz_read_func is non-NULL, then use it (with @a
01777  * authz_read_baton) to validate the changed-paths associated with @a
01778  * rev.  If the revision contains any unreadable changed paths, then
01779  * return SVN_ERR_AUTHZ_UNREADABLE.
01780  *
01781  * Validate @a name and @a new_value like the same way
01782  * svn_repos_fs_change_node_prop() does.
01783  *
01784  * Use @a pool for temporary allocations.
01785  *
01786  * @since New in 1.5.
01787  */
01788 svn_error_t *
01789 svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
01790                               svn_revnum_t rev,
01791                               const char *author,
01792                               const char *name,
01793                               const svn_string_t *new_value,
01794                               svn_boolean_t
01795                               use_pre_revprop_change_hook,
01796                               svn_boolean_t
01797                               use_post_revprop_change_hook,
01798                               svn_repos_authz_func_t
01799                               authz_read_func,
01800                               void *authz_read_baton,
01801                               apr_pool_t *pool);
01802 
01803 /**
01804  * Similar to svn_repos_fs_change_rev_prop3(), but with the @a
01805  * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
01806  * always set to @c TRUE.
01807  *
01808  * @deprecated Provided for backward compatibility with the 1.4 API.
01809  */
01810 SVN_DEPRECATED
01811 svn_error_t *
01812 svn_repos_fs_change_rev_prop2(svn_repos_t *repos,
01813                               svn_revnum_t rev,
01814                               const char *author,
01815                               const char *name,
01816                               const svn_string_t *new_value,
01817                               svn_repos_authz_func_t
01818                               authz_read_func,
01819                               void *authz_read_baton,
01820                               apr_pool_t *pool);
01821 
01822 /**
01823  * Similar to svn_repos_fs_change_rev_prop2(), but with the
01824  * @a authz_read_func parameter always NULL.
01825  *
01826  * @deprecated Provided for backward compatibility with the 1.0 API.
01827  */
01828 SVN_DEPRECATED
01829 svn_error_t *
01830 svn_repos_fs_change_rev_prop(svn_repos_t *repos,
01831                              svn_revnum_t rev,
01832                              const char *author,
01833                              const char *name,
01834                              const svn_string_t *new_value,
01835                              apr_pool_t *pool);
01836 
01837 
01838 
01839 /**
01840  * Set @a *value_p to the value of the property named @a propname on
01841  * revision @a rev in the filesystem opened in @a repos.  If @a rev
01842  * has no property by that name, set @a *value_p to zero.  Allocate
01843  * the result in @a pool.
01844  *
01845  * If @a authz_read_func is non-NULL, then use it (with @a
01846  * authz_read_baton) to validate the changed-paths associated with @a
01847  * rev.  If the changed-paths are all unreadable, then set @a *value_p
01848  * to zero unconditionally.  If only some of the changed-paths are
01849  * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be
01850  * fetched, but return 0 for any other property.
01851  *
01852  * @since New in 1.1.
01853  */
01854 svn_error_t *
01855 svn_repos_fs_revision_prop(svn_string_t **value_p,
01856                            svn_repos_t *repos,
01857                            svn_revnum_t rev,
01858                            const char *propname,
01859                            svn_repos_authz_func_t
01860                            authz_read_func,
01861                            void *authz_read_baton,
01862                            apr_pool_t *pool);
01863 
01864 
01865 /**
01866  * Set @a *table_p to the entire property list of revision @a rev in
01867  * filesystem opened in @a repos, as a hash table allocated in @a
01868  * pool.  The table maps <tt>char *</tt> property names to @c
01869  * svn_string_t * values; the names and values are allocated in @a
01870  * pool.
01871  *
01872  * If @a authz_read_func is non-NULL, then use it (with @a
01873  * authz_read_baton) to validate the changed-paths associated with @a
01874  * rev.  If the changed-paths are all unreadable, then return an empty
01875  * hash. If only some of the changed-paths are unreadable, then return
01876  * an empty hash, except for 'svn:author' and 'svn:date' properties
01877  * (assuming those properties exist).
01878  *
01879  * @since New in 1.1.
01880  */
01881 svn_error_t *
01882 svn_repos_fs_revision_proplist(apr_hash_t **table_p,
01883                                svn_repos_t *repos,
01884                                svn_revnum_t rev,
01885                                svn_repos_authz_func_t
01886                                authz_read_func,
01887                                void *authz_read_baton,
01888                                apr_pool_t *pool);
01889 
01890 
01891 
01892 /* ---------------------------------------------------------------*/
01893 
01894 /* Prop-changing wrappers for libsvn_fs routines. */
01895 
01896 /* NOTE: svn_repos_fs_change_rev_prop() also exists, but is located
01897    above with the hook-related functions. */
01898 
01899 
01900 /** Validating wrapper for svn_fs_change_node_prop() (which see for
01901  * argument descriptions).
01902  *
01903  * If @a name's kind is not @c svn_prop_regular_kind, return @c
01904  * SVN_ERR_REPOS_BAD_ARGS.  If @a name is an "svn:" property, validate its
01905  * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the
01906  * property.
01907  *
01908  * @note Currently, the only properties validated are the "svn:" properties
01909  * @c SVN_PROP_REVISION_LOG and @c SVN_PROP_REVISION_DATE. This may change
01910  * in future releases.
01911  */
01912 svn_error_t *
01913 svn_repos_fs_change_node_prop(svn_fs_root_t *root,
01914                               const char *path,
01915                               const char *name,
01916                               const svn_string_t *value,
01917                               apr_pool_t *pool);
01918 
01919 /** Validating wrapper for svn_fs_change_txn_prop() (which see for
01920  * argument descriptions).  See svn_repos_fs_change_txn_props() for more
01921  * information.
01922  */
01923 svn_error_t *
01924 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn,
01925                              const char *name,
01926                              const svn_string_t *value,
01927                              apr_pool_t *pool);
01928 
01929 /** Validating wrapper for svn_fs_change_txn_props() (which see for
01930  * argument descriptions).  Validate properties and their values the
01931  * same way svn_repos_fs_change_node_prop() does.
01932  *
01933  * @since New in 1.5.
01934  */
01935 svn_error_t *
01936 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn,
01937                               apr_array_header_t *props,
01938                               apr_pool_t *pool);
01939 
01940 /** @} */
01941 
01942 /* ---------------------------------------------------------------*/
01943 
01944 /**
01945  * @defgroup svn_repos_inspection Data structures and editor things for
01946  * repository inspection.
01947  * @{
01948  *
01949  * As it turns out, the svn_repos_dir_delta2() interface can be
01950  * extremely useful for examining the repository, or more exactly,
01951  * changes to the repository.  svn_repos_dir_delta2() allows for
01952  * differences between two trees to be described using an editor.
01953  *
01954  * By using the editor obtained from svn_repos_node_editor() with
01955  * svn_repos_dir_delta2(), the description of how to transform one tree
01956  * into another can be used to build an in-memory linked-list tree,
01957  * which each node representing a repository node that was changed as a
01958  * result of having svn_repos_dir_delta2() drive that editor.
01959  */
01960 
01961 /** A node in the repository. */
01962 typedef struct svn_repos_node_t
01963 {
01964   /** Node type (file, dir, etc.) */
01965   svn_node_kind_t kind;
01966 
01967   /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */
01968   char action;
01969 
01970   /** Were there any textual mods? (files only) */
01971   svn_boolean_t text_mod;
01972 
01973   /** Where there any property mods? */
01974   svn_boolean_t prop_mod;
01975 
01976   /** The name of this node as it appears in its parent's entries list */
01977   const char *name;
01978 
01979   /** The filesystem revision where this was copied from (if any) */
01980   svn_revnum_t copyfrom_rev;
01981 
01982   /** The filesystem path where this was copied from (if any) */
01983   const char *copyfrom_path;
01984 
01985   /** Pointer to the next sibling of this node */
01986   struct svn_repos_node_t *sibling;
01987 
01988   /** Pointer to the first child of this node */
01989   struct svn_repos_node_t *child;
01990 
01991   /** Pointer to the parent of this node */
01992   struct svn_repos_node_t *parent;
01993 
01994 } svn_repos_node_t;
01995 
01996 
01997 /** Set @a *editor and @a *edit_baton to an editor that, when driven by
01998  * svn_repos_dir_delta2(), builds an <tt>svn_repos_node_t *</tt> tree
01999  * representing the delta from @a base_root to @a root in @a repos's
02000  * filesystem.
02001  *
02002  * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root
02003  * node afterwards.
02004  *
02005  * Note that the delta includes "bubbled-up" directories; that is,
02006  * many of the directory nodes will have no prop_mods.
02007  *
02008  * Allocate the tree and its contents in @a node_pool; do all other
02009  * allocation in @a pool.
02010  */
02011 svn_error_t *
02012 svn_repos_node_editor(const svn_delta_editor_t **editor,
02013                       void **edit_baton,
02014                       svn_repos_t *repos,
02015                       svn_fs_root_t *base_root,
02016                       svn_fs_root_t *root,
02017                       apr_pool_t *node_pool,
02018                       apr_pool_t *pool);
02019 
02020 /** Return the root node of the linked-list tree generated by driving
02021  * the editor created by svn_repos_node_editor() with
02022  * svn_repos_dir_delta2(), which is stored in @a edit_baton.  This is
02023  * only really useful if used *after* the editor drive is completed.
02024  */
02025 svn_repos_node_t *
02026 svn_repos_node_from_baton(void *edit_baton);
02027 
02028 /** @} */
02029 
02030 /* ---------------------------------------------------------------*/
02031 
02032 /**
02033  * @defgroup svn_repos_dump_load Dumping and loading filesystem data
02034  * @{
02035  *
02036  * The filesystem 'dump' format contains nothing but the abstract
02037  * structure of the filesystem -- independent of any internal node-id
02038  * schema or database back-end.  All of the data in the dumpfile is
02039  * acquired by public function calls into svn_fs.h.  Similarly, the
02040  * parser which reads the dumpfile is able to reconstruct the
02041  * filesystem using only public svn_fs.h routines.
02042  *
02043  * Thus the dump/load feature's main purpose is for *migrating* data
02044  * from one svn filesystem to another -- presumably two filesystems
02045  * which have different internal implementations.
02046  *
02047  * If you simply want to backup your filesystem, you're probably
02048  * better off using the built-in facilities of the DB backend (using
02049  * Berkeley DB's hot-backup feature, for example.)
02050  *
02051  * For a description of the dumpfile format, see
02052  * /trunk/notes/fs_dumprestore.txt.
02053  */
02054 
02055 /* The RFC822-style headers in our dumpfile format. */
02056 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER            "SVN-fs-dump-format-version"
02057 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION           3
02058 #define SVN_REPOS_DUMPFILE_UUID                      "UUID"
02059 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH            "Content-length"
02060 
02061 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER           "Revision-number"
02062 
02063 #define SVN_REPOS_DUMPFILE_NODE_PATH                 "Node-path"
02064 #define SVN_REPOS_DUMPFILE_NODE_KIND                 "Node-kind"
02065 #define SVN_REPOS_DUMPFILE_NODE_ACTION               "Node-action"
02066 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH        "Node-copyfrom-path"
02067 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV         "Node-copyfrom-rev"
02068 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5      "Text-copy-source-md5"
02069 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1     "Text-copy-source-sha1"
02070 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \
02071                                         SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5
02072 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5          "Text-content-md5"
02073 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1         "Text-content-sha1"
02074 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM     \
02075                                         SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5
02076 
02077 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH       "Prop-content-length"
02078 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH       "Text-content-length"
02079 
02080 /** @since New in 1.1. */
02081 #define SVN_REPOS_DUMPFILE_PROP_DELTA                "Prop-delta"
02082 /** @since New in 1.1. */
02083 #define SVN_REPOS_DUMPFILE_TEXT_DELTA                "Text-delta"
02084 /** @since New in 1.5. */
02085 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5       "Text-delta-base-md5"
02086 /** @since New in 1.6. */
02087 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1      "Text-delta-base-sha1"
02088 /** @since New in 1.6. */
02089 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM  \
02090                                         SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5
02091 
02092 /** The different "actions" attached to nodes in the dumpfile. */
02093 enum svn_node_action
02094 {
02095   svn_node_action_change,
02096   svn_node_action_add,
02097   svn_node_action_delete,
02098   svn_node_action_replace
02099 };
02100 
02101 /** The different policies for processing the UUID in the dumpfile. */
02102 enum svn_repos_load_uuid
02103 {
02104   svn_repos_load_uuid_default,
02105   svn_repos_load_uuid_ignore,
02106   svn_repos_load_uuid_force
02107 };
02108 
02109 
02110 /**
02111  * Verify the contents of the file system in @a repos.
02112  *
02113  * If @a feedback_stream is not @c NULL, write feedback to it (lines of
02114  * the form "* Verified revision %ld\n").
02115  *
02116  * If @a start_rev is @c SVN_INVALID_REVNUM, then start verifying at
02117  * revision 0.  If @a end_rev is @c SVN_INVALID_REVNUM, then verify
02118  * through the @c HEAD revision.
02119  *
02120  * If @a cancel_func is not @c NULL, call it periodically with @a
02121  * cancel_baton as argument to see if the caller wishes to cancel the
02122  * verification.
02123  *
02124  * @since New in 1.5.
02125  */
02126 svn_error_t *
02127 svn_repos_verify_fs(svn_repos_t *repos,
02128                     svn_stream_t *feedback_stream,
02129                     svn_revnum_t start_rev,
02130                     svn_revnum_t end_rev,
02131                     svn_cancel_func_t cancel_func,
02132                     void *cancel_baton,
02133                     apr_pool_t *pool);
02134 
02135 
02136 /**
02137  * Dump the contents of the filesystem within already-open @a repos into
02138  * writable @a dumpstream.  Begin at revision @a start_rev, and dump every
02139  * revision up through @a end_rev.  Use @a pool for all allocation.  If
02140  * non-@c NULL, send feedback to @a feedback_stream.  If @a dumpstream is
02141  * @c NULL, this is effectively a primitive verify.  It is not complete,
02142  * however; see svn_fs_verify instead.
02143  *
02144  * If @a start_rev is @c SVN_INVALID_REVNUM, then start dumping at revision
02145  * 0.  If @a end_rev is @c SVN_INVALID_REVNUM, then dump through the @c HEAD
02146  * revision.
02147  *
02148  * If @a incremental is @c TRUE, the first revision dumped will be a diff
02149  * against the previous revision (usually it looks like a full dump of
02150  * the tree).
02151  *
02152  * If @a use_deltas is @c TRUE, output only node properties which have
02153  * changed relative to the previous contents, and output text contents
02154  * as svndiff data against the previous contents.  Regardless of how
02155  * this flag is set, the first revision of a non-incremental dump will
02156  * be done with full plain text.  A dump with @a use_deltas set cannot
02157  * be loaded by Subversion 1.0.x.
02158  *
02159  * If @a cancel_func is not @c NULL, it is called periodically with
02160  * @a cancel_baton as argument to see if the client wishes to cancel
02161  * the dump.
02162  *
02163  * @since New in 1.1.
02164  */
02165 svn_error_t *
02166 svn_repos_dump_fs2(svn_repos_t *repos,
02167                    svn_stream_t *dumpstream,
02168                    svn_stream_t *feedback_stream,
02169                    svn_revnum_t start_rev,
02170                    svn_revnum_t end_rev,
02171                    svn_boolean_t incremental,
02172                    svn_boolean_t use_deltas,
02173                    svn_cancel_func_t cancel_func,
02174                    void *cancel_baton,
02175                    apr_pool_t *pool);
02176 
02177 
02178 /**
02179  * Similar to svn_repos_dump_fs2(), but with the @a use_deltas
02180  * parameter always set to @c FALSE.
02181  *
02182  * @deprecated Provided for backward compatibility with the 1.0 API.
02183  */
02184 SVN_DEPRECATED
02185 svn_error_t *
02186 svn_repos_dump_fs(svn_repos_t *repos,
02187                   svn_stream_t *dumpstream,
02188                   svn_stream_t *feedback_stream,
02189                   svn_revnum_t start_rev,
02190                   svn_revnum_t end_rev,
02191                   svn_boolean_t incremental,
02192                   svn_cancel_func_t cancel_func,
02193                   void *cancel_baton,
02194                   apr_pool_t *pool);
02195 
02196 
02197 /**
02198  * Read and parse dumpfile-formatted @a dumpstream, reconstructing
02199  * filesystem revisions in already-open @a repos, handling uuids
02200  * in accordance with @a uuid_action.
02201  *
02202  * Read and parse dumpfile-formatted @a dumpstream, reconstructing
02203  * filesystem revisions in already-open @a repos.  Use @a pool for all
02204  * allocation.  If non-@c NULL, send feedback to @a feedback_stream.
02205  *
02206  * If the dumpstream contains copy history that is unavailable in the
02207  * repository, an error will be thrown.
02208  *
02209  * The repository's UUID will be updated iff
02210  *   the dumpstream contains a UUID and
02211  *   @a uuid_action is not equal to @c svn_repos_load_uuid_ignore and
02212  *   either the repository contains no revisions or
02213  *          @a uuid_action is equal to @c svn_repos_load_uuid_force.
02214  *
02215  * If the dumpstream contains no UUID, then @a uuid_action is
02216  * ignored and the repository UUID is not touched.
02217  *
02218  * If @a parent_dir is not NULL, then the parser will reparent all the
02219  * loaded nodes, from root to @a parent_dir.  The directory @a parent_dir
02220  * must be an existing directory in the repository.
02221  *
02222  * If @a use_pre_commit_hook is set, call the repository's pre-commit
02223  * hook before committing each loaded revision.
02224  *
02225  * If @a use_post_commit_hook is set, call the repository's
02226  * post-commit hook after committing each loaded revision.
02227  *
02228  * If @a cancel_func is not @c NULL, it is called periodically with
02229  * @a cancel_baton as argument to see if the client wishes to cancel
02230  * the load.
02231  *
02232  * @since New in 1.2.
02233  */
02234 svn_error_t *
02235 svn_repos_load_fs2(svn_repos_t *repos,
02236                    svn_stream_t *dumpstream,
02237                    svn_stream_t *feedback_stream,
02238                    enum svn_repos_load_uuid uuid_action,
02239                    const char *parent_dir,
02240                    svn_boolean_t use_pre_commit_hook,
02241                    svn_boolean_t use_post_commit_hook,
02242                    svn_cancel_func_t cancel_func,
02243                    void *cancel_baton,
02244                    apr_pool_t *pool);
02245 
02246 /**
02247  * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and
02248  * @a use_post_commit_hook always @c FALSE.
02249  *
02250  * @deprecated Provided for backward compatibility with the 1.0 API.
02251  */
02252 SVN_DEPRECATED
02253 svn_error_t *
02254 svn_repos_load_fs(svn_repos_t *repos,
02255                   svn_stream_t *dumpstream,
02256                   svn_stream_t *feedback_stream,
02257                   enum svn_repos_load_uuid uuid_action,
02258                   const char *parent_dir,
02259                   svn_cancel_func_t cancel_func,
02260                   void *cancel_baton,
02261                   apr_pool_t *pool);
02262 
02263 
02264 /**
02265  * A vtable that is driven by svn_repos_parse_dumpstream2().
02266  *
02267  * @since New in 1.1.
02268  */
02269 typedef struct svn_repos_parse_fns2_t
02270 {
02271   /** The parser has discovered a new revision record within the
02272    * parsing session represented by @a parse_baton.  All the headers are
02273    * placed in @a headers (allocated in @a pool), which maps <tt>const
02274    * char *</tt> header-name ==> <tt>const char *</tt> header-value.
02275    * The @a revision_baton received back (also allocated in @a pool)
02276    * represents the revision.
02277    */
02278   svn_error_t *(*new_revision_record)(void **revision_baton,
02279                                       apr_hash_t *headers,
02280                                       void *parse_baton,
02281                                       apr_pool_t *pool);
02282 
02283   /** The parser has discovered a new uuid record within the parsing
02284    * session represented by @a parse_baton.  The uuid's value is
02285    * @a uuid, and it is allocated in @a pool.
02286    */
02287   svn_error_t *(*uuid_record)(const char *uuid,
02288                               void *parse_baton,
02289                               apr_pool_t *pool);
02290 
02291   /** The parser has discovered a new node record within the current
02292    * revision represented by @a revision_baton.  All the headers are
02293    * placed in @a headers (as with @c new_revision_record), allocated in
02294    * @a pool.  The @a node_baton received back is allocated in @a pool
02295    * and represents the node.
02296    */
02297   svn_error_t *(*new_node_record)(void **node_baton,
02298                                   apr_hash_t *headers,
02299                                   void *revision_baton,
02300                                   apr_pool_t *pool);
02301 
02302   /** For a given @a revision_baton, set a property @a name to @a value. */
02303   svn_error_t *(*set_revision_property)(void *revision_baton,
02304                                         const char *name,
02305                                         const svn_string_t *value);
02306 
02307   /** For a given @a node_baton, set a property @a name to @a value. */
02308   svn_error_t *(*set_node_property)(void *node_baton,
02309                                     const char *name,
02310                                     const svn_string_t *value);
02311 
02312   /** For a given @a node_baton, delete property @a name. */
02313   svn_error_t *(*delete_node_property)(void *node_baton, const char *name);
02314 
02315   /** For a given @a node_baton, remove all properties. */
02316   svn_error_t *(*remove_node_props)(void *node_baton);
02317 
02318   /** For a given @a node_baton, receive a writable @a stream capable of
02319    * receiving the node's fulltext.  After writing the fulltext, call
02320    * the stream's close() function.
02321    *
02322    * If a @c NULL is returned instead of a stream, the vtable is
02323    * indicating that no text is desired, and the parser will not
02324    * attempt to send it.
02325    */
02326   svn_error_t *(*set_fulltext)(svn_stream_t **stream,
02327                                void *node_baton);
02328 
02329   /** For a given @a node_baton, set @a handler and @a handler_baton
02330    * to a window handler and baton capable of receiving a delta
02331    * against the node's previous contents.  A NULL window will be
02332    * sent to the handler after all the windows are sent.
02333    *
02334    * If a @c NULL is returned instead of a handler, the vtable is
02335    * indicating that no delta is desired, and the parser will not
02336    * attempt to send it.
02337    */
02338   svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
02339                                   void **handler_baton,
02340                                   void *node_baton);
02341 
02342   /** The parser has reached the end of the current node represented by
02343    * @a node_baton, it can be freed.
02344    */
02345   svn_error_t *(*close_node)(void *node_baton);
02346 
02347   /** The parser has reached the end of the current revision
02348    * represented by @a revision_baton.  In other words, there are no more
02349    * changed nodes within the revision.  The baton can be freed.
02350    */
02351   svn_error_t *(*close_revision)(void *revision_baton);
02352 
02353 } svn_repos_parse_fns2_t;
02354 
02355 /** @deprecated Provided for backward compatibility with the 1.2 API. */
02356 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t;
02357 
02358 
02359 /**
02360  * Read and parse dumpfile-formatted @a stream, calling callbacks in
02361  * @a parse_fns/@a parse_baton, and using @a pool for allocations.
02362  *
02363  * If @a cancel_func is not @c NULL, it is called periodically with
02364  * @a cancel_baton as argument to see if the client wishes to cancel
02365  * the dump.
02366  *
02367  * This parser has built-in knowledge of the dumpfile format, but only
02368  * in a general sense:
02369  *
02370  *    * it recognizes revision and node records by looking for either
02371  *      a REVISION_NUMBER or NODE_PATH headers.
02372  *
02373  *    * it recognizes the CONTENT-LENGTH headers, so it knows if and
02374  *      how to suck up the content body.
02375  *
02376  *    * it knows how to parse a content body into two parts:  props
02377  *      and text, and pass the pieces to the vtable.
02378  *
02379  * This is enough knowledge to make it easy on vtable implementors,
02380  * but still allow expansion of the format:  most headers are ignored.
02381  *
02382  * @since New in 1.1.
02383  */
02384 svn_error_t *
02385 svn_repos_parse_dumpstream2(svn_stream_t *stream,
02386                             const svn_repos_parse_fns2_t *parse_fns,
02387                             void *parse_baton,
02388                             svn_cancel_func_t cancel_func,
02389                             void *cancel_baton,
02390                             apr_pool_t *pool);
02391 
02392 
02393 /**
02394  * Set @a *parser and @a *parse_baton to a vtable parser which commits new
02395  * revisions to the fs in @a repos.  The constructed parser will treat
02396  * UUID records in a manner consistent with @a uuid_action.  Use @a pool
02397  * to operate on the fs.
02398  *
02399  * If @a use_history is set, then the parser will require relative
02400  * 'copyfrom' history to exist in the repository when it encounters
02401  * nodes that are added-with-history.
02402  *
02403  * If @a parent_dir is not NULL, then the parser will reparent all the
02404  * loaded nodes, from root to @a parent_dir.  The directory @a parent_dir
02405  * must be an existing directory in the repository.
02406  *
02407  * Print all parsing feedback to @a outstream (if non-@c NULL).
02408  *
02409  *
02410  * @since New in 1.1.
02411  */
02412 svn_error_t *
02413 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser,
02414                                void **parse_baton,
02415                                svn_repos_t *repos,
02416                                svn_boolean_t use_history,
02417                                enum svn_repos_load_uuid uuid_action,
02418                                svn_stream_t *outstream,
02419                                const char *parent_dir,
02420                                apr_pool_t *pool);
02421 
02422 
02423 /**
02424  * A vtable that is driven by svn_repos_parse_dumpstream().
02425  * Similar to @c svn_repos_parse_fns2_t except that it lacks
02426  * the delete_node_property and apply_textdelta callbacks.
02427  *
02428  * @deprecated Provided for backward compatibility with the 1.0 API.
02429  */
02430 typedef struct svn_repos_parse_fns_t
02431 {
02432   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02433   svn_error_t *(*new_revision_record)(void **revision_baton,
02434                                       apr_hash_t *headers,
02435                                       void *parse_baton,
02436                                       apr_pool_t *pool);
02437   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02438   svn_error_t *(*uuid_record)(const char *uuid,
02439                               void *parse_baton,
02440                               apr_pool_t *pool);
02441   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02442   svn_error_t *(*new_node_record)(void **node_baton,
02443                                   apr_hash_t *headers,
02444                                   void *revision_baton,
02445                                   apr_pool_t *pool);
02446   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02447   svn_error_t *(*set_revision_property)(void *revision_baton,
02448                                         const char *name,
02449                                         const svn_string_t *value);
02450   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02451   svn_error_t *(*set_node_property)(void *node_baton,
02452                                     const char *name,
02453                                     const svn_string_t *value);
02454   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02455   svn_error_t *(*remove_node_props)(void *node_baton);
02456   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02457   svn_error_t *(*set_fulltext)(svn_stream_t **stream,
02458                                void *node_baton);
02459   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02460   svn_error_t *(*close_node)(void *node_baton);
02461   /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
02462   svn_error_t *(*close_revision)(void *revision_baton);
02463 } svn_repos_parser_fns_t;
02464 
02465 
02466 /**
02467  * Similar to svn_repos_parse_dumpstream2(), but uses the more limited
02468  * @c svn_repos_parser_fns_t vtable type.
02469  *
02470  * @deprecated Provided for backward compatibility with the 1.0 API.
02471  */
02472 SVN_DEPRECATED
02473 svn_error_t *
02474 svn_repos_parse_dumpstream(svn_stream_t *stream,
02475                            const svn_repos_parser_fns_t *parse_fns,
02476                            void *parse_baton,
02477                            svn_cancel_func_t cancel_func,
02478                            void *cancel_baton,
02479                            apr_pool_t *pool);
02480 
02481 
02482 /**
02483  * Similar to svn_repos_get_fs_build_parser2(), but yields the more
02484  * limited svn_repos_parser_fns_t vtable type.
02485  *
02486  * @deprecated Provided for backward compatibility with the 1.0 API.
02487  */
02488 SVN_DEPRECATED
02489 svn_error_t *
02490 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser,
02491                               void **parse_baton,
02492                               svn_repos_t *repos,
02493                               svn_boolean_t use_history,
02494                               enum svn_repos_load_uuid uuid_action,
02495                               svn_stream_t *outstream,
02496                               const char *parent_dir,
02497                               apr_pool_t *pool);
02498 
02499 
02500 /** @} */
02501 
02502 /** A data type which stores the authz information.
02503  *
02504  * @since New in 1.3.
02505  */
02506 typedef struct svn_authz_t svn_authz_t;
02507 
02508 /** Read authz configuration data from @a file (a file or registry
02509  * path) into @a *authz_p, allocated in @a pool.
02510  *
02511  * If @a file is not a valid authz rule file, then return
02512  * SVN_AUTHZ_INVALID_CONFIG.  The contents of @a *authz_p is then
02513  * undefined.  If @a must_exist is TRUE, a missing authz file is also
02514  * an error.
02515  *
02516  * @since New in 1.3.
02517  */
02518 svn_error_t *
02519 svn_repos_authz_read(svn_authz_t **authz_p,
02520                      const char *file,
02521                      svn_boolean_t must_exist,
02522                      apr_pool_t *pool);
02523 
02524 /**
02525  * Check whether @a user can access @a path in the repository @a
02526  * repos_name with the @a required_access.  @a authz lists the ACLs to
02527  * check against.  Set @a *access_granted to indicate if the requested
02528  * access is granted.
02529  *
02530  * If @a path is NULL, then check whether @a user has the @a
02531  * required_access anywhere in the repository.  Set @a *access_granted
02532  * to TRUE if at least one path is accessible with the @a
02533  * required_access.
02534  *
02535  * @since New in 1.3.
02536  */
02537 svn_error_t *
02538 svn_repos_authz_check_access(svn_authz_t *authz,
02539                              const char *repos_name,
02540                              const char *path,
02541                              const char *user,
02542                              svn_repos_authz_access_t required_access,
02543                              svn_boolean_t *access_granted,
02544                              apr_pool_t *pool);
02545 
02546 
02547 
02548 /** Revision Access Levels
02549  *
02550  * Like most version control systems, access to versioned objects in
02551  * Subversion is determined on primarily path-based system.  Users either
02552  * do or don't have the ability to read a given path.
02553  *
02554  * However, unlike many version control systems where versioned objects
02555  * maintain their own distinct version information (revision numbers,
02556  * authors, log messages, change timestamps, etc.), Subversion binds
02557  * multiple paths changed as part of a single commit operation into a
02558  * set, calls the whole thing a revision, and hangs commit metadata
02559  * (author, date, log message, etc.) off of that revision.  So, commit
02560  * metadata is shared across all the paths changed as part of a given
02561  * commit operation.
02562  *
02563  * It is common (or, at least, we hope it is) for log messages to give
02564  * detailed information about changes made in the commit to which the log
02565  * message is attached.  Such information might include a mention of all
02566  * the files changed, what was changed in them, and so on.  But this
02567  * causes a problem when presenting information to readers who aren't
02568  * authorized to read every path in the repository.  Simply knowing that
02569  * a given path exists may be a security leak, even if the user can't see
02570  * the contents of the data located at that path.
02571  *
02572  * So Subversion does what it reasonably can to prevent the leak of this
02573  * information, and does so via a staged revision access policy.  A
02574  * reader can be said to have one of three levels of access to a given
02575  * revision's metadata, based solely on the reader's access rights to the
02576  * paths changed or copied in that revision:
02577  *
02578  *   'full access' -- Granted when the reader has access to all paths
02579  *      changed or copied in the revision, or when no paths were
02580  *      changed in the revision at all, this access level permits
02581  *      full visibility of all revision property names and values,
02582  *      and the full changed-paths information.
02583  *
02584  *   'no access' -- Granted when the reader does not have access to any
02585  *      paths changed or copied in the revision, this access level
02586  *      denies the reader access to all revision properties and all
02587  *      changed-paths information.
02588  *
02589  *   'partial access' -- Granted when the reader has access to at least
02590  *      one, but not all, of the paths changed or copied in the revision,
02591  *      this access level permits visibility of the svn:date and
02592  *      svn:author revision properties and only the paths of the
02593  *      changed-paths information to which the reader has access.
02594  *
02595  */
02596 
02597 
02598 /** An enum defining levels of revision access.
02599  *
02600  * @since New in 1.5.
02601  */
02602 typedef enum
02603 {
02604   svn_repos_revision_access_none,
02605   svn_repos_revision_access_partial,
02606   svn_repos_revision_access_full
02607 }
02608 svn_repos_revision_access_level_t;
02609 
02610 
02611 /**
02612  * Set @a access to the access level granted for @a revision in @a
02613  * repos, as determined by consulting the @a authz_read_func callback
02614  * function and its associated @a authz_read_baton.
02615  *
02616  * @a authz_read_func may be @c NULL, in which case @a access will be
02617  * set to @c svn_repos_revision_access_full.
02618  *
02619  * @since New in 1.5.
02620  */
02621 svn_error_t *
02622 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level,
02623                                 svn_repos_t *repos,
02624                                 svn_revnum_t revision,
02625                                 svn_repos_authz_func_t authz_read_func,
02626                                 void *authz_read_baton,
02627                                 apr_pool_t *pool);
02628 
02629 
02630 
02631 /** Capabilities **/
02632 
02633 /**
02634  * Store in @a repos the client-reported capabilities @a capabilities,
02635  * which must be allocated in memory at least as long-lived as @a repos.
02636  *
02637  * The elements of @a capabilities are 'const char *', a subset of
02638  * the constants beginning with @c SVN_RA_CAPABILITY_.
02639  * @a capabilities is not copied, so changing it later will affect
02640  * what is remembered by @a repos.
02641  *
02642  * @note The capabilities are passed along to the start-commit hook;
02643  * see that hook's template for details.
02644  *
02645  * @note As of Subversion 1.5, there are no error conditions defined,
02646  * so this always returns SVN_NO_ERROR.  In future releases it may
02647  * return error, however, so callers should check.
02648  *
02649  * @since New in 1.5.
02650  */
02651 svn_error_t *
02652 svn_repos_remember_client_capabilities(svn_repos_t *repos,
02653                                        apr_array_header_t *capabilities);
02654 
02655 
02656 
02657 #ifdef __cplusplus
02658 }
02659 #endif /* __cplusplus */
02660 
02661 #endif /* SVN_REPOS_H */

Generated on Thu Jun 16 2011 02:51:02 for Subversion by  doxygen 1.7.1