svn_repos.h

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

Generated on Fri Nov 1 15:57:36 2013 for Subversion by  doxygen 1.4.7