- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# svn_repos.h

Go to the documentation of this file.

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

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines