diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
commit | cf46733632c7279a9fd0fe6ce26f9185a4ae82a9 (patch) | |
tree | da27775a2161723ef342e91af41a8b51fedef405 /subversion/include/svn_repos.h | |
parent | bb0ef45f7c46b0ae221b26265ef98a768c33f820 (diff) | |
download | subversion-tarball-master.tar.gz |
subversion-1.9.7HEADsubversion-1.9.7master
Diffstat (limited to 'subversion/include/svn_repos.h')
-rw-r--r-- | subversion/include/svn_repos.h | 826 |
1 files changed, 626 insertions, 200 deletions
diff --git a/subversion/include/svn_repos.h b/subversion/include/svn_repos.h index 6ffa842..45b7a8f 100644 --- a/subversion/include/svn_repos.h +++ b/subversion/include/svn_repos.h @@ -66,20 +66,12 @@ enum svn_node_action svn_node_action_replace }; -/** The different policies for processing the UUID in the dumpfile. */ -enum svn_repos_load_uuid -{ - /** only update uuid if the repos has no revisions. */ - svn_repos_load_uuid_default, - /** never update uuid. */ - svn_repos_load_uuid_ignore, - /** always update uuid. */ - svn_repos_load_uuid_force -}; - -/** Callback type for checking authorization on paths produced by (at - * least) svn_repos_dir_delta2(). +/** @defgroup svn_repos_authz_callbacks Repository authorization callbacks + * @{ + */ + +/** Callback type for checking authorization on a path. * * Set @a *allowed to TRUE to indicate that some operation is * authorized for @a path in @a root, or set it to FALSE to indicate @@ -167,24 +159,13 @@ typedef svn_error_t *(*svn_repos_authz_callback_t) void *baton, apr_pool_t *pool); -/** - * Similar to #svn_file_rev_handler_t, but without the @a - * result_of_merge parameter. - * - * @deprecated Provided for backward compatibility with 1.4 API. - * @since New in 1.1. +/** @} */ + + +/** @defgroup svn_repos_notifications Repository notifications + * @{ */ -typedef svn_error_t *(*svn_repos_file_rev_handler_t) - (void *baton, - const char *path, - svn_revnum_t rev, - apr_hash_t *rev_props, - svn_txdelta_window_handler_t *delta_handler, - void **delta_baton, - apr_array_header_t *prop_diffs, - apr_pool_t *pool); - /* Notification system. */ /** The type of action occurring. @@ -251,11 +232,22 @@ typedef enum svn_repos_notify_action_t svn_repos_notify_load_skipped_rev, /** The structure of a revision is being verified. @since New in 1.8. */ - svn_repos_notify_verify_rev_structure + svn_repos_notify_verify_rev_structure, + + /** A revprop shard got packed. @since New in 1.9. */ + svn_repos_notify_pack_revprops, + /** A non-packed revprop shard got removed. @since New in 1.9. */ + svn_repos_notify_cleanup_revprops, + + /** The repository format got bumped. @since New in 1.9. */ + svn_repos_notify_format_bumped, + + /** A revision range was copied. @since New in 1.9. */ + svn_repos_notify_hotcopy_rev_range } svn_repos_notify_action_t; -/** The type of error occurring. +/** The type of warning occurring. * * @since New in 1.7. */ @@ -273,8 +265,33 @@ typedef enum svn_repos_notify_warning_t * @see svn_fs.h:"Directory entry names and directory paths" */ /* ### TODO(doxygen): make that a proper doxygen link */ /* See svn_fs__path_valid(). */ - svn_repos_notify_warning_invalid_fspath + svn_repos_notify_warning_invalid_fspath, + + /** + * Detected a name collision. Reported when the names of two or more + * entries in the same directory differ only in character + * representation (normalization), but are otherwise identical. + * + * @since New in 1.9. + */ + svn_repos_notify_warning_name_collision, + /** + * Detected a mergeinfo path collision. Reported when the paths in + * two or more entries in the same svn:mergeinfo property differ + * only in character representation (normalization), but are + * otherwise identical. + * + * @since New in 1.9. + */ + svn_repos_notify_warning_mergeinfo_collision, + + /** + * Detected invalid mergeinfo. + * + * @since New in 1.9. + */ + svn_repos_notify_warning_invalid_mergeinfo } svn_repos_notify_warning_t; /** @@ -295,25 +312,30 @@ typedef struct svn_repos_notify_t svn_repos_notify_action_t action; /** For #svn_repos_notify_dump_rev_end and #svn_repos_notify_verify_rev_end, - * the revision which just completed. */ + * the revision which just completed. + * For #svn_fs_upgrade_format_bumped, the new format version. */ svn_revnum_t revision; - /** For #svn_repos_notify_warning, the warning object. */ + /** For #svn_repos_notify_warning, the warning message. */ const char *warning_str; + /** For #svn_repos_notify_warning, the warning type. */ svn_repos_notify_warning_t warning; /** For #svn_repos_notify_pack_shard_start, #svn_repos_notify_pack_shard_end, + #svn_repos_notify_pack_revprops, + #svn_repos_notify_cleanup_revprops #svn_repos_notify_pack_shard_start_revprop, and #svn_repos_notify_pack_shard_end_revprop, the shard processed. */ apr_int64_t shard; - /** For #svn_repos_notify_load_node_done, the revision committed. */ + /** For #svn_repos_notify_load_txn_committed, the revision committed. */ svn_revnum_t new_revision; - /** For #svn_repos_notify_load_node_done, the source revision, if + /** For #svn_repos_notify_load_txn_committed, the source revision, if different from @a new_revision, otherwise #SVN_INVALID_REVNUM. - For #svn_repos_notify_load_txn_start, the source revision. */ + For #svn_repos_notify_load_txn_start and + #svn_repos_notify_load_skipped_rev, the source revision. */ svn_revnum_t old_revision; /** For #svn_repos_notify_load_node_start, the action being taken on the @@ -323,6 +345,16 @@ typedef struct svn_repos_notify_t /** For #svn_repos_notify_load_node_start, the path of the node. */ const char *path; + /** For #svn_repos_notify_hotcopy_rev_range, the start of the copied + revision range. + @since New in 1.9. */ + svn_revnum_t start_revision; + + /** For #svn_repos_notify_hotcopy_rev_range, the end of the copied + revision range (might be the same as @a start_revision). + @since New in 1.9. */ + svn_revnum_t end_revision; + /* NOTE: Add new fields at the end to preserve binary compatibility. Also, if you add fields here, you have to update svn_repos_notify_create(). */ @@ -347,7 +379,9 @@ svn_repos_notify_t * svn_repos_notify_create(svn_repos_notify_action_t action, apr_pool_t *result_pool); - +/** @} */ + + /** The repository object. */ typedef struct svn_repos_t svn_repos_t; @@ -366,16 +400,31 @@ svn_repos_find_root_path(const char *path, /** Set @a *repos_p to a repository object for the repository at @a path. * - * Allocate @a *repos_p in @a pool. + * Allocate @a *repos_p in @a result_pool. * * Acquires a shared lock on the repository, and attaches a cleanup - * function to @a pool to remove the lock. If no lock can be acquired, + * function to @a result_pool to remove the lock. If no lock can be acquired, * returns error, with undefined effect on @a *repos_p. If an exclusive * lock is present, this blocks until it's gone. @a fs_config will be * passed to the filesystem initialization function and may be @c NULL. * + * Use @a scratch_pool for temporary allocations. + * + * @since New in 1.9. + */ +svn_error_t * +svn_repos_open3(svn_repos_t **repos_p, + const char *path, + apr_hash_t *fs_config, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** Similar to svn_repos_open3() but without @a scratch_pool. + * + * @deprecated Provided for backward compatibility with 1.8 API. * @since New in 1.7. */ +SVN_DEPRECATED svn_error_t * svn_repos_open2(svn_repos_t **repos_p, const char *path, @@ -478,6 +527,11 @@ svn_error_t * svn_repos_delete(const char *path, apr_pool_t *pool); + +/** @defgroup svn_repos_capabilities Repository capabilities + * @{ + */ + /** * Set @a *has to TRUE if @a repos has @a capability (one of the * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set @@ -496,7 +550,27 @@ svn_repos_has_capability(svn_repos_t *repos, const char *capability, apr_pool_t *pool); -/** @} */ +/** + * Return a set of @a capabilities supported by the running Subversion + * library and by @a repos. (Capabilities supported by this version of + * Subversion but not by @a repos are not listed. This may happen when + * svn_repos_upgrade2() has not been called after a software upgrade.) + * + * The set is represented as a hash whose const char * keys are the set + * members. The values are not defined. + * + * Allocate @a capabilities in @a result_pool and use @a scratch_pool for + * temporary allocations. + * + * @see svn_repos_info_format + * + * @since New in 1.9. + */ +svn_error_t * +svn_repos_capabilities(apr_hash_t **capabilities, + svn_repos_t *repos, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /** * The capability of doing the right thing with merge-tracking @@ -516,11 +590,46 @@ svn_repos_has_capability(svn_repos_t *repos, * If you add a capability, update svn_repos_capabilities(). */ +/** @} */ + + +/** + * Store in @a repos the client-reported capabilities @a capabilities, + * which must be allocated in memory at least as long-lived as @a repos. + * + * The elements of @a capabilities are 'const char *', a subset of + * the constants beginning with @c SVN_RA_CAPABILITY_. + * @a capabilities is not copied, so changing it later will affect + * what is remembered by @a repos. + * + * @note The capabilities are passed along to the start-commit hook; + * see that hook's template for details. + * + * @note As of Subversion 1.5, there are no error conditions defined, + * so this always returns SVN_NO_ERROR. In future releases it may + * return error, however, so callers should check. + * + * @since New in 1.5. + */ +svn_error_t * +svn_repos_remember_client_capabilities(svn_repos_t *repos, + const apr_array_header_t *capabilities); + /** Return the filesystem associated with repository object @a repos. */ svn_fs_t * svn_repos_fs(svn_repos_t *repos); +/** Return the type of filesystem associated with repository object + * @a repos allocated in @a result_pool. + * + * @see #svn_fs_backend_names + * + * @since New in 1.9. + */ +const char * +svn_repos_fs_type(svn_repos_t *repos, + apr_pool_t *result_pool); /** Make a hot copy of the Subversion repository found at @a src_path * to @a dst_path. @@ -535,8 +644,41 @@ svn_repos_fs(svn_repos_t *repos); * already present in the destination. If incremental hotcopy is not * implemented by the filesystem backend, raise SVN_ERR_UNSUPPORTED_FEATURE. * + * For each revision range copied, the @a notify_func function will be + * called with the @a notify_baton and a notification structure containing + * appropriate values in @c start_revision and @c end_revision (both + * inclusive). @c start_revision might be equal to @c end_revision in + * case the copied range consists of a single revision. Currently, this + * notification is not triggered by the BDB backend. @a notify_func + * may be @c NULL if this notification is not required. + * + * The optional @a cancel_func callback will be invoked with + * @a cancel_baton as usual to allow the user to preempt this potentially + * lengthy operation. + * + * Use @a scratch_pool for temporary allocations. + * + * @since New in 1.9. + */ +svn_error_t * +svn_repos_hotcopy3(const char *src_path, + const char *dst_path, + svn_boolean_t clean_logs, + svn_boolean_t incremental, + svn_repos_notify_func_t notify_func, + void *notify_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool); + +/** + * Like svn_repos_hotcopy3(), but with @a notify_func and @a notify_baton + * always passed as @c NULL. + * * @since New in 1.8. + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_repos_hotcopy2(const char *src_path, const char *dst_path, @@ -682,6 +824,11 @@ typedef svn_error_t *(*svn_repos_freeze_func_t)(void *baton, apr_pool_t *pool); * FS backend the repository uses. Repositories are locked in the * order in which they are specified in the array. * + * @note @a freeze_func must not, directly or indirectly, call any function + * that attempts to take out a lock on the underlying repository. These + * include functions for packing, hotcopying, setting revprops and commits. + * Attempts to do so may result in a deadlock. + * * @note On some platforms the exclusive lock does not exclude other * threads in the same process so this function should only be called * by a single threaded process, or by a multi-threaded process when @@ -879,7 +1026,7 @@ svn_repos_hooks_setenv(svn_repos_t *repos, * when using larger values here. Pass 0 for @a zero_copy_limit to * disable this optimization altogether. * - * @a note Never activate this optimization if @a editor might access + * @note Never activate this optimization if @a editor might access * any FSFS data structures (and, hence, caches). So, it is basically * safe for networked editors only. * @@ -1355,10 +1502,9 @@ svn_repos_replay(svn_fs_root_t *root, * filesystem of @a repos, beginning at location 'rev:@a base_path', * where "rev" is the argument given to open_root(). * - * @a repos is a previously opened repository. @a repos_url is the + * @a repos is a previously opened repository. @a repos_url_decoded is the * decoded URL to the base of the repository, and is used to check - * copyfrom paths. copyfrom paths passed to the editor must be full, - * URI-encoded, URLs. @a txn is a filesystem transaction object to use + * copyfrom paths. @a txn is a filesystem transaction object to use * during the commit, or @c NULL to indicate that this function should * create (and fully manage) a new transaction. * @@ -1380,29 +1526,34 @@ svn_repos_replay(svn_fs_root_t *root, * If @a commit_callback is non-NULL, then before @c close_edit returns (but * after the commit has succeeded) @c close_edit will invoke * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton, - * and @a pool or some subpool thereof as arguments. If @a commit_callback + * and @a pool or some subpool thereof as arguments. The @c repos_root field + * of the #svn_commit_info_t is @c NULL. If @a commit_callback * returns an error, that error will be returned from @c close_edit, * otherwise if there was a post-commit hook failure, then that error * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. - * (Note that prior to Subversion 1.6, @a commit_callback cannot be NULL; if - * you don't need a callback, pass a dummy function.) + * (Note that prior to Subversion 1.6, @a commit_callback cannot be @c NULL; + * if you don't need a callback, pass a dummy function.) * * Calling @a (*editor)->abort_edit aborts the commit, and will also * abort the commit transaction unless @a txn was supplied (not @c * NULL). Callers who supply their own transactions are responsible * for cleaning them up (either by committing them, or aborting them). * - * @since New in 1.5. + * @since New in 1.5. Since 1.6, @a commit_callback can be @c NULL. * - * @note Yes, @a repos_url is a <em>decoded</em> URL. We realize + * @note Yes, @a repos_url_decoded is a <em>decoded</em> URL. We realize * that's sorta wonky. Sorry about that. + * + * @note Like most commit editors, the returned editor requires that the + * @c copyfrom_path parameter passed to its @c add_file and @c add_directory + * methods is a full, URI-encoded URL, not a relative path. */ svn_error_t * svn_repos_get_commit_editor5(const svn_delta_editor_t **editor, void **edit_baton, svn_repos_t *repos, svn_fs_txn_t *txn, - const char *repos_url, + const char *repos_url_decoded, const char *base_path, apr_hash_t *revprop_table, svn_commit_callback2_t commit_callback, @@ -1709,16 +1860,6 @@ svn_repos_node_location_segments(svn_repos_t *repos, apr_pool_t *pool); -/* ### other queries we can do someday -- - - * fetch the last revision created by <user> - (once usernames become revision properties!) - * fetch the last revision where <path> was modified - -*/ - - - /* ---------------------------------------------------------------*/ /* Retrieving log messages. */ @@ -1740,7 +1881,7 @@ svn_repos_node_location_segments(svn_repos_t *repos, * show all revisions regardless of what paths were changed in those * revisions. * - * If @a limit is non-zero then only invoke @a receiver on the first + * If @a limit is greater than zero then only invoke @a receiver on the first * @a limit logs. * * If @a discover_changed_paths, then each call to @a receiver passes a @@ -1946,6 +2087,12 @@ svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog, * the revision range for @a include_merged_revision @c FALSE reporting by * switching @a start with @a end. * + * @note Prior to Subversion 1.9, this function may request delta handlers + * from @a handler even for empty text deltas. Starting with 1.9, the + * delta handler / baton return arguments passed to @a handler will be + * #NULL unless there is an actual difference in the file contents between + * the current and the previous call. + * * @since New in 1.5. */ svn_error_t * @@ -1961,6 +2108,23 @@ svn_repos_get_file_revs2(svn_repos_t *repos, apr_pool_t *pool); /** + * Similar to #svn_file_rev_handler_t, but without the @a + * result_of_merge parameter. + * + * @deprecated Provided for backward compatibility with 1.4 API. + * @since New in 1.1. + */ +typedef svn_error_t *(*svn_repos_file_rev_handler_t) + (void *baton, + const char *path, + svn_revnum_t rev, + apr_hash_t *rev_props, + svn_txdelta_window_handler_t *delta_handler, + void **delta_baton, + apr_array_header_t *prop_diffs, + apr_pool_t *pool); + +/** * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions * set to FALSE. * @@ -2087,19 +2251,50 @@ svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p, * @{ */ -/** Like svn_fs_lock(), but invoke the @a repos's pre- and - * post-lock hooks before and after the locking action. Use @a pool - * for any necessary allocations. +/** Like svn_fs_lock_many(), but invoke the @a repos's pre- and + * post-lock hooks before and after the locking action. + * + * The pre-lock is run for every path in @a targets. Those targets for + * which the pre-lock is successful are passed to svn_fs_lock_many and + * the post-lock is run for those that are successfully locked. + * Pre-lock hook errors are passed to @a lock_callback. * - * If the pre-lock hook or svn_fs_lock() fails, throw the original - * error to caller. If an error occurs when running the post-lock - * hook, return the original error wrapped with - * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the caller sees this - * error, it knows that the lock succeeded anyway. + * For each path in @a targets @a lock_callback will be invoked + * passing @a lock_baton and the lock and error that apply to path. + * @a lock_callback can be NULL in which case it is not called and any + * errors that would have been passed to the callback are not reported. + * + * If an error occurs when running the post-lock hook the error is + * returned wrapped with #SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the + * caller sees this error, it knows that some locks succeeded. * * The pre-lock hook may cause a different token to be used for the - * lock, instead of @a token; see the pre-lock-hook documentation for - * more. + * lock, instead of the token supplied; see the pre-lock-hook + * documentation for more. + * + * The lock and path passed to @a lock_callback will be allocated in + * @a result_pool. Use @a scratch_pool for temporary allocations. + * + * @note This function is not atomic. If it returns an error, some targets + * may remain unlocked while others may have been locked. + * + * @see svn_fs_lock_many + * + * @since New in 1.9. + */ +svn_error_t * +svn_repos_fs_lock_many(svn_repos_t *repos, + apr_hash_t *lock_targets, + const char *comment, + svn_boolean_t is_dav_comment, + apr_time_t expiration_date, + svn_boolean_t steal_lock, + svn_fs_lock_callback_t lock_callback, + void *lock_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** Similar to svn_repos_fs_lock_many() but locks only a single path. * * @since New in 1.2. */ @@ -2116,15 +2311,46 @@ svn_repos_fs_lock(svn_lock_t **lock, apr_pool_t *pool); -/** Like svn_fs_unlock(), but invoke the @a repos's pre- and - * post-unlock hooks before and after the unlocking action. Use @a - * pool for any necessary allocations. +/** Like svn_fs_unlock_many(), but invoke the @a repos's pre- and + * post-unlock hooks before and after the unlocking action. + * + * The pre-unlock hook is run for every path in @a targets. Those + * targets for which the pre-unlock is successful are passed to + * svn_fs_unlock_many and the post-unlock is run for those that are + * successfully unlocked. Pre-unlock hook errors are passed to @a + * lock_callback. + * + * For each path in @a targets @a lock_callback will be invoked + * passing @a lock_baton and error that apply to path. The lock + * passed to the callback will be NULL. @a lock_callback can be NULL + * in which case it is not called and any errors that would have been + * passed to the callback are not reported. + * + * If an error occurs when running the post-unlock hook, return the + * original error wrapped with #SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. + * If the caller sees this error, it knows that some unlocks + * succeeded. + * + * The path passed to @a lock_callback will be allocated in @a result_pool. + * Use @a scratch_pool for temporary allocations. * - * If the pre-unlock hook or svn_fs_unlock() fails, throw the original - * error to caller. If an error occurs when running the post-unlock - * hook, return the original error wrapped with - * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. If the caller sees this - * error, it knows that the unlock succeeded anyway. + * @note This function is not atomic. If it returns an error, some targets + * may remain locked while others may have been unlocked. + * + * @see svn_fs_unlock_many + * + * @since New in 1.9. + */ +svn_error_t * +svn_repos_fs_unlock_many(svn_repos_t *repos, + apr_hash_t *unlock_targets, + svn_boolean_t break_lock, + svn_fs_lock_callback_t lock_callback, + void *lock_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** Similar to svn_repos_fs_unlock_many() but only unlocks a single path. * * @since New in 1.2. */ @@ -2178,6 +2404,12 @@ svn_repos_fs_get_locks(apr_hash_t **locks, /** @} */ +/** @defgroup svn_repos_properties Versioned and Unversioned Properties + * + * Prop-changing and prop-reading wrappers for libsvn_fs routines. + * @{ + */ + /** * Like svn_fs_change_rev_prop2(), but validate the name and value of the * property and invoke the @a repos's pre- and post-revprop-change hooks @@ -2210,12 +2442,9 @@ svn_repos_fs_change_rev_prop4(svn_repos_t *repos, const char *name, const svn_string_t *const *old_value_p, const svn_string_t *new_value, - svn_boolean_t - use_pre_revprop_change_hook, - svn_boolean_t - use_post_revprop_change_hook, - svn_repos_authz_func_t - authz_read_func, + svn_boolean_t use_pre_revprop_change_hook, + svn_boolean_t use_post_revprop_change_hook, + svn_repos_authz_func_t authz_read_func, void *authz_read_baton, apr_pool_t *pool); @@ -2234,12 +2463,9 @@ svn_repos_fs_change_rev_prop3(svn_repos_t *repos, const char *author, const char *name, const svn_string_t *new_value, - svn_boolean_t - use_pre_revprop_change_hook, - svn_boolean_t - use_post_revprop_change_hook, - svn_repos_authz_func_t - authz_read_func, + svn_boolean_t use_pre_revprop_change_hook, + svn_boolean_t use_post_revprop_change_hook, + svn_repos_authz_func_t authz_read_func, void *authz_read_baton, apr_pool_t *pool); @@ -2257,8 +2483,7 @@ svn_repos_fs_change_rev_prop2(svn_repos_t *repos, const char *author, const char *name, const svn_string_t *new_value, - svn_repos_authz_func_t - authz_read_func, + svn_repos_authz_func_t authz_read_func, void *authz_read_baton, apr_pool_t *pool); @@ -2299,8 +2524,7 @@ svn_repos_fs_revision_prop(svn_string_t **value_p, svn_repos_t *repos, svn_revnum_t rev, const char *propname, - svn_repos_authz_func_t - authz_read_func, + svn_repos_authz_func_t authz_read_func, void *authz_read_baton, apr_pool_t *pool); @@ -2325,21 +2549,10 @@ svn_error_t * svn_repos_fs_revision_proplist(apr_hash_t **table_p, svn_repos_t *repos, svn_revnum_t rev, - svn_repos_authz_func_t - authz_read_func, + svn_repos_authz_func_t authz_read_func, void *authz_read_baton, apr_pool_t *pool); - - -/* ---------------------------------------------------------------*/ - -/* Prop-changing wrappers for libsvn_fs routines. */ - -/* NOTE: svn_repos_fs_change_rev_prop() also exists, but is located - above with the hook-related functions. */ - - /** Validating wrapper for svn_fs_change_node_prop() (which see for * argument descriptions). * @@ -2348,9 +2561,9 @@ svn_repos_fs_revision_proplist(apr_hash_t **table_p, * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the * property. * - * @note Currently, the only properties validated are the "svn:" properties - * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. This may change - * in future releases. + * @note Originally, the only properties validated were the "svn:" properties + * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. For the current + * validation rules see the private function svn_repos__validate_prop(). */ svn_error_t * svn_repos_fs_change_node_prop(svn_fs_root_t *root, @@ -2359,6 +2572,36 @@ svn_repos_fs_change_node_prop(svn_fs_root_t *root, const svn_string_t *value, apr_pool_t *pool); +/** + * Set @a *inherited_values to a depth-first ordered array of + * #svn_prop_inherited_item_t * structures (the path_or_url members of + * which are relative filesystem paths) representing the properties + * inherited by @a path in @a root. If no properties are inherited, + * then set @a *inherited_values to an empty array. + * + * if @a propname is NULL then retrieve all explicit and/or inherited + * properties. Otherwise retrieve only the properties named @a propname. + * + * If optional @a authz_read_func is non-NULL, then use this function + * (along with optional @a authz_read_baton) to check the readability + * of each parent path from which properties are inherited. Silently omit + * properties for unreadable parent paths. + * + * Allocate @a *inherited_props in @a result_pool. Use @a scratch_pool for + * temporary allocations. + * + * @since New in 1.8. + */ +svn_error_t * +svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props, + svn_fs_root_t *root, + const char *path, + const char *propname, + svn_repos_authz_func_t authz_read_func, + void *authz_read_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + /** Validating wrapper for svn_fs_change_txn_prop() (which see for * argument descriptions). See svn_repos_fs_change_txn_props() for more * information. @@ -2380,6 +2623,8 @@ svn_repos_fs_change_txn_props(svn_fs_txn_t *txn, const apr_array_header_t *props, apr_pool_t *pool); +/** @} */ + /* ---------------------------------------------------------------*/ @@ -2470,12 +2715,34 @@ svn_repos_node_editor(const svn_delta_editor_t **editor, svn_repos_node_t * svn_repos_node_from_baton(void *edit_baton); +/** + * Return repository format information for @a repos. + * + * Set @a *repos_format to the repository format number of @a repos, which is + * an integer that increases when incompatible changes are made (such as + * by #svn_repos_upgrade2). + * + * Set @a *supports_version to the version number of the minimum Subversion + * GA release that can read and write @a repos; allocate it in + * @a result_pool. Use @a scratch_pool for temporary allocations. + * + * @see svn_fs_info_format, svn_repos_capabilities + * + * @since New in 1.9. + */ +svn_error_t * +svn_repos_info_format(int *repos_format, + svn_version_t **supports_version, + svn_repos_t *repos, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + /** @} */ /* ---------------------------------------------------------------*/ /** - * @defgroup svn_repos_dump_load Dumping and loading filesystem data + * @defgroup svn_repos_dump_load Dumping, loading and verifying filesystem data * @{ * * The filesystem 'dump' format contains nothing but the abstract @@ -2539,26 +2806,132 @@ svn_repos_node_from_baton(void *edit_baton); #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM \ SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 -/** - * Verify the contents of the file system in @a repos. +/** The different policies for processing the UUID in the dumpfile. */ +enum svn_repos_load_uuid +{ + /** only update uuid if the repos has no revisions. */ + svn_repos_load_uuid_default, + /** never update uuid. */ + svn_repos_load_uuid_ignore, + /** always update uuid. */ + svn_repos_load_uuid_force +}; + +/** Callback type for use with svn_repos_verify_fs3(). @a revision + * and @a verify_err are the details of a single verification failure + * that occurred during the svn_repos_verify_fs3() call. @a baton is + * the same baton given to svn_repos_verify_fs3(). @a scratch_pool is + * provided for the convenience of the implementor, who should not + * expect it to live longer than a single callback call. * - * If @a feedback_stream is not @c NULL, write feedback to it (lines of - * the form "* Verified revision %ld\n"). + * @a verify_err will be cleared and becomes invalid after the callback + * returns, use svn_error_dup() to preserve the error. If a callback uses + * @a verify_err as the return value or as a part of the return value, it + * should also call svn_error_dup() for @a verify_err. Implementors of this + * callback are forbidden to call svn_error_clear() for @a verify_err. + * + * @see svn_repos_verify_fs3 * - * If @a start_rev is #SVN_INVALID_REVNUM, then start verifying at - * revision 0. If @a end_rev is #SVN_INVALID_REVNUM, then verify - * through the @c HEAD revision. + * @since New in 1.9. + */ +typedef svn_error_t *(*svn_repos_verify_callback_t)(void *baton, + svn_revnum_t revision, + svn_error_t *verify_err, + apr_pool_t *scratch_pool); + +/** + * Verify the contents of the file system in @a repos. * - * For every verified revision call @a notify_func with @a rev set to - * the verified revision and @a warning_text @c NULL. For warnings call @a - * notify_func with @a warning_text set. + * Verify the revisions from @a start_rev to @a end_rev inclusive. If + * @a start_rev is #SVN_INVALID_REVNUM, start at revision 0; if @a end_rev + * is #SVN_INVALID_REVNUM, end at the head revision. @a start_rev must be + * older than or equal to @a end_rev. If revision 0 is included in the + * range, then also verify "global invariants" of the repository, as + * described in svn_fs_verify(). + * + * If @a check_normalization is @c TRUE, report any name collisions + * within the same directory or svn:mergeinfo property where the names + * differ only in character representation, but are otherwise + * identical. + * + * If @a metadata_only is @c TRUE, backends that have a concept of separate + * metadata verification will only perform that and skip the more expensive + * file context reconstruction and verification. For FSFS format 7+ and + * FSX, this allows for a very fast check against external corruption. + * + * If @a verify_callback is not @c NULL, call it with @a verify_baton upon + * receiving an FS-specific structure failure or a revision verification + * failure. Set @c revision callback argument to #SVN_INVALID_REVNUM or + * to the revision number respectively. Set @c verify_err to svn_error_t + * describing the reason of the failure. @c verify_err will be cleared + * after the callback returns, use svn_error_dup() to preserve the error. + * If @a verify_callback returns an error different from #SVN_NO_ERROR, + * stop verifying the repository and immediately return the error from + * @a verify_callback. + * + * If @a verify_callback is @c NULL, this function returns the first + * encountered verification error or #SVN_NO_ERROR if there were no failures + * during the verification. Errors that prevent the verification process + * from continuing, such as #SVN_ERR_CANCELLED, are returned immediately + * and do not trigger an invocation of @a verify_callback. + * + * If @a notify_func is not null, then call it with @a notify_baton and + * with a notification structure in which the fields are set as follows. + * (For a warning that does not apply to a specific revision, the revision + * number is #SVN_INVALID_REVNUM.) + * + * For each FS-specific structure warning: + * @c action = svn_repos_notify_verify_rev_structure + * @c revision = the revision or #SVN_INVALID_REVNUM + * + * For each revision verification warning: + * @c action = #svn_repos_notify_warning + * @c warning and @c warning_str fields set accordingly + * ### TODO: Set @c revision = the revision? + * + * For each successfully verified revision: + * @c action = #svn_repos_notify_verify_rev_end + * @c revision = the revision + * + * At the end: + * @c action = svn_repos_notify_verify_end + * ### Do we really need a callback to tell us the function we + * called has reached its end and is about to return? + * ### Not sent, currently, if a FS structure error is found. * * If @a cancel_func is not @c NULL, call it periodically with @a * cancel_baton as argument to see if the caller wishes to cancel the * verification. * + * Use @a scratch_pool for temporary allocation. + * + * @see svn_repos_verify_callback_t + * + * @since New in 1.9. + */ +svn_error_t * +svn_repos_verify_fs3(svn_repos_t *repos, + svn_revnum_t start_rev, + svn_revnum_t end_rev, + svn_boolean_t check_normalization, + svn_boolean_t metadata_only, + svn_repos_notify_func_t notify_func, + void *notify_baton, + svn_repos_verify_callback_t verify_callback, + void *verify_baton, + svn_cancel_func_t cancel, + void *cancel_baton, + apr_pool_t *scratch_pool); + +/** + * Like svn_repos_verify_fs3(), but with @a verify_callback and + * @a verify_baton set to @c NULL and with @a check_normalization + * and @a metadata_only set to @c FALSE. + * * @since New in 1.7. + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_repos_verify_fs2(svn_repos_t *repos, svn_revnum_t start_rev, @@ -2571,7 +2944,10 @@ svn_repos_verify_fs2(svn_repos_t *repos, /** * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of - * handling feedback via the notify_func handler + * handling feedback via the notify_func handler. + * + * If @a feedback_stream is not @c NULL, write feedback to it (lines of + * the form "* Verified revision %ld\n"). * * @since New in 1.5. * @deprecated Provided for backward compatibility with the 1.6 API. @@ -2588,15 +2964,13 @@ svn_repos_verify_fs(svn_repos_t *repos, /** * Dump the contents of the filesystem within already-open @a repos into - * writable @a dumpstream. Begin at revision @a start_rev, and dump every - * revision up through @a end_rev. Use @a pool for all allocation. If - * non-@c NULL, send feedback to @a feedback_stream. If @a dumpstream is + * writable @a dumpstream. If @a dumpstream is * @c NULL, this is effectively a primitive verify. It is not complete, - * however; svn_repos_verify_fs2() and svn_fs_verify(). + * however; see instead svn_repos_verify_fs3(). * - * If @a start_rev is #SVN_INVALID_REVNUM, then start dumping at revision - * 0. If @a end_rev is #SVN_INVALID_REVNUM, then dump through the @c HEAD - * revision. + * Begin at revision @a start_rev, and dump every revision up through + * @a end_rev. If @a start_rev is #SVN_INVALID_REVNUM, start at revision + * 0. If @a end_rev is #SVN_INVALID_REVNUM, end at the head revision. * * If @a incremental is @c TRUE, the first revision dumped will be a diff * against the previous revision (usually it looks like a full dump of @@ -2609,14 +2983,37 @@ svn_repos_verify_fs(svn_repos_t *repos, * be done with full plain text. A dump with @a use_deltas set cannot * be loaded by Subversion 1.0.x. * - * If @a notify_func is not @c NULL, then for every dumped revision call - * @a notify_func with @a rev set to the dumped revision and @a warning_text - * @c NULL. For warnings call @a notify_func with @a warning_text. + * If @a notify_func is not null, then call it with @a notify_baton and + * with a notification structure in which the fields are set as follows. + * (For a warning or error notification that does not apply to a specific + * revision, the revision number is #SVN_INVALID_REVNUM.) + * + * For each warning: + * @c action = #svn_repos_notify_warning + * @c warning and @c warning_str fields set accordingly + * ### TODO: Set @c revision = the revision or #SVN_INVALID_REVNUM? + * + * For each successfully dumped revision: + * @c action = #svn_repos_notify_dump_rev_end + * @c revision = the revision + * + * At the end: + * @c action = svn_repos_notify_verify_end + * ### Do we really need a callback to tell us the function we + * called has reached its end and is about to return? + * + * At the end, if there were certain warnings previously: + * @c action = #svn_repos_notify_warning + * @c warning and @c warning_str fields set accordingly, + * reiterating the existence of previous warnings + * ### This is a presentation issue. Caller could do this itself. * * If @a cancel_func is not @c NULL, it is called periodically with * @a cancel_baton as argument to see if the client wishes to cancel * the dump. * + * Use @a scratch_pool for temporary allocation. + * * @since New in 1.7. */ svn_error_t * @@ -2709,6 +3106,11 @@ svn_repos_dump_fs(svn_repos_t *repos, * node properties (those in the svn: namespace) against established * rules for those things. * + * If @a ignore_dates is set, ignore any revision datestamps found in + * @a dumpstream, allowing the revisions created by the load process + * to be stamped as if they were newly created via the normal commit + * process. + * * If non-NULL, use @a notify_func and @a notify_baton to send notification * of events to the caller. * @@ -2716,8 +3118,32 @@ svn_repos_dump_fs(svn_repos_t *repos, * @a cancel_baton as argument to see if the client wishes to cancel * the load. * + * @since New in 1.9. + */ +svn_error_t * +svn_repos_load_fs5(svn_repos_t *repos, + svn_stream_t *dumpstream, + svn_revnum_t start_rev, + svn_revnum_t end_rev, + enum svn_repos_load_uuid uuid_action, + const char *parent_dir, + svn_boolean_t use_pre_commit_hook, + svn_boolean_t use_post_commit_hook, + svn_boolean_t validate_props, + svn_boolean_t ignore_dates, + svn_repos_notify_func_t notify_func, + void *notify_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *pool); + +/** Similar to svn_repos_load_fs5(), but with @a ignore_dates + * always passed as FALSE. + * * @since New in 1.8. + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_repos_load_fs4(svn_repos_t *repos, svn_stream_t *dumpstream, @@ -2856,9 +3282,10 @@ typedef struct svn_repos_parse_fns3_t /** For a given @a node_baton, remove all properties. */ svn_error_t *(*remove_node_props)(void *node_baton); - /** For a given @a node_baton, receive a writable @a stream capable of - * receiving the node's fulltext. After writing the fulltext, call - * the stream's close() function. + /** For a given @a node_baton, set @a stream to a writable stream + * capable of receiving the node's fulltext. The parser will write + * the fulltext to the stream and then close the stream to signal + * completion. * * If a @c NULL is returned instead of a stream, the vtable is * indicating that no text is desired, and the parser will not @@ -2869,8 +3296,9 @@ typedef struct svn_repos_parse_fns3_t /** For a given @a node_baton, set @a handler and @a handler_baton * to a window handler and baton capable of receiving a delta - * against the node's previous contents. A NULL window will be - * sent to the handler after all the windows are sent. + * against the node's previous contents. The parser will send all + * the windows of data to this handler, and will then send a NULL + * window to signal completion. * * If a @c NULL is returned instead of a handler, the vtable is * indicating that no delta is desired, and the parser will not @@ -2927,6 +3355,12 @@ typedef struct svn_repos_parse_fns3_t * but still allow expansion of the format: most headers do not have * to be handled explicitly. * + * ### [JAF] Wouldn't it be more efficient to support a start/end rev + * range here than only supporting it in receivers such as + * svn_repos_get_fs_build_parser4()? This parser could then skip over + * chunks of the input stream before the oldest required rev, and + * could stop reading entirely after the youngest required rev. + * * @since New in 1.8. */ svn_error_t * @@ -2946,26 +3380,72 @@ svn_repos_parse_dumpstream3(svn_stream_t *stream, * to operate on the fs. * * @a start_rev and @a end_rev act as filters, the lower and upper - * (inclusive) range values of revisions in @a dumpstream which will + * (inclusive) range values of revisions which will * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in * which case no revision-based filtering occurs at all), or both are * valid revisions (where @a start_rev is older than or equivalent to - * @a end_rev). + * @a end_rev). They refer to dump stream revision numbers rather than + * committed revision numbers. + * + * If @a use_history is true, then when the parser encounters a node that + * is added-with-history, it will require 'copy-from' history to exist in + * the repository at the relative (adjusted) copy-from revision and path. + * It will perform a copy from that source location, and will fail if no + * suitable source exists there. If @a use_history is false, then it will + * instead convert every copy to a plain add. * - * If @a use_history is set, then the parser will require relative - * 'copyfrom' history to exist in the repository when it encounters - * nodes that are added-with-history. + * ### The 'use_history=FALSE' case is unused and untested in Subversion. + * It seems to me it would not work with a deltas dumpfile (a driver + * that calls the @c apply_textdelta method), as it would not have + * access to the delta base text. + * + * If @a use_pre_commit_hook is set, call the repository's pre-commit + * hook before committing each loaded revision. + * + * If @a use_post_commit_hook is set, call the repository's + * post-commit hook after committing each loaded revision. * * If @a validate_props is set, then validate Subversion revision and * node properties (those in the svn: namespace) against established * rules for those things. * + * If @a ignore_dates is set, ignore any revision datestamps found in + * @a dumpstream, allowing the revisions created by the load process + * to be stamped as if they were newly created via the normal commit + * process. + * * If @a parent_dir is not NULL, then the parser will reparent all the * loaded nodes, from root to @a parent_dir. The directory @a parent_dir * must be an existing directory in the repository. * + * @since New in 1.9. + */ +svn_error_t * +svn_repos_get_fs_build_parser5(const svn_repos_parse_fns3_t **parser, + void **parse_baton, + svn_repos_t *repos, + svn_revnum_t start_rev, + svn_revnum_t end_rev, + svn_boolean_t use_history, + svn_boolean_t validate_props, + enum svn_repos_load_uuid uuid_action, + const char *parent_dir, + svn_boolean_t use_pre_commit_hook, + svn_boolean_t use_post_commit_hook, + svn_boolean_t ignore_dates, + svn_repos_notify_func_t notify_func, + void *notify_baton, + apr_pool_t *pool); + +/** + * Similar to svn_repos_get_fs_build_parser5(), but with the + * @c use_pre_commit_hook, @c use_post_commit_hook and @c ignore_dates + * arguments all false. + * * @since New in 1.8. + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser, void **parse_baton, @@ -2981,10 +3461,11 @@ svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser, apr_pool_t *pool); + /** * A vtable that is driven by svn_repos_parse_dumpstream2(). * Similar to #svn_repos_parse_fns3_t except that it lacks - * the delete_node_property and apply_textdelta callbacks. + * the magic_header_record callback. * * @deprecated Provided for backward compatibility with the 1.7 API. */ @@ -3312,7 +3793,7 @@ svn_repos_authz_check_access(svn_authz_t *authz, typedef enum svn_repos_revision_access_level_t { /** no access allowed to the revision properties and all changed-paths - * information. */ + * information. */ svn_repos_revision_access_none, /** access granted to some (svn:date and svn:author) revision properties and * changed-paths information on paths the read has access to. */ @@ -3342,61 +3823,6 @@ svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level, void *authz_read_baton, apr_pool_t *pool); -/** - * Set @a *inherited_values to a depth-first ordered array of - * #svn_prop_inherited_item_t * structures (the path_or_url members of - * which are relative filesystem paths) representing the properties - * inherited by @a path in @a root. If no properties are inherited, - * then set @a *inherited_values to an empty array. - * - * if @a propname is NULL then retrieve all explicit and/or inherited - * properties. Otherwise retrieve only the properties named @a propname. - * - * If optional @a authz_read_func is non-NULL, then use this function - * (along with optional @a authz_read_baton) to check the readability - * of each parent path from which properties are inherited. Silently omit - * properties for unreadable parent paths. - * - * Allocate @a *inherited_props in @a result_pool. Use @a scratch_pool for - * temporary allocations. - * - * @since New in 1.8. - */ -svn_error_t * -svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props, - svn_fs_root_t *root, - const char *path, - const char *propname, - svn_repos_authz_func_t authz_read_func, - void *authz_read_baton, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool); - - -/** Capabilities **/ - -/** - * Store in @a repos the client-reported capabilities @a capabilities, - * which must be allocated in memory at least as long-lived as @a repos. - * - * The elements of @a capabilities are 'const char *', a subset of - * the constants beginning with @c SVN_RA_CAPABILITY_. - * @a capabilities is not copied, so changing it later will affect - * what is remembered by @a repos. - * - * @note The capabilities are passed along to the start-commit hook; - * see that hook's template for details. - * - * @note As of Subversion 1.5, there are no error conditions defined, - * so this always returns SVN_NO_ERROR. In future releases it may - * return error, however, so callers should check. - * - * @since New in 1.5. - */ -svn_error_t * -svn_repos_remember_client_capabilities(svn_repos_t *repos, - const apr_array_header_t *capabilities); - #ifdef __cplusplus } |