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 | |
parent | bb0ef45f7c46b0ae221b26265ef98a768c33f820 (diff) | |
download | subversion-tarball-1843e7deb3a59d5efe69eb9e9b1114af8a4f1b4f.tar.gz |
subversion-1.9.7HEADsubversion-1.9.7master
Diffstat (limited to 'subversion/include')
66 files changed, 6373 insertions, 1205 deletions
diff --git a/subversion/include/mod_dav_svn.h b/subversion/include/mod_dav_svn.h index c498c5e..223f2f1 100644 --- a/subversion/include/mod_dav_svn.h +++ b/subversion/include/mod_dav_svn.h @@ -40,7 +40,7 @@ extern "C" { /** Given an apache request @a r, a @a uri, and a @a root_path to the svn location block, process @a uri and return many things, allocated in - @a r->pool: + @a pool: - @a cleaned_uri: The uri with duplicate and trailing slashes removed. @@ -74,7 +74,25 @@ extern "C" { - @a relative_path: /!svn/blah/13/A/B/alpha - @a repos_path: A/B/alpha - @a trailing_slash: FALSE + + NOTE: The returned dav_error will be also allocated in @a pool, not + in @a r->pool. + + @since New in 1.9 */ +AP_MODULE_DECLARE(dav_error *) dav_svn_split_uri2(request_rec *r, + const char *uri_to_split, + const char *root_path, + const char **cleaned_uri, + int *trailing_slash, + const char **repos_basename, + const char **relative_path, + const char **repos_path, + apr_pool_t *pool); + +/** + * Same as dav_svn_split_uri2() but allocates the result in @a r->pool. + */ AP_MODULE_DECLARE(dav_error *) dav_svn_split_uri(request_rec *r, const char *uri, const char *root_path, @@ -87,7 +105,22 @@ AP_MODULE_DECLARE(dav_error *) dav_svn_split_uri(request_rec *r, /** * Given an apache request @a r and a @a root_path to the svn location - * block, set @a *repos_path to the path of the repository on disk. */ + * block, set @a *repos_path to the path of the repository on disk. + * Perform all allocations in @a pool. + * + * NOTE: The returned dav_error will be also allocated in @a pool, not + * in @a r->pool. + * + * @since New in 1.9 + */ +AP_MODULE_DECLARE(dav_error *) dav_svn_get_repos_path2(request_rec *r, + const char *root_path, + const char **repos_path, + apr_pool_t *pool); + +/** + * Same as dav_svn_get_repos_path2() but allocates the result in@a r->pool. + */ AP_MODULE_DECLARE(dav_error *) dav_svn_get_repos_path(request_rec *r, const char *root_path, const char **repos_path); diff --git a/subversion/include/private/svn_atomic.h b/subversion/include/private/svn_atomic.h index 187703b..6a6b2dc 100644 --- a/subversion/include/private/svn_atomic.h +++ b/subversion/include/private/svn_atomic.h @@ -46,39 +46,19 @@ extern "C" { */ /** The type used by all the other atomic operations. */ -#if APR_VERSION_AT_LEAST(1, 0, 0) #define svn_atomic_t apr_uint32_t -#else -#define svn_atomic_t apr_atomic_t -#endif /** Atomically read an #svn_atomic_t from memory. */ -#if APR_VERSION_AT_LEAST(1, 0, 0) #define svn_atomic_read(mem) apr_atomic_read32((mem)) -#else -#define svn_atomic_read(mem) apr_atomic_read((mem)) -#endif /** Atomically set an #svn_atomic_t in memory. */ -#if APR_VERSION_AT_LEAST(1, 0, 0) #define svn_atomic_set(mem, val) apr_atomic_set32((mem), (val)) -#else -#define svn_atomic_set(mem, val) apr_atomic_set((mem), (val)) -#endif /** Atomically increment an #svn_atomic_t. */ -#if APR_VERSION_AT_LEAST(1, 0, 0) #define svn_atomic_inc(mem) apr_atomic_inc32(mem) -#else -#define svn_atomic_inc(mem) apr_atomic_inc(mem) -#endif /** Atomically decrement an #svn_atomic_t. */ -#if APR_VERSION_AT_LEAST(1, 0, 0) #define svn_atomic_dec(mem) apr_atomic_dec32(mem) -#else -#define svn_atomic_dec(mem) apr_atomic_dec(mem) -#endif /** * Atomic compare-and-swap. @@ -91,13 +71,8 @@ extern "C" { * that on some platforms, the CAS function is implemented in a * way that is incompatible with the other atomic operations. */ -#if APR_VERSION_AT_LEAST(1, 0, 0) #define svn_atomic_cas(mem, with, cmp) \ apr_atomic_cas32((mem), (with), (cmp)) -#else -#define svn_atomic_cas(mem, with, cmp) \ - apr_atomic_cas((mem), (with), (cmp)) -#endif /** @} */ /** diff --git a/subversion/include/private/svn_auth_private.h b/subversion/include/private/svn_auth_private.h index 6c32688..89146b9 100644 --- a/subversion/include/private/svn_auth_private.h +++ b/subversion/include/private/svn_auth_private.h @@ -231,6 +231,16 @@ svn_auth__ssl_client_cert_pw_set(svn_boolean_t *done, svn_boolean_t non_interactive, apr_pool_t *pool); +/* Apply the specified configuration for connecting with SERVER_NAME + to the auth baton */ +svn_error_t * +svn_auth__make_session_auth(svn_auth_baton_t **session_auth_baton, + const svn_auth_baton_t *auth_baton, + apr_hash_t *config, + const char *server_name, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + #if (defined(WIN32) && !defined(__MINGW32__)) || defined(DOXYGEN) /** * Set @a *provider to an authentication provider that implements diff --git a/subversion/include/private/svn_cache.h b/subversion/include/private/svn_cache.h index 08d2f09..166295d 100644 --- a/subversion/include/private/svn_cache.h +++ b/subversion/include/private/svn_cache.h @@ -173,6 +173,12 @@ typedef struct svn_cache__info_t * May be 0 if that information is not available. */ apr_uint64_t total_entries; + + /** Number of index buckets with the given number of entries. + * Bucket sizes larger than the array will saturate into the + * highest array index. + */ + apr_uint64_t histogram[32]; } svn_cache__info_t; /** @@ -251,7 +257,8 @@ svn_cache__create_memcache(svn_cache__t **cache_p, * Given @a config, returns an APR memcached interface in @a * *memcache_p allocated in @a result_pool if @a config contains entries in * the SVN_CACHE_CONFIG_CATEGORY_MEMCACHED_SERVERS section describing - * memcached servers; otherwise, sets @a *memcache_p to NULL. + * memcached servers; otherwise, sets @a *memcache_p to NULL. Use + * @a scratch_pool for temporary allocations. * * If Subversion was not built with apr_memcache_support, then raises * SVN_ERR_NO_APR_MEMCACHE if and only if @a config is configured to @@ -260,7 +267,8 @@ svn_cache__create_memcache(svn_cache__t **cache_p, svn_error_t * svn_cache__make_memcache_from_config(svn_memcache_t **memcache_p, svn_config_t *config, - apr_pool_t *result_pool); + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /** * Creates a new membuffer cache object in @a *cache. It will contain @@ -303,6 +311,33 @@ svn_cache__membuffer_cache_create(svn_membuffer_t **cache, apr_pool_t *result_pool); /** + * @defgroup Standard priority classes for #svn_cache__create_membuffer_cache. + * @{ + */ + +/** + * Data in this priority class should not be removed from the cache unless + * absolutely necessary. Use of this should be very restricted. + */ +#define SVN_CACHE__MEMBUFFER_HIGH_PRIORITY 10000 + +/** + * Data in this priority class has a good chance to remain in cache unless + * there is more data in this class than the cache's capacity. Use of this + * as the default for all information that is costly to fetch from disk. + */ +#define SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY 1000 + +/** + * Data in this priority class will be removed as soon as the cache starts + * filling up. Use of this for ephemeral data that can easily be acquired + * again from other sources. + */ +#define SVN_CACHE__MEMBUFFER_LOW_PRIORITY 100 + +/** @} */ + +/** * Creates a new cache in @a *cache_p, storing the data in a potentially * shared @a membuffer object. The elements in the cache will be indexed * by keys of length @a klen, which may be APR_HASH_KEY_STRING if they @@ -310,7 +345,10 @@ svn_cache__membuffer_cache_create(svn_membuffer_t **cache, * serialize_func and deserialized using @a deserialize_func. Because * the same memcache object may cache many different kinds of values * form multiple caches, @a prefix should be specified to differentiate - * this cache from other caches. @a *cache_p will be allocated in @a result_pool. + * this cache from other caches. All entries written through this cache + * interface will be assigned into the given @a priority class. @a *cache_p + * will be allocated in @a result_pool. @a scratch_pool is used for + * temporary allocations. * * If @a deserialize_func is NULL, then the data is returned as an * svn_stringbuf_t; if @a serialize_func is NULL, then the data is @@ -329,8 +367,10 @@ svn_cache__create_membuffer_cache(svn_cache__t **cache_p, svn_cache__deserialize_func_t deserialize, apr_ssize_t klen, const char *prefix, + apr_uint32_t priority, svn_boolean_t thread_safe, - apr_pool_t *result_pool); + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /** * Sets @a handler to be @a cache's error handling routine. If any @@ -375,6 +415,18 @@ svn_cache__get(void **value, apr_pool_t *result_pool); /** + * Looks for an entry indexed by @a key in @a cache, setting @a *found + * to TRUE if an entry has been found and FALSE otherwise. @a key may be + * NULL in which case @a *found will be FALSE. Temporary allocations will + * be made from @a scratch_pool. + */ +svn_error_t * +svn_cache__has_key(svn_boolean_t *found, + svn_cache__t *cache, + const void *key, + apr_pool_t *scratch_pool); + +/** * Stores the value @a value under the key @a key in @a cache. Uses @a * scratch_pool for temporary allocations. The cache makes copies of * @a key and @a value if necessary (that is, @a key and @a value may @@ -465,13 +517,16 @@ svn_cache__get_info(svn_cache__t *cache, /** * Return the information given in @a info formatted as a multi-line string. - * Allocations take place in @a result_pool. + * If @a access_only has been set, size and fill-level statistics will be + * omitted. Allocations take place in @a result_pool. */ svn_string_t * svn_cache__format_info(const svn_cache__info_t *info, + svn_boolean_t access_only, apr_pool_t *result_pool); -/* Access the process-global (singleton) membuffer cache. The first call +/** + * Access the process-global (singleton) membuffer cache. The first call * will automatically allocate the cache using the current cache config. * NULL will be returned if the desired cache size is 0. * @@ -480,6 +535,22 @@ svn_cache__format_info(const svn_cache__info_t *info, struct svn_membuffer_t * svn_cache__get_global_membuffer_cache(void); +/** + * Return total access and size stats over all membuffer caches as they + * share the underlying data buffer. The result will be allocated in POOL. + */ +svn_cache__info_t * +svn_cache__membuffer_get_global_info(apr_pool_t *pool); + +/** + * Remove all current contents from CACHE. + * + * NOTE: In a multi-threaded environment, new contents may have been put + * into the cache by the time this function returns. + */ +svn_error_t * +svn_cache__membuffer_clear(svn_membuffer_t *cache); + /** @} */ diff --git a/subversion/include/private/svn_client_mtcc.h b/subversion/include/private/svn_client_mtcc.h new file mode 100644 index 0000000..fe670b0 --- /dev/null +++ b/subversion/include/private/svn_client_mtcc.h @@ -0,0 +1,226 @@ +/** + * @copyright + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + * @endcopyright + * + * @file svn_client_mtcc.h + * @brief Subversion multicommand client support + * + * Requires: The working copy library and client library. + * Provides: High level multicommand api. + * Used By: Client programs, svnmucc. + */ + +#ifndef SVN_CLIENT_MTCC_H +#define SVN_CLIENT_MTCC_H + +#include "svn_client.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/** + * + * @defgroup clnt_mtcc Multi Command Context related functions + * + * @{ + * + */ + +/** This is a structure which stores a list of repository commands + * that can be played to a repository as a single operation + * + * Use svn_client__mtcc_create() to create instances + * + * @since New in 1.9. + */ +typedef struct svn_client__mtcc_t svn_client__mtcc_t; + +/** Creates a new multicommand context for an operation on @a anchor_url and + * its descendants. + * + * Allocate the context in @a result_pool and perform temporary allocations in + * @a scratch_pool. + * + * @since New in 1.9. + */ +svn_error_t * +svn_client__mtcc_create(svn_client__mtcc_t **mtcc, + const char *anchor_url, + svn_revnum_t base_revision, + svn_client_ctx_t *ctx, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** Adds a file add operation of @a relpath to @a mtcc. If @a src_checksum + * is not null it will be provided to the repository to verify if the file + * was transferred successfully. + * + * Perform temporary allocations in @a scratch_pool. + * + * @note The current implementation keeps @a src_stream open until @a mtcc + * is committed. + * + * @since New in 1.9. + */ +svn_error_t * +svn_client__mtcc_add_add_file(const char *relpath, + svn_stream_t *src_stream, + const svn_checksum_t *src_checksum, + svn_client__mtcc_t *mtcc, + apr_pool_t *scratch_pool); + +/** Adds a copy operation of the node @a src_relpath at revision @a revision + * to @a dst_relpath to @a mtcc. + * + * Perform temporary allocations in @a scratch_pool. + * + * @since New in 1.9. + */ +svn_error_t * +svn_client__mtcc_add_copy(const char *src_relpath, + svn_revnum_t revision, + const char *dst_relpath, + svn_client__mtcc_t *mtcc, + apr_pool_t *scratch_pool); + +/** Adds a delete of @a relpath to @a mtcc. + * + * Perform temporary allocations in @a scratch_pool. + * + * @since New in 1.9. + */ +svn_error_t * +svn_client__mtcc_add_delete(const char *relpath, + svn_client__mtcc_t *mtcc, + apr_pool_t *scratch_pool); + +/** Adds an mkdir operation of @a relpath to @a mtcc. + * + * Perform temporary allocations in @a scratch_pool. + * + * @since New in 1.9. + */ +svn_error_t * +svn_client__mtcc_add_mkdir(const char *relpath, + svn_client__mtcc_t *mtcc, + apr_pool_t *scratch_pool); + + +/** Adds a move operation of the node @a src_relpath to @a dst_relpath to + * @a mtcc. + * + * Perform temporary allocations in @a scratch_pool. + * + * @since New in 1.9. + */ +svn_error_t * +svn_client__mtcc_add_move(const char *src_relpath, + const char *dst_relpath, + svn_client__mtcc_t *mtcc, + apr_pool_t *scratch_pool); + +/** Adds a propset operation for the property @a propname to @a propval + * (which can be NULL for a delete) on @a relpath to @a mtcc. + * + * If @a skip_checks is not FALSE Subversion defined properties are verified + * for correctness like svn_client_propset_remote() + * + * Perform temporary allocations in @a scratch_pool. + * + * @since New in 1.9. + */ +svn_error_t * +svn_client__mtcc_add_propset(const char *relpath, + const char *propname, + const svn_string_t *propval, + svn_boolean_t skip_checks, + svn_client__mtcc_t *mtcc, + apr_pool_t *scratch_pool); + + +/** Adds an update file operation for @a relpath to @a mtcc. + * + * The final version of the file is provided with @a src_stream. If @a + * src_checksum is provided it will be provided to the repository to verify + * the final result. + * + * If @a base_checksum is provided it will be used by the repository to verify + * if the base file matches this checksum. + * + * If @a base_stream is not NULL only the binary diff from @a base_stream to + * @a src_stream is written to the repository. + * + * Perform temporary allocations in @a scratch_pool. + * + * @note Callers should assume that the mtcc requires @a src_stream and @a + * base_stream to be valid until @a mtcc is committed. + * + * @since New in 1.9. + */ +svn_error_t * +svn_client__mtcc_add_update_file(const char *relpath, + svn_stream_t *src_stream, + const svn_checksum_t *src_checksum, + svn_stream_t *base_stream, + const svn_checksum_t *base_checksum, + svn_client__mtcc_t *mtcc, + apr_pool_t *scratch_pool); + +/** Obtains the kind of node at @a relpath in the current state of @a mtcc. + * This value might be from the cache (in case of modifications, copies) + * or fetched from the repository. + * + * If @a check_repository is TRUE, verify the node type with the repository at + * least once and cache the result for further checks. + * + * When a node does not exist this functions sets @a *kind to @c svn_node_node. + * + * @since New in 1.9. + */ +svn_error_t * +svn_client__mtcc_check_path(svn_node_kind_t *kind, + const char *relpath, + svn_boolean_t check_repository, + svn_client__mtcc_t *mtcc, + apr_pool_t *scratch_pool); + +/** Commits all operations stored in @a mtcc as a new revision and destroys + * @a mtcc. + * + * @since New in 1.9. + */ +svn_error_t * +svn_client__mtcc_commit(apr_hash_t *revprop_table, + svn_commit_callback2_t commit_callback, + void *commit_baton, + svn_client__mtcc_t *mtcc, + apr_pool_t *scratch_pool); + + +/** @} end group: Multi Command Context related functions */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* SVN_CLIENT_MTCC_H */ diff --git a/subversion/include/private/svn_client_private.h b/subversion/include/private/svn_client_private.h index 91ea647..892fc4b 100644 --- a/subversion/include/private/svn_client_private.h +++ b/subversion/include/private/svn_client_private.h @@ -33,11 +33,58 @@ #include "svn_client.h" #include "svn_types.h" +#include "private/svn_diff_tree.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +/* Set *REVNUM to the revision number identified by REVISION. + + If REVISION->kind is svn_opt_revision_number, just use + REVISION->value.number, ignoring LOCAL_ABSPATH and RA_SESSION. + + Else if REVISION->kind is svn_opt_revision_committed, + svn_opt_revision_previous, or svn_opt_revision_base, or + svn_opt_revision_working, then the revision can be identified + purely based on the working copy's administrative information for + LOCAL_ABSPATH, so RA_SESSION is ignored. If LOCAL_ABSPATH is not + under revision control, return SVN_ERR_UNVERSIONED_RESOURCE, or if + LOCAL_ABSPATH is null, return SVN_ERR_CLIENT_VERSIONED_PATH_REQUIRED. + + Else if REVISION->kind is svn_opt_revision_date or + svn_opt_revision_head, then RA_SESSION is used to retrieve the + revision from the repository (using REVISION->value.date in the + former case), and LOCAL_ABSPATH is ignored. If RA_SESSION is null, + return SVN_ERR_CLIENT_RA_ACCESS_REQUIRED. + + Else if REVISION->kind is svn_opt_revision_unspecified, set + *REVNUM to SVN_INVALID_REVNUM. + + If YOUNGEST_REV is non-NULL, it is an in/out parameter. If + *YOUNGEST_REV is valid, use it as the youngest revision in the + repository (regardless of reality) -- don't bother to lookup the + true value for HEAD, and don't return any value in *REVNUM greater + than *YOUNGEST_REV. If *YOUNGEST_REV is not valid, and a HEAD + lookup is required to populate *REVNUM, then also populate + *YOUNGEST_REV with the result. This is useful for making multiple + serialized calls to this function with a basically static view of + the repository, avoiding race conditions which could occur between + multiple invocations with HEAD lookup requests. + + Else return SVN_ERR_CLIENT_BAD_REVISION. + + Use SCRATCH_POOL for any temporary allocation. */ +svn_error_t * +svn_client__get_revision_number(svn_revnum_t *revnum, + svn_revnum_t *youngest_rev, + svn_wc_context_t *wc_ctx, + const char *local_abspath, + svn_ra_session_t *ra_session, + const svn_opt_revision_t *revision, + apr_pool_t *scratch_pool); + /* Return true if KIND is a revision kind that is dependent on the working * copy. Otherwise, return false. */ #define SVN_CLIENT__REVKIND_NEEDS_WC(kind) \ @@ -200,29 +247,6 @@ svn_client__create_status(svn_client_status_t **cst, apr_pool_t *result_pool, apr_pool_t *scratch_pool); -/* Set *ANCESTOR_URL and *ANCESTOR_REVISION to the URL and revision, - * respectively, of the youngest common ancestor of the two locations - * PATH_OR_URL1@REV1 and PATH_OR_URL2@REV2. Set *ANCESTOR_RELPATH to - * NULL and *ANCESTOR_REVISION to SVN_INVALID_REVNUM if they have no - * common ancestor. This function assumes that PATH_OR_URL1@REV1 and - * PATH_OR_URL2@REV2 both refer to the same repository. - * - * Use the authentication baton cached in CTX to authenticate against - * the repository. - * - * See also svn_client__get_youngest_common_ancestor(). - */ -svn_error_t * -svn_client__youngest_common_ancestor(const char **ancestor_url, - svn_revnum_t *ancestor_rev, - const char *path_or_url1, - const svn_opt_revision_t *revision1, - const char *path_or_url2, - const svn_opt_revision_t *revision2, - svn_client_ctx_t *ctx, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool); - /* Get the repository location of the base node at LOCAL_ABSPATH. * * A pathrev_t wrapper around svn_wc__node_get_base(). @@ -257,20 +281,6 @@ svn_client__wc_node_get_origin(svn_client__pathrev_t **origin_p, apr_pool_t *result_pool, apr_pool_t *scratch_pool); -/* Produce a diff with depth DEPTH between two files or two directories at - * LOCAL_ABSPATH1 and LOCAL_ABSPATH2, using the provided diff callbacks to - * show changes in files. The files and directories involved may be part of - * a working copy or they may be unversioned. For versioned files, show - * property changes, too. */ -svn_error_t * -svn_client__arbitrary_nodes_diff(const char *local_abspath1, - const char *local_abspath2, - svn_depth_t depth, - const svn_wc_diff_callbacks4_t *callbacks, - void *callback_baton, - svn_client_ctx_t *ctx, - apr_pool_t *scratch_pool); - /* Copy the file or directory on URL in some repository to DST_ABSPATH, * copying node information and properties. Resolve URL using PEG_REV and * REVISION. diff --git a/subversion/include/private/svn_cmdline_private.h b/subversion/include/private/svn_cmdline_private.h index ad16b66..f21a5d2 100644 --- a/subversion/include/private/svn_cmdline_private.h +++ b/subversion/include/private/svn_cmdline_private.h @@ -88,11 +88,15 @@ typedef struct svn_cmdline__config_argument_t * containing svn_cmdline__config_argument_t* elements, allocating the option * data in @a pool * + * [Since 1.9/1.10:] If the file, section, or option value is not recognized, + * warn to @c stderr, using @a prefix as in svn_handle_warning2(). + * * @since New in 1.7. */ svn_error_t * svn_cmdline__parse_config_option(apr_array_header_t *config_options, const char *opt_arg, + const char *prefix, apr_pool_t *pool); /** Sets the config options in @a config_options, an apr array containing @@ -220,6 +224,20 @@ svn_boolean_t svn_cmdline__be_interactive(svn_boolean_t non_interactive, svn_boolean_t force_interactive); +/* Parses the argument value of '--trust-server-cert-failures' OPT_ARG into + * the expected booleans for passing to svn_cmdline_create_auth_baton2() + * + * @since New in 1.9. + */ +svn_error_t * +svn_cmdline__parse_trust_options( + svn_boolean_t *trust_server_cert_unknown_ca, + svn_boolean_t *trust_server_cert_cn_mismatch, + svn_boolean_t *trust_server_cert_expired, + svn_boolean_t *trust_server_cert_not_yet_valid, + svn_boolean_t *trust_server_cert_other_failure, + const char *opt_arg, + apr_pool_t *scratch_pool); #ifdef __cplusplus } diff --git a/subversion/include/private/svn_delta_private.h b/subversion/include/private/svn_delta_private.h index 4de85a9..260327c 100644 --- a/subversion/include/private/svn_delta_private.h +++ b/subversion/include/private/svn_delta_private.h @@ -101,25 +101,12 @@ svn_delta__delta_from_editor(const svn_delta_editor_t **deditor, struct svn_delta__extra_baton *exb, apr_pool_t *pool); -/** - * Get the data from IN, compress it according to the specified - * COMPRESSION_LEVEL and write the result to OUT. - * SVN_DELTA_COMPRESSION_LEVEL_NONE is valid for COMPRESSION_LEVEL. - */ +/** Read the txdelta window header from @a stream and return the total + length of the unparsed window data in @a *window_len. */ svn_error_t * -svn__compress(svn_string_t *in, - svn_stringbuf_t *out, - int compression_level); - -/** - * Get the compressed data from IN, decompress it and write the result to - * OUT. Return an error if the decompressed size is larger than LIMIT. - */ -svn_error_t * -svn__decompress(svn_string_t *in, - svn_stringbuf_t *out, - apr_size_t limit); - +svn_txdelta__read_raw_window_len(apr_size_t *window_len, + svn_stream_t *stream, + apr_pool_t *pool); #ifdef __cplusplus } diff --git a/subversion/include/private/svn_dep_compat.h b/subversion/include/private/svn_dep_compat.h index 108b67c..729cf7e 100644 --- a/subversion/include/private/svn_dep_compat.h +++ b/subversion/include/private/svn_dep_compat.h @@ -20,7 +20,7 @@ * ==================================================================== * @endcopyright * - * @file svn_compat.h + * @file svn_dep_compat.h * @brief Compatibility macros and functions. * @since New in 1.5.0. */ @@ -35,71 +35,30 @@ extern "C" { #endif /* __cplusplus */ /** - * Check at compile time if the APR version is at least a certain - * level. - * @param major The major version component of the version checked - * for (e.g., the "1" of "1.3.0"). - * @param minor The minor version component of the version checked - * for (e.g., the "3" of "1.3.0"). - * @param patch The patch level component of the version checked - * for (e.g., the "0" of "1.3.0"). + * We assume that 'int' and 'unsigned' are at least 32 bits wide. + * This also implies that long (rev numbers) is 32 bits or wider. * - * @since New in 1.5. - */ -#ifndef APR_VERSION_AT_LEAST /* Introduced in APR 1.3.0 */ -#define APR_VERSION_AT_LEAST(major,minor,patch) \ -(((major) < APR_MAJOR_VERSION) \ - || ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \ - || ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && \ - (patch) <= APR_PATCH_VERSION)) -#endif /* APR_VERSION_AT_LEAST */ - -/** - * If we don't have a recent enough APR, emulate the behavior of the - * apr_array_clear() API. + * @since New in 1.9. */ -#if !APR_VERSION_AT_LEAST(1,3,0) -#define apr_array_clear(arr) (arr)->nelts = 0 +#if defined(APR_HAVE_LIMITS_H) \ + && !defined(SVN_ALLOW_SHORT_INTS) \ + && (INT_MAX < 0x7FFFFFFFl) +#error int is shorter than 32 bits and may break Subversion. Define SVN_ALLOW_SHORT_INTS to skip this check. #endif -#if !APR_VERSION_AT_LEAST(1,3,0) -/* Equivalent to the apr_hash_clear() function in APR >= 1.3.0. Used to - * implement the 'apr_hash_clear' macro if the version of APR that - * we build against does not provide the apr_hash_clear() function. */ -void svn_hash__clear(struct apr_hash_t *ht); - /** - * If we don't have a recent enough APR, emulate the behavior of the - * apr_hash_clear() API. + * We assume that 'char' is 8 bits wide. The critical interfaces are + * our repository formats and RA encodings. E.g. a 32 bit wide char may + * mess up UTF8 parsing, how we interpret size values etc. + * + * @since New in 1.9. */ -#define apr_hash_clear(ht) svn_hash__clear(ht) +#if defined(CHAR_BIT) \ + && !defined(SVN_ALLOW_NON_8_BIT_CHARS) \ + && (CHAR_BIT != 8) +#error char is not 8 bits and may break Subversion. Define SVN_ALLOW_NON_8_BIT_CHARS to skip this check. #endif -#if !APR_VERSION_AT_LEAST(1,0,0) -#define APR_UINT64_C(val) UINT64_C(val) -#define APR_FPROT_OS_DEFAULT APR_OS_DEFAULT -#define apr_hash_make_custom(pool,hash_func) apr_hash_make(pool) -#endif - -#if !APR_VERSION_AT_LEAST(1,3,0) -#define APR_UINT16_MAX 0xFFFFU -#define APR_INT16_MAX 0x7FFF -#define APR_INT16_MIN (-APR_INT16_MAX-1) -#define APR_UINT32_MAX 0xFFFFFFFFU -#define APR_INT32_MAX 0x7FFFFFFF -#define APR_INT32_MIN (-APR_INT32_MAX-1) -#define APR_UINT64_MAX APR_UINT64_C(0xFFFFFFFFFFFFFFFF) -#define APR_INT64_MAX APR_INT64_C(0x7FFFFFFFFFFFFFFF) -#define APR_INT64_MIN (-APR_INT64_MAX-1) -#define APR_SIZE_MAX (~(apr_size_t)0) - -#if APR_SIZEOF_VOIDP == 8 -typedef apr_uint64_t apr_uintptr_t; -#else -typedef apr_uint32_t apr_uintptr_t; -#endif -#endif /* !APR_VERSION_AT_LEAST(1,3,0) */ - /** * Work around a platform dependency issue. apr_thread_rwlock_trywrlock() * will make APR_STATUS_IS_EBUSY() return TRUE if the lock could not be @@ -115,6 +74,19 @@ typedef apr_uint32_t apr_uintptr_t; #define SVN_LOCK_IS_BUSY(x) APR_STATUS_IS_EBUSY(x) #endif +/** + * APR keeps a few interesting defines hidden away in its private + * headers apr_arch_file_io.h, so we redefined them here. + * + * @since New in 1.9 + */ +#ifndef APR_FREADONLY +#define APR_FREADONLY 0x10000000 +#endif +#ifndef APR_OPENINFO +#define APR_OPENINFO 0x00100000 +#endif + #if !APR_VERSION_AT_LEAST(1,4,0) #ifndef apr_time_from_msec #define apr_time_from_msec(msec) ((apr_time_t)(msec) * 1000) diff --git a/subversion/include/private/svn_diff_private.h b/subversion/include/private/svn_diff_private.h index bb17c17..48b4d52 100644 --- a/subversion/include/private/svn_diff_private.h +++ b/subversion/include/private/svn_diff_private.h @@ -97,6 +97,9 @@ svn_diff__unidiff_write_header(svn_stream_t *output_stream, * merged or reverse merged; otherwise (or if the mergeinfo property values * don't parse correctly) display them just like any other property. * + * Pass @a context_size, @a cancel_func and @a cancel_baton to the diff + * output functions. + * * Use @a scratch_pool for temporary allocations. */ svn_error_t * @@ -105,6 +108,9 @@ svn_diff__display_prop_diffs(svn_stream_t *outstream, const apr_array_header_t *propchanges, apr_hash_t *original_props, svn_boolean_t pretty_print_mergeinfo, + int context_size, + svn_cancel_func_t cancel_func, + void *cancel_baton, apr_pool_t *scratch_pool); diff --git a/subversion/include/private/svn_diff_tree.h b/subversion/include/private/svn_diff_tree.h index 8cd4c0e..4554da2 100644 --- a/subversion/include/private/svn_diff_tree.h +++ b/subversion/include/private/svn_diff_tree.h @@ -103,18 +103,22 @@ extern "C" { * Note that it is possible for nodes to be described as a delete followed by * an add at the same place within one parent. (Iff the diff is reversed you * can see an add followed by a delete!) + * ### "An add followed by a delete" sounds wrong. * * The directory batons live between the open and close events of a directory * and are thereby guaranteed to outlive the batons of their descendants. */ /* Describes the source of a merge */ +/* ### You mean a diff? + * ### How come many users don't set the 'repos_relpath' field? */ typedef struct svn_diff_source_t { /* Always available */ svn_revnum_t revision; /* Depending on the driver available for copyfrom */ + /* ### What? */ const char *repos_relpath; } svn_diff_source_t; @@ -137,9 +141,10 @@ typedef struct svn_diff_tree_processor_t { /** The value passed to svn_diff__tree_processor_create() as BATON. */ - void *baton; /* To avoid an additional in some places */ + void *baton; /* To avoid an additional in some places + * ### What? */ - /* Called before a directories children are processed. + /* Called before a directory's children are processed. * * Set *SKIP_CHILDREN to TRUE, to skip calling callbacks for all * children. @@ -319,7 +324,7 @@ svn_diff__tree_processor_filter_create(const svn_diff_tree_processor_t *processo apr_pool_t *result_pool); /** - * Create a new svn_diff_tree_processor_t instace with all function setup + * Create a new svn_diff_tree_processor_t instance with all function setup * to call into processor with all adds with copyfrom information transformed * to simple node changes. * diff --git a/subversion/include/private/svn_editor.h b/subversion/include/private/svn_editor.h index d714bb1..aa8a2ac 100644 --- a/subversion/include/private/svn_editor.h +++ b/subversion/include/private/svn_editor.h @@ -270,7 +270,6 @@ svn_delta_shim_callbacks_default(apr_pool_t *result_pool); * svn_editor_setcb_delete() \n * svn_editor_setcb_copy() \n * svn_editor_setcb_move() \n - * svn_editor_setcb_rotate() \n * svn_editor_setcb_complete() \n * svn_editor_setcb_abort() * @@ -293,7 +292,6 @@ svn_delta_shim_callbacks_default(apr_pool_t *result_pool); * svn_editor_delete() \n * svn_editor_copy() \n * svn_editor_move() \n - * svn_editor_rotate() * \n\n * Just before each callback invocation is carried out, the @a cancel_func * that was passed to svn_editor_create() is invoked to poll any @@ -325,7 +323,7 @@ svn_delta_shim_callbacks_default(apr_pool_t *result_pool); * In order to reduce complexity of callback receivers, the editor callbacks * must be driven in adherence to these rules: * - * - If any path is added (with add_*) or deleted/moved/rotated, then + * - If any path is added (with add_*) or deleted/moved, then * an svn_editor_alter_directory() call must be made for its parent * directory with the target/eventual set of children. * @@ -344,15 +342,13 @@ svn_delta_shim_callbacks_default(apr_pool_t *result_pool); * its children, if a directory) may be copied many times, and are * otherwise subject to the Once Rule. The destination path of a copy * or move may have alter_* operations applied, but not add_* or delete. - * If the destination path of a copy, move, or rotate is a directory, + * If the destination path of a copy or move is a directory, * then its children are subject to the Once Rule. The source path of * a move (and its child paths) may be referenced in add_*, or as the * destination of a copy (where these new or copied nodes are subject - * to the Once Rule). Paths listed in a rotation are both sources and - * destinations, so they may not be referenced again in an add_* or a - * deletion; these paths may have alter_* operations applied. + * to the Once Rule). * - * - The ancestor of an added, copied-here, moved-here, rotated, or + * - The ancestor of an added, copied-here, moved-here, or * modified node may not be deleted. The ancestor may not be moved * (instead: perform the move, *then* the edits). * @@ -375,10 +371,6 @@ svn_delta_shim_callbacks_default(apr_pool_t *result_pool); * by a delete... that is fine. It is simply that svn_editor_move() * should be used to describe a semantic move. * - * - Paths mentioned in svn_editor_rotate() may have their properties - * and contents edited (via alter_* calls) by a previous or later call, - * but they may not be subject to a later move, rotate, or deletion. - * * - One of svn_editor_complete() or svn_editor_abort() must be called * exactly once, which must be the final call the driver invokes. * Invoking svn_editor_complete() must imply that the set of changes has @@ -573,9 +565,9 @@ typedef svn_error_t *(*svn_editor_cb_alter_file_t)( void *baton, const char *relpath, svn_revnum_t revision, - apr_hash_t *props, const svn_checksum_t *checksum, svn_stream_t *contents, + apr_hash_t *props, apr_pool_t *scratch_pool); /** @see svn_editor_alter_symlink(), svn_editor_t. @@ -585,8 +577,8 @@ typedef svn_error_t *(*svn_editor_cb_alter_symlink_t)( void *baton, const char *relpath, svn_revnum_t revision, - apr_hash_t *props, const char *target, + apr_hash_t *props, apr_pool_t *scratch_pool); /** @see svn_editor_delete(), svn_editor_t. @@ -620,15 +612,6 @@ typedef svn_error_t *(*svn_editor_cb_move_t)( svn_revnum_t replaces_rev, apr_pool_t *scratch_pool); -/** @see svn_editor_rotate(), svn_editor_t. - * @since New in 1.8. - */ -typedef svn_error_t *(*svn_editor_cb_rotate_t)( - void *baton, - const apr_array_header_t *relpaths, - const apr_array_header_t *revisions, - apr_pool_t *scratch_pool); - /** @see svn_editor_complete(), svn_editor_t. * @since New in 1.8. */ @@ -790,17 +773,6 @@ svn_editor_setcb_move(svn_editor_t *editor, svn_editor_cb_move_t callback, apr_pool_t *scratch_pool); -/** Sets the #svn_editor_cb_rotate_t callback in @a editor - * to @a callback. - * @a scratch_pool is used for temporary allocations (if any). - * @see also svn_editor_setcb_many(). - * @since New in 1.8. - */ -svn_error_t * -svn_editor_setcb_rotate(svn_editor_t *editor, - svn_editor_cb_rotate_t callback, - apr_pool_t *scratch_pool); - /** Sets the #svn_editor_cb_complete_t callback in @a editor * to @a callback. * @a scratch_pool is used for temporary allocations (if any). @@ -841,7 +813,6 @@ typedef struct svn_editor_cb_many_t svn_editor_cb_delete_t cb_delete; svn_editor_cb_copy_t cb_copy; svn_editor_cb_move_t cb_move; - svn_editor_cb_rotate_t cb_rotate; svn_editor_cb_complete_t cb_complete; svn_editor_cb_abort_t cb_abort; @@ -1020,9 +991,9 @@ svn_error_t * svn_editor_alter_file(svn_editor_t *editor, const char *relpath, svn_revnum_t revision, - apr_hash_t *props, const svn_checksum_t *checksum, - svn_stream_t *contents); + svn_stream_t *contents, + apr_hash_t *props); /** Drive @a editor's #svn_editor_cb_alter_symlink_t callback. * @@ -1047,8 +1018,8 @@ svn_error_t * svn_editor_alter_symlink(svn_editor_t *editor, const char *relpath, svn_revnum_t revision, - apr_hash_t *props, - const char *target); + const char *target, + apr_hash_t *props); /** Drive @a editor's #svn_editor_cb_delete_t callback. * @@ -1093,7 +1064,7 @@ svn_editor_copy(svn_editor_t *editor, * expect to find this node. That is, @a src_relpath at the start of * the whole edit and @a src_relpath at @a src_revision must lie within * the same node-rev (aka history-segment). This is just like the - * revisions specified to svn_editor_delete() and svn_editor_rotate(). + * revisions specified to svn_editor_delete(). * * For a description of @a replaces_rev, see svn_editor_add_file(). * @@ -1110,36 +1081,6 @@ svn_editor_move(svn_editor_t *editor, const char *dst_relpath, svn_revnum_t replaces_rev); -/** Drive @a editor's #svn_editor_cb_rotate_t callback. - * - * Perform a rotation among multiple nodes in the target tree. - * - * The @a relpaths and @a revisions arrays (pair-wise) specify nodes in the - * tree which are located at a path and expected to be at a specific - * revision. These nodes are simultaneously moved in a rotation pattern. - * For example, the node at index 0 of @a relpaths and @a revisions will - * be moved to the relpath specified at index 1 of @a relpaths. The node - * at index 1 will be moved to the location at index 2. The node at index - * N-1 will be moved to the relpath specified at index 0. - * - * The simplest form of this operation is to swap nodes A and B. One may - * think to move A to a temporary location T, then move B to A, then move - * T to B. However, this last move violations the Once Rule by moving T - * (which had already by edited by the move from A). In order to keep the - * restrictions against multiple moves of a single node, the rotation - * operation is needed for certain types of tree edits. - * - * ### what happens if one of the paths of the rotation is not "within" the - * ### receiver's set of paths? - * - * For all restrictions on driving the editor, see #svn_editor_t. - * @since New in 1.8. - */ -svn_error_t * -svn_editor_rotate(svn_editor_t *editor, - const apr_array_header_t *relpaths, - const apr_array_header_t *revisions); - /** Drive @a editor's #svn_editor_cb_complete_t callback. * * Send word that the edit has been completed successfully. diff --git a/subversion/include/private/svn_error_private.h b/subversion/include/private/svn_error_private.h index f8bd2bc..2d35bc6 100644 --- a/subversion/include/private/svn_error_private.h +++ b/subversion/include/private/svn_error_private.h @@ -37,7 +37,7 @@ extern "C" { * Returns if @a err is a "tracing" error. */ svn_boolean_t -svn_error__is_tracing_link(svn_error_t *err); +svn_error__is_tracing_link(const svn_error_t *err); /** * Converts a zlib error to an svn_error_t. zerr is the error code, diff --git a/subversion/include/private/svn_fs_fs_private.h b/subversion/include/private/svn_fs_fs_private.h new file mode 100644 index 0000000..59aede1 --- /dev/null +++ b/subversion/include/private/svn_fs_fs_private.h @@ -0,0 +1,355 @@ +/** + * @copyright + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + * @endcopyright + * + * @file svn_fs_fs_private.h + * @brief Private API for tools that access FSFS internals and can't use + * the svn_fs_t API for that. + */ + + +#ifndef SVN_FS_FS_PRIVATE_H +#define SVN_FS_FS_PRIVATE_H + +#include <apr_pools.h> +#include <apr_hash.h> + +#include "svn_types.h" +#include "svn_error.h" +#include "svn_fs.h" +#include "svn_iter.h" +#include "svn_config.h" +#include "svn_string.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + + +/* Description of one large representation. It's content will be reused / + * overwritten when it gets replaced by an even larger representation. + */ +typedef struct svn_fs_fs__large_change_info_t +{ + /* size of the (deltified) representation */ + apr_uint64_t size; + + /* Revision of the representation. SVN_INVALID_REVNUM for unused entries. */ + svn_revnum_t revision; + + /* node path. "" for unused instances */ + svn_stringbuf_t *path; +} svn_fs_fs__large_change_info_t; + +/* Container for the largest representations found so far. The capacity + * is fixed and entries will be inserted by reusing the last one and + * reshuffling the entry pointers. + */ +typedef struct svn_fs_fs__largest_changes_t +{ + /* number of entries allocated in CHANGES */ + apr_size_t count; + + /* size of the smallest change */ + apr_uint64_t min_size; + + /* changes kept in this struct */ + svn_fs_fs__large_change_info_t **changes; +} svn_fs_fs__largest_changes_t; + +/* Information we gather per size bracket. + */ +typedef struct svn_fs_fs__histogram_line_t +{ + /* number of item that fall into this bracket */ + apr_uint64_t count; + + /* sum of values in this bracket */ + apr_uint64_t sum; +} svn_fs_fs__histogram_line_t; + +/* A histogram of 64 bit integer values. + */ +typedef struct svn_fs_fs__histogram_t +{ + /* total sum over all brackets */ + svn_fs_fs__histogram_line_t total; + + /* one bracket per binary step. + * line[i] is the 2^(i-1) <= x < 2^i bracket */ + svn_fs_fs__histogram_line_t lines[64]; +} svn_fs_fs__histogram_t; + +/* Information we collect per file ending. + */ +typedef struct svn_fs_fs__extension_info_t +{ + /* file extension, including leading "." + * "(none)" in the container for files w/o extension. */ + const char *extension; + + /* histogram of representation sizes */ + svn_fs_fs__histogram_t rep_histogram; + + /* histogram of sizes of changed files */ + svn_fs_fs__histogram_t node_histogram; +} svn_fs_fs__extension_info_t; + +/* Compression statistics we collect over a given set of representations. + */ +typedef struct svn_fs_fs__rep_pack_stats_t +{ + /* number of representations */ + apr_uint64_t count; + + /* total size after deltification (i.e. on disk size) */ + apr_uint64_t packed_size; + + /* total size after de-deltification (i.e. plain text size) */ + apr_uint64_t expanded_size; + + /* total on-disk header size */ + apr_uint64_t overhead_size; +} svn_fs_fs__rep_pack_stats_t; + +/* Statistics we collect over a given set of representations. + * We group them into shared and non-shared ("unique") reps. + */ +typedef struct svn_fs_fs__representation_stats_t +{ + /* stats over all representations */ + svn_fs_fs__rep_pack_stats_t total; + + /* stats over those representations with ref_count == 1 */ + svn_fs_fs__rep_pack_stats_t uniques; + + /* stats over those representations with ref_count > 1 */ + svn_fs_fs__rep_pack_stats_t shared; + + /* sum of all ref_counts */ + apr_uint64_t references; + + /* sum of ref_count * expanded_size, + * i.e. total plaintext content if there was no rep sharing */ + apr_uint64_t expanded_size; +} svn_fs_fs__representation_stats_t; + +/* Basic statistics we collect over a given set of noderevs. + */ +typedef struct svn_fs_fs__node_stats_t +{ + /* number of noderev structs */ + apr_uint64_t count; + + /* their total size on disk (structs only) */ + apr_uint64_t size; +} svn_fs_fs__node_stats_t; + +/* Comprises all the information needed to create the output of the + * 'svnfsfs stats' command. + */ +typedef struct svn_fs_fs__stats_t +{ + /* sum total of all rev / pack file sizes in bytes */ + apr_uint64_t total_size; + + /* number of revisions in the repository */ + apr_uint64_t revision_count; + + /* total number of changed paths */ + apr_uint64_t change_count; + + /* sum of all changed path list sizes on disk in bytes */ + apr_uint64_t change_len; + + /* stats on all representations */ + svn_fs_fs__representation_stats_t total_rep_stats; + + /* stats on all file text representations */ + svn_fs_fs__representation_stats_t file_rep_stats; + + /* stats on all directory text representations */ + svn_fs_fs__representation_stats_t dir_rep_stats; + + /* stats on all file prop representations */ + svn_fs_fs__representation_stats_t file_prop_rep_stats; + + /* stats on all directory prop representations */ + svn_fs_fs__representation_stats_t dir_prop_rep_stats; + + /* size and count summary over all noderevs */ + svn_fs_fs__node_stats_t total_node_stats; + + /* size and count summary over all file noderevs */ + svn_fs_fs__node_stats_t file_node_stats; + + /* size and count summary over all directory noderevs */ + svn_fs_fs__node_stats_t dir_node_stats; + + /* the biggest single contributors to repo size */ + svn_fs_fs__largest_changes_t *largest_changes; + + /* histogram of representation sizes */ + svn_fs_fs__histogram_t rep_size_histogram; + + /* histogram of sizes of changed nodes */ + svn_fs_fs__histogram_t node_size_histogram; + + /* histogram of representation sizes */ + svn_fs_fs__histogram_t added_rep_size_histogram; + + /* histogram of sizes of changed nodes */ + svn_fs_fs__histogram_t added_node_size_histogram; + + /* histogram of unused representations */ + svn_fs_fs__histogram_t unused_rep_histogram; + + /* histogram of sizes of changed files */ + svn_fs_fs__histogram_t file_histogram; + + /* histogram of sizes of file representations */ + svn_fs_fs__histogram_t file_rep_histogram; + + /* histogram of sizes of changed file property sets */ + svn_fs_fs__histogram_t file_prop_histogram; + + /* histogram of sizes of file property representations */ + svn_fs_fs__histogram_t file_prop_rep_histogram; + + /* histogram of sizes of changed directories (in bytes) */ + svn_fs_fs__histogram_t dir_histogram; + + /* histogram of sizes of directories representations */ + svn_fs_fs__histogram_t dir_rep_histogram; + + /* histogram of sizes of changed directories property sets */ + svn_fs_fs__histogram_t dir_prop_histogram; + + /* histogram of sizes of directories property representations */ + svn_fs_fs__histogram_t dir_prop_rep_histogram; + + /* extension -> svn_fs_fs__extension_info_t* map */ + apr_hash_t *by_extension; +} svn_fs_fs__stats_t; + + +/* Scan all contents of the repository FS and return statistics in *STATS, + * allocated in RESULT_POOL. Report progress through PROGRESS_FUNC with + * PROGRESS_BATON, if PROGRESS_FUNC is not NULL. + * Use SCRATCH_POOL for temporary allocations. + */ +svn_error_t * +svn_fs_fs__get_stats(svn_fs_fs__stats_t **stats, + svn_fs_t *fs, + svn_fs_progress_notify_func_t progress_func, + void *progress_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/* Node-revision IDs in FSFS consist of 3 of sub-IDs ("parts") that consist + * of a creation REVISION number and some revision- / transaction-local + * counter value (NUMBER). Old-style ID parts use global counter values. + * + * The parts are: node_id, copy_id and txn_id for in-txn IDs as well as + * node_id, copy_id and rev_offset for in-revision IDs. This struct the + * data structure used for each of those parts. + */ +typedef struct svn_fs_fs__id_part_t +{ + /* SVN_INVALID_REVNUM for txns -> not a txn, COUNTER must be 0. + SVN_INVALID_REVNUM for others -> not assigned to a revision, yet. + 0 for others -> old-style ID or the root in rev 0. */ + svn_revnum_t revision; + + /* sub-id value relative to REVISION. Its interpretation depends on + the part itself. In rev_item, it is the index_index value, in others + it represents a unique counter value. */ + apr_uint64_t number; +} svn_fs_fs__id_part_t; + +/* (user visible) entry in the phys-to-log index. It describes a section + * of some packed / non-packed rev file as containing a specific item. + * There must be no overlapping / conflicting entries. + */ +typedef struct svn_fs_fs__p2l_entry_t +{ + /* offset of the first byte that belongs to the item */ + apr_off_t offset; + + /* length of the item in bytes */ + apr_off_t size; + + /* type of the item (see SVN_FS_FS__ITEM_TYPE_*) defines */ + apr_uint32_t type; + + /* modified FNV-1a checksum. 0 if unknown checksum */ + apr_uint32_t fnv1_checksum; + + /* item in that block */ + svn_fs_fs__id_part_t item; +} svn_fs_fs__p2l_entry_t; + + +/* Callback function type receiving a single P2L index ENTRY, a user + * provided BATON and a SCRATCH_POOL for temporary allocations. + * ENTRY's lifetime may end when the callback returns. + */ +typedef svn_error_t * +(*svn_fs_fs__dump_index_func_t)(const svn_fs_fs__p2l_entry_t *entry, + void *baton, + apr_pool_t *scratch_pool); + +/* Read the P2L index for the rev / pack file containing REVISION in FS. + * For each index entry, invoke CALLBACK_FUNC with CALLBACK_BATON. + * If not NULL, call CANCEL_FUNC with CANCEL_BATON from time to time. + * Use SCRATCH_POOL for temporary allocations. + */ +svn_error_t * +svn_fs_fs__dump_index(svn_fs_t *fs, + svn_revnum_t revision, + svn_fs_fs__dump_index_func_t callback_func, + void *callback_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool); + + +/* Rewrite the respective index information of the rev / pack file in FS + * containing REVISION and use the svn_fs_fs__p2l_entry_t * array ENTRIES + * as the new index contents. Allocate temporaries from SCRATCH_POOL. + * + * Note that this becomes a no-op if ENTRIES is empty. You may use a zero- + * sized empty entry instead. + */ +svn_error_t * +svn_fs_fs__load_index(svn_fs_t *fs, + svn_revnum_t revision, + apr_array_header_t *entries, + apr_pool_t *scratch_pool); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* SVN_FS_FS_PRIVATE_H */ diff --git a/subversion/include/private/svn_fs_private.h b/subversion/include/private/svn_fs_private.h index 20b70cd..5bd89c0 100644 --- a/subversion/include/private/svn_fs_private.h +++ b/subversion/include/private/svn_fs_private.h @@ -179,6 +179,23 @@ svn_fs__editor_commit(svn_revnum_t *revision, apr_pool_t *scratch_pool); +/** Set @a *mergeinfo to the mergeinfo for @a path in @a root. + * + * If there is no mergeinfo, set @a *mergeinfo to NULL. + * + * See svn_fs_get_mergeinfo2() but for the meanings of @a inherit and + * @a adjust_inheritable_mergeinfo and other details. + */ +svn_error_t * +svn_fs__get_mergeinfo_for_path(svn_mergeinfo_t *mergeinfo, + svn_fs_root_t *root, + const char *path, + svn_mergeinfo_inheritance_t inherit, + svn_boolean_t adjust_inherited_mergeinfo, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + + /** @} */ diff --git a/subversion/include/private/svn_fs_util.h b/subversion/include/private/svn_fs_util.h index eb0f024..c9f74a1 100644 --- a/subversion/include/private/svn_fs_util.h +++ b/subversion/include/private/svn_fs_util.h @@ -29,12 +29,17 @@ #include "svn_types.h" #include "svn_error.h" +#include "svn_version.h" #include "svn_fs.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +/* Get libsvn_fs_util version information. */ +const svn_version_t * +svn_fs_util__version(void); + /* Returns whether PATH is in canonical form as defined by svn_fs__canonicalize_abspath(). */ @@ -210,6 +215,26 @@ svn_fs__append_to_merged_froms(svn_mergeinfo_t *output, const char *rel_path, apr_pool_t *pool); +/* Given the FS creation options in CONFIG, return the oldest version that + we shall be compatible with in *COMPATIBLE_VERSION. The patch level + is always set to 0 and the tag to "". Allocate the result in POOL. + + Note that the result will always be compatible to the current tool + version, i.e. will be a version number not more recent than this tool. */ +svn_error_t * +svn_fs__compatible_version(svn_version_t **compatible_version, + apr_hash_t *config, + apr_pool_t *pool); + +/* Compare the property lists A and B using POOL for temporary allocations. + Return true iff both lists contain the same properties with the same + values. A and B may be NULL in which case they will be equal to and + empty list. */ +svn_boolean_t +svn_fs__prop_lists_equal(apr_hash_t *a, + apr_hash_t *b, + apr_pool_t *pool); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/subversion/include/private/svn_io_private.h b/subversion/include/private/svn_io_private.h index 239cd6e..814c27a 100644 --- a/subversion/include/private/svn_io_private.h +++ b/subversion/include/private/svn_io_private.h @@ -44,6 +44,15 @@ extern "C" { #define SVN__APR_FINFO_MASK_OUT (0) #endif +/* 90% of the lines we encounter will be less than this many chars. + * + * Line-based functions like svn_stream_readline should fetch data in + * blocks no longer than this. Although using a larger prefetch size is + * not illegal and must not break any functionality, it may be + * significantly less efficient in certain situations. + */ +#define SVN__LINE_CHUNK_SIZE 80 + /** Set @a *executable TRUE if @a file_info is executable for the * user, FALSE otherwise. @@ -64,6 +73,18 @@ svn_io__is_finfo_read_only(svn_boolean_t *read_only, apr_pool_t *pool); +/** + * Lock file at @a lock_file. If that file does not exist, create an empty + * file. + * + * Lock will be automatically released when @a pool is cleared or destroyed. + * Use @a pool for memory allocations. + */ +svn_error_t * +svn_io__file_lock_autocreate(const char *lock_file, + apr_pool_t *pool); + + /** Buffer test handler function for a generic stream. @see svn_stream_t * and svn_stream__is_buffered(). * @@ -81,7 +102,7 @@ svn_stream__set_is_buffered(svn_stream_t *stream, /** Return whether this generic @a stream uses internal buffering. * This may be used to work around subtle differences between buffered - * an non-buffered APR files. A lazy-open stream cannot report the + * and non-buffered APR files. A lazy-open stream cannot report the * true buffering state until after the lazy open: a stream that * initially reports as non-buffered may report as buffered later. * @@ -96,6 +117,82 @@ svn_stream__is_buffered(svn_stream_t *stream); apr_file_t * svn_stream__aprfile(svn_stream_t *stream); +/* Creates as *INSTALL_STREAM a stream that once completed can be installed + using Windows checkouts much slower than Unix. + + While writing the stream is temporarily stored in TMP_ABSPATH. + */ +svn_error_t * +svn_stream__create_for_install(svn_stream_t **install_stream, + const char *tmp_abspath, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/* Installs a stream created with svn_stream__create_for_install in its final + location FINAL_ABSPATH, potentially using platform specific optimizations. + + If MAKE_PARENTS is TRUE, this function will create missing parent + directories if needed. + */ +svn_error_t * +svn_stream__install_stream(svn_stream_t *install_stream, + const char *final_abspath, + svn_boolean_t make_parents, + apr_pool_t *scratch_pool); + +/* Deletes the install stream (when installing is not necessary after all) */ +svn_error_t * +svn_stream__install_delete(svn_stream_t *install_stream, + apr_pool_t *scratch_pool); + +/* Optimized apr_file_stat / apr_file_info_get operating on a closed + install stream */ +svn_error_t * +svn_stream__install_get_info(apr_finfo_t *finfo, + svn_stream_t *install_stream, + apr_int32_t wanted, + apr_pool_t *scratch_pool); + + +#if defined(WIN32) + +/* ### Move to something like io.h or subr.h, to avoid making it + part of the DLL api */ + +/* This is semantically the same as the APR utf8_to_unicode_path + function, but reimplemented here because APR does not export it. + + Note that this function creates "\\?\" paths so the resulting path + can only be used for WINAPI functions that explicitly document support + for this kind of paths. Newer Windows functions (Vista+) that support + long paths directly DON'T want this kind of escaping. + */ +svn_error_t* +svn_io__utf8_to_unicode_longpath(const WCHAR **result, + const char *source, + apr_pool_t *result_pool); + +/* This Windows-specific function marks the file to be deleted on close using + an existing file handle. It can be used to avoid having to reopen the file + as part of the delete handling. Return SVN_ERR_UNSUPPORTED_FEATURE if + delete on close operation is not supported by OS. */ +svn_error_t * +svn_io__win_delete_file_on_close(apr_file_t *file, + const char *path, + apr_pool_t *pool); + +/* This Windows-specific function renames the file using an existing file + handle. It can be used to avoid having to reopen the file as part of the + rename operation. Return SVN_ERR_UNSUPPORTED_FEATURE if renaming open + file is not supported by OS.*/ +svn_error_t * +svn_io__win_rename_open_file(apr_file_t *file, + const char *from_path, + const char *to_path, + apr_pool_t *pool); + +#endif /* WIN32 */ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/subversion/include/private/svn_log.h b/subversion/include/private/svn_log.h index bdcf32f..1ad8d55 100644 --- a/subversion/include/private/svn_log.h +++ b/subversion/include/private/svn_log.h @@ -204,7 +204,7 @@ svn_log__get_file_revs(const char *path, svn_revnum_t start, svn_revnum_t end, * @since New in 1.6. */ const char * -svn_log__lock(const apr_array_header_t *paths, svn_boolean_t steal, +svn_log__lock(apr_hash_t *targets, svn_boolean_t steal, apr_pool_t *pool); /** @@ -213,7 +213,7 @@ svn_log__lock(const apr_array_header_t *paths, svn_boolean_t steal, * @since New in 1.6. */ const char * -svn_log__unlock(const apr_array_header_t *paths, svn_boolean_t break_lock, +svn_log__unlock(apr_hash_t *targets, svn_boolean_t break_lock, apr_pool_t *pool); /** diff --git a/subversion/include/private/svn_magic.h b/subversion/include/private/svn_magic.h index b057e56..2e5fafd 100644 --- a/subversion/include/private/svn_magic.h +++ b/subversion/include/private/svn_magic.h @@ -30,14 +30,16 @@ /* An opaque struct that wraps a libmagic cookie. */ typedef struct svn_magic__cookie_t svn_magic__cookie_t; -/* This routine initialises libmagic. +/* This routine initialises libmagic. CONFIG is a config hash and + * may be NULL. * Upon success a new *MAGIC_COOKIE is allocated in RESULT_POOL. * On failure *MAGIC_COOKIE is set to NULL. * All resources used by libmagic are freed by a cleanup handler * installed on RESULT_POOL, i.e. *MAGIC_COOKIE becomes invalid when * the pool is cleared! */ -void +svn_error_t * svn_magic__init(svn_magic__cookie_t **magic_cookie, + apr_hash_t *config, apr_pool_t *result_pool); /* Detect the mime-type of the file at LOCAL_ABSPATH using MAGIC_COOKIE. diff --git a/subversion/include/private/svn_mergeinfo_private.h b/subversion/include/private/svn_mergeinfo_private.h index b8748f4..716d0c9 100644 --- a/subversion/include/private/svn_mergeinfo_private.h +++ b/subversion/include/private/svn_mergeinfo_private.h @@ -119,13 +119,13 @@ svn_mergeinfo__equals(svn_boolean_t *is_equal, svn_boolean_t consider_inheritance, apr_pool_t *pool); -/* Examine MERGEINFO, removing all paths from the hash which map to - empty rangelists. POOL is used only to allocate the apr_hash_index_t - iterator. Returns TRUE if any paths were removed and FALSE if none were +/* Remove all paths from MERGEINFO which map to empty rangelists. + + Return TRUE if any paths were removed and FALSE if none were removed or MERGEINFO is NULL. */ svn_boolean_t svn_mergeinfo__remove_empty_rangelists(svn_mergeinfo_t mergeinfo, - apr_pool_t *pool); + apr_pool_t *scratch_pool); /* Make a shallow (ie, mergeinfos are not duped, or altered at all; keys share storage) copy of IN_CATALOG in *OUT_CATALOG, removing diff --git a/subversion/include/private/svn_mutex.h b/subversion/include/private/svn_mutex.h index c647697..c04820b 100644 --- a/subversion/include/private/svn_mutex.h +++ b/subversion/include/private/svn_mutex.h @@ -39,27 +39,23 @@ extern "C" { * This is a simple wrapper around @c apr_thread_mutex_t and will be a * valid identifier even if APR does not support threading. */ -#if APR_HAS_THREADS /** A mutex for synchronization between threads. It may be NULL, in * which case no synchronization will take place. The latter is useful * when implementing some functionality with optional synchronization. */ -typedef apr_thread_mutex_t svn_mutex__t; - -#else - -/** Dummy definition. The content will never be actually accessed. - */ -typedef void svn_mutex__t; - -#endif +typedef struct svn_mutex__t svn_mutex__t; /** Initialize the @a *mutex. If @a mutex_required is TRUE, the mutex will * actually be created with a lifetime defined by @a result_pool. Otherwise, * the pointer will be set to @c NULL and svn_mutex__lock() as well as * svn_mutex__unlock() will be no-ops. * + * We don't support recursive locks, i.e. a thread may not acquire the same + * mutex twice without releasing it in between. Attempts to lock a mutex + * recursively will cause lock ups and other undefined behavior on some + * systems. + * * If threading is not supported by APR, this function is a no-op. */ svn_error_t * diff --git a/subversion/include/private/svn_named_atomic.h b/subversion/include/private/svn_named_atomic.h deleted file mode 100644 index 4efa255..0000000 --- a/subversion/include/private/svn_named_atomic.h +++ /dev/null @@ -1,162 +0,0 @@ -/** - * @copyright - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * ==================================================================== - * @endcopyright - * - * @file svn_named_atomics.h - * @brief Structures and functions for machine-wide named atomics. - * These atomics store 64 bit signed integer values and provide - * a number of basic operations on them. Instead of an address, - * these atomics are identified by strings / names. We also support - * namespaces - mainly to separate debug from production data. - */ - -#ifndef SVN_NAMED_ATOMICS_H -#define SVN_NAMED_ATOMICS_H - -#include "svn_error.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** An opaque structure that represents a namespace, i.e. a container - * for named atomics. - */ -typedef struct svn_atomic_namespace__t svn_atomic_namespace__t; - -/** An opaque structure that represents a named, system-wide visible - * 64 bit integer with atomic access routines. - */ -typedef struct svn_named_atomic__t svn_named_atomic__t; - -/** Maximum length of the name of any atomic (excluding the terminal NUL). - */ -#define SVN_NAMED_ATOMIC__MAX_NAME_LENGTH 30 - -/** Returns #FALSE when named atomics are not available to our process - * and svn_atomic_namespace__create is likely to fail. - * - * @note The actual check will be performed only once and later - * changes in process privileges will not reflect in the outcome of future - * calls to this function. - */ -svn_boolean_t -svn_named_atomic__is_supported(void); - -/** Returns #TRUE on platforms that don't need expensive synchronization - * objects to serialize access to named atomics. If this returns #FALSE, - * reading from or modifying a #svn_named_atomic__t may be as expensive - * as a file system operation. - */ -svn_boolean_t -svn_named_atomic__is_efficient(void); - -/** Create a namespace (i.e. access object) with the given @a name and - * return it in @a *ns. - * - * Multiple access objects with the same name may be created. They access - * the same shared memory region but have independent lifetimes. - * - * The access object will be allocated in @a result_pool and atomics gotten - * from this object will become invalid when the pool is being cleared. - */ -svn_error_t * -svn_atomic_namespace__create(svn_atomic_namespace__t **ns, - const char *name, - apr_pool_t *result_pool); - -/** Removes persistent data structures (files in particular) that got - * created for the namespace given by @a name. Use @a pool for temporary - * allocations. - * - * @note You must not call this while the respective namespace is still - * in use. Calling this multiple times for the same namespace is safe. - */ -svn_error_t * -svn_atomic_namespace__cleanup(const char *name, - apr_pool_t *pool); - -/** Find the atomic with the specified @a name in namespace @a ns and - * return it in @a *atomic. If no object with that name can be found, the - * behavior depends on @a auto_create. If it is @c FALSE, @a *atomic will - * be set to @c NULL. Otherwise, a new atomic will be created, its value - * set to 0 and the access structure be returned in @a *atomic. - * - * Note that @a name must not exceed #SVN_NAMED_ATOMIC__MAX_NAME_LENGTH - * characters and an error will be returned if the specified name is longer - * than supported. - * - * @note The lifetime of the atomic object is bound to the lifetime - * of the @a ns object, i.e. the pool the latter was created in. - * The data in the namespace persists as long as at least one process - * holds an #svn_atomic_namespace__t object corresponding to it. - */ -svn_error_t * -svn_named_atomic__get(svn_named_atomic__t **atomic, - svn_atomic_namespace__t *ns, - const char *name, - svn_boolean_t auto_create); - -/** Read the @a atomic and return its current @a *value. - * An error will be returned if @a atomic is @c NULL. - */ -svn_error_t * -svn_named_atomic__read(apr_int64_t *value, - svn_named_atomic__t *atomic); - -/** Set the data in @a atomic to @a new_value and return its old content - * in @a *old_value. @a old_value may be NULL. - * - * An error will be returned if @a atomic is @c NULL. - */ -svn_error_t * -svn_named_atomic__write(apr_int64_t *old_value, - apr_int64_t new_value, - svn_named_atomic__t *atomic); - -/** Add @a delta to the data in @a atomic and return its new value in - * @a *new_value. @a new_value may be null. - * - * An error will be returned if @a atomic is @c NULL. - */ -svn_error_t * -svn_named_atomic__add(apr_int64_t *new_value, - apr_int64_t delta, - svn_named_atomic__t *atomic); - -/** If the current data in @a atomic equals @a comperand, set it to - * @a new_value. Return the initial value in @a *old_value. - * @a old_value may be NULL. - * - * An error will be returned if @a atomic is @c NULL. - */ -svn_error_t * -svn_named_atomic__cmpxchg(apr_int64_t *old_value, - apr_int64_t new_value, - apr_int64_t comperand, - svn_named_atomic__t *atomic); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* SVN_NAMED_ATOMICS_H */ diff --git a/subversion/include/private/svn_object_pool.h b/subversion/include/private/svn_object_pool.h new file mode 100644 index 0000000..7a9383e --- /dev/null +++ b/subversion/include/private/svn_object_pool.h @@ -0,0 +1,154 @@ +/** + * @copyright + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + * @endcopyright + * + * @file svn_object_pool.h + * @brief multithreaded object pool API + * + * This is the core data structure behind various object pools. It + * provides a thread-safe associative container for object instances of + * the same type. + * + * Memory and lifetime management for the objects are handled by the pool. + * Reference counting takes care that neither objects nor the object pool + * get actually destroyed while other parts depend on them. All objects + * are thought to be recycle-able and live in their own root memory pools + * making them (potentially) safe to be used from different threads. + * Currently unused objects may be kept around for a while and returned + * by the next lookup. + * + * Two modes are supported: shared use and exclusive use. In shared mode, + * any object can be handed out to multiple users and in potentially + * different threads at the same time. In exclusive mode, the same object + * will only be referenced at most once. + * + * Object creation and access must be provided outside this structure. + * In particular, the using container will usually wrap the actual object + * in a meta-data struct containing key information etc and must provide + * getters and setters for those wrapper structs. + */ + + + +#ifndef SVN_OBJECT_POOL_H +#define SVN_OBJECT_POOL_H + +#include <apr.h> /* for apr_int64_t */ +#include <apr_pools.h> /* for apr_pool_t */ +#include <apr_hash.h> /* for apr_hash_t */ + +#include "svn_types.h" + +#include "private/svn_mutex.h" +#include "private/svn_string_private.h" + + + +/* The opaque object container type. */ +typedef struct svn_object_pool__t svn_object_pool__t; + +/* Extract the actual object from the WRAPPER using optional information + * from BATON (provided through #svn_object_pool__lookup) and return it. + * The result will be used with POOL and must remain valid throughout + * POOL's lifetime. + * + * It is legal to return a copy, allocated in POOL, of the wrapped object. + */ +typedef void * (* svn_object_pool__getter_t)(void *wrapper, + void *baton, + apr_pool_t *pool); + +/* Copy the information from the SOURCE object wrapper into the already + * existing *TARGET object wrapper using POOL for allocations and BATON + * for optional context (provided through #svn_object_pool__insert). + */ +typedef svn_error_t * (* svn_object_pool__setter_t)(void **target, + void *source, + void *baton, + apr_pool_t *pool); + +/* Create a new object pool in POOL and return it in *OBJECT_POOL. + * Objects will be extracted using GETTER and updated using SETTER. Either + * one (or both) may be NULL and the default implementation assumes that + * wrapper == object and updating is a no-op. + * + * If THREAD_SAFE is not set, neither the object pool nor the object + * references returned from it may be accessed from multiple threads. + * + * It is not legal to call any API on the object pool after POOL got + * cleared or destroyed. However, existing object references handed out + * from the object pool remain valid and will keep the internal pool data + * structures alive for as long as such object references exist. + */ +svn_error_t * +svn_object_pool__create(svn_object_pool__t **object_pool, + svn_object_pool__getter_t getter, + svn_object_pool__setter_t setter, + svn_boolean_t thread_safe, + apr_pool_t *pool); + +/* Return the root pool containing the OBJECT_POOL and all sub-structures. + */ +apr_pool_t * +svn_object_pool__new_wrapper_pool(svn_object_pool__t *object_pool); + +/* Return the mutex used to serialize all OBJECT_POOL access. + */ +svn_mutex__t * +svn_object_pool__mutex(svn_object_pool__t *object_pool); + +/* Return the number of object instances (used or unused) in OBJECT_POOL. + */ +unsigned +svn_object_pool__count(svn_object_pool__t *object_pool); + +/* In OBJECT_POOL, look for an available object by KEY and return a + * reference to it in *OBJECT. If none can be found, *OBJECT will be NULL. + * BATON will be passed to OBJECT_POOL's getter function. The reference + * will be returned when *RESULT_POOL gets cleaned up or destroyed. + */ +svn_error_t * +svn_object_pool__lookup(void **object, + svn_object_pool__t *object_pool, + svn_membuf_t *key, + void *baton, + apr_pool_t *result_pool); + +/* Store the wrapped object WRAPPER under KEY in OBJECT_POOL and return + * a reference to the object in *OBJECT (just like lookup). + * + * The object must have been created in WRAPPER_POOL and the latter must + * be a sub-pool of OBJECT_POOL's root POOL (see #svn_object_pool__pool). + * + * BATON will be passed to OBJECT_POOL's setter and getter functions. + * The reference will be returned when *RESULT_POOL gets cleaned up or + * destroyed. + */ +svn_error_t * +svn_object_pool__insert(void **object, + svn_object_pool__t *object_pool, + const svn_membuf_t *key, + void *wrapper, + void *baton, + apr_pool_t *wrapper_pool, + apr_pool_t *result_pool); + +#endif /* SVN_OBJECT_POOL_H */ diff --git a/subversion/include/private/svn_opt_private.h b/subversion/include/private/svn_opt_private.h index 6ae67a5..89e7227 100644 --- a/subversion/include/private/svn_opt_private.h +++ b/subversion/include/private/svn_opt_private.h @@ -46,10 +46,6 @@ extern "C" { * UTF8_TARGET need not be canonical. *TRUE_TARGET will not be canonical * unless UTF8_TARGET is. * - * It is an error if *TRUE_TARGET results in the empty string after the - * split, which happens in case UTF8_TARGET has a leading '@' character - * with no additional '@' characters to escape the first '@'. - * * Note that *PEG_REVISION will still contain the '@' symbol as the first * character if a peg revision was found. If a trailing '@' symbol was * used to escape other '@' characters in UTF8_TARGET, *PEG_REVISION will diff --git a/subversion/include/private/svn_packed_data.h b/subversion/include/private/svn_packed_data.h new file mode 100644 index 0000000..6faf0dd --- /dev/null +++ b/subversion/include/private/svn_packed_data.h @@ -0,0 +1,255 @@ +/* packed_data.h : Interface to the packed binary stream data structure + * + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + */ + +#ifndef SVN_PACKED_DATA_H +#define SVN_PACKED_DATA_H + +#include "svn_string.h" +#include "svn_io.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* This API provides Yet Another Serialization Framework. + * + * It is geared towards efficiently encoding collections of structured + * binary data (e.g. an array of noderev objects). The basic idea is to + * transform them into hierarchies of streams with each stream usually + * corresponding to a single attribute in the original data structures. + * The user is free model the mapping structure <-> streams mapping as she + * sees fit. + * + * With all data inside the same (sub-)stream carrying similar attribute + * values, the whole stream lends itself to data compression. Strings / + * plain byte sequences will be stored as is. Numbers use a 7b/8b encoding + * scheme to eliminate leading zeros. Because values are often dependent + * (increasing offsets, roughly similar revision number, etc.), streams + * can be configured as storing (hopefully shorter) deltas instead of the + * original value. + * + * Two stream types are provided: integer and byte streams. While the + * first store 64 bit integers only and can be configured to assume + * signed and / or deltifyable data, the second will store arbitrary + * byte sequences including their length. At the root level, you may + * create an arbitrary number of integer and byte streams. Any stream + * may have an arbitrary number of sub-streams of the same kind. You + * should create the full stream hierarchy before writing any data to it. + * + * As a convenience, when an integer stream has sub-streams, you may write + * to the parent stream instead of all sub-streams individually and the + * values will be passed down automatically in a round-robin fashion. + * Reading from the parent stream is similarly supported. + * + * When all data has been added to the stream, it can be written to an + * ordinary svn_stream_t. First, we write a description of the stream + * structure (types, sub-streams, sizes and configurations) followed by + * zlib compressed stream content. For each top-level stream, all sub- + * stream data will be concatenated and then compressed as a single block. + * To maximize the effect of this, make sure all data in that stream + * hierarchy has a similar value distribution. + * + * Reading data starts with an svn_stream_t and automatically recreates + * the stream hierarchies. You only need to extract data from it in the + * same order as you wrote it. + * + * Although not enforced programmatically, you may either only write to a + * stream hierarchy or only read from it but you cannot do both on the + * same data structure. + */ + + + +/* We pack / unpack integers en block to minimize calling and setup overhead. + * This is the number of integers we put into a buffer before writing them + * them to / after reading them from the 7b/8b stream. Under 64 bits, this + * value creates a 128 byte data structure (14 + 2 integers, 8 bytes each). + */ +#define SVN__PACKED_DATA_BUFFER_SIZE 14 + + +/* Data types. */ + +/* Opaque type for the root object. + */ +typedef struct svn_packed__data_root_t svn_packed__data_root_t; + +/* Opaque type for byte streams. + */ +typedef struct svn_packed__byte_stream_t svn_packed__byte_stream_t; + +/* Semi-opaque type for integer streams. We expose the unpacked buffer + * to allow for replacing svn_packed__add_uint and friends by macros. + */ +typedef struct svn_packed__int_stream_t +{ + /* pointer to the remainder of the data structure */ + void *private_data; + + /* number of value entries in BUFFER */ + apr_size_t buffer_used; + + /* unpacked integers (either yet to be packed or pre-fetched from the + * packed buffers). Only the first BUFFER_USED entries are valid. */ + apr_uint64_t buffer[SVN__PACKED_DATA_BUFFER_SIZE]; +} svn_packed__int_stream_t; + + +/* Writing data. */ + +/* Return a new serialization root object, allocated in POOL. + */ +svn_packed__data_root_t * +svn_packed__data_create_root(apr_pool_t *pool); + +/* Create and return a new top-level integer stream in ROOT. If signed, + * negative numbers will be put into that stream, SIGNED_INTS should be + * TRUE as a more efficient encoding will be used in that case. Set + * DIFF to TRUE if you expect the difference between consecutive numbers + * to be much smaller (~100 times) than the actual numbers. + */ +svn_packed__int_stream_t * +svn_packed__create_int_stream(svn_packed__data_root_t *root, + svn_boolean_t diff, + svn_boolean_t signed_ints); + +/* Create and return a sub-stream to the existing integer stream PARENT. + * If signed, negative numbers will be put into that stream, SIGNED_INTS + * should be TRUE as a more efficient encoding will be used in that case. + * Set DIFF to TRUE if you expect the difference between consecutive numbers + * to be much smaller (~100 times) than the actual numbers. + */ +svn_packed__int_stream_t * +svn_packed__create_int_substream(svn_packed__int_stream_t *parent, + svn_boolean_t diff, + svn_boolean_t signed_ints); + +/* Create and return a new top-level byte sequence stream in ROOT. + */ +svn_packed__byte_stream_t * +svn_packed__create_bytes_stream(svn_packed__data_root_t *root); + +/* Write the unsigned integer VALUE to STEAM. + */ +void +svn_packed__add_uint(svn_packed__int_stream_t *stream, + apr_uint64_t value); + +/* Write the signed integer VALUE to STEAM. + */ +void +svn_packed__add_int(svn_packed__int_stream_t *stream, + apr_int64_t value); + +/* Write the sequence stating at DATA containing LEN bytes to STEAM. + */ +void +svn_packed__add_bytes(svn_packed__byte_stream_t *stream, + const char *data, + apr_size_t len); + +/* Write all contents of ROOT (including all sub-streams) to STREAM. + * Use SCRATCH_POOL for temporary allocations. + */ +svn_error_t * +svn_packed__data_write(svn_stream_t *stream, + svn_packed__data_root_t *root, + apr_pool_t *scratch_pool); + + +/* Reading data. */ + +/* Return the first integer stream in ROOT. Returns NULL in case there + * aren't any. + */ +svn_packed__int_stream_t * +svn_packed__first_int_stream(svn_packed__data_root_t *root); + +/* Return the first byte sequence stream in ROOT. Returns NULL in case + * there aren't any. + */ +svn_packed__byte_stream_t * +svn_packed__first_byte_stream(svn_packed__data_root_t *root); + +/* Return the next (sibling) integer stream to STREAM. Returns NULL in + * case there isn't any. + */ +svn_packed__int_stream_t * +svn_packed__next_int_stream(svn_packed__int_stream_t *stream); + +/* Return the next (sibling) byte sequence stream to STREAM. Returns NULL + * in case there isn't any. + */ +svn_packed__byte_stream_t * +svn_packed__next_byte_stream(svn_packed__byte_stream_t *stream); + +/* Return the first sub-stream of STREAM. Returns NULL in case there + * isn't any. + */ +svn_packed__int_stream_t * +svn_packed__first_int_substream(svn_packed__int_stream_t *stream); + +/* Return the number of integers left to read from STREAM. + */ +apr_size_t +svn_packed__int_count(svn_packed__int_stream_t *stream); + +/* Return the number of bytes left to read from STREAM. + */ +apr_size_t +svn_packed__byte_count(svn_packed__byte_stream_t *stream); + +/* Return the next number from STREAM as unsigned integer. Returns 0 when + * reading beyond the end of the stream. + */ +apr_uint64_t +svn_packed__get_uint(svn_packed__int_stream_t *stream); + +/* Return the next number from STREAM as signed integer. Returns 0 when + * reading beyond the end of the stream. + */ +apr_int64_t +svn_packed__get_int(svn_packed__int_stream_t *stream); + +/* Return the next byte sequence from STREAM and set *LEN to the length + * of that sequence. Sets *LEN to 0 when reading beyond the end of the + * stream. + */ +const char * +svn_packed__get_bytes(svn_packed__byte_stream_t *stream, + apr_size_t *len); + +/* Allocate a new packed data root in RESULT_POOL, read its structure and + * stream contents from STREAM and return it in *ROOT_P. Use SCRATCH_POOL + * for temporary allocations. + */ +svn_error_t * +svn_packed__data_read(svn_packed__data_root_t **root_p, + svn_stream_t *stream, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* SVN_PACKED_DATA_H */ diff --git a/subversion/include/private/svn_pseudo_md5.h b/subversion/include/private/svn_pseudo_md5.h deleted file mode 100644 index 34d5929..0000000 --- a/subversion/include/private/svn_pseudo_md5.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @copyright - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * ==================================================================== - * @endcopyright - * - * @file svn_pseudo_md5.h - * @brief Subversion hash sum calculation for runtime data (only) - */ - -#ifndef SVN_PSEUDO_MD5_H -#define SVN_PSEUDO_MD5_H - -#include <apr.h> /* for apr_uint32_t */ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -/** - * Calculates a hash sum for 15 bytes in @a x and returns it in @a digest. - * The most significant byte in @a x must be 0 (independent of being on a - * little or big endian machine). - * - * @note Use for runtime data hashing only. - * - * @note The output is NOT an MD5 digest shares has the same basic - * cryptographic properties. Collisions with proper MD5 on the same - * or other input data is equally unlikely as any MD5 collision. - */ -void svn__pseudo_md5_15(apr_uint32_t digest[4], - const apr_uint32_t x[4]); - -/** - * Calculates a hash sum for 31 bytes in @a x and returns it in @a digest. - * The most significant byte in @a x must be 0 (independent of being on a - * little or big endian machine). - * - * @note Use for runtime data hashing only. - * - * @note The output is NOT an MD5 digest shares has the same basic - * cryptographic properties. Collisions with proper MD5 on the same - * or other input data is equally unlikely as any MD5 collision. - */ -void svn__pseudo_md5_31(apr_uint32_t digest[4], - const apr_uint32_t x[8]); - -/** - * Calculates a hash sum for 63 bytes in @a x and returns it in @a digest. - * The most significant byte in @a x must be 0 (independent of being on a - * little or big endian machine). - * - * @note Use for runtime data hashing only. - * - * @note The output is NOT an MD5 digest shares has the same basic - * cryptographic properties. Collisions with proper MD5 on the same - * or other input data is equally unlikely as any MD5 collision. - */ -void svn__pseudo_md5_63(apr_uint32_t digest[4], - const apr_uint32_t x[16]); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* SVN_PSEUDO_MD5_H */ diff --git a/subversion/include/private/svn_ra_private.h b/subversion/include/private/svn_ra_private.h index accca3d..1afa071 100644 --- a/subversion/include/private/svn_ra_private.h +++ b/subversion/include/private/svn_ra_private.h @@ -39,6 +39,33 @@ extern "C" { #endif /* __cplusplus */ + + +/** + * Open a new ra session @a *new_session to the same repository as an existing + * ra session @a old_session, copying the callbacks, auth baton, etc. from the + * old session. This essentially limits the lifetime of the new, duplicated + * session to the lifetime of the old session. If the new session should + * outlive the new session, creating a new session using svn_ra_open4() is + * recommended. + * + * If @a session_url is not NULL, parent the new session at session_url. Note + * that @a session_url MUST BE in the same repository as @a old_session or an + * error will be returned. When @a session_url NULL the same session root + * will be used. + * + * Allocate @a new_session in @a result_pool. Perform temporary allocations + * in @a scratch_pool. + * + * @since New in 1.9. + */ +svn_error_t * +svn_ra__dup_session(svn_ra_session_t **new_session, + svn_ra_session_t *old_session, + const char *session_url, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + /* Equivalent to svn_ra__assert_capable_server() for SVN_RA_CAPABILITY_MERGEINFO. */ svn_error_t * diff --git a/subversion/include/private/svn_ra_svn_private.h b/subversion/include/private/svn_ra_svn_private.h index b4294d0..bc2fa45 100644 --- a/subversion/include/private/svn_ra_svn_private.h +++ b/subversion/include/private/svn_ra_svn_private.h @@ -43,6 +43,12 @@ svn_ra_svn__set_shim_callbacks(svn_ra_svn_conn_t *conn, svn_delta_shim_callbacks_t *shim_callbacks); /** + * Return the memory pool used to allocate @a conn. + */ +apr_pool_t * +svn_ra_svn__get_pool(svn_ra_svn_conn_t *conn); + +/** * @defgroup ra_svn_deprecated ra_svn low-level functions * @{ */ @@ -83,6 +89,15 @@ svn_ra_svn__write_word(svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *word); +/** Write a boolean over the net. + * + * Writes will be buffered until the next read or flush. + */ +svn_error_t * +svn_ra_svn__write_boolean(svn_ra_svn_conn_t *conn, + apr_pool_t *pool, + svn_boolean_t value); + /** Write a list of properties over the net. @a props is allowed to be NULL, * in which case an empty list will be written out. * @@ -186,6 +201,7 @@ svn_ra_svn__skip_leading_garbage(svn_ra_svn_conn_t *conn, w const char ** Word b svn_boolean_t * Word ("true" or "false") B apr_uint64_t * Word ("true" or "false") + 3 svn_tristate_t * Word ("true" or "false") l apr_array_header_t ** List ( Begin tuple ) End tuple @@ -196,14 +212,18 @@ svn_ra_svn__skip_leading_garbage(svn_ra_svn_conn_t *conn, * the end of the specification. So if @a fmt is "c?cc" and @a list * contains two elements, an error will result. * - * 'B' is similar to 'b', but may be used in the optional tuple specification. - * It returns TRUE, FALSE, or SVN_RA_SVN_UNSPECIFIED_NUMBER. + * '3' is similar to 'b', but may be used in the optional tuple specification. + * It returns #svn_tristate_true, #svn_tristate_false or #svn_tristate_unknown. + * + * 'B' is similar to '3', but it returns @c TRUE, @c FALSE, or + * #SVN_RA_SVN_UNSPECIFIED_NUMBER. 'B' is deprecated; new code should + * use '3' instead. * * If an optional part of a tuple contains no data, 'r' values will be - * set to @c SVN_INVALID_REVNUM, 'n' and 'B' values will be set to - * SVN_RA_SVN_UNSPECIFIED_NUMBER, and 's', 'c', 'w', and 'l' values - * will be set to @c NULL. 'b' may not appear inside an optional - * tuple specification; use 'B' instead. + * set to @c SVN_INVALID_REVNUM; 'n' and 'B' values will be set to + * #SVN_RA_SVN_UNSPECIFIED_NUMBER; 's', 'c', 'w', and 'l' values + * will be set to @c NULL; and '3' values will be set to #svn_tristate_unknown + * 'b' may not appear inside an optional tuple specification; use '3' instead. */ svn_error_t * svn_ra_svn__parse_tuple(const apr_array_header_t *list, @@ -236,6 +256,33 @@ svn_ra_svn__read_cmd_response(svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *fmt, ...); +/** Check the receive buffer and socket of @a conn whether there is some + * unprocessed incoming data without waiting for new data to come in. + * If data is found, set @a *has_command to TRUE. If the connection does + * not contain any more data and has been closed, set @a *terminated to + * TRUE. + */ +svn_error_t * +svn_ra_svn__has_command(svn_boolean_t *has_command, + svn_boolean_t *terminated, + svn_ra_svn_conn_t *conn, + apr_pool_t *pool); + +/** Accept a single command from @a conn and handle them according + * to @a cmd_hash. Command handlers will be passed @a conn, @a pool, + * the parameters of the command, and @a baton. @a *terminate will be + * set if either @a error_on_disconnect is FALSE and the connection got + * closed, or if the command being handled has the "terminate" flag set + * in the command table. + */ +svn_error_t * +svn_ra_svn__handle_command(svn_boolean_t *terminate, + apr_hash_t *cmd_hash, + void *baton, + svn_ra_svn_conn_t *conn, + svn_boolean_t error_on_disconnect, + apr_pool_t *pool); + /** Accept commands over the network and handle them according to @a * commands. Command handlers will be passed @a conn, a subpool of @a * pool (cleared after each command is handled), the parameters of the @@ -267,11 +314,13 @@ svn_ra_svn__write_cmd_response(svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *fmt, ...); -/** Write an unsuccessful command response over the network. */ +/** Write an unsuccessful command response over the network. + * + * @note This does not clear @a err. */ svn_error_t * svn_ra_svn__write_cmd_failure(svn_ra_svn_conn_t *conn, apr_pool_t *pool, - svn_error_t *err); + const svn_error_t *err); /** * @} @@ -563,7 +612,11 @@ svn_ra_svn__write_cmd_get_dated_rev(svn_ra_svn_conn_t *conn, /** Send a "change-rev-prop2" command over connection @a conn. * Use @a pool for allocations. * - * @see #svn_ra_change_rev_prop2 for a description. + * If @a dont_care is false then check that the old value matches + * @a old_value. If @a dont_care is true then do not check the old + * value; in this case @a old_value must be NULL. + * + * @see #svn_ra_change_rev_prop2 for the rest of the description. */ svn_error_t * svn_ra_svn__write_cmd_change_rev_prop2(svn_ra_svn_conn_t *conn, @@ -819,6 +872,77 @@ svn_ra_svn__write_cmd_finish_replay(svn_ra_svn_conn_t *conn, /** * @} */ + +/** + * @defgroup svn_send_data sending data structures over ra_svn + * @{ + */ + +/** Send a changed path (as part of transmitting a log entry) over connection + * @a conn. Use @a pool for allocations. + * + * @see svn_log_changed_path2_t for a description of the other parameters. + */ +svn_error_t * +svn_ra_svn__write_data_log_changed_path(svn_ra_svn_conn_t *conn, + apr_pool_t *pool, + const char *path, + char action, + const char *copyfrom_path, + svn_revnum_t copyfrom_rev, + svn_node_kind_t node_kind, + svn_boolean_t text_modified, + svn_boolean_t props_modified); + +/** Send a the details of a log entry (as part of transmitting a log entry + * and without revprops and changed paths) over connection @a conn. + * Use @a pool for allocations. + * + * @a author, @a date and @a message have been extracted and removed from + * the revprops to follow. @a has_children is taken directly from the + * #svn_log_entry_t struct. @a revision is too, except when it equals + * #SVN_INVALID_REVNUM. In that case, @a revision must be 0 and + * @a invalid_revnum be set to TRUE. @a revprop_count is the number of + * revprops that will follow in the revprops list. + */ +svn_error_t * +svn_ra_svn__write_data_log_entry(svn_ra_svn_conn_t *conn, + apr_pool_t *pool, + svn_revnum_t revision, + const svn_string_t *author, + const svn_string_t *date, + const svn_string_t *message, + svn_boolean_t has_children, + svn_boolean_t invalid_revnum, + unsigned revprop_count); + +/** + * @} + */ + +/** + * @defgroup svn_read_data reading data structures from ra_svn + * @{ + */ + +/** Take the data tuple ITEMS received over ra_svn and convert it to the + * a changed path (as part of receiving a log entry). + * + * @see svn_log_changed_path2_t for a description of the output parameters. + */ +svn_error_t * +svn_ra_svn__read_data_log_changed_entry(const apr_array_header_t *items, + svn_string_t **cpath, + const char **action, + const char **copy_path, + svn_revnum_t *copy_rev, + const char **kind_str, + apr_uint64_t *text_mods, + apr_uint64_t *prop_mods); +/** + * @} + */ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/subversion/include/private/svn_repos_private.h b/subversion/include/private/svn_repos_private.h index 09e4037..c5a232f 100644 --- a/subversion/include/private/svn_repos_private.h +++ b/subversion/include/private/svn_repos_private.h @@ -32,16 +32,30 @@ #include "svn_types.h" #include "svn_repos.h" #include "svn_editor.h" +#include "svn_config.h" + +#include "private/svn_string_private.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -/** Validate that property @a name is valid for use in a Subversion - * repository; return @c SVN_ERR_REPOS_BAD_ARGS if it isn't. For some - * "svn:" properties, also validate the @a value, and return - * @c SVN_ERR_BAD_PROPERTY_VALUE if it is not valid. +/** Validate that property @a name with @a value is valid (as an addition + * or edit or deletion) in a Subversion repository. Return an error if not. + * + * If @a value is NULL, return #SVN_NO_ERROR to indicate that any property + * may be deleted, even an invalid one. Otherwise, if the @a name is not + * of kind #svn_prop_regular_kind (see #svn_prop_kind_t), return + * #SVN_ERR_REPOS_BAD_ARGS. Otherwise, for some "svn:" properties, also + * perform some validations on the @a value (e.g., for such properties, + * typically the @a value must be in UTF-8 with LF linefeeds), and return + * #SVN_ERR_BAD_PROPERTY_VALUE if it is not valid. + * + * Validations may be added in future releases, for example, for + * newly-added #SVN_PROP_PREFIX properties. However, user-defined + * (non-#SVN_PROP_PREFIX) properties will never have their @a value + * validated in any way. * * Use @a pool for temporary allocations. * @@ -113,10 +127,260 @@ svn_repos__replay_ev2(svn_fs_root_t *root, void *authz_read_baton, apr_pool_t *scratch_pool); -/* A private addition to svn_repos_notify_warning_t. */ -#define svn_repos__notify_warning_invalid_mergeinfo \ - ((svn_repos_notify_warning_t)(-1)) +/* Given a PATH which might be a relative repo URL (^/), an absolute + * local repo URL (file://), an absolute path outside of the repo + * or a location in the Windows registry. + * + * Retrieve the configuration data that PATH points at and parse it into + * CFG_P allocated in POOL. + * + * If PATH cannot be parsed as a config file then an error is returned. The + * contents of CFG_P is then undefined. If MUST_EXIST is TRUE, a missing + * authz file is also an error. The CASE_SENSITIVE controls the lookup + * behavior for section and option names alike. + * + * REPOS_ROOT points at the root of the repos you are + * going to apply the authz against, can be NULL if you are sure that you + * don't have a repos relative URL in PATH. */ +svn_error_t * +svn_repos__retrieve_config(svn_config_t **cfg_p, + const char *path, + svn_boolean_t must_exist, + svn_boolean_t case_sensitive, + apr_pool_t *pool); + +/** + * @defgroup svn_config_pool Configuration object pool API + * @{ + */ + +/* Opaque thread-safe factory and container for configuration objects. + * + * Instances handed out are read-only and may be given to multiple callers + * from multiple threads. Configuration objects no longer referenced by + * any user may linger for a while before being cleaned up. + */ +typedef struct svn_repos__config_pool_t svn_repos__config_pool_t; + +/* Create a new configuration pool object with a lifetime determined by + * POOL and return it in *CONFIG_POOL. + * + * The THREAD_SAFE flag indicates whether the pool actually needs to be + * thread-safe and POOL must be also be thread-safe if this flag is set. + */ +svn_error_t * +svn_repos__config_pool_create(svn_repos__config_pool_t **config_pool, + svn_boolean_t thread_safe, + apr_pool_t *pool); +/* Set *CFG to a read-only reference to the current contents of the + * configuration specified by PATH. If the latter is a URL, we read the + * data from a local repository. CONFIG_POOL will store the configuration + * and make further callers use the same instance if the content matches. + * If KEY is not NULL, *KEY will be set to a unique ID - if available. + * + * If MUST_EXIST is TRUE, a missing config file is also an error, *CFG + * is otherwise simply NULL. The CASE_SENSITIVE controls the lookup + * behavior for section and option names alike. + * + * PREFERRED_REPOS is only used if it is not NULL and PATH is a URL. + * If it matches the URL, access the repository through this object + * instead of creating a new repo instance. Note that this might not + * return the latest content. + * + * POOL determines the minimum lifetime of *CFG (may remain cached after + * release) but must not exceed the lifetime of the pool provided to + * #svn_repos__config_pool_create. + */ +svn_error_t * +svn_repos__config_pool_get(svn_config_t **cfg, + svn_membuf_t **key, + svn_repos__config_pool_t *config_pool, + const char *path, + svn_boolean_t must_exist, + svn_boolean_t case_sensitive, + svn_repos_t *preferred_repos, + apr_pool_t *pool); + +/** @} */ + +/** + * @defgroup svn_authz_pool Authz object pool API + * @{ + */ + +/* Opaque thread-safe factory and container for authorization objects. + * + * Instances handed out are read-only and may be given to multiple callers + * from multiple threads. Authorization objects no longer referenced by + * any user may linger for a while before being cleaned up. + */ +typedef struct svn_repos__authz_pool_t svn_repos__authz_pool_t; + +/* Create a new authorization pool object with a lifetime determined by + * POOL and return it in *AUTHZ_POOL. CONFIG_POOL will be the common + * source for the configuration data underlying the authz objects and must + * remain valid at least until POOL cleanup. + * + * The THREAD_SAFE flag indicates whether the pool actually needs to be + * thread-safe and POOL must be also be thread-safe if this flag is set. + */ +svn_error_t * +svn_repos__authz_pool_create(svn_repos__authz_pool_t **authz_pool, + svn_repos__config_pool_t *config_pool, + svn_boolean_t thread_safe, + apr_pool_t *pool); + +/* Set *AUTHZ_P to a read-only reference to the current contents of the + * authorization specified by PATH and GROUPS_PATH. If these are URLs, + * we read the data from a local repository (see #svn_repos_authz_read2). + * AUTHZ_POOL will store the authz data and make further callers use the + * same instance if the content matches. + * + * If MUST_EXIST is TRUE, a missing config file is also an error, *AUTHZ_P + * is otherwise simply NULL. + * + * PREFERRED_REPOS is only used if it is not NULL and PATH is a URL. + * If it matches the URL, access the repository through this object + * instead of creating a new repo instance. Note that this might not + * return the latest content. + * + * POOL determines the minimum lifetime of *AUTHZ_P (may remain cached + * after release) but must not exceed the lifetime of the pool provided to + * svn_repos__authz_pool_create. + */ +svn_error_t * +svn_repos__authz_pool_get(svn_authz_t **authz_p, + svn_repos__authz_pool_t *authz_pool, + const char *path, + const char *groups_path, + svn_boolean_t must_exist, + svn_repos_t *preferred_repos, + apr_pool_t *pool); + +/** @} */ + +/* Adjust mergeinfo paths and revisions in ways that are useful when loading + * a dump stream. + * + * Set *NEW_VALUE_P to an adjusted version of the mergeinfo property value + * supplied in OLD_VALUE, with the following adjustments. + * + * - Normalize line endings: if all CRLF, change to LF; but error if + * mixed. If this normalization is performed, send a notification type + * svn_repos_notify_load_normalized_mergeinfo to NOTIFY_FUNC/NOTIFY_BATON. + * + * - Prefix all the merge source paths with PARENT_DIR, if not null. + * + * - Adjust any mergeinfo revisions not older than OLDEST_DUMPSTREAM_REV + * by using REV_MAP which maps (svn_revnum_t) old rev to (svn_revnum_t) + * new rev. + * + * - Adjust any mergeinfo revisions older than OLDEST_DUMPSTREAM_REV by + * (-OLDER_REVS_OFFSET), dropping any revisions that become <= 0. + * + * Allocate *NEW_VALUE_P in RESULT_POOL. + */ +svn_error_t * +svn_repos__adjust_mergeinfo_property(svn_string_t **new_value_p, + const svn_string_t *old_value, + const char *parent_dir, + apr_hash_t *rev_map, + svn_revnum_t oldest_dumpstream_rev, + apr_int32_t older_revs_offset, + svn_repos_notify_func_t notify_func, + void *notify_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/* A (nearly) opaque representation of an ordered list of header lines. + */ +typedef struct apr_array_header_t svn_repos__dumpfile_headers_t; + +/* Create an empty set of headers. + */ +svn_repos__dumpfile_headers_t * +svn_repos__dumpfile_headers_create(apr_pool_t *pool); + +/* Push the header (KEY, VAL) onto HEADERS. + * + * Duplicate the key and value into HEADERS's pool. + */ +void +svn_repos__dumpfile_header_push(svn_repos__dumpfile_headers_t *headers, + const char *key, + const char *val); + +/* Push the header (KEY, val = VAL_FMT ...) onto HEADERS. + * + * Duplicate the key and value into HEADERS's pool. + */ +void +svn_repos__dumpfile_header_pushf(svn_repos__dumpfile_headers_t *headers, + const char *key, + const char *val_fmt, + ...) + __attribute__((format(printf, 3, 4))); + +/* Write to STREAM the headers in HEADERS followed by a blank line. + */ +svn_error_t * +svn_repos__dump_headers(svn_stream_t *stream, + svn_repos__dumpfile_headers_t *headers, + apr_pool_t *scratch_pool); + +/* Write a revision record to DUMP_STREAM for revision REVISION with revision + * properies REVPROPS, creating appropriate headers. + * + * Include all of the headers in EXTRA_HEADERS (if non-null), ignoring + * the revision number header and the three content length headers (which + * will be recreated as needed). EXTRA_HEADERS maps (char *) key to + * (char *) value. + * + * REVPROPS maps (char *) key to (svn_string_t *) value. + * + * Iff PROPS_SECTION_ALWAYS is true, include a prop content section (and + * corresponding header) even when REVPROPS is empty. This option exists + * to support a historical difference between svndumpfilter and svnadmin + * dump. + * + * Finally write another blank line. + */ +svn_error_t * +svn_repos__dump_revision_record(svn_stream_t *dump_stream, + svn_revnum_t revision, + apr_hash_t *extra_headers, + apr_hash_t *revprops, + svn_boolean_t props_section_always, + apr_pool_t *scratch_pool); + +/* Output node headers and props. + * + * Output HEADERS, content length headers, blank line, and + * then PROPS_STR (if non-null) to DUMP_STREAM. + * + * HEADERS is an array of headers as struct {const char *key, *val;}. + * Write them all in the given order. + * + * PROPS_STR is the property content block, including a terminating + * 'PROPS_END\n' line. Iff PROPS_STR is non-null, write a + * Prop-content-length header and the prop content block. + * + * Iff HAS_TEXT is true, write a Text-content length, using the value + * TEXT_CONTENT_LENGTH. + * + * Write a Content-length header, its value being the sum of the + * Prop- and Text- content length headers, if props and/or text are present + * or if CONTENT_LENGTH_ALWAYS is true. + */ +svn_error_t * +svn_repos__dump_node_record(svn_stream_t *dump_stream, + svn_repos__dumpfile_headers_t *headers, + svn_stringbuf_t *props_str, + svn_boolean_t has_text, + svn_filesize_t text_content_length, + svn_boolean_t content_length_always, + apr_pool_t *scratch_pool); #ifdef __cplusplus } diff --git a/subversion/include/private/svn_sorts_private.h b/subversion/include/private/svn_sorts_private.h new file mode 100644 index 0000000..c358513 --- /dev/null +++ b/subversion/include/private/svn_sorts_private.h @@ -0,0 +1,227 @@ +/** + * @copyright + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + * @endcopyright + * + * @file svn_sorts_private.h + * @brief all sorts of sorts. + */ + + +#ifndef SVN_SORTS_PRIVATE_H +#define SVN_SORTS_PRIVATE_H + +#include "../svn_sorts.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + + +/** This structure is used to hold a key/value from a hash table. + * @note Private. For use by Subversion's own code only. See issue #1644. + */ +struct svn_sort__item_t { + /** pointer to the key */ + const void *key; + + /** size of the key */ + apr_ssize_t klen; + + /** pointer to the value */ + void *value; +}; + +/** Sort @a ht according to its keys, return an @c apr_array_header_t + * containing @c svn_sort__item_t structures holding those keys and values + * (i.e. for each @c svn_sort__item_t @a item in the returned array, + * @a item->key and @a item->size are the hash key, and @a item->value points to + * the hash value). + * + * Storage is shared with the original hash, not copied. + * + * @a comparison_func should take two @c svn_sort__item_t's and return an + * integer greater than, equal to, or less than 0, according as the first item + * is greater than, equal to, or less than the second. + * + * @note Private. For use by Subversion's own code only. See issue #1644. + * + * @note This function and the @c svn_sort__item_t should go over to APR. + */ +apr_array_header_t * +svn_sort__hash(apr_hash_t *ht, + int (*comparison_func)(const svn_sort__item_t *, + const svn_sort__item_t *), + apr_pool_t *pool); + +/* Sort APR array @a array using ordering defined by @a comparison_func. + * @a comparison_func is defined as for the C stdlib function qsort(). + */ +void +svn_sort__array(apr_array_header_t *array, + int (*comparison_func)(const void *, + const void *)); + +/* Return the lowest index at which the element @a *key should be inserted into + * the array @a array, according to the ordering defined by @a compare_func. + * The array must already be sorted in the ordering defined by @a compare_func. + * @a compare_func is defined as for the C stdlib function bsearch(); the + * @a key will always passed to it as the second parameter. + * + * @note Private. For use by Subversion's own code only. + */ +int +svn_sort__bsearch_lower_bound(const apr_array_header_t *array, + const void *key, + int (*compare_func)(const void *, const void *)); + +/* Find the lowest index at which the element @a *key should be inserted into + * the array @a array, according to the ordering defined by @a compare_func. + * The array must already be sorted in the ordering defined by @a compare_func. + * @a compare_func is defined as for the C stdlib function bsearch(); the + * @a key will always passed to it as the second parameter. + * + * Returns a reference to the array element at the insertion location if + * that matches @a key and return NULL otherwise. If you call this function + * multiple times for the same array and expect the results to often be + * consecutive array elements, provide @a hint. It should be initialized + * with -1 for the first call and receives the array index if the returned + * element. If the return value is NULL, @a *hint is the location where + * the respective key would be inserted. + * + * @note Private. For use by Subversion's own code only. + */ +void * +svn_sort__array_lookup(const apr_array_header_t *array, + const void *key, + int *hint, + int (*compare_func)(const void *, const void *)); + + +/* Insert a shallow copy of @a *new_element into the array @a array at the index + * @a insert_index, growing the array and shuffling existing elements along to + * make room. + * + * @note Private. For use by Subversion's own code only. + */ +void +svn_sort__array_insert(apr_array_header_t *array, + const void *new_element, + int insert_index); + + +/* Remove @a elements_to_delete elements starting at @a delete_index from the + * array @a arr. If @a delete_index is not a valid element of @a arr, + * @a elements_to_delete is not greater than zero, or + * @a delete_index + @a elements_to_delete is greater than @a arr->nelts, + * then do nothing. + * + * @note Private. For use by Subversion's own code only. + */ +void +svn_sort__array_delete(apr_array_header_t *arr, + int delete_index, + int elements_to_delete); + +/* Reverse the order of elements in @a array, in place. + * + * @note Private. For use by Subversion's own code only. + */ +void +svn_sort__array_reverse(apr_array_header_t *array, + apr_pool_t *scratch_pool); + +/** Priority queues. + * + * @defgroup svn_priority_queue__t Priority Queues + * @{ + */ + +/** + * We implement priority queues on top of existing ELEMENTS arrays. They + * provide us with memory management and very basic element type information. + * + * The extraction order is being defined by a comparison function similar + * to the ones used with qsort. The first element in the queue is always + * on with COMPARISON_FUNC(first,element) <= 0, for all elements in the + * queue. + */ + +/** + * Opaque data type for priority queues. + */ +typedef struct svn_priority_queue__t svn_priority_queue__t; + +/** + * Return a priority queue containing all provided @a elements and prioritize + * them according to @a compare_func. + * + * @note The priority queue will use the existing @a elements array for data + * storage. So, you must not manipulate that array while using the queue. + * Also, the lifetime of the queue is bound to that of the array. + */ +svn_priority_queue__t * +svn_priority_queue__create(apr_array_header_t *elements, + int (*compare_func)(const void *, const void *)); + +/** + * Returns the number of elements in the @a queue. + */ +apr_size_t +svn_priority_queue__size(svn_priority_queue__t *queue); + +/** + * Returns a reference to the first element in the @a queue. The queue + * contents remains unchanged. If the @a queue is empty, #NULL will be + * returned. + */ +void * +svn_priority_queue__peek(svn_priority_queue__t *queue); + +/** + * Notify the @a queue after modifying the first item as returned by + * #svn_priority_queue__peek. + */ +void +svn_priority_queue__update(svn_priority_queue__t *queue); + +/** + * Remove the first element from the @a queue. This is a no-op for empty + * queues. + */ +void +svn_priority_queue__pop(svn_priority_queue__t *queue); + +/** + * Append the new @a element to the @a queue. @a element must neither be + * #NULL nor the first element as returned by #svn_priority_queue__peek. + */ +void +svn_priority_queue__push(svn_priority_queue__t *queue, const void *element); + +/** @} */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* SVN_SORTS_PRIVATE_H */ diff --git a/subversion/include/private/svn_sqlite.h b/subversion/include/private/svn_sqlite.h index 4c03e19..4c6cb97 100644 --- a/subversion/include/private/svn_sqlite.h +++ b/subversion/include/private/svn_sqlite.h @@ -63,7 +63,7 @@ typedef enum svn_sqlite__mode_e { typedef svn_error_t *(*svn_sqlite__func_t)(svn_sqlite__context_t *sctx, int argc, svn_sqlite__value_t *values[], - apr_pool_t *scatch_pool); + void *baton); /* Step the given statement; if it returns SQLITE_DONE, reset the statement. @@ -117,12 +117,16 @@ svn_sqlite__read_schema_version(int *version, STATEMENTS itself may be NULL, in which case it has no impact. See svn_sqlite__get_statement() for how these strings are used. + TIMEOUT defines the SQLite busy timeout, values <= 0 cause a Subversion + default to be used. + The statements will be finalized and the SQLite database will be closed when RESULT_POOL is cleaned up. */ svn_error_t * -svn_sqlite__open(svn_sqlite__db_t **db, const char *repos_path, +svn_sqlite__open(svn_sqlite__db_t **db, const char *path, svn_sqlite__mode_t mode, const char * const statements[], int latest_schema, const char * const *upgrade_sql, + apr_int32_t timeout, apr_pool_t *result_pool, apr_pool_t *scratch_pool); /* Explicitly close the connection in DB. */ @@ -130,11 +134,16 @@ svn_error_t * svn_sqlite__close(svn_sqlite__db_t *db); /* Add a custom function to be used with this database connection. The data - in BATON should live at least as long as the connection in DB. */ + in BATON should live at least as long as the connection in DB. + + Pass TRUE if the result of the function is constant within a statement with + a specific set of argument values and FALSE if not (or when in doubt). When + TRUE newer Sqlite versions use this knowledge for query optimizations. */ svn_error_t * svn_sqlite__create_scalar_function(svn_sqlite__db_t *db, const char *func_name, int argc, + svn_boolean_t deterministic, svn_sqlite__func_t func, void *baton); @@ -345,6 +354,11 @@ svn_sqlite__column_is_null(svn_sqlite__stmt_t *stmt, int column); int svn_sqlite__column_bytes(svn_sqlite__stmt_t *stmt, int column); +/* When Subversion is compiled in maintainer mode: enables the sqlite error + logging to SVN_DBG_OUTPUT. */ +void +svn_sqlite__dbg_enable_errorlog(void); + /* --------------------------------------------------------------------- */ @@ -372,6 +386,9 @@ svn_sqlite__result_null(svn_sqlite__context_t *sctx); void svn_sqlite__result_int64(svn_sqlite__context_t *sctx, apr_int64_t val); +void +svn_sqlite__result_error(svn_sqlite__context_t *sctx, const char *msg, int num); + /* --------------------------------------------------------------------- */ @@ -522,7 +539,7 @@ svn_sqlite__with_immediate_transaction(svn_sqlite__db_t *db, SCRATCH_POOL will be passed to the callback (NULL is valid). ### Since we now require SQLite >= 3.6.18, this function has the effect of - always behaving like a defered transaction. Can it be combined with + always behaving like a deferred transaction. Can it be combined with svn_sqlite__with_transaction()? */ svn_error_t * @@ -538,6 +555,9 @@ svn_sqlite__hotcopy(const char *src_path, const char *dst_path, apr_pool_t *scratch_pool); +/* Backported version of SVN_ERR_SQLITE_ROLLBACK_FAILED. */ +#define SVN_SQLITE__ERR_ROLLBACK_FAILED (SVN_ERR_MISC_CATEGORY_START + 44) + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/subversion/include/private/svn_string_private.h b/subversion/include/private/svn_string_private.h index 8579f4d..2f16273 100644 --- a/subversion/include/private/svn_string_private.h +++ b/subversion/include/private/svn_string_private.h @@ -131,10 +131,13 @@ svn_membuf__nzero(svn_membuf_t *membuf, apr_size_t size); svn_string_t * svn_stringbuf__morph_into_string(svn_stringbuf_t *strbuf); -/** Like apr_strtoff but provided here for backward compatibility - * with APR 0.9 */ -apr_status_t -svn__strtoff(apr_off_t *offset, const char *buf, char **end, int base); +/** Like strtoul but with a fixed base of 10 and without overflow checks. + * This allows the compiler to generate massively faster (4x on 64bit LINUX) + * code. Overflow checks may be added on the caller side where you might + * want to test for a more specific value range anyway. + */ +unsigned long +svn__strtoul(const char *buffer, const char **end); /** Number of chars needed to represent signed (19 places + sign + NUL) or * unsigned (20 places + NUL) integers as strings. @@ -156,22 +159,55 @@ apr_size_t svn__i64toa(char * dest, apr_int64_t number); /** Returns a decimal string for @a number allocated in @a pool. Put in - * the @a seperator at each third place. + * the @a separator at each third place. */ char * -svn__ui64toa_sep(apr_uint64_t number, char seperator, apr_pool_t *pool); +svn__ui64toa_sep(apr_uint64_t number, char separator, apr_pool_t *pool); /** Returns a decimal string for @a number allocated in @a pool. Put in - * the @a seperator at each third place. + * the @a separator at each third place. */ char * -svn__i64toa_sep(apr_int64_t number, char seperator, apr_pool_t *pool); +svn__i64toa_sep(apr_int64_t number, char separator, apr_pool_t *pool); + + +/** Writes the @a number as base36-encoded string into @a dest. The latter + * must provide space for at least #SVN_INT64_BUFFER_SIZE characters. + * Returns the number chars written excluding the terminating NUL. + * + * @note The actual maximum buffer requirement is much shorter than + * #SVN_INT64_BUFFER_SIZE but introducing yet another constant is only + * marginally useful and may open the door to security issues when e.g. + * switching between base10 and base36 encoding. + */ +apr_size_t +svn__ui64tobase36(char *dest, apr_uint64_t number); + +/** Returns the value of the base36 encoded unsigned integer starting at + * @a source. If @a next is not NULL, @a *next will be set to the first + * position after the integer. + * + * The data in @a source will be considered part of the number to parse + * as long as the characters are within the base36 range. If there are + * no such characters to begin with, 0 is returned. Inputs with more than + * #SVN_INT64_BUFFER_SIZE digits will not be fully parsed, i.e. the value + * of @a *next as well as the return value are undefined. + */ +apr_uint64_t +svn__base36toui64(const char **next, const char *source); + +/** + * The upper limit of the similarity range returned by + * svn_cstring__similarity() and svn_string__similarity(). + */ +#define SVN_STRING__SIM_RANGE_MAX 1000000 /** * Computes the similarity score of STRA and STRB. Returns the ratio * of the length of their longest common subsequence and the average - * length of the strings, normalized to the range [0..1000]. - * The result is equivalent to Python's + * length of the strings, normalized to the range + * [0..SVN_STRING__SIM_RANGE_MAX]. The result is equivalent to + * Python's * * difflib.SequenceMatcher.ratio * @@ -196,7 +232,7 @@ svn__i64toa_sep(apr_int64_t number, char seperator, apr_pool_t *pool); * has O(strlen(STRA) * strlen(STRB)) worst-case performance, * so do keep a rein on your enthusiasm. */ -unsigned int +apr_size_t svn_cstring__similarity(const char *stra, const char *strb, svn_membuf_t *buffer, apr_size_t *rlcs); @@ -204,12 +240,82 @@ svn_cstring__similarity(const char *stra, const char *strb, * Like svn_cstring__similarity, but accepts svn_string_t's instead * of NUL-terminated character strings. */ -unsigned int +apr_size_t svn_string__similarity(const svn_string_t *stringa, const svn_string_t *stringb, svn_membuf_t *buffer, apr_size_t *rlcs); +/* Return the lowest position at which A and B differ. If no difference + * can be found in the first MAX_LEN characters, MAX_LEN will be returned. + */ +apr_size_t +svn_cstring__match_length(const char *a, + const char *b, + apr_size_t max_len); + +/* Return the number of bytes before A and B that don't differ. If no + * difference can be found in the first MAX_LEN characters, MAX_LEN will + * be returned. Please note that A-MAX_LEN and B-MAX_LEN must both be + * valid addresses. + */ +apr_size_t +svn_cstring__reverse_match_length(const char *a, + const char *b, + apr_size_t max_len); + +/** @} */ + +/** Prefix trees. + * + * Prefix trees allow for a space-efficient representation of a set of path- + * like strings, i.e. those that share common prefixes. Any given string + * value will be stored only once, i.e. two strings stored in the same tree + * are equal if and only if the point to the same #svn_prefix_string__t. + * + * @defgroup svn_prefix_string Strings in prefix trees. +* @{ + */ + +/** + * Opaque data type for prefix-tree-based strings. + */ +typedef struct svn_prefix_string__t svn_prefix_string__t; + +/** + * Opaque data type representing a prefix tree + */ +typedef struct svn_prefix_tree__t svn_prefix_tree__t; + +/** + * Return a new prefix tree allocated in @a pool. + */ +svn_prefix_tree__t * +svn_prefix_tree__create(apr_pool_t *pool); + +/** + * Return a string with the value @a s stored in @a tree. If no such string + * exists yet, add it automatically. + */ +svn_prefix_string__t * +svn_prefix_string__create(svn_prefix_tree__t *tree, + const char *s); + +/** + * Return the contents of @a s as a new string object allocated in @a pool. + */ +svn_string_t * +svn_prefix_string__expand(const svn_prefix_string__t *s, + apr_pool_t *pool); + +/** + * Compare the two strings @a lhs and @a rhs that must be part of the same + * tree. + */ +int +svn_prefix_string__compare(const svn_prefix_string__t *lhs, + const svn_prefix_string__t *rhs); + /** @} */ /** @} */ diff --git a/subversion/include/private/svn_subr_private.h b/subversion/include/private/svn_subr_private.h index 30fbbf2..095d71c 100644 --- a/subversion/include/private/svn_subr_private.h +++ b/subversion/include/private/svn_subr_private.h @@ -26,7 +26,7 @@ #include "svn_types.h" #include "svn_io.h" -#include "svn_version.h" +#include "svn_config.h" #ifdef __cplusplus @@ -95,11 +95,32 @@ svn_spillbuf__create(apr_size_t blocksize, apr_size_t maxsize, apr_pool_t *result_pool); +/* Create a spill buffer, with extra parameters. */ +svn_spillbuf_t * +svn_spillbuf__create_extended(apr_size_t blocksize, + apr_size_t maxsize, + svn_boolean_t delete_on_close, + svn_boolean_t spill_all_contents, + const char* dirpath, + apr_pool_t *result_pool); /* Determine how much content is stored in the spill buffer. */ svn_filesize_t svn_spillbuf__get_size(const svn_spillbuf_t *buf); +/* Determine how much content the spill buffer is caching in memory. */ +svn_filesize_t +svn_spillbuf__get_memory_size(const svn_spillbuf_t *buf); + +/* Retrieve the name of the spill file. The returned value can be NULL + if the file has not been created yet. */ +const char * +svn_spillbuf__get_filename(const svn_spillbuf_t *buf); + +/* Retrieve the handle of the spill file. The returned value can be + NULL if the file has not been created yet. */ +apr_file_t * +svn_spillbuf__get_file(const svn_spillbuf_t *buf); /* Write some data into the spill buffer. */ svn_error_t * @@ -153,13 +174,13 @@ svn_spillbuf__process(svn_boolean_t *exhausted, typedef struct svn_spillbuf_reader_t svn_spillbuf_reader_t; -/* Create a spill-buffer and a reader for it. */ +/* Create a spill-buffer and a reader for it, using the same arguments as + svn_spillbuf__create(). */ svn_spillbuf_reader_t * svn_spillbuf__reader_create(apr_size_t blocksize, apr_size_t maxsize, apr_pool_t *result_pool); - /* Read @a len bytes from @a reader into @a data. The number of bytes actually read is stored in @a amt. If the content is exhausted, then @a amt is set to zero. It will always be non-zero if the spill-buffer @@ -191,17 +212,23 @@ svn_spillbuf__reader_write(svn_spillbuf_reader_t *reader, apr_pool_t *scratch_pool); -/* Return a stream built on top of a spillbuf, using the same arguments as - svn_spillbuf__create(). This stream can be used for reading and writing, - but implements the same basic sematics of a spillbuf for the underlying - storage. */ +/* Return a stream built on top of a spillbuf. + + This stream can be used for reading and writing, but implements the + same basic semantics of a spillbuf for the underlying storage. */ svn_stream_t * -svn_stream__from_spillbuf(apr_size_t blocksize, - apr_size_t maxsize, +svn_stream__from_spillbuf(svn_spillbuf_t *buf, apr_pool_t *result_pool); /** @} */ +/*----------------------------------------------------*/ + +/** + * @defgroup svn_checksum_private Checksumming helper APIs + * @{ + */ + /** * Internal function for creating a MD5 checksum from a binary digest. * @@ -221,6 +248,76 @@ svn_checksum_t * svn_checksum__from_digest_sha1(const unsigned char *digest, apr_pool_t *result_pool); +/** + * Internal function for creating a 32 bit FNV-1a checksum from a binary + * digest. + * + * @since New in 1.9 + */ +svn_checksum_t * +svn_checksum__from_digest_fnv1a_32(const unsigned char *digest, + apr_pool_t *result_pool); + +/** + * Internal function for creating a modified 32 bit FNV-1a checksum from + * a binary digest. + * + * @since New in 1.9 + */ +svn_checksum_t * +svn_checksum__from_digest_fnv1a_32x4(const unsigned char *digest, + apr_pool_t *result_pool); + + +/** + * Return a stream that calculates a checksum of type @a kind over all + * data written to the @a inner_stream. When the returned stream gets + * closed, write the checksum to @a *checksum. + * Allocate the result in @a pool. + * + * @note The stream returned only supports #svn_stream_write and + * #svn_stream_close. + */ +svn_stream_t * +svn_checksum__wrap_write_stream(svn_checksum_t **checksum, + svn_stream_t *inner_stream, + svn_checksum_kind_t kind, + apr_pool_t *pool); + +/** + * Return a stream that calculates a 32 bit modified FNV-1a checksum + * over all data written to the @a inner_stream and writes the digest + * to @a *digest when the returned stream gets closed. + * Allocate the stream in @a pool. + */ +svn_stream_t * +svn_checksum__wrap_write_stream_fnv1a_32x4(apr_uint32_t *digest, + svn_stream_t *inner_stream, + apr_pool_t *pool); + +/** + * Return a 32 bit FNV-1a checksum for the first @a len bytes in @a input. + * + * @since New in 1.9 + */ +apr_uint32_t +svn__fnv1a_32(const void *input, apr_size_t len); + +/** + * Return a 32 bit modified FNV-1a checksum for the first @a len bytes in + * @a input. + * + * @note This is a proprietary checksumming algorithm based FNV-1a with + * approximately the same strength. It is up to 4 times faster + * than plain FNV-1a for longer data blocks. + * + * @since New in 1.9 + */ +apr_uint32_t +svn__fnv1a_32x4(const void *input, apr_size_t len); + +/** @} */ + /** * @defgroup svn_hash_support Hash table serialization support @@ -285,6 +382,54 @@ svn_hash__make(apr_pool_t *pool); /** @} */ +/** + * @defgroup svn_hash_read Reading serialized hash tables + * @{ + */ + +/** Struct that represents a key value pair read from a serialized hash + * representation. There are special cases that can also be represented: + * a #NULL @a key signifies the end of the hash, a #NULL @a val for non- + * NULL keys is only possible in incremental mode describes a deletion. + * + * @since New in 1.9. + */ +typedef struct svn_hash__entry_t +{ + /** 0-terminated Key. #NULL if this contains no data at all because we + * encountered the end of the hash. */ + char *key; + + /** Length of @a key. Must be 0 if @a key is #NULL. */ + apr_size_t keylen; + + /** 0-terminated value stored with the key. If this is #NULL for a + * non-NULL @a key, then this means that the key shall be removed from + * the hash (only used in incremental mode). Must be #NULL if @a key is + * #NULL. */ + char *val; + + /** Length of @a val. Must be 0 if @a val is #NULL. */ + apr_size_t vallen; +} svn_hash__entry_t; + +/** Reads a single key-value pair from @a stream and returns it in the + * caller-provided @a *entry (members don't need to be pre-initialized). + * @a pool is used to allocate members of @a *entry and for tempoaries. + * + * @see #svn_hash_read2 for more details. + * + * @since New in 1.9. + */ +svn_error_t * +svn_hash__read_entry(svn_hash__entry_t *entry, + svn_stream_t *stream, + const char *terminator, + svn_boolean_t incremental, + apr_pool_t *pool); + +/** @} */ + /** @} */ @@ -332,20 +477,230 @@ svn_version__at_least(svn_version_t *version, int minor, int patch); -/** Like svn_ver_check_list(), but with a @a comparator parameter. - * Private backport of svn_ver_check_list2() from trunk. +/** @} */ + +/** + * @defgroup svn_compress Data (de-)compression API + * @{ + */ + +/* This is at least as big as the largest size of an integer that + svn__encode_uint() can generate; it is sufficient for creating buffers + for it to write into. This assumes that integers are at most 64 bits, + and so 10 bytes (with 7 bits of information each) are sufficient to + represent them. */ +#define SVN__MAX_ENCODED_UINT_LEN 10 + +/* Compression method parameters for svn__encode_uint. */ + +/* No compression (but a length prefix will still be added to the buffer) */ +#define SVN__COMPRESSION_NONE 0 + +/* Fastest, least effective compression method & level provided by zlib. */ +#define SVN__COMPRESSION_ZLIB_MIN 1 + +/* Default compression method & level provided by zlib. */ +#define SVN__COMPRESSION_ZLIB_DEFAULT 5 + +/* Slowest, best compression method & level provided by zlib. */ +#define SVN__COMPRESSION_ZLIB_MAX 9 + +/* Encode VAL into the buffer P using the variable-length 7b/8b unsigned + integer format. Return the incremented value of P after the + encoded bytes have been written. P must point to a buffer of size + at least SVN__MAX_ENCODED_UINT_LEN. + + This encoding uses the high bit of each byte as a continuation bit + and the other seven bits as data bits. High-order data bits are + encoded first, followed by lower-order bits, so the value can be + reconstructed by concatenating the data bits from left to right and + interpreting the result as a binary number. Examples (brackets + denote byte boundaries, spaces are for clarity only): + + 1 encodes as [0 0000001] + 33 encodes as [0 0100001] + 129 encodes as [1 0000001] [0 0000001] + 2000 encodes as [1 0001111] [0 1010000] +*/ +unsigned char * +svn__encode_uint(unsigned char *p, apr_uint64_t val); + +/* Decode an unsigned 7b/8b-encoded integer into *VAL and return a pointer + to the byte after the integer. The bytes to be decoded live in the + range [P..END-1]. If these bytes do not contain a whole encoded + integer, return NULL; in this case *VAL is undefined. + + See the comment for svn__encode_uint() earlier in this file for more + detail on the encoding format. */ +const unsigned char * +svn__decode_uint(apr_uint64_t *val, + const unsigned char *p, + const unsigned char *end); + +/* Get the data from IN, compress it according to the specified + * COMPRESSION_METHOD and write the result to OUT. + * SVN__COMPRESSION_NONE is valid for COMPRESSION_METHOD. + */ +svn_error_t * +svn__compress(svn_stringbuf_t *in, + svn_stringbuf_t *out, + int compression_method); + +/* Get the compressed data from IN, decompress it and write the result to + * OUT. Return an error if the decompressed size is larger than LIMIT. + */ +svn_error_t * +svn__decompress(svn_stringbuf_t *in, + svn_stringbuf_t *out, + apr_size_t limit); + +/** @} */ + +/** + * @defgroup svn_root_pools Recycle-able root pools API + * @{ + */ + +/* Opaque thread-safe container for unused / recylcleable root pools. + * + * Recyling root pools (actually, their allocators) circumvents a + * scalability bottleneck in the OS memory management when multi-threaded + * applications frequently create and destroy allocators. + */ +typedef struct svn_root_pools__t svn_root_pools__t; + +/* Create a new root pools container and return it in *POOLS. */ svn_error_t * -svn_ver__check_list2(const svn_version_t *my_version, - const svn_version_checklist_t *checklist, - svn_boolean_t (*comparator)(const svn_version_t *, - const svn_version_t *)); +svn_root_pools__create(svn_root_pools__t **pools); + +/* Return a currently unused pool from POOLS. If POOLS is empty, create a + * new root pool and return that. The pool returned is not thread-safe. + */ +apr_pool_t * +svn_root_pools__acquire_pool(svn_root_pools__t *pools); -/** To minimize merge churn in callers, alias the trunk name privately. */ -#define svn_ver_check_list2 svn_ver__check_list2 +/* Clear and release the given root POOL and put it back into POOLS. + * If that fails, destroy POOL. + */ +void +svn_root_pools__release_pool(apr_pool_t *pool, + svn_root_pools__t *pools); /** @} */ +/** + * @defgroup svn_config_private Private configuration handling API + * @{ + */ + +/* Future attempts to modify CFG will trigger an assertion. */ +void +svn_config__set_read_only(svn_config_t *cfg, + apr_pool_t *scratch_pool); + +/* Return TRUE, if CFG cannot be modified. */ +svn_boolean_t +svn_config__is_read_only(svn_config_t *cfg); + +/* Return TRUE, if OPTION in SECTION in CFG exists and does not require + * further expansion (due to either containing no placeholders or already + * having been expanded). */ +svn_boolean_t +svn_config__is_expanded(svn_config_t *cfg, + const char *section, + const char *option); + +/* Return a shallow copy of SCR in POOL. If SRC is read-only, different + * shallow copies may be used from different threads. + * + * Any single r/o svn_config_t or shallow copy is not thread-safe because + * it contains shared buffers for tempoary data. + */ +svn_config_t * +svn_config__shallow_copy(svn_config_t *src, + apr_pool_t *pool); + +/* Add / replace SECTION in TARGET with the same section from SOURCE by + * simply adding a reference to it. If TARGET is read-only, the sections + * list in target gets duplicated before the modification. + * + * This is an API tailored for use by the svn_repos__authz_pool_t API to + * prevent breach of encapsulation. + */ +void +svn_config__shallow_replace_section(svn_config_t *target, + svn_config_t *source, + const char *section); + +/* Allocate *CFG_HASH and populate it with default, empty, + * svn_config_t for the configuration categories (@c + * SVN_CONFIG_CATEGORY_SERVERS, @c SVN_CONFIG_CATEGORY_CONFIG, etc.). + * This returns a hash equivalent to svn_config_get_config when the + * config files are empty. + */ +svn_error_t * +svn_config__get_default_config(apr_hash_t **cfg_hash, + apr_pool_t *pool); + +/** @} */ + + +/** + * @defgroup svn_bit_array Packed bit array handling API + * @{ + */ + +/* This opaque data struct is an alternative to an INT->VOID hash. + * + * Technically, it is an automatically growing packed bit array. + * All indexes not previously set are implicitly 0 and setting it will + * grow the array as needed. + */ +typedef struct svn_bit_array__t svn_bit_array__t; + +/* Return a new bit array allocated in POOL. MAX is a mere hint for + * the initial size of the array in bits. + */ +svn_bit_array__t * +svn_bit_array__create(apr_size_t max, + apr_pool_t *pool); + +/* Set bit at index IDX in ARRAY to VALUE. If necessary, grow the + * underlying data buffer, i.e. any IDX is valid unless we run OOM. + */ +void +svn_bit_array__set(svn_bit_array__t *array, + apr_size_t idx, + svn_boolean_t value); + +/* Get the bit value at index IDX in ARRAY. Bits not previously accessed + * are implicitly 0 (or FALSE). That implies IDX can never be out-of-range. + */ +svn_boolean_t +svn_bit_array__get(svn_bit_array__t *array, + apr_size_t idx); + +/* Return the global pool used by the DSO loader, this may be NULL if + no DSOs have been loaded. */ +apr_pool_t * +svn_dso__pool(void); + +/** @} */ + + +/* Return the xml (expat) version we compiled against. */ +const char *svn_xml__compiled_version(void); + +/* Return the xml (expat) version we run against. */ +const char *svn_xml__runtime_version(void); + +/* Return the zlib version we compiled against. */ +const char *svn_zlib__compiled_version(void); + +/* Return the zlib version we run against. */ +const char *svn_zlib__runtime_version(void); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/subversion/include/private/svn_temp_serializer.h b/subversion/include/private/svn_temp_serializer.h index 7a007c3..dd2e047 100644 --- a/subversion/include/private/svn_temp_serializer.h +++ b/subversion/include/private/svn_temp_serializer.h @@ -143,6 +143,22 @@ void svn_temp_serializer__pop(svn_temp_serializer__context_t *context); /** + * Serialize a referenced sub-structure within the serialization + * @a context. @a source_struct must be a reference to the + * pointer in the original parent structure so that the correspondence in + * the serialized structure can be established. @a struct_size must match + * the result of @c sizeof() of the actual structure. + * + * This function is equivalent but more efficient than calling + * #svn_temp_serializer__push() immediately followed by + * #svn_temp_serializer__pop(). + */ +void +svn_temp_serializer__add_leaf(svn_temp_serializer__context_t *context, + const void * const * source_struct, + apr_size_t struct_size); + +/** * Serialize a string referenced from the current structure within the * serialization @a context. @a s must be a reference to the @c char* * pointer in the original structure so that the correspondence in the diff --git a/subversion/include/private/svn_utf_private.h b/subversion/include/private/svn_utf_private.h index 9f5a4ad..4584944 100644 --- a/subversion/include/private/svn_utf_private.h +++ b/subversion/include/private/svn_utf_private.h @@ -21,7 +21,7 @@ * @endcopyright * * @file svn_utf_private.h - * @brief UTF validation routines + * @brief UTF validation and normalization routines */ #ifndef SVN_UTF_PRIVATE_H @@ -31,6 +31,8 @@ #include <apr_pools.h> #include "svn_types.h" +#include "svn_string.h" +#include "svn_string_private.h" #ifdef __cplusplus extern "C" { @@ -71,6 +73,18 @@ svn_utf__last_valid(const char *src, apr_size_t len); const char * svn_utf__last_valid2(const char *src, apr_size_t len); +/* Copy LENGTH bytes of SRC, converting characters as follows: + - Pass characters from the ASCII subset to the result + - Strip all combining marks from the string + - Represent other valid Unicode chars as {U+XXXX} + - Replace invalid Unicode chars with {U?XXXX} + - Represent chars that are not valid UTF-8 as ?\XX + - Replace codes outside the Unicode range with a sequence of ?\XX + - Represent the null byte as \0 + Allocate the result in POOL. */ +const char * +svn_utf__fuzzy_escape(const char *src, apr_size_t length, apr_pool_t *pool); + const char * svn_utf__cstring_from_utf8_fuzzy(const char *src, apr_pool_t *pool, @@ -80,6 +94,166 @@ svn_utf__cstring_from_utf8_fuzzy(const char *src, apr_pool_t *)); +#if defined(WIN32) +/* On Windows: Convert the UTF-8 string SRC to UTF-16. + If PREFIX is not NULL, prepend it to the converted result. + The result, if not empty, will be allocated in RESULT_POOL. */ +svn_error_t * +svn_utf__win32_utf8_to_utf16(const WCHAR **result, + const char *src, + const WCHAR *prefix, + apr_pool_t *result_pool); + +/* On Windows: Convert the UTF-16 string SRC to UTF-8. + If PREFIX is not NULL, prepend it to the converted result. + The result, if not empty, will be allocated in RESULT_POOL. */ +svn_error_t * +svn_utf__win32_utf16_to_utf8(const char **result, + const WCHAR *src, + const char *prefix, + apr_pool_t *result_pool); +#endif /* WIN32*/ + + +/* A constant used for many length parameters in the utf8proc wrappers + * to indicate that the length of a string is unknonw. */ +#define SVN_UTF__UNKNOWN_LENGTH ((apr_size_t) -1) + + +/* Compare two UTF-8 strings, ignoring normalization, using buffers + * BUF1 and BUF2 for temporary storage. If either of LEN1 or LEN2 is + * SVN_UTF__UNKNOWN_LENGTH, assume the associated string is + * null-terminated; otherwise, consider the string only up to the + * given length. + * + * Return compare value in *RESULT. + */ +svn_error_t * +svn_utf__normcmp(int *result, + const char *str1, apr_size_t len1, + const char *str2, apr_size_t len2, + svn_membuf_t *buf1, svn_membuf_t *buf2); + +/* Normalize the UTF-8 string STR to form C, using BUF for temporary + * storage. If LEN is SVN_UTF__UNKNOWN_LENGTH, assume STR is + * null-terminated; otherwise, consider the string only up to the + * given length. + * + * Return the normalized string in *RESULT, which shares storage with + * BUF and is valid only until the next time BUF is modified. + * + * A returned error may indicate that STRING contains invalid UTF-8 or + * invalid Unicode codepoints. + */ +svn_error_t* +svn_utf__normalize(const char **result, + const char *str, apr_size_t len, + svn_membuf_t *buf); + +/* Check if STRING is a valid, NFC-normalized UTF-8 string. Note that + * a FALSE return value may indicate that STRING is not valid UTF-8 at + * all. + * + * Use SCRATCH_POOL for temporary allocations. + */ +svn_boolean_t +svn_utf__is_normalized(const char *string, apr_pool_t *scratch_pool); + +/* Encode an UCS-4 string to UTF-8, placing the result into BUFFER. + * While utf8proc does have a similar function, it does more checking + * and processing than we want here; this function does not attempt + * any normalizations but just encodes the individual code points. + * The encoded string will always be NUL-terminated. + * + * Return the length of the result (excluding the NUL terminator) in + * *result_length. + * + * A returned error indicates that a codepoint is invalid. + */ +svn_error_t * +svn_utf__encode_ucs4_string(svn_membuf_t *buffer, + const apr_int32_t *ucs4str, + apr_size_t length, + apr_size_t *result_length); + +/* Pattern matching similar to the the SQLite LIKE and GLOB + * operators. PATTERN, KEY and ESCAPE must all point to UTF-8 + * strings. Furthermore, ESCAPE, if provided, must be a character from + * the ASCII subset. + * + * If any of PATTERN_LEN, STRING_LEN or ESCAPE_LEN are + * SVN_UTF__UNKNOWN_LENGTH, assume the associated string is + * null-terminated; otherwise, consider the string only up to the + * given length. + * + * Use buffers PATTERN_BUF, STRING_BUF and TEMP_BUF for temporary storage. + * + * If SQL_LIKE is true, interpret PATTERN as a pattern used by the SQL + * LIKE operator and notice ESCAPE. Otherwise it's a Unix fileglob + * pattern, and ESCAPE must be NULL. + * + * Set *MATCH to the result of the comparison. +*/ +svn_error_t * +svn_utf__glob(svn_boolean_t *match, + const char *pattern, apr_size_t pattern_len, + const char *string, apr_size_t string_len, + const char *escape, apr_size_t escape_len, + svn_boolean_t sql_like, + svn_membuf_t *pattern_buf, + svn_membuf_t *string_buf, + svn_membuf_t *temp_buf); + +/* Return the compiled version of the wrapped utf8proc library. */ +const char * +svn_utf__utf8proc_compiled_version(void); + +/* Return the runtime version of the wrapped utf8proc library. */ +const char * +svn_utf__utf8proc_runtime_version(void); + +/* Convert an UTF-16 (or UCS-2) string to UTF-8, returning the pointer + * in RESULT. If BIG_ENDIAN is set, then UTF16STR is big-endian; + * otherwise, it's little-endian. + * + * If UTF16LEN is SVN_UTF__UNKNOWN_LENGTH, then UTF16STR must be + * terminated with a zero; otherwise, it is the number of 16-bit codes + * to convert, and the source string may contain NUL values. + * + * Allocate RESULT in RESULT_POOL and use SCRATCH_POOL for + * intermediate allocation. + * + * This function combines UTF-16 surrogate pairs into single code + * points, but will leave single lead or trail surrogates unchanged. + */ +svn_error_t * +svn_utf__utf16_to_utf8(const svn_string_t **result, + const apr_uint16_t *utf16str, + apr_size_t utf16len, + svn_boolean_t big_endian, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/* Convert an UTF-32 string to UTF-8, returning the pointer in + * RESULT. If BIG_ENDIAN is set, then UTF32STR is big-endian; + * otherwise, it's little-endian. + * + * If UTF32LEN is SVN_UTF__UNKNOWN_LENGTH, then UTF32STR must be + * terminated with a zero; otherwise, it is the number of 32-bit codes + * to convert, and the source string may contain NUL values. + * + * Allocate RESULT in RESULT_POOL and use SCRATCH_POOL for + * intermediate allocation. + */ +svn_error_t * +svn_utf__utf32_to_utf8(const svn_string_t **result, + const apr_int32_t *utf32str, + apr_size_t utf32len, + svn_boolean_t big_endian, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/subversion/include/private/svn_wc_private.h b/subversion/include/private/svn_wc_private.h index fce42b0..28d2247 100644 --- a/subversion/include/private/svn_wc_private.h +++ b/subversion/include/private/svn_wc_private.h @@ -82,8 +82,6 @@ svn_wc__get_file_external_editor(const svn_delta_editor_t **editor, const char *recorded_url, const svn_opt_revision_t *recorded_peg_rev, const svn_opt_revision_t *recorded_rev, - svn_wc_conflict_resolver_func2_t conflict_func, - void *conflict_baton, svn_cancel_func_t cancel_func, void *cancel_baton, svn_wc_notify_func2_t notify_func, @@ -354,7 +352,6 @@ svn_wc__get_wcroot(const char **wcroot_abspath, * before the 1.7 release. */ - /* * Convert from svn_wc_conflict_description2_t to * svn_wc_conflict_description_t. This is needed by some backwards-compat @@ -370,7 +367,11 @@ svn_wc__cd2_to_cd(const svn_wc_conflict_description2_t *conflict, /* * Convert from svn_wc_status3_t to svn_wc_status2_t. * Allocate the result in RESULT_POOL. + * + * Deprecated because svn_wc_status2_t is deprecated and the only + * calls are from other deprecated functions. */ +SVN_DEPRECATED svn_error_t * svn_wc__status2_from_3(svn_wc_status2_t **status, const svn_wc_status3_t *old_status, @@ -379,15 +380,13 @@ svn_wc__status2_from_3(svn_wc_status2_t **status, apr_pool_t *result_pool, apr_pool_t *scratch_pool); - /** * Set @a *children to a new array of the immediate children of the working * node at @a dir_abspath. The elements of @a *children are (const char *) * absolute paths. * - * Include children that are scheduled for deletion. Iff @a show_hidden - * is true, also include children that are 'excluded' or 'server-excluded' or - * 'not-present'. + * Include children that are scheduled for deletion, but not those that + * are excluded, server-excluded or not-present. * * Return every path that refers to a child of the working node at * @a dir_abspath. Do not include a path just because it was a child of a @@ -401,24 +400,20 @@ svn_error_t * svn_wc__node_get_children_of_working_node(const apr_array_header_t **children, svn_wc_context_t *wc_ctx, const char *dir_abspath, - svn_boolean_t show_hidden, apr_pool_t *result_pool, apr_pool_t *scratch_pool); /** - * Like svn_wc__node_get_children_of_working_node(), except also include any - * path that was a child of a deleted directory that existed at - * @a dir_abspath, even if that directory is now scheduled to be replaced by - * the working node at @a dir_abspath. + * Gets the immediate 'not-present' children of a node. + * + * #### Needed during 'svn cp WC URL' to handle mixed revision cases */ svn_error_t * -svn_wc__node_get_children(const apr_array_header_t **children, - svn_wc_context_t *wc_ctx, - const char *dir_abspath, - svn_boolean_t show_hidden, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool); - +svn_wc__node_get_not_present_children(const apr_array_header_t **children, + svn_wc_context_t *wc_ctx, + const char *dir_abspath, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /** * Fetch the repository information for the working version @@ -442,18 +437,6 @@ svn_wc__node_get_repos_info(svn_revnum_t *revision, apr_pool_t *result_pool, apr_pool_t *scratch_pool); - - -/** - * Get the depth of @a local_abspath using @a wc_ctx. If @a local_abspath is - * not in the working copy, return @c SVN_ERR_WC_PATH_NOT_FOUND. - */ -svn_error_t * -svn_wc__node_get_depth(svn_depth_t *depth, - svn_wc_context_t *wc_ctx, - const char *local_abspath, - apr_pool_t *scratch_pool); - /** * Get the changed revision, date and author for @a local_abspath using @a * wc_ctx. Allocate the return values in @a result_pool; use @a scratch_pool @@ -501,6 +484,8 @@ svn_wc__node_get_url(const char **url, * If not NULL, sets @a revision, @a repos_relpath, @a repos_root_url and * @a repos_uuid to the original (if a copy) or their current values. * + * If not NULL, set @a depth, to the recorded depth on @a local_abspath. + * * If @a copy_root_abspath is not NULL, and @a *is_copy indicates that the * node was copied, set @a *copy_root_abspath to the local absolute path of * the root of the copied subtree containing the node. If the copied node is @@ -519,6 +504,7 @@ svn_wc__node_get_origin(svn_boolean_t *is_copy, const char **repos_relpath, const char **repos_root_url, const char **repos_uuid, + svn_depth_t *depth, const char **copy_root_abspath, svn_wc_context_t *wc_ctx, const char *local_abspath, @@ -527,38 +513,6 @@ svn_wc__node_get_origin(svn_boolean_t *is_copy, apr_pool_t *scratch_pool); /** - * Set @a *is_deleted to TRUE if @a local_abspath is deleted, using - * @a wc_ctx. If @a local_abspath is not in the working copy, return - * @c SVN_ERR_WC_PATH_NOT_FOUND. Use @a scratch_pool for all temporary - * allocations. - */ -svn_error_t * -svn_wc__node_is_status_deleted(svn_boolean_t *is_deleted, - svn_wc_context_t *wc_ctx, - const char *local_abspath, - apr_pool_t *scratch_pool); - -/** - * Set @a *deleted_ancestor_abspath to the root of the delete operation - * that deleted @a local_abspath. If @a local_abspath itself was deleted - * and has no deleted ancestor, @a *deleted_ancestor_abspath will equal - * @a local_abspath. If @a local_abspath was not deleted, - * set @a *deleted_ancestor_abspath to @c NULL. - * - * A node is considered 'deleted' if it is deleted or moved-away, and is - * not replaced. - * - * @a *deleted_ancestor_abspath is allocated in @a result_pool. - * Use @a scratch_pool for all temporary allocations. - */ -svn_error_t * -svn_wc__node_get_deleted_ancestor(const char **deleted_ancestor_abspath, - svn_wc_context_t *wc_ctx, - const char *local_abspath, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool); - -/** * Set @a *not_present to TRUE when @a local_abspath has status * svn_wc__db_status_not_present. Set @a *user_excluded to TRUE when * @a local_abspath has status svn_wc__db_status_excluded. Set @@ -641,7 +595,6 @@ svn_wc__node_get_base(svn_node_kind_t *kind, svn_wc_context_t *wc_ctx, const char *local_abspath, svn_boolean_t ignore_enoent, - svn_boolean_t show_hidden, apr_pool_t *result_pool, apr_pool_t *scratch_pool); @@ -771,20 +724,6 @@ svn_wc__call_with_write_lock(svn_wc__with_write_lock_func_t func, } while (0) -/** - * Calculates the schedule and copied status of a node as that would - * have been stored in an svn_wc_entry_t instance. - * - * If not @c NULL, @a schedule and @a copied are set to their calculated - * values. - */ -svn_error_t * -svn_wc__node_get_schedule(svn_wc_schedule_t *schedule, - svn_boolean_t *copied, - svn_wc_context_t *wc_ctx, - const char *local_abspath, - apr_pool_t *scratch_pool); - /** A callback invoked by svn_wc__prop_list_recursive(). * It is equivalent to svn_proplist_receiver_t declared in svn_client.h, * but kept private within the svn_wc__ namespace because it is used within @@ -978,15 +917,17 @@ svn_wc__get_excluded_subtrees(apr_hash_t **server_excluded_subtrees, /* Indicate in @a *is_modified whether the working copy has local * modifications, using context @a wc_ctx. - * Use @a scratch_pool for temporary allocations. * - * This function provides a subset of the functionality of - * svn_wc_revision_status2() and is more efficient if the caller - * doesn't need all information returned by svn_wc_revision_status2(). */ + * If IGNORE_UNVERSIONED, unversioned paths inside the tree rooted by + * LOCAL_ABSPATH are not seen as a change, otherwise they are. + * (svn:ignored paths are always ignored) + * + * Use @a scratch_pool for temporary allocations. */ svn_error_t * svn_wc__has_local_mods(svn_boolean_t *is_modified, svn_wc_context_t *wc_ctx, const char *local_abspath, + svn_boolean_t ignore_unversioned, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *scratch_pool); @@ -1294,6 +1235,44 @@ svn_wc__resolve_relative_external_url(const char **resolved_url, apr_pool_t *result_pool, apr_pool_t *scratch_pool); +typedef enum svn_wc__external_description_format_t +{ + /* LOCALPATH [-r PEG] URL */ + svn_wc__external_description_format_1 = 0, + + /* [-r REV] URL[@PEG] LOCALPATH, introduced in Subversion 1.5 */ + svn_wc__external_description_format_2 +} svn_wc__external_description_format_t; + +/* Additional information about what the external's parser has parsed. */ +typedef struct svn_wc__externals_parser_info_t +{ + /* The syntax format used by the external description. */ + svn_wc__external_description_format_t format; + + /* The string used for defining the operative revision, i.e. + "-rN", "-rHEAD", or "-r{DATE}". + NULL if revision was not given. */ + const char *rev_str; + + /* The string used for defining the peg revision (equals rev_str in + format 1, is "@N", or "@HEAD" or "@{DATE}" in format 2). + NULL if peg revision was not given. */ + const char *peg_rev_str; + +} svn_wc__externals_parser_info_t; + +/* Like svn_wc_parse_externals_description3() but returns an additional array + * with elements of type svn_wc__externals_parser_info_t in @a *parser_infos_p. + * @a parser_infos_p may be NULL if not required by the caller. + */ +svn_error_t * +svn_wc__parse_externals_description(apr_array_header_t **externals_p, + apr_array_header_t **parser_infos_p, + const char *defining_directory, + const char *desc, + svn_boolean_t canonicalize_url, + apr_pool_t *pool); /** * Set @a *editor and @a *edit_baton to an editor that generates @@ -1318,8 +1297,8 @@ svn_wc__resolve_relative_external_url(const char **resolved_url, * * Assuming the target is a directory, then: * - * - If @a get_all is FALSE, then only locally-modified entries will be - * returned. If TRUE, then all entries will be returned. + * - If @a get_all is @c FALSE, then only locally-modified entries will be + * returned. If @c TRUE, then all entries will be returned. * * - If @a depth is #svn_depth_empty, a status structure will * be returned for the target only; if #svn_depth_files, for the @@ -1334,6 +1313,9 @@ svn_wc__resolve_relative_external_url(const char **resolved_url, * If the given @a depth is incompatible with the depth found in a * working copy directory, the found depth always governs. * + * If @a check_working_copy is not set, do not scan the working copy + * for local modifications, taking only the BASE tree into account. + * * If @a no_ignore is set, statuses that would typically be ignored * will instead be reported. * @@ -1368,6 +1350,7 @@ svn_wc__get_status_editor(const svn_delta_editor_t **editor, const char *target_basename, svn_depth_t depth, svn_boolean_t get_all, + svn_boolean_t check_working_copy, svn_boolean_t no_ignore, svn_boolean_t depth_as_sticky, svn_boolean_t server_performs_filtering, @@ -1557,7 +1540,7 @@ svn_wc__get_switch_editor(const svn_delta_editor_t **editor, * Diffs will be reported as valid relpaths, with @a anchor_abspath being * the root (""). * - * @a callbacks/@a callback_baton is the callback table to use. + * @a diff_processor will retrieve the diff report. * * If @a depth is #svn_depth_empty, just diff exactly @a target or * @a anchor_path if @a target is empty. If #svn_depth_files then do the same @@ -1583,8 +1566,12 @@ svn_wc__get_switch_editor(const svn_delta_editor_t **editor, * if they weren't modified after being copied. This allows the callbacks * to generate appropriate --git diff headers for such files. * - * Normally, the difference from repository->working_copy is shown. - * If @a reverse_order is TRUE, then show working_copy->repository diffs. + * Normally, the difference from repository->working_copy is shown. If + * @a reverse_order is TRUE, then we want to show working_copy->repository + * diffs. Most of the reversal is done by the caller; here we just swap the + * order of reporting a replacement so that the local addition is reported + * before the remote delete. (The caller's diff processor can then transform + * adds into deletes and deletes into adds, but it can't reorder the output.) * * If @a cancel_func is non-NULL, it will be used along with @a cancel_baton * to periodically check if the client has canceled the operation. @@ -1628,14 +1615,11 @@ svn_wc__get_diff_editor(const svn_delta_editor_t **editor, const char *target, svn_depth_t depth, svn_boolean_t ignore_ancestry, - svn_boolean_t show_copies_as_adds, - svn_boolean_t use_git_diff_format, svn_boolean_t use_text_base, svn_boolean_t reverse_order, svn_boolean_t server_performs_filtering, const apr_array_header_t *changelist_filter, - const svn_wc_diff_callbacks4_t *callbacks, - void *callback_baton, + const svn_diff_tree_processor_t *diff_processor, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *result_pool, @@ -1840,6 +1824,29 @@ svn_wc__acquire_write_lock_for_resolve(const char **lock_root_abspath, const char *local_abspath, apr_pool_t *result_pool, apr_pool_t *scratch_pool); + +/* The implemementation of svn_wc_diff6(), but reporting to a diff processor + * + * If ROOT_RELPATH is not NULL, set *ROOT_RELPATH to the target of the diff + * within the diff namespace. ("" or a single path component). + * + * If ROOT_IS_FILE is NOT NULL set it + * the first processor call. (The anchor is LOCAL_ABSPATH or an ancestor of it) + */ +svn_error_t * +svn_wc__diff7(const char **root_relpath, + svn_boolean_t *root_is_dir, + svn_wc_context_t *wc_ctx, + const char *local_abspath, + svn_depth_t depth, + svn_boolean_t ignore_ancestry, + const apr_array_header_t *changelist_filter, + const svn_diff_tree_processor_t *diff_processor, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/subversion/include/svn_auth.h b/subversion/include/svn_auth.h index 3e9f45e..3a78ba6 100644 --- a/subversion/include/svn_auth.h +++ b/subversion/include/svn_auth.h @@ -884,7 +884,11 @@ svn_auth_get_platform_specific_client_providers( * @note An administrative password reset may invalidate the account's * secret key. This function will detect that situation and behave as * if the password were not cached at all. + * @deprecated Provided for backwards compatibility with the 1.8 API. Use + * svn_auth_get_platform_specific_provider with provider_name of "windows" + * and provider_type of "simple". */ +SVN_DEPRECATED void svn_auth_get_windows_simple_provider(svn_auth_provider_object_t **provider, apr_pool_t *pool); @@ -906,7 +910,11 @@ svn_auth_get_windows_simple_provider(svn_auth_provider_object_t **provider, * @note An administrative password reset may invalidate the account's * secret key. This function will detect that situation and behave as * if the password were not cached at all. + * @deprecated Provided for backwards compatibility with the 1.8 API. + * Use svn_auth_get_platform_specific_provider with provider_name + * of "windows" and provider_type of "ssl_client_cert_pw". */ +SVN_DEPRECATED void svn_auth_get_windows_ssl_client_cert_pw_provider( svn_auth_provider_object_t **provider, @@ -923,7 +931,11 @@ svn_auth_get_windows_ssl_client_cert_pw_provider( * * @since New in 1.5. * @note This function is only available on Windows. + * @deprecated Provided for backwards compatibility with the 1.8 API. + * Use svn_auth_get_platform_specific_provider with provider_name + * of "windows" and provider_type of "ssl_server_trust". */ +SVN_DEPRECATED void svn_auth_get_windows_ssl_server_trust_provider( svn_auth_provider_object_t **provider, @@ -943,7 +955,11 @@ svn_auth_get_windows_ssl_server_trust_provider( * * @since New in 1.4 * @note This function is only available on Mac OS 10.2 and higher. + * @deprecated Provided for backwards compatibility with the 1.8 API. + * Use svn_auth_get_platform_specific_provider with provider_name + * of "keychain" and provider_type of "simple". */ +SVN_DEPRECATED void svn_auth_get_keychain_simple_provider(svn_auth_provider_object_t **provider, apr_pool_t *pool); @@ -959,7 +975,11 @@ svn_auth_get_keychain_simple_provider(svn_auth_provider_object_t **provider, * * @since New in 1.6 * @note This function is only available on Mac OS 10.2 and higher. + * @deprecated Provided for backwards compatibility with the 1.8 API. + * Use svn_auth_get_platform_specific_provider with provider_name + * of "keychain" and provider_type of "ssl_client_cert_pw". */ +SVN_DEPRECATED void svn_auth_get_keychain_ssl_client_cert_pw_provider( svn_auth_provider_object_t **provider, @@ -1029,7 +1049,11 @@ svn_auth_gnome_keyring_version(void); * @since New in 1.6 * @note This function actually works only on systems with * libsvn_auth_gnome_keyring and GNOME Keyring installed. + * @deprecated Provided for backwards compatibility with the 1.8 API. + * Use svn_auth_get_platform_specific_provider with provider_name + * of "gnome_keyring" and provider_type of "simple". */ +SVN_DEPRECATED void svn_auth_get_gnome_keyring_simple_provider( svn_auth_provider_object_t **provider, @@ -1056,7 +1080,11 @@ svn_auth_get_gnome_keyring_simple_provider( * @since New in 1.6 * @note This function actually works only on systems with * libsvn_auth_gnome_keyring and GNOME Keyring installed. + * @deprecated Provided for backwards compatibility with the 1.8 API. + * Use svn_auth_get_platform_specific_provider with provider_name + * of "gnome_keyring" and provider_type of "ssl_client_cert_pw". */ +SVN_DEPRECATED void svn_auth_get_gnome_keyring_ssl_client_cert_pw_provider( svn_auth_provider_object_t **provider, @@ -1084,7 +1112,11 @@ svn_auth_kwallet_version(void); * @since New in 1.6 * @note This function actually works only on systems with libsvn_auth_kwallet * and KWallet installed. + * @deprecated Provided for backwards compatibility with the 1.8 API. + * Use svn_auth_get_platform_specific_provider with provider_name + * of "kwallet" and provider_type of "simple". */ +SVN_DEPRECATED void svn_auth_get_kwallet_simple_provider(svn_auth_provider_object_t **provider, apr_pool_t *pool); @@ -1102,7 +1134,11 @@ svn_auth_get_kwallet_simple_provider(svn_auth_provider_object_t **provider, * @since New in 1.6 * @note This function actually works only on systems with libsvn_auth_kwallet * and KWallet installed. + * @deprecated Provided for backwards compatibility with the 1.8 API. + * Use svn_auth_get_platform_specific_provider with provider_name + * of "kwallet" and provider_type of "ssl_client_cert_pw". */ +SVN_DEPRECATED void svn_auth_get_kwallet_ssl_client_cert_pw_provider( svn_auth_provider_object_t **provider, @@ -1124,7 +1160,11 @@ svn_auth_get_kwallet_ssl_client_cert_pw_provider( * @since New in 1.8 * @note This function actually works only on systems with * GNU Privacy Guard installed. + * @deprecated Provided for backwards compatibility with the 1.8 API. + * Use svn_auth_get_platform_specific_provider with provider_name + * of "gpg_agent" and provider_type of "simple". */ +SVN_DEPRECATED void svn_auth_get_gpg_agent_simple_provider (svn_auth_provider_object_t **provider, diff --git a/subversion/include/svn_cache_config.h b/subversion/include/svn_cache_config.h index b03a079..2db619a 100644 --- a/subversion/include/svn_cache_config.h +++ b/subversion/include/svn_cache_config.h @@ -41,6 +41,9 @@ extern "C" { /** Cache resource settings. It controls what caches, in what size and how they will be created. The settings apply for the whole process. + @note Do not extend this data structure as this would break binary + compatibility. + @since New in 1.7. */ typedef struct svn_cache_config_t @@ -56,6 +59,8 @@ typedef struct svn_cache_config_t /** is this application guaranteed to be single-threaded? */ svn_boolean_t single_threaded; + + /* DON'T add new members here. Bump struct and API version instead. */ } svn_cache_config_t; /** Get the current cache configuration. If it has not been set, diff --git a/subversion/include/svn_checksum.h b/subversion/include/svn_checksum.h index d3271f5..e332e87 100644 --- a/subversion/include/svn_checksum.h +++ b/subversion/include/svn_checksum.h @@ -48,7 +48,17 @@ typedef enum svn_checksum_kind_t svn_checksum_md5, /** The checksum is (or should be set to) a SHA1 checksum. */ - svn_checksum_sha1 + svn_checksum_sha1, + + /** The checksum is (or should be set to) a FNV-1a 32 bit checksum, + * in big endian byte order. + * @since New in 1.9. */ + svn_checksum_fnv1a_32, + + /** The checksum is (or should be set to) a modified FNV-1a 32 bit, + * in big endian byte order. + * @since New in 1.9. */ + svn_checksum_fnv1a_32x4 } svn_checksum_kind_t; /** diff --git a/subversion/include/svn_client.h b/subversion/include/svn_client.h index 5db3e16..cb0f49d 100644 --- a/subversion/include/svn_client.h +++ b/subversion/include/svn_client.h @@ -465,13 +465,19 @@ typedef struct svn_client_commit_item3_t { /* IMPORTANT: If you extend this structure, add new fields to the end. */ - /** absolute working-copy path of item */ + /** absolute working-copy path of item. Always set during normal commits + * (and copies from a working copy) to the repository. Can only be NULL + * when stub commit items are created for operations that only involve + * direct repository operations. During WC->REPOS copy operations, this + * path is the WC source path of the operation. */ const char *path; /** node kind (dir, file) */ svn_node_kind_t kind; - /** commit URL for this item */ + /** commit URL for this item. Points to the repository location of PATH + * during commits, or to the final URL of the item when copying from the + * working copy to the repository. */ const char *url; /** revision of textbase */ @@ -1014,6 +1020,31 @@ typedef struct svn_client_ctx_t * @since New in 1.7. */ svn_wc_context_t *wc_ctx; + /** Check-tunnel callback + * + * If not @c NULL, and open_tunnel_func is also not @c NULL, this + * callback will be invoked to check if open_tunnel_func should be + * used to create a specific tunnel, or if the default tunnel + * implementation (either built-in or configured in the client + * configuration file) should be used instead. + * @since New in 1.9. + */ + svn_ra_check_tunnel_func_t check_tunnel_func; + + /** Open-tunnel callback + * + * If not @c NULL, this callback will be invoked to create a tunnel + * for a ra_svn connection that needs one, overriding any tunnel + * definitions in the client config file. This callback is used only + * for ra_svn and ignored by the other RA modules. + * @since New in 1.9. + */ + svn_ra_open_tunnel_func_t open_tunnel_func; + + /** The baton used with check_tunnel_func and open_tunnel_func. + * @since New in 1.9. + */ + void *tunnel_baton; } svn_client_ctx_t; /** Initialize a client context. @@ -1051,20 +1082,15 @@ svn_client_create_context(svn_client_ctx_t **ctx, /** @} end group: Client context management */ /** - * @name Authentication information file names - * - * Names of files that contain authentication information. - * - * These filenames are decided by libsvn_client, since this library - * implements all the auth-protocols; libsvn_wc does nothing but - * blindly store and retrieve these files from protected areas. - * - * @defgroup clnt_auth_filenames Client authentication file names - * @{ + * @deprecated Provided for backward compatibility. This constant was never + * used in released versions. */ #define SVN_CLIENT_AUTH_USERNAME "username" +/** + * @deprecated Provided for backward compatibility. This constant was never + * used in released versions. + */ #define SVN_CLIENT_AUTH_PASSWORD "password" -/** @} group end: Authentication information file names */ /** Client argument processing * @@ -1100,6 +1126,12 @@ svn_client_create_context(svn_client_ctx_t **ctx, * error, and if this is the only type of error encountered, complete * the operation before returning the error(s). * + * Return an error if a target is just a peg specifier with no path, such as + * "@abc". Before v1.6.5 (r878062) this form was interpreted as a literal path; + * it is now ambiguous. The form "@abc@" should now be used to refer to the + * literal path "@abc" with no peg revision, or the form ".@abc" to refer to + * the empty path with peg revision "abc". + * * @since New in 1.7 */ svn_error_t * @@ -1114,6 +1146,9 @@ svn_client_args_to_target_array2(apr_array_header_t **targets_p, * Similar to svn_client_args_to_target_array2() but with * @a keep_last_origpath_on_truepath_collision always set to FALSE. * + * @since Since 1.6.5, this returns an error if a path contains a peg + * specifier with no path before it, such as "@abc". + * * @deprecated Provided for backward compatibility with the 1.6 API. */ SVN_DEPRECATED @@ -2471,12 +2506,20 @@ typedef svn_error_t *(*svn_client_status_func_t)( * retrieve only "interesting" entries (local mods and/or * out of date). * - * - If @a update is set, contact the repository and augment the - * status structures with information about out-of-dateness (with - * respect to @a revision). Also, if @a result_rev is not @c NULL, - * set @a *result_rev to the actual revision against which the - * working copy was compared (@a *result_rev is not meaningful unless - * @a update is set). + * - If @a check_out_of_date is set, contact the repository and + * augment the status structures with information about + * out-of-dateness (with respect to @a revision). Also, if @a + * result_rev is not @c NULL, set @a *result_rev to the actual + * revision against which the working copy was compared (@a + * *result_rev is not meaningful unless @a check_out_of_date is + * set). + * + * - If @a check_working_copy is not set, do not scan the working + * copy for local modifications. This parameter will be ignored + * unless @a check_out_of_date is set. When set, the status + * report will not contain any information about local changes in + * the working copy; this includes local deletions and + * replacements. * * If @a no_ignore is @c FALSE, don't report any file or directory (or * recurse into any directory) that is found by recursion (as opposed to @@ -2507,8 +2550,34 @@ typedef svn_error_t *(*svn_client_status_func_t)( * * All temporary allocations are performed in @a scratch_pool. * + * @since New in 1.9. + */ +svn_error_t * +svn_client_status6(svn_revnum_t *result_rev, + svn_client_ctx_t *ctx, + const char *path, + const svn_opt_revision_t *revision, + svn_depth_t depth, + svn_boolean_t get_all, + svn_boolean_t check_out_of_date, + svn_boolean_t check_working_copy, + svn_boolean_t no_ignore, + svn_boolean_t ignore_externals, + svn_boolean_t depth_as_sticky, + const apr_array_header_t *changelists, + svn_client_status_func_t status_func, + void *status_baton, + apr_pool_t *scratch_pool); + + +/** + * Same as svn_client_status6(), but with @a check_out_of_date set to + * @a update and @a check_working_copy set to @c TRUE. + * * @since New in 1.7. + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_client_status5(svn_revnum_t *result_rev, svn_client_ctx_t *ctx, @@ -2641,8 +2710,8 @@ svn_client_status(svn_revnum_t *result_rev, * #svn_opt_revision_unspecified, it defaults to #svn_opt_revision_head * for URLs or #svn_opt_revision_working for WC paths. * - * If @a limit is non-zero only invoke @a receiver on the first @a limit - * logs. + * If @a limit is greater than zero only invoke @a receiver on the first + * @a limit logs. * * If @a discover_changed_paths is set, then the @c changed_paths and @c * changed_paths2 fields in the @c log_entry argument to @a receiver will be @@ -2814,6 +2883,11 @@ svn_client_log(const apr_array_header_t *targets, * in which case blame information will be generated regardless of the * MIME types of the revisions. * + * @a start may resolve to a revision number greater (younger) than @a end + * only if the server is 1.8.0 or greater (supports + * #SVN_RA_CAPABILITY_GET_FILE_REVS_REVERSE) and the client is 1.9.0 or + * newer. + * * Use @a diff_options to determine how to compare different revisions of the * target. * @@ -3919,8 +3993,15 @@ svn_client_mergeinfo_get_merged(apr_hash_t **mergeinfo, * If a depth other than #svn_depth_empty or #svn_depth_infinity is * requested then return a #SVN_ERR_UNSUPPORTED_FEATURE error. * - * @a discover_changed_paths and @a revprops are the same as for - * svn_client_log5(). Use @a scratch_pool for all temporary allocations. + * In addition to the behavior of @a discover_changed_paths described in + * svn_client_log5(), if set to TRUE it enables detection of sub-tree + * merges that are complete but can't be detected as complete without + * access to the changed paths. Sub-tree merges detected as complete will + * be included if @a finding_merged is TRUE or filtered if @a finding_merged + * is FALSE. + * + * @a revprops is the same as for svn_client_log5(). Use @a scratch_pool for + * all temporary allocations. * * @a ctx is a context used for authentication. * @@ -4017,17 +4098,96 @@ svn_client_mergeinfo_log_eligible(const char *path_or_url, * @{ */ -/** Recursively cleanup a working copy directory @a dir, finishing any +/** Recursively vacuum a working copy directory @a dir_abspath, + * removing unnecessary data. + * + * If @a include_externals is @c TRUE, recurse into externals and vacuum them + * as well. + * + * If @a remove_unversioned_items is @c TRUE, remove unversioned items + * in @a dir_abspath after successful working copy cleanup. + * If @a remove_ignored_items is @c TRUE, remove ignored unversioned items + * in @a dir_abspath after successful working copy cleanup. + * + * If @a fix_recorded_timestamps is @c TRUE, this function fixes recorded + * timestamps for unmodified files in the working copy, reducing comparision + * time on future checks. + * + * If @a vacuum_pristines is @c TRUE, and @a dir_abspath points to the working + * copy root unreferenced files in the pristine store are removed. + * + * When asked to remove unversioned or ignored items, and the working copy + * is already locked, return #SVN_ERR_WC_LOCKED. This prevents accidental + * working copy corruption in case users run the cleanup operation to + * remove unversioned items while another client is performing some other + * operation on the working copy. + * + * If @a ctx->cancel_func is non-NULL, invoke it with @a + * ctx->cancel_baton at various points during the operation. If it + * returns an error (typically #SVN_ERR_CANCELLED), return that error + * immediately. + * + * Use @a scratch_pool for any temporary allocations. + * + * @since New in 1.9. + */ +svn_error_t * +svn_client_vacuum(const char *dir_abspath, + svn_boolean_t remove_unversioned_items, + svn_boolean_t remove_ignored_items, + svn_boolean_t fix_recorded_timestamps, + svn_boolean_t vacuum_pristines, + svn_boolean_t include_externals, + svn_client_ctx_t *ctx, + apr_pool_t *scratch_pool); + + +/** Recursively cleanup a working copy directory @a dir_abspath, finishing any * incomplete operations, removing lockfiles, etc. * + * If @a break_locks is @c TRUE, existing working copy locks at or below @a + * dir_abspath are broken, otherwise a normal write lock is obtained. + * + * If @a fix_recorded_timestamps is @c TRUE, this function fixes recorded + * timestamps for unmodified files in the working copy, reducing comparision + * time on future checks. + * + * If @a clear_dav_cache is @c TRUE, the caching of DAV information for older + * mod_dav served repositories is cleared. This clearing invalidates some + * cached information used for pre-HTTPv2 repositories. + * + * If @a vacuum_pristines is @c TRUE, and @a dir_abspath points to the working + * copy root unreferenced files in the pristine store are removed. + * + * If @a include_externals is @c TRUE, recurse into externals and clean + * them up as well. + * * If @a ctx->cancel_func is non-NULL, invoke it with @a * ctx->cancel_baton at various points during the operation. If it * returns an error (typically #SVN_ERR_CANCELLED), return that error * immediately. * * Use @a scratch_pool for any temporary allocations. + * + * @since New in 1.9. */ svn_error_t * +svn_client_cleanup2(const char *dir_abspath, + svn_boolean_t break_locks, + svn_boolean_t fix_recorded_timestamps, + svn_boolean_t clear_dav_cache, + svn_boolean_t vacuum_pristines, + svn_boolean_t include_externals, + svn_client_ctx_t *ctx, + apr_pool_t *scratch_pool); + +/** Like svn_client_cleanup2(), but no support for not breaking locks and + * cleaning up externals and using a potentially non absolute path. + * + * @deprecated Provided for limited backwards compatibility with the 1.8 API. + */ +SVN_DEPRECATED +svn_error_t * svn_client_cleanup(const char *dir, svn_client_ctx_t *ctx, apr_pool_t *scratch_pool); @@ -4133,6 +4293,13 @@ svn_client_relocate(const char *dir, * changelists. If @a changelists is empty (or altogether @c NULL), * no changelist filtering occurs. * + * If @a clear_changelists is TRUE, then changelist information for the + * paths is cleared while reverting. + * + * If @a metadata_only is TRUE, the files and directories aren't changed + * by the operation. If there are conflict marker files attached to the + * targets these are removed. + * * If @a ctx->notify_func2 is non-NULL, then for each item reverted, * call @a ctx->notify_func2 with @a ctx->notify_baton2 and the path of * the reverted item. @@ -4141,8 +4308,24 @@ svn_client_relocate(const char *dir, * then do not error, just invoke @a ctx->notify_func2 with @a * ctx->notify_baton2, using notification code #svn_wc_notify_skip. * + * @since New in 1.9. + */ +svn_error_t * +svn_client_revert3(const apr_array_header_t *paths, + svn_depth_t depth, + const apr_array_header_t *changelists, + svn_boolean_t clear_changelists, + svn_boolean_t metadata_only, + svn_client_ctx_t *ctx, + apr_pool_t *pool); + +/** Similar to svn_client_revert2, but with @a clear_changelists set to + * FALSE and @a metadata_only set to FALSE. + * * @since New in 1.5. + * @deprecated Provided for backwards compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_client_revert2(const apr_array_header_t *paths, svn_depth_t depth, @@ -4160,7 +4343,7 @@ svn_client_revert2(const apr_array_header_t *paths, * @note Most APIs map @a recurse==FALSE to @a depth==svn_depth_files; * revert is deliberately different. * - * @deprecated Provided for backwards compatibility with the 1.0 API. + * @deprecated Provided for backwards compatibility with the 1.4 API. */ SVN_DEPRECATED svn_error_t * @@ -4316,6 +4499,41 @@ typedef struct svn_client_copy_source_t * If @a ignore_externals is set, don't process externals definitions * as part of this operation. * + * If @a metadata_only is @c TRUE and copying a file in a working copy, + * everything in the metadata is updated as if the node is moved, but the + * actual disk copy operation is not performed. This feature is useful for + * clients that want to keep the working copy in sync while the actual working + * copy is updated by some other task. + * + * If @a pin_externals is set, pin URLs in copied externals definitions + * to their current revision unless they were already pinned to a + * particular revision. A pinned external uses a URL which points at a + * fixed revision, rather than the HEAD revision. Externals in the copy + * destination are pinned to either a working copy base revision or the + * HEAD revision of a repository (as of the time the copy operation is + * performed), depending on the type of the copy source: + <pre> + copy source: working copy (WC) REPOS + ------------+------------------------+---------------------------+ + copy WC | external's WC BASE rev | external's repos HEAD rev | + dest: |------------------------+---------------------------+ + REPOS | external's WC BASE rev | external's repos HEAD rev | + ------------+------------------------+---------------------------+ + </pre> + * If the copy source is a working copy, then all externals must be checked + * out, be at a single-revision, contain no local modifications, and contain + * no switched subtrees. Else, #SVN_ERR_WC_PATH_UNEXPECTED_STATUS is returned. + * + * If non-NULL, @a externals_to_pin restricts pinning to a subset of externals. + * It is a hash table keyed by either a local absolute path or a URL at which + * an svn:externals property is set. The hash table contains apr_array_header_t* + * elements as returned by svn_wc_parse_externals_description3(). These arrays + * contain elements of type svn_wc_external_item2_t*, each of which corresponds + * to a single line of an svn:externals definition. Externals corresponding to + * these items will be pinned, other externals will not be pinned. + * If @a externals_to_pin is @c NULL then all externals are pinned. + * If @a pin_externals is @c FALSE then @a externals_to_pin is ignored. + * * If non-NULL, @a revprop_table is a hash table holding additional, * custom revision properties (<tt>const char *</tt> names mapped to * <tt>svn_string_t *</tt> values) to be set on the new revision in @@ -4334,8 +4552,32 @@ typedef struct svn_client_copy_source_t * @a commit_callback with @a commit_baton and a #svn_commit_info_t for * the commit. * + * @since New in 1.9. + */ +svn_error_t * +svn_client_copy7(const apr_array_header_t *sources, + const char *dst_path, + svn_boolean_t copy_as_child, + svn_boolean_t make_parents, + svn_boolean_t ignore_externals, + svn_boolean_t metadata_only, + svn_boolean_t pin_externals, + const apr_hash_t *externals_to_pin, + const apr_hash_t *revprop_table, + svn_commit_callback2_t commit_callback, + void *commit_baton, + svn_client_ctx_t *ctx, + apr_pool_t *pool); + +/** + * Similar to svn_client_copy7(), but doesn't support meta_data_only + * and cannot pin externals. + * + * * @since New in 1.7. + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_client_copy6(const apr_array_header_t *sources, const char *dst_path, @@ -5065,6 +5307,8 @@ svn_client_propget(apr_hash_t **props, * in @a ctx for authentication, and @a pool for all memory allocation. * Return the actual rev queried in @a *set_rev. * + * If @a propname does not exist on @a revision, set @a *propval to @c NULL. + * * Note that unlike its cousin svn_client_propget(), this routine * doesn't affect the working copy at all; it's a pure network * operation that queries an *unversioned* property attached to a @@ -5616,15 +5860,14 @@ svn_client_ls(apr_hash_t **dirents, /** * Output the content of a file. * - * @param[in] out The stream to which the content will be written. - * @param[in] path_or_url The path or URL of the file. - * @param[in] peg_revision The peg revision. - * @param[in] revision The operative revision. + * @param[out] props Optional output argument to obtain properties. + * @param[in] out The stream to which the content will be written. + * @param[in] path_or_url The path or URL of the file. + * @param[in] peg_revision The peg revision. + * @param[in] revision The operative revision. + * @param[in] expand_keywords When true, keywords (when set) are expanded. * @param[in] ctx The standard client context, used for possible * authentication. - * @param[in] pool Used for any temporary allocation. - * - * @todo Add an expansion/translation flag? * * @return A pointer to an #svn_error_t of the type (this list is not * exhaustive): <br> @@ -5634,12 +5877,35 @@ svn_client_ls(apr_hash_t **dirents, * determined. <br> * If no error occurred, return #SVN_NO_ERROR. * - * @since New in 1.2. + * If @a *props is not NULL it is set to a hash of all the file's + * non-inherited properties. If it is NULL, the properties are only + * used for determining how and if the file should be translated. * * @see #svn_client_ctx_t <br> @ref clnt_revisions for * a discussion of operative and peg revisions. + * + * @since New in 1.9. */ svn_error_t * +svn_client_cat3(apr_hash_t **props, + svn_stream_t *out, + const char *path_or_url, + const svn_opt_revision_t *peg_revision, + const svn_opt_revision_t *revision, + svn_boolean_t expand_keywords, + svn_client_ctx_t *ctx, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** + * Similar to svn_client_cat3() except without the option of directly + * reading the properties, and with @a expand_keywords always TRUE. + * + * @since New in 1.2. + * @deprecated Provided for backward compatibility with the 1.8 API. + */ +SVN_DEPRECATED +svn_error_t * svn_client_cat2(svn_stream_t *out, const char *path_or_url, const svn_opt_revision_t *peg_revision, @@ -6110,14 +6376,38 @@ typedef svn_error_t *(*svn_client_info_receiver2_t)( * is TRUE also send nodes that don't exist as versioned but are still * tree conflicted. * + * If @a include_externals is @c TRUE, recurse into externals and report about + * them as well. + * * @a changelists is an array of <tt>const char *</tt> changelist * names, used as a restrictive filter on items whose info is * reported; that is, don't report info about any item unless * it's a member of one of those changelists. If @a changelists is * empty (or altogether @c NULL), no changelist filtering occurs. * + * @since New in 1.9. + */ +svn_error_t * +svn_client_info4(const char *abspath_or_url, + const svn_opt_revision_t *peg_revision, + const svn_opt_revision_t *revision, + svn_depth_t depth, + svn_boolean_t fetch_excluded, + svn_boolean_t fetch_actual_only, + svn_boolean_t include_externals, + const apr_array_header_t *changelists, + svn_client_info_receiver2_t receiver, + void *receiver_baton, + svn_client_ctx_t *ctx, + apr_pool_t *scratch_pool); + + +/** Similar to svn_client_info4, but doesn't support walking externals. + * * @since New in 1.7. + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_client_info3(const char *abspath_or_url, const svn_opt_revision_t *peg_revision, diff --git a/subversion/include/svn_cmdline.h b/subversion/include/svn_cmdline.h index 80442e4..923aeee 100644 --- a/subversion/include/svn_cmdline.h +++ b/subversion/include/svn_cmdline.h @@ -320,8 +320,28 @@ svn_cmdline_auth_plaintext_passphrase_prompt(svn_boolean_t *may_save_plaintext, * by the command line client. * * @a non_interactive, @a username, @a password, @a config_dir, - * @a no_auth_cache, and @a trust_server_cert are the values of the - * command line options of the corresponding names. + * and @a no_auth_cache are the values of the command line options + * of the corresponding names. + * + * If @a non_interactive is @c TRUE, then the following parameters + * control whether an invalid SSL certificate will be accepted + * regardless of a specific verification failure: + * + * @a trust_server_cert_unknown_ca: If @c TRUE, accept certificates + * from unknown certificate authorities. + * + * @a trust_server_cert_cn_mismatch: If @c TRUE, accept certificates + * even if the Common Name attribute of the certificate differs from + * the hostname of the server. + * + * @a trust_server_cert_expired: If @c TRUE, accept certificates even + * if they are expired. + * + * @a trust_server_cert_not_yet_valid: If @c TRUE, accept certificates + * from the future. + * + * @a trust_server_cert_other_failure: If @c TRUE, accept certificates + * even if any other verification failure than the above occured. * * @a cfg is the @c SVN_CONFIG_CATEGORY_CONFIG configuration, and * @a cancel_func and @a cancel_baton control the cancellation of the @@ -329,6 +349,29 @@ svn_cmdline_auth_plaintext_passphrase_prompt(svn_boolean_t *may_save_plaintext, * * Use @a pool for all allocations. * + * @since New in 1.9. + */ +svn_error_t * +svn_cmdline_create_auth_baton2(svn_auth_baton_t **ab, + svn_boolean_t non_interactive, + const char *username, + const char *password, + const char *config_dir, + svn_boolean_t no_auth_cache, + svn_boolean_t trust_server_cert_unknown_ca, + svn_boolean_t trust_server_cert_cn_mismatch, + svn_boolean_t trust_server_cert_expired, + svn_boolean_t trust_server_cert_not_yet_valid, + svn_boolean_t trust_server_cert_other_failure, + svn_config_t *cfg, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *pool); + +/* Like svn_cmdline_create_auth_baton2, but with only one trust_server_cert + * option which corresponds to trust_server_cert_unknown_ca. + * + * @deprecated Provided for backward compatibility with the 1.8 API. * @since New in 1.6. */ svn_error_t * diff --git a/subversion/include/svn_compat.h b/subversion/include/svn_compat.h index a127125..35bbe19 100644 --- a/subversion/include/svn_compat.h +++ b/subversion/include/svn_compat.h @@ -32,6 +32,7 @@ #include <apr_tables.h> #include "svn_types.h" +#include "svn_string.h" #ifdef __cplusplus extern "C" { @@ -75,6 +76,17 @@ svn_compat_log_revprops_in(apr_pool_t *pool); * revprops is NULL, all return values are NULL. Any return value may be * NULL if the corresponding property is not set in @a revprops. * + * @since New in 1.9. + */ +void +svn_compat_log_revprops_out_string(const svn_string_t **author, + const svn_string_t **date, + const svn_string_t **message, + apr_hash_t *revprops); + +/** Simiar to svn_compat_log_revprops_out_string() but returns C-style strings + * instead of #svn_string_t. + * * @since New in 1.5. */ void diff --git a/subversion/include/svn_config.h b/subversion/include/svn_config.h index a3fa9df..5ad3b0b 100644 --- a/subversion/include/svn_config.h +++ b/subversion/include/svn_config.h @@ -76,18 +76,27 @@ typedef struct svn_config_t svn_config_t; #define SVN_CONFIG_OPTION_HTTP_PROXY_EXCEPTIONS "http-proxy-exceptions" #define SVN_CONFIG_OPTION_HTTP_TIMEOUT "http-timeout" #define SVN_CONFIG_OPTION_HTTP_COMPRESSION "http-compression" +/** @deprecated Not used since 1.8. */ #define SVN_CONFIG_OPTION_NEON_DEBUG_MASK "neon-debug-mask" +/** @since New in 1.5. */ #define SVN_CONFIG_OPTION_HTTP_AUTH_TYPES "http-auth-types" #define SVN_CONFIG_OPTION_SSL_AUTHORITY_FILES "ssl-authority-files" #define SVN_CONFIG_OPTION_SSL_TRUST_DEFAULT_CA "ssl-trust-default-ca" #define SVN_CONFIG_OPTION_SSL_CLIENT_CERT_FILE "ssl-client-cert-file" #define SVN_CONFIG_OPTION_SSL_CLIENT_CERT_PASSWORD "ssl-client-cert-password" +/** @deprecated Not used since 1.8. + * @since New in 1.5. */ #define SVN_CONFIG_OPTION_SSL_PKCS11_PROVIDER "ssl-pkcs11-provider" +/** @since New in 1.5. */ #define SVN_CONFIG_OPTION_HTTP_LIBRARY "http-library" +/** @since New in 1.1. */ #define SVN_CONFIG_OPTION_STORE_PASSWORDS "store-passwords" +/** @since New in 1.6. */ #define SVN_CONFIG_OPTION_STORE_PLAINTEXT_PASSWORDS "store-plaintext-passwords" #define SVN_CONFIG_OPTION_STORE_AUTH_CREDS "store-auth-creds" +/** @since New in 1.6. */ #define SVN_CONFIG_OPTION_STORE_SSL_CLIENT_CERT_PP "store-ssl-client-cert-pp" +/** @since New in 1.6. */ #define SVN_CONFIG_OPTION_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT \ "store-ssl-client-cert-pp-plaintext" #define SVN_CONFIG_OPTION_USERNAME "username" @@ -95,6 +104,14 @@ typedef struct svn_config_t svn_config_t; #define SVN_CONFIG_OPTION_HTTP_BULK_UPDATES "http-bulk-updates" /** @since New in 1.8. */ #define SVN_CONFIG_OPTION_HTTP_MAX_CONNECTIONS "http-max-connections" +/** @since New in 1.9. */ +#define SVN_CONFIG_OPTION_HTTP_CHUNKED_REQUESTS "http-chunked-requests" + +/** @since New in 1.9. */ +#define SVN_CONFIG_OPTION_SERF_LOG_COMPONENTS "serf-log-components" +/** @since New in 1.9. */ +#define SVN_CONFIG_OPTION_SERF_LOG_LEVEL "serf-log-level" + #define SVN_CONFIG_CATEGORY_CONFIG "config" #define SVN_CONFIG_SECTION_AUTH "auth" @@ -115,6 +132,7 @@ typedef struct svn_config_t svn_config_t; #define SVN_CONFIG_OPTION_DIFF_EXTENSIONS "diff-extensions" #define SVN_CONFIG_OPTION_DIFF3_CMD "diff3-cmd" #define SVN_CONFIG_OPTION_DIFF3_HAS_PROGRAM_ARG "diff3-has-program-arg" +/** @since New in 1.5. */ #define SVN_CONFIG_OPTION_MERGE_TOOL_CMD "merge-tool-cmd" #define SVN_CONFIG_SECTION_MISCELLANY "miscellany" #define SVN_CONFIG_OPTION_GLOBAL_IGNORES "global-ignores" @@ -123,13 +141,20 @@ typedef struct svn_config_t svn_config_t; /** @deprecated Not used by Subversion since 2003/r847039 (well before 1.0) */ #define SVN_CONFIG_OPTION_TEMPLATE_ROOT "template-root" #define SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS "enable-auto-props" +/** @since New in 1.9. */ +#define SVN_CONFIG_OPTION_ENABLE_MAGIC_FILE "enable-magic-file" +/** @since New in 1.2. */ #define SVN_CONFIG_OPTION_NO_UNLOCK "no-unlock" +/** @since New in 1.5. */ #define SVN_CONFIG_OPTION_MIMETYPES_FILE "mime-types-file" +/** @since New in 1.5. */ #define SVN_CONFIG_OPTION_PRESERVED_CF_EXTS "preserved-conflict-file-exts" /** @since New in 1.7. */ #define SVN_CONFIG_OPTION_INTERACTIVE_CONFLICTS "interactive-conflicts" /** @since New in 1.7. */ #define SVN_CONFIG_OPTION_MEMORY_CACHE_SIZE "memory-cache-size" +/** @since New in 1.9. */ +#define SVN_CONFIG_OPTION_DIFF_IGNORE_CONTENT_TYPE "diff-ignore-content-type" #define SVN_CONFIG_SECTION_TUNNELS "tunnels" #define SVN_CONFIG_SECTION_AUTO_PROPS "auto-props" /** @since New in 1.8. */ @@ -138,6 +163,8 @@ typedef struct svn_config_t svn_config_t; #define SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE "exclusive-locking" /** @since New in 1.8. */ #define SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE_CLIENTS "exclusive-locking-clients" +/** @since New in 1.9. */ +#define SVN_CONFIG_OPTION_SQLITE_BUSY_TIMEOUT "busy-timeout" /** @} */ /** @name Repository conf directory configuration files strings @@ -158,9 +185,13 @@ typedef struct svn_config_t svn_config_t; #define SVN_CONFIG_OPTION_FORCE_USERNAME_CASE "force-username-case" /** @since New in 1.8. */ #define SVN_CONFIG_OPTION_HOOKS_ENV "hooks-env" +/** @since New in 1.5. */ #define SVN_CONFIG_SECTION_SASL "sasl" +/** @since New in 1.5. */ #define SVN_CONFIG_OPTION_USE_SASL "use-sasl" +/** @since New in 1.5. */ #define SVN_CONFIG_OPTION_MIN_SSF "min-encryption" +/** @since New in 1.5. */ #define SVN_CONFIG_OPTION_MAX_SSF "max-encryption" /* For repository password database */ @@ -177,7 +208,7 @@ typedef struct svn_config_t svn_config_t; #define SVN_CONFIG__DEFAULT_GLOBAL_IGNORES_LINE_1 \ "*.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo __pycache__" #define SVN_CONFIG__DEFAULT_GLOBAL_IGNORES_LINE_2 \ - "*.rej *~ #*# .#* .*.swp .DS_Store" + "*.rej *~ #*# .#* .*.swp .DS_Store [Tt]humbs.db" #endif #define SVN_CONFIG_DEFAULT_GLOBAL_IGNORES \ @@ -659,11 +690,67 @@ svn_config_ensure(const char *config_dir, */ -/** A hash-key pointing to a realmstring. Every file containing - * authentication data should have this key. +/** + * Attributes of authentication credentials. + * + * The values of these keys are C strings. + * + * @note Some of these hash keys were also used in versions < 1.9 but were + * not part of the public API (except #SVN_CONFIG_REALMSTRING_KEY which + * has been present since 1.0). + * + * @defgroup cached_authentication_data_attributes Cached authentication data attributes + * @{ + */ + +/** A hash-key pointing to a realmstring. This attribute is mandatory. + * + * @since New in 1.0. */ #define SVN_CONFIG_REALMSTRING_KEY "svn:realmstring" +/** A hash-key for usernames. + * @since New in 1.9. + */ +#define SVN_CONFIG_AUTHN_USERNAME_KEY "username" + +/** A hash-key for passwords. + * The password may be in plaintext or encrypted form, depending on + * the authentication provider. + * @since New in 1.9. + */ +#define SVN_CONFIG_AUTHN_PASSWORD_KEY "password" + +/** A hash-key for passphrases, + * such as SSL client ceritifcate passphrases. The passphrase may be in + * plaintext or encrypted form, depending on the authentication provider. + * @since New in 1.9. + */ +#define SVN_CONFIG_AUTHN_PASSPHRASE_KEY "passphrase" + +/** A hash-key for the type of a password or passphrase. The type + * indicates which provider owns the credential. + * @since New in 1.9. + */ +#define SVN_CONFIG_AUTHN_PASSTYPE_KEY "passtype" + +/** A hash-key for SSL certificates. The value is the base64-encoded DER form + * certificate. + * @since New in 1.9. + * @note The value is not human readable. + */ +#define SVN_CONFIG_AUTHN_ASCII_CERT_KEY "ascii_cert" + +/** A hash-key for recorded SSL certificate verification + * failures. Failures encoded as an ASCII integer containing any of the + * SVN_AUTH_SSL_* SSL server certificate failure bits defined in svn_auth.h. + * @since New in 1.9. + */ +#define SVN_CONFIG_AUTHN_FAILURES_KEY "failures" + + +/** @} */ + /** Use @a cred_kind and @a realmstring to locate a file within the * ~/.subversion/auth/ area. If the file exists, initialize @a *hash * and load the file contents into the hash, using @a pool. If the @@ -712,7 +799,8 @@ svn_config_write_auth_data(apr_hash_t *hash, * fully purged) to allow perusal and selective removal of credentials. * * @a cred_kind and @a realmstring specify the key of the credential. - * @a hash contains the hash data associated with the record. + * @a hash contains the hash data associated with the record. @a walk_baton + * is the baton passed to svn_config_walk_auth_data(). * * Before returning set @a *delete_cred to TRUE to remove the credential from * the cache; leave @a *delete_cred unchanged or set it to FALSE to keep the @@ -728,7 +816,7 @@ svn_config_write_auth_data(apr_hash_t *hash, */ typedef svn_error_t * (*svn_config_auth_walk_func_t)(svn_boolean_t *delete_cred, - void *cleanup_baton, + void *walk_baton, const char *cred_kind, const char *realmstring, apr_hash_t *hash, @@ -747,7 +835,7 @@ typedef svn_error_t * * * @note Removing credentials from the config-based disk store will * not purge them from any open svn_auth_baton_t instance. Consider - * using svn_auth_forget_credentials() -- from the @a cleanup_func, + * using svn_auth_forget_credentials() -- from the @a walk_func, * even -- for this purpose. * * @note Removing credentials from the config-based disk store will @@ -799,7 +887,7 @@ svn_config_get_user_config_path(const char **path, */ svn_error_t * svn_config_dup(svn_config_t **cfgp, - svn_config_t *src, + const svn_config_t *src, apr_pool_t *pool); /** Create a deep copy of the config hash @a src_hash and return diff --git a/subversion/include/svn_delta.h b/subversion/include/svn_delta.h index 7df7f3f..d949ced 100644 --- a/subversion/include/svn_delta.h +++ b/subversion/include/svn_delta.h @@ -249,6 +249,7 @@ svn_txdelta_compose_windows(const svn_txdelta_window_t *window_A, * * @since New in 1.4 * + * @since Since 1.9, @a tbuf may be NULL if @a *tlen is 0. */ void svn_txdelta_apply_instructions(svn_txdelta_window_t *window, @@ -545,10 +546,26 @@ svn_txdelta_to_svndiff(svn_stream_t *output, /** Return a writable generic stream which will parse svndiff-format * data into a text delta, invoking @a handler with @a handler_baton - * whenever a new window is ready. If @a error_on_early_close is @c - * TRUE, attempting to close this stream before it has handled the entire - * svndiff data set will result in #SVN_ERR_SVNDIFF_UNEXPECTED_END, - * else this error condition will be ignored. + * whenever a new window is ready. + * + * When the caller closes this stream, this will signal completion to + * the window handler by invoking @a handler once more, passing zero for + * the @c window argument. + * + * If @a error_on_early_close is @c TRUE, then attempt to avoid + * signaling completion to the window handler if the delta was + * incomplete. Specifically, attempting to close the stream will be + * successful only if the data written to the stream consisted of one or + * more complete windows of svndiff data and no extra bytes. Otherwise, + * closing the stream will not signal completion to the window handler, + * and will return a #SVN_ERR_SVNDIFF_UNEXPECTED_END error. Note that if + * no data at all was written, the delta is considered incomplete. + * + * If @a error_on_early_close is @c FALSE, closing the stream will + * signal completion to the window handler, regardless of how much data + * was written, and discard any pending incomplete data. + * + * Allocate the stream in @a pool. */ svn_stream_t * svn_txdelta_parse_svndiff(svn_txdelta_window_handler_t handler, diff --git a/subversion/include/svn_diff.h b/subversion/include/svn_diff.h index ac9f8fc..5b8f8d7 100644 --- a/subversion/include/svn_diff.h +++ b/subversion/include/svn_diff.h @@ -55,6 +55,7 @@ #include "svn_types.h" #include "svn_io.h" /* for svn_stream_t */ #include "svn_string.h" +#include "svn_mergeinfo.h" #ifdef __cplusplus extern "C" { @@ -402,12 +403,32 @@ typedef enum svn_diff_conflict_display_style_t /** Like svn_diff_conflict_display_modified_original_latest, but *only* showing conflicts. */ svn_diff_conflict_display_only_conflicts + + /* IMPORTANT: If you extend this enum note that it is mapped in + tools/diff/diff3.c. */ } svn_diff_conflict_display_style_t; /** Given a vtable of @a output_fns/@a output_baton for consuming * differences, output the differences in @a diff. + * + * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple + * times while processing larger diffs. + * + * @since New in 1.9. + */ +svn_error_t * +svn_diff_output2(svn_diff_t *diff, + void *output_baton, + const svn_diff_output_fns_t *output_fns, + svn_cancel_func_t cancel_func, + void *cancel_baton); + +/** Similar to svn_diff_output2(), but without cancel support. + * + * @deprecated Provided for backwards compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_diff_output(svn_diff_t *diff, void *output_baton, @@ -457,8 +478,15 @@ typedef struct svn_diff_file_options_t * of the nearest preceding line that starts with a character that might be * the initial character of a C language identifier. The default is * @c FALSE. + * @since New in 1.5. */ svn_boolean_t show_c_function; + + /** The number of context lines produced above and below modifications, if + * available. The number of context lines must be >= 0. + * + * @since New in 1.9 */ + int context_size; } svn_diff_file_options_t; /** Allocate a @c svn_diff_file_options_t structure in @a pool, initializing @@ -481,6 +509,7 @@ svn_diff_file_options_create(apr_pool_t *pool); * - --ignore-all-space, -w * - --ignore-eol-style * - --show-c-function, -p @since New in 1.5. + * - --context, -U ARG @since New in 1.9. * - --unified, -u (for compatibility, does nothing). */ svn_error_t * @@ -585,8 +614,6 @@ svn_diff_file_diff4(svn_diff_t **diff, /** A convenience function to produce unified diff output from the * diff generated by svn_diff_file_diff(). * - * @since New in 1.5. - * * Output a @a diff between @a original_path and @a modified_path in unified * context diff format to @a output_stream. Optionally supply * @a original_header and/or @a modified_header to be displayed in the header @@ -599,7 +626,38 @@ svn_diff_file_diff4(svn_diff_t **diff, * @a relative_to_dir is not @c NULL but @a relative_to_dir is not a parent * path of the target, an error is returned. Finally, if @a relative_to_dir * is a URL, an error will be returned. + * + * If @a context_size is not negative, then this number of context lines + * will be used in the generated diff output. Otherwise the legacy compile + * time default will be used. + * + * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple + * times while processing larger diffs. + * + * @since New in 1.9. + */ +svn_error_t * +svn_diff_file_output_unified4(svn_stream_t *output_stream, + svn_diff_t *diff, + const char *original_path, + const char *modified_path, + const char *original_header, + const char *modified_header, + const char *header_encoding, + const char *relative_to_dir, + svn_boolean_t show_c_function, + int context_size, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool); + +/** Similar to svn_diff_file_output_unified4(), but without cancel + * support and with @a context_size set to -1. + * + * @since New in 1.5. + * @deprecated Provided for backwards compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_diff_file_output_unified3(svn_stream_t *output_stream, svn_diff_t *diff, @@ -653,10 +711,36 @@ svn_diff_file_output_unified(svn_stream_t *output_stream, * @a conflict_latest to be displayed as conflict markers in the output. * If @a conflict_original, @a conflict_modified, @a conflict_latest and/or * @a conflict_separator is @c NULL, a default marker will be displayed. - * @a conflict_style dictates how conflicts are displayed. + * @a conflict_style dictates how conflicts are displayed. + * Uses @a scratch_pool for temporary allocations. + * + * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple + * times while processing larger diffs. + * + * @since New in 1.9. + */ +svn_error_t * +svn_diff_file_output_merge3(svn_stream_t *output_stream, + svn_diff_t *diff, + const char *original_path, + const char *modified_path, + const char *latest_path, + const char *conflict_original, + const char *conflict_modified, + const char *conflict_latest, + const char *conflict_separator, + svn_diff_conflict_display_style_t conflict_style, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool); + +/** Similar to svn_diff_file_output_merge3, but without cancel support. * * @since New in 1.6. + * + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_diff_file_output_merge2(svn_stream_t *output_stream, svn_diff_t *diff, @@ -700,7 +784,28 @@ svn_diff_file_output_merge(svn_stream_t *output_stream, svn_boolean_t display_resolved_conflicts, apr_pool_t *pool); - +/** Creates a git-like binary diff hunk describing the differences between + * @a original and @a latest. It does this by either producing either the + * literal content of both versions in a compressed format, or by describing + * one way transforms. + * + * Either @a original or @a latest may be NULL to describe that the version + * didn't exist. + * + * Writes the output to @a output_stream. + * + * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple + * times while processing larger diffs. + * + * @since New in 1.9. + */ +svn_error_t * +svn_diff_output_binary(svn_stream_t *output_stream, + svn_stream_t *original, + svn_stream_t *latest, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool); /* Diffs on in-memory structures */ @@ -762,8 +867,40 @@ svn_diff_mem_string_diff4(svn_diff_t **diff, * final line use the text "\ No newline at end of property" instead of * "\ No newline at end of file". * + * If @a context_size is not negative, then this number of context lines + * will be used in the generated diff output. Otherwise the legacy compile + * time default will be used. + * + * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple + * times while processing larger diffs. + * + * Uses @a scratch_pool for temporary allocations. + * + * @since New in 1.9 + */ +svn_error_t * +svn_diff_mem_string_output_unified3(svn_stream_t *output_stream, + svn_diff_t *diff, + svn_boolean_t with_diff_header, + const char *hunk_delimiter, + const char *original_header, + const char *modified_header, + const char *header_encoding, + const svn_string_t *original, + const svn_string_t *modified, + int context_size, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool); + +/** Similar to svn_diff_mem_string_output_unified3() but without + * cancel support and with @a context_size set to -1. + * * @since New in 1.7. Hunk delimiter "##" has the special meaning since 1.8. + * + * @deprecated Provided for backwards compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_diff_mem_string_output_unified2(svn_stream_t *output_stream, svn_diff_t *diff, @@ -781,7 +918,10 @@ svn_diff_mem_string_output_unified2(svn_stream_t *output_stream, * set to NULL. * * @since New in 1.5. + * + * @deprecated Provided for backwards compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_diff_mem_string_output_unified(svn_stream_t *output_stream, svn_diff_t *diff, @@ -802,8 +942,35 @@ svn_diff_mem_string_output_unified(svn_stream_t *output_stream, * * @a conflict_style dictates how conflicts are displayed. * + * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple + * times while processing larger diffs. + * + * Uses @a scratch_pool for temporary allocations. + * + * @since New in 1.9. + */ +svn_error_t * +svn_diff_mem_string_output_merge3(svn_stream_t *output_stream, + svn_diff_t *diff, + const svn_string_t *original, + const svn_string_t *modified, + const svn_string_t *latest, + const char *conflict_original, + const char *conflict_modified, + const char *conflict_latest, + const char *conflict_separator, + svn_diff_conflict_display_style_t style, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool); + +/** Similar to svn_diff_mem_string_output_merge2(), but without cancel support. + * * @since New in 1.6. + * + * @deprecated Provided for backwards compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_diff_mem_string_output_merge2(svn_stream_t *output_stream, svn_diff_t *diff, @@ -912,7 +1079,7 @@ typedef struct svn_diff_hunk_t svn_diff_hunk_t; /** * Allocate @a *stringbuf in @a result_pool, and read into it one line * of the diff text of @a hunk. The hunk header is not returned only the - * unidiff data lines (starting with '+', '-', or ' ') are returned. + * unidiff data lines (starting with '+', '-', or ' ') are returned. * If the @a hunk is being interpreted in reverse (i.e. the reverse * parameter of svn_diff_parse_next_patch() was @c TRUE), the diff * text will be returned in reversed form. @@ -922,8 +1089,8 @@ typedef struct svn_diff_hunk_t svn_diff_hunk_t; * hunk does not end with a newline character and @a eol is not NULL. * Temporary allocations will be performed in @a scratch_pool. * - * @note The hunk header information can be retrievied with the following - * functions: + * @note The hunk header information can be retrieved with the following + * functions: * @see svn_diff_hunk_get_original_start() * @see svn_diff_hunk_get_original_length() * @see svn_diff_hunk_get_modified_start() @@ -1074,6 +1241,14 @@ typedef struct svn_patch_t { /** * Indicates whether the patch is being interpreted in reverse. */ svn_boolean_t reverse; + + /** + * Mergeinfo parsed from svn:mergeinfo diff data, with one entry for + * forward merges and one for reverse merges. + * Either entry can be @c NULL if no such merges are part of the diff. + * @since New in 1.9. */ + svn_mergeinfo_t mergeinfo; + svn_mergeinfo_t reverse_mergeinfo; } svn_patch_t; /** An opaque type representing an open patch file. diff --git a/subversion/include/svn_dirent_uri.h b/subversion/include/svn_dirent_uri.h index c4374d7..94856f2 100644 --- a/subversion/include/svn_dirent_uri.h +++ b/subversion/include/svn_dirent_uri.h @@ -202,7 +202,7 @@ svn_dirent_join(const char *base, apr_pool_t *result_pool); /** Join multiple components onto a @a base dirent. The components are - * terminated by a @c NULL. + * terminated by a @c SVN_VA_NULL. * * If any component is the empty string, it will be ignored. * @@ -218,7 +218,7 @@ svn_dirent_join(const char *base, char * svn_dirent_join_many(apr_pool_t *result_pool, const char *base, - ...); + ...) SVN_NEEDS_SENTINEL_NULL; /** Join a base relpath (@a base) with a component (@a component). * @a component need not be a single component. @@ -354,6 +354,19 @@ char * svn_relpath_dirname(const char *relpath, apr_pool_t *result_pool); +/** Return a maximum of @a max_components components of @a relpath. This is + * an efficient way of calling svn_relpath_dirname() multiple times until only + * a specific number of components is left. + * + * Allocate the result in @a result_pool (or statically in case of 0) + * + * @since New in 1.9. + */ +const char * +svn_relpath_prefix(const char *relpath, + int max_components, + apr_pool_t *result_pool); + /** Divide the canonicalized @a uri into a uri @a *dirpath and a * (URI-decoded) relpath @a *base_name. diff --git a/subversion/include/svn_error.h b/subversion/include/svn_error.h index 3a6e4c5..5681644 100644 --- a/subversion/include/svn_error.h +++ b/subversion/include/svn_error.h @@ -105,7 +105,7 @@ svn_error_symbolic_name(apr_status_t statcode); * @note @a buf and @a bufsize are provided in the interface so that * this function is thread-safe and yet does no allocation. */ -const char *svn_err_best_message(svn_error_t *err, +const char *svn_err_best_message(const svn_error_t *err, char *buf, apr_size_t bufsize); @@ -173,6 +173,19 @@ svn_error_t * svn_error_quick_wrap(svn_error_t *child, const char *new_msg); +/** A quick n' easy way to create a wrapped exception with your own + * printf-style error message produced by passing @a fmt, using + * apr_psprintf(), before throwing it up the stack. (It uses all of the + * @a child's fields.) + * + * @since New in 1.9. + */ +svn_error_t * +svn_error_quick_wrapf(svn_error_t *child, + const char *fmt, + ...) + __attribute__((format(printf, 2, 3))); + /** Compose two errors, returning the composition as a brand new error * and consuming the original errors. Either or both of @a err1 and * @a err2 may be @c SVN_NO_ERROR. If both are not @c SVN_NO_ERROR, @@ -202,7 +215,8 @@ svn_error_compose(svn_error_t *chain, /** Return the root cause of @a err by finding the last error in its * chain (e.g. it or its children). @a err may be @c SVN_NO_ERROR, in - * which case @c SVN_NO_ERROR is returned. + * which case @c SVN_NO_ERROR is returned. The returned error should + * @em not be cleared as it shares memory with @a err. * * @since New in 1.5. */ @@ -225,7 +239,7 @@ svn_error_find_cause(svn_error_t *err, apr_status_t apr_err); * @since New in 1.2. */ svn_error_t * -svn_error_dup(svn_error_t *err); +svn_error_dup(const svn_error_t *err); /** Free the memory used by @a error, as well as all ancestors and * descendants of @a error. @@ -255,6 +269,8 @@ svn_error__locate(const char *file, (svn_error__locate(__FILE__,__LINE__), (svn_error_wrap_apr)) #define svn_error_quick_wrap \ (svn_error__locate(__FILE__,__LINE__), (svn_error_quick_wrap)) +#define svn_error_quick_wrapf \ + (svn_error__locate(__FILE__,__LINE__), (svn_error_quick_wrapf)) #endif @@ -268,6 +284,10 @@ svn_error__locate(const char *file, * what code that used to call svn_handle_error() and now calls * svn_handle_error2() does. * + * Note that this should only be used from commandline specific code, or + * code that knows that @a stream is really where the application wants + * to receive its errors on. + * * @since New in 1.2. */ void @@ -293,11 +313,13 @@ svn_handle_error(svn_error_t *error, * * @a error may not be @c NULL. * + * @note This does not clear @a error. + * * @since New in 1.2. */ void svn_handle_warning2(FILE *stream, - svn_error_t *error, + const svn_error_t *error, const char *prefix); /** Like svn_handle_warning2() but with @c prefix set to "svn: " @@ -387,10 +409,17 @@ svn_error_t *svn_error_purge_tracing(svn_error_t *err); } while (0) -/** A statement macro, similar to @c SVN_ERR, but returns an integer. +/** A statement macro intended for the main() function of the 'svn' program. + * + * Evaluate @a expr. If it yields an error, display the error on stdout + * and return @c EXIT_FAILURE. * - * Evaluate @a expr. If it yields an error, handle that error and - * return @c EXIT_FAILURE. + * @note Not for use in the library, as it prints to stderr. This macro + * no longer suits the needs of the 'svn' program, and is not generally + * suitable for third-party use as it assumes the program name is 'svn'. + * + * @deprecated Provided for backward compatibility with the 1.8 API. Consider + * using svn_handle_error2() or svn_cmdline_handle_exit_error() instead. */ #define SVN_INT_ERR(expr) \ do { \ @@ -417,18 +446,26 @@ svn_error_t *svn_error_purge_tracing(svn_error_t *err); * SVN_ERR_FS_OUT_OF_DATE and SVN_ERR_FS_NOT_FOUND are in here because it's a * non-fatal error that can be thrown when attempting to lock an item. * + * SVN_ERR_REPOS_HOOK_FAILURE refers to the pre-lock hook. + * * @since New in 1.2. */ #define SVN_ERR_IS_LOCK_ERROR(err) \ (err->apr_err == SVN_ERR_FS_PATH_ALREADY_LOCKED || \ err->apr_err == SVN_ERR_FS_NOT_FOUND || \ err->apr_err == SVN_ERR_FS_OUT_OF_DATE || \ - err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN) + err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN || \ + err->apr_err == SVN_ERR_REPOS_HOOK_FAILURE || \ + err->apr_err == SVN_ERR_FS_NO_SUCH_REVISION || \ + err->apr_err == SVN_ERR_FS_OUT_OF_DATE || \ + err->apr_err == SVN_ERR_FS_NOT_FILE) /** * Return TRUE if @a err is an error specifically related to unlocking * a path in the repository, FALSE otherwise. * + * SVN_ERR_REPOS_HOOK_FAILURE refers to the pre-unlock hook. + * * @since New in 1.2. */ #define SVN_ERR_IS_UNLOCK_ERROR(err) \ @@ -437,7 +474,8 @@ svn_error_t *svn_error_purge_tracing(svn_error_t *err); err->apr_err == SVN_ERR_FS_LOCK_OWNER_MISMATCH || \ err->apr_err == SVN_ERR_FS_NO_SUCH_LOCK || \ err->apr_err == SVN_ERR_RA_NOT_LOCKED || \ - err->apr_err == SVN_ERR_FS_LOCK_EXPIRED) + err->apr_err == SVN_ERR_FS_LOCK_EXPIRED || \ + err->apr_err == SVN_ERR_REPOS_HOOK_FAILURE) /** Evaluates to @c TRUE iff @a apr_err (of type apr_status_t) is in the given * @a category, which should be one of the @c SVN_ERR_*_CATEGORY_START @@ -626,6 +664,11 @@ typedef svn_error_t *(*svn_error_malfunction_handler_t) svn_error_malfunction_handler_t svn_error_set_malfunction_handler(svn_error_malfunction_handler_t func); +/** Return the malfunction handler that is currently in effect. + * @since New in 1.9. */ +svn_error_malfunction_handler_t +svn_error_get_malfunction_handler(void); + /** Handle a malfunction by returning an error object that describes it. * * When @a can_return is false, abort() diff --git a/subversion/include/svn_error_codes.h b/subversion/include/svn_error_codes.h index 222bc2b..f8348f4 100644 --- a/subversion/include/svn_error_codes.h +++ b/subversion/include/svn_error_codes.h @@ -150,6 +150,8 @@ extern "C" { + (22 * SVN_ERR_CATEGORY_SIZE)) #define SVN_ERR_MALFUNC_CATEGORY_START (APR_OS_START_USERERR \ + (23 * SVN_ERR_CATEGORY_SIZE)) +#define SVN_ERR_X509_CATEGORY_START (APR_OS_START_USERERR \ + + (24 * SVN_ERR_CATEGORY_SIZE)) #endif /* DOXYGEN_SHOULD_SKIP_THIS */ @@ -233,6 +235,11 @@ SVN_ERROR_START SVN_ERR_BAD_CATEGORY_START + 15, "Invalid atomic") + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_BAD_COMPRESSION_METHOD, + SVN_ERR_BAD_CATEGORY_START + 16, + "Invalid compression method") + /* xml errors */ SVN_ERRDEF(SVN_ERR_XML_ATTRIB_NOT_FOUND, @@ -255,6 +262,11 @@ SVN_ERROR_START SVN_ERR_XML_CATEGORY_START + 4, "Data cannot be safely XML-escaped") + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_XML_UNEXPECTED_ELEMENT, + SVN_ERR_XML_CATEGORY_START + 5, + "Unexpected XML element found") + /* io errors */ SVN_ERRDEF(SVN_ERR_IO_INCONSISTENT_EOL, @@ -312,6 +324,11 @@ SVN_ERROR_START SVN_ERR_STREAM_CATEGORY_START + 3, "Stream doesn't support seeking") + /** Since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_STREAM_NOT_SUPPORTED, + SVN_ERR_STREAM_CATEGORY_START + 4, + "Stream doesn't support this capability") + /* node errors */ SVN_ERRDEF(SVN_ERR_NODE_UNKNOWN_KIND, @@ -796,6 +813,61 @@ SVN_ERROR_START SVN_ERR_FS_CATEGORY_START + 52, "Could not initialize the revprop caching infrastructure.") + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_FS_MALFORMED_TXN_ID, + SVN_ERR_FS_CATEGORY_START + 53, + "Malformed transaction ID string.") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_FS_INDEX_CORRUPTION, + SVN_ERR_FS_CATEGORY_START + 54, + "Corrupt index file.") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_FS_INDEX_REVISION, + SVN_ERR_FS_CATEGORY_START + 55, + "Revision not covered by index.") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_FS_INDEX_OVERFLOW, + SVN_ERR_FS_CATEGORY_START + 56, + "Item index too large for this revision.") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_FS_CONTAINER_INDEX, + SVN_ERR_FS_CATEGORY_START + 57, + "Container index out of range.") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_FS_INDEX_INCONSISTENT, + SVN_ERR_FS_CATEGORY_START + 58, + "Index files are inconsistent.") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_FS_LOCK_OPERATION_FAILED, + SVN_ERR_FS_CATEGORY_START + 59, + "Lock operation failed") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_FS_UNSUPPORTED_TYPE, + SVN_ERR_FS_CATEGORY_START + 60, + "Unsupported FS type") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_FS_CONTAINER_SIZE, + SVN_ERR_FS_CATEGORY_START + 61, + "Container capacity exceeded.") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_FS_MALFORMED_NODEREV_ID, + SVN_ERR_FS_CATEGORY_START + 62, + "Malformed node revision ID string.") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_FS_INVALID_GENERATION, + SVN_ERR_FS_CATEGORY_START + 63, + "Invalid generation number data.") + /* repos errors */ SVN_ERRDEF(SVN_ERR_REPOS_LOCKED, @@ -910,6 +982,11 @@ SVN_ERROR_START SVN_ERR_RA_CATEGORY_START + 12, "Can't create tunnel") + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_RA_CANNOT_CREATE_SESSION, + SVN_ERR_RA_CATEGORY_START + 13, + "Can't create session") + /* ra_dav errors */ SVN_ERRDEF(SVN_ERR_RA_DAV_SOCK_INIT, @@ -979,6 +1056,16 @@ SVN_ERROR_START SVN_ERR_RA_DAV_CATEGORY_START + 13, "URL access forbidden for unknown reason") + /** @since New in 1.9 */ + SVN_ERRDEF(SVN_ERR_RA_DAV_PRECONDITION_FAILED, + SVN_ERR_RA_DAV_CATEGORY_START + 14, + "The server state conflicts with the requested preconditions") + + /** @since New in 1.9 */ + SVN_ERRDEF(SVN_ERR_RA_DAV_METHOD_NOT_ALLOWED, + SVN_ERR_RA_DAV_CATEGORY_START + 15, + "The URL doesn't allow the requested method") + /* ra_local errors */ SVN_ERRDEF(SVN_ERR_RA_LOCAL_REPOS_NOT_FOUND, @@ -1330,6 +1417,31 @@ SVN_ERROR_START SVN_ERR_MISC_CATEGORY_START + 38, "Atomic data storage is corrupt") + /** @since New in 1.8. */ + SVN_ERRDEF(SVN_ERR_UTF8PROC_ERROR, + SVN_ERR_MISC_CATEGORY_START + 39, + "utf8proc library error") + + /** @since New in 1.8. */ + SVN_ERRDEF(SVN_ERR_UTF8_GLOB, + SVN_ERR_MISC_CATEGORY_START + 40, + "Bad arguments to SQL operators GLOB or LIKE") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_CORRUPT_PACKED_DATA, + SVN_ERR_MISC_CATEGORY_START + 41, + "Packed data stream is corrupt") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_COMPOSED_ERROR, + SVN_ERR_MISC_CATEGORY_START + 42, + "Additional errors:") + + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_INVALID_INPUT, + SVN_ERR_MISC_CATEGORY_START + 43, + "Parser error: invalid input") + /* command-line client errors */ SVN_ERRDEF(SVN_ERR_CL_ARG_PARSING_ERROR, @@ -1380,6 +1492,11 @@ SVN_ERROR_START SVN_ERR_CL_CATEGORY_START + 11, "Failed processing one or more externals definitions") + /** @since New in 1.9. */ + SVN_ERRDEF(SVN_ERR_CL_REPOS_VERIFY_FAILED, + SVN_ERR_CL_CATEGORY_START + 12, + "Repository verification failed") + /* ra_svn errors */ SVN_ERRDEF(SVN_ERR_RA_SVN_CMD_ERR, @@ -1478,11 +1595,14 @@ SVN_ERROR_START "Diff data source modified unexpectedly") /* libsvn_ra_serf errors */ - /** @since New in 1.5. */ + /** @since New in 1.5. + @deprecated SSPI now handled by serf rather than libsvn_ra_serf. */ SVN_ERRDEF(SVN_ERR_RA_SERF_SSPI_INITIALISATION_FAILED, SVN_ERR_RA_SERF_CATEGORY_START + 0, "Initialization of SSPI library failed") - /** @since New in 1.5. */ + /** @since New in 1.5. + @deprecated Certificate verification now handled by serf rather + than libsvn_ra_serf. */ SVN_ERRDEF(SVN_ERR_RA_SERF_SSL_CERT_UNTRUSTED, SVN_ERR_RA_SERF_CATEGORY_START + 1, "Server SSL certificate untrusted") @@ -1507,6 +1627,90 @@ SVN_ERROR_START SVN_ERR_MALFUNC_CATEGORY_START + 1, "No non-tracing links found in the error chain") + /* X509 parser errors. + * Names of these error codes are based on tropicssl error codes. + * @since New in 1.9 */ + + SVN_ERRDEF(SVN_ERR_ASN1_OUT_OF_DATA, + SVN_ERR_X509_CATEGORY_START + 0, + "Unexpected end of ASN1 data") + + SVN_ERRDEF(SVN_ERR_ASN1_UNEXPECTED_TAG, + SVN_ERR_X509_CATEGORY_START + 1, + "Unexpected ASN1 tag") + + SVN_ERRDEF(SVN_ERR_ASN1_INVALID_LENGTH, + SVN_ERR_X509_CATEGORY_START + 2, + "Invalid ASN1 length") + + SVN_ERRDEF(SVN_ERR_ASN1_LENGTH_MISMATCH, + SVN_ERR_X509_CATEGORY_START + 3, + "ASN1 length mismatch") + + SVN_ERRDEF(SVN_ERR_ASN1_INVALID_DATA, + SVN_ERR_X509_CATEGORY_START + 4, + "Invalid ASN1 data") + + SVN_ERRDEF(SVN_ERR_X509_FEATURE_UNAVAILABLE, + SVN_ERR_X509_CATEGORY_START + 5, + "Unavailable X509 feature") + + SVN_ERRDEF(SVN_ERR_X509_CERT_INVALID_PEM, + SVN_ERR_X509_CATEGORY_START + 6, + "Invalid PEM certificate") + + SVN_ERRDEF(SVN_ERR_X509_CERT_INVALID_FORMAT, + SVN_ERR_X509_CATEGORY_START + 7, + "Invalid certificate format") + + SVN_ERRDEF(SVN_ERR_X509_CERT_INVALID_VERSION, + SVN_ERR_X509_CATEGORY_START + 8, + "Invalid certificate version") + + SVN_ERRDEF(SVN_ERR_X509_CERT_INVALID_SERIAL, + SVN_ERR_X509_CATEGORY_START + 9, + "Invalid certificate serial number") + + SVN_ERRDEF(SVN_ERR_X509_CERT_INVALID_ALG, + SVN_ERR_X509_CATEGORY_START + 10, + "Found invalid algorithm in certificate") + + SVN_ERRDEF(SVN_ERR_X509_CERT_INVALID_NAME, + SVN_ERR_X509_CATEGORY_START + 11, + "Found invalid name in certificate") + + SVN_ERRDEF(SVN_ERR_X509_CERT_INVALID_DATE, + SVN_ERR_X509_CATEGORY_START + 12, + "Found invalid date in certificate") + + SVN_ERRDEF(SVN_ERR_X509_CERT_INVALID_PUBKEY, + SVN_ERR_X509_CATEGORY_START + 13, + "Found invalid public key in certificate") + + SVN_ERRDEF(SVN_ERR_X509_CERT_INVALID_SIGNATURE, + SVN_ERR_X509_CATEGORY_START + 14, + "Found invalid signature in certificate") + + SVN_ERRDEF(SVN_ERR_X509_CERT_INVALID_EXTENSIONS, + SVN_ERR_X509_CATEGORY_START + 15, + "Found invalid extensions in certificate") + + SVN_ERRDEF(SVN_ERR_X509_CERT_UNKNOWN_VERSION, + SVN_ERR_X509_CATEGORY_START + 16, + "Unknown certificate version") + + SVN_ERRDEF(SVN_ERR_X509_CERT_UNKNOWN_PK_ALG, + SVN_ERR_X509_CATEGORY_START + 17, + "Certificate uses unknown public key algorithm") + + SVN_ERRDEF(SVN_ERR_X509_CERT_SIG_MISMATCH, + SVN_ERR_X509_CATEGORY_START + 18, + "Certificate signature mismatch") + + SVN_ERRDEF(SVN_ERR_X509_CERT_VERIFY_FAILED, + SVN_ERR_X509_CATEGORY_START + 19, + "Certficate verification failed") + SVN_ERROR_END diff --git a/subversion/include/svn_fs.h b/subversion/include/svn_fs.h index 8cef9a3..e34146d 100644 --- a/subversion/include/svn_fs.h +++ b/subversion/include/svn_fs.h @@ -65,6 +65,30 @@ svn_fs_version(void); /** An object representing a Subversion filesystem. */ typedef struct svn_fs_t svn_fs_t; +/** + * @defgroup svn_fs_backend_names Built-in back-ends + * Constants defining the currently supported built-in filesystem backends. + * + * @see svn_fs_type + * @{ + */ +/** @since New in 1.1. */ +#define SVN_FS_TYPE_BDB "bdb" +/** @since New in 1.1. */ +#define SVN_FS_TYPE_FSFS "fsfs" + +/** + * EXPERIMENTAL filesystem backend. + * + * It is not ready for general production use. Please consult the + * respective release notes on suggested usage scenarios. + * + * @since New in 1.9. + */ +#define SVN_FS_TYPE_FSX "fsx" + +/** @} */ + /** * @name Filesystem configuration options @@ -110,16 +134,39 @@ typedef struct svn_fs_t svn_fs_t; */ #define SVN_FS_CONFIG_FSFS_CACHE_NS "fsfs-cache-namespace" +/** Enable / disable the FSFS format 7 "block read" feature. + * + * @since New in 1.9. + */ +#define SVN_FS_CONFIG_FSFS_BLOCK_READ "fsfs-block-read" + +/** String with a decimal representation of the FSFS format shard size. + * Zero ("0") means that a repository with linear layout should be created. + * + * This option will only be used during the creation of new repositories + * and is otherwise ignored. + * + * @since New in 1.9. + */ +#define SVN_FS_CONFIG_FSFS_SHARD_SIZE "fsfs-shard-size" + +/** Enable / disable the FSFS format 7 logical addressing feature for a + * newly created repository. + * + * This option will only be used during the creation of new repositories + * and is otherwise ignored. + * + * @since New in 1.9. + */ +#define SVN_FS_CONFIG_FSFS_LOG_ADDRESSING "fsfs-log-addressing" + /* Note to maintainers: if you add further SVN_FS_CONFIG_FSFS_CACHE_* knobs, update fs_fs.c:verify_as_revision_before_current_plus_plus(). */ -/* See also svn_fs_type(). */ -/** @since New in 1.1. */ +/** Select the filesystem type. See also #svn_fs_type(). + * + * @since New in 1.1. */ #define SVN_FS_CONFIG_FS_TYPE "fs-type" -/** @since New in 1.1. */ -#define SVN_FS_TYPE_BDB "bdb" -/** @since New in 1.1. */ -#define SVN_FS_TYPE_FSFS "fsfs" /** Create repository format compatible with Subversion versions * earlier than 1.4. @@ -148,6 +195,18 @@ typedef struct svn_fs_t svn_fs_t; * @since New in 1.8. */ #define SVN_FS_CONFIG_PRE_1_8_COMPATIBLE "pre-1.8-compatible" + +/** Create repository format compatible with the specified Subversion + * release. The value must be a version in the same format as + * #SVN_VER_NUMBER and cannot exceed the current version. + * + * @note The @c patch component would often be ignored, due to our forward + * compatibility promises within minor release lines. It should therefore + * usually be set to @c 0. + * + * @since New in 1.9. + */ +#define SVN_FS_CONFIG_COMPATIBLE_VERSION "compatible-version" /** @} */ @@ -222,6 +281,7 @@ svn_fs_set_warning_func(svn_fs_t *fs, * * SVN_FS_TYPE_BDB Berkeley-DB implementation * SVN_FS_TYPE_FSFS Native-filesystem implementation + * SVN_FS_TYPE_FSX Experimental filesystem implementation * * If @a fs_config is @c NULL or does not contain a value for * #SVN_FS_CONFIG_FS_TYPE then the default filesystem type will be used. @@ -242,40 +302,113 @@ svn_fs_create(svn_fs_t **fs_p, * return a pointer to it in @a *fs_p. If @a fs_config is not @c * NULL, the options it contains modify the behavior of the * filesystem. The interpretation of @a fs_config is specific to the - * filesystem back-end. The opened filesystem may be closed by - * destroying @a pool. + * filesystem back-end. The opened filesystem will be allocated in + * @a result_pool may be closed by clearing or destroying that pool. + * Use @a scratch_pool for temporary allocations. * * @note The lifetime of @a fs_config must not be shorter than @a - * pool's. It's a good idea to allocate @a fs_config from @a pool or - * one of its ancestors. + * result_pool's. It's a good idea to allocate @a fs_config from + * @a result_pool or one of its ancestors. * * Only one thread may operate on any given filesystem object at once. * Two threads may access the same filesystem simultaneously only if * they open separate filesystem objects. * * @note You probably don't want to use this directly. Take a look at - * svn_repos_open2() instead. + * svn_repos_open3() instead. * + * @since New in 1.9. + */ +svn_error_t * +svn_fs_open2(svn_fs_t **fs_p, + const char *path, + apr_hash_t *fs_config, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** + * Like svn_fs_open2(), but without @a scratch_pool. + * + * @deprecated Provided for backward compatibility with the 1.8 API. * @since New in 1.1. */ +SVN_DEPRECATED svn_error_t * svn_fs_open(svn_fs_t **fs_p, const char *path, apr_hash_t *fs_config, apr_pool_t *pool); +/** The kind of action being taken by 'upgrade'. + * + * @since New in 1.9. + */ +typedef enum svn_fs_upgrade_notify_action_t +{ + /** Packing of the revprop shard has completed. + * The number parameter is the shard being processed. */ + svn_fs_upgrade_pack_revprops = 0, + + /** Removal of the non-packed revprop shard is completed. + * The number parameter is the shard being processed */ + svn_fs_upgrade_cleanup_revprops, + + /** DB format has been set to the new value. + * The number parameter is the new format number. */ + svn_fs_upgrade_format_bumped +} svn_fs_upgrade_notify_action_t; + +/** The type of an upgrade notification function. @a number is specifc + * to @a action (see #svn_fs_upgrade_notify_action_t); @a action is the + * type of action being performed. @a baton is the corresponding baton + * for the notification function, and @a scratch_pool can be used for + * temporary allocations, but will be cleared between invocations. + * + * @since New in 1.9. + */ +typedef svn_error_t *(*svn_fs_upgrade_notify_t)(void *baton, + apr_uint64_t number, + svn_fs_upgrade_notify_action_t action, + apr_pool_t *scratch_pool); + /** * Upgrade the Subversion filesystem located in the directory @a path * to the latest version supported by this library. Return * #SVN_ERR_FS_UNSUPPORTED_UPGRADE and make no changes to the - * filesystem if the requested upgrade is not supported. Use @a pool - * for necessary allocations. + * filesystem if the requested upgrade is not supported. Use + * @a scratch_pool for temporary allocations. + * + * The optional @a notify_func callback is only a general feedback that + * the operation is still in process but may be called in e.g. random shard + * order and more than once for the same shard. + * + * The optional @a cancel_func callback will be invoked as usual to allow + * the user to preempt this potentially lengthy operation. * * @note You probably don't want to use this directly. Take a look at - * svn_repos_upgrade() instead. + * svn_repos_upgrade2() instead. * + * @note Canceling an upgrade is legal but may leave remnants of previous + * format data that may not be cleaned up automatically by later calls. + * + * @since New in 1.9. + */ +svn_error_t * +svn_fs_upgrade2(const char *path, + svn_fs_upgrade_notify_t notify_func, + void *notify_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool); + +/** + * Like svn_fs_upgrade2 but with notify_func, notify_baton, cancel_func + * and cancel_baton being set to NULL. + * + * @deprecated Provided for backward compatibility with the 1.8 API. * @since New in 1.5. */ +SVN_DEPRECATED svn_error_t * svn_fs_upgrade(const char *path, apr_pool_t *pool); @@ -283,7 +416,7 @@ svn_fs_upgrade(const char *path, /** * Callback function type for progress notification. * - * @a revision is the number of the revision currently begin processed, + * @a revision is the number of the revision currently being processed, * #SVN_INVALID_REVNUM if the current stage is not linked to any specific * revision. @a baton is the callback baton. * @@ -328,7 +461,7 @@ svn_fs_path(svn_fs_t *fs, * Return a shallow copy of the configuration parameters used to open * @a fs, allocated in @a pool. It may be @c NULL. The contents of the * hash contents remains valid only for @a fs's lifetime. - * + * * @note This is just what was passed to svn_fs_create() or svn_fs_open(). * You may not modify it. * @@ -351,6 +484,17 @@ svn_error_t * svn_fs_delete_fs(const char *path, apr_pool_t *pool); +/** The type of a hotcopy notification function. @a start_revision and + * @a end_revision indicate the copied revision range. @a baton is the + * corresponding baton for the notification function, and @a scratch_pool + * can be used for temporary allocations, but will be cleared between + * invocations. + */ +typedef void (*svn_fs_hotcopy_notify_t)(void *baton, + svn_revnum_t start_revision, + svn_revnum_t end_revision, + apr_pool_t *scratch_pool); + /** * Copy a possibly live Subversion filesystem from @a src_path to * @a dest_path. If @a clean is @c TRUE, perform cleanup on the @@ -363,10 +507,39 @@ svn_fs_delete_fs(const char *path, * incremental hotcopy is not implemented, raise * #SVN_ERR_UNSUPPORTED_FEATURE. * + * For each revision range copied, @a notify_func will be called with + * staring and ending revision numbers (both inclusive and not necessarily + * different) and with the @a notify_baton. 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_fs_hotcopy3(const char *src_path, + const char *dest_path, + svn_boolean_t clean, + svn_boolean_t incremental, + svn_fs_hotcopy_notify_t notify_func, + void *notify_baton, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool); + +/** + * Like svn_fs_hotcopy3(), but with @a notify_func and @a notify_baton + * always passed as @c NULL. + * + * @deprecated Provided for backward compatibility with the 1.8 API. * @since New in 1.8. */ +SVN_DEPRECATED svn_error_t * svn_fs_hotcopy2(const char *src_path, const char *dest_path, @@ -443,6 +616,11 @@ typedef svn_error_t *(*svn_fs_freeze_func_t)(void *baton, apr_pool_t *pool); * Take an exclusive lock on @a fs to prevent commits and then invoke * @a freeze_func passing @a freeze_baton. * + * @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 The BDB backend doesn't implement this feature so most * callers should not call this function directly but should use the * higher level svn_repos_freeze() instead. @@ -710,12 +888,54 @@ svn_fs_access_add_lock_token(svn_fs_access_t *access_ctx, * @{ */ +/** Defines the possible ways two arbitrary (root, path)-pairs may be + * related. + * + * @since New in 1.9. + */ +typedef enum svn_fs_node_relation_t +{ + /** The (root, path)-pairs are not related, i.e. none of the other cases + * apply. If the roots refer to different @c svn_fs_t instances, then + * they are always considered unrelated - even if the underlying + * repository is the same. + */ + svn_fs_node_unrelated = 0, + + /** No changes have been made between the (root, path)-pairs, i.e. they + * have the same (relative) nodes in their sub-trees, corresponding sub- + * tree nodes have the same contents as well as properties and report the + * same "created-path" and "created-rev" data. This implies having a + * common ancestor. + * + * However, due to efficiency considerations, the FS implementation may + * report some combinations as merely having a common ancestor + * (@a svn_fs_node_common_ancestor) instead of actually being unchanged. + */ + svn_fs_node_unchanged, + + /** The (root, path)-pairs have a common ancestor (which may be one of + * them) but there are changes between them, i.e. they don't fall into + * the @c svn_fs_node_unchanged category. + * + * Due to efficiency considerations, the FS implementation may falsely + * classify some combinations as merely having a common ancestor that + * are, in fact, unchanged (@a svn_fs_node_unchanged). + */ + svn_fs_node_common_ancestor + +} svn_fs_node_relation_t; + /** An object representing a node-revision id. */ typedef struct svn_fs_id_t svn_fs_id_t; /** Return -1, 0, or 1 if node revisions @a a and @a b are respectively * unrelated, equivalent, or otherwise related (part of the same node). + * + * @note Consider using the more expressive #svn_fs_node_relation() instead. + * + * @see #svn_fs_node_relation */ int svn_fs_compare_ids(const svn_fs_id_t *a, @@ -725,6 +945,10 @@ svn_fs_compare_ids(const svn_fs_id_t *a, /** Return TRUE if node revisions @a id1 and @a id2 are related (part of the * same node), else return FALSE. + * + * @note Consider using the more expressive #svn_fs_node_relation() instead. + * + * @see #svn_fs_node_relation */ svn_boolean_t svn_fs_check_related(const svn_fs_id_t *id1, @@ -827,10 +1051,9 @@ svn_fs_unparse_id(const svn_fs_id_t *id, * pairs. When you commit a transaction, all of its properties become * unversioned revision properties of the new revision. (There is one * exception: the svn:date property will be automatically set on new - * transactions to the date that the transaction was created, and will + * transactions to the date that the transaction was created, and can * be overwritten when the transaction is committed by the current - * time; changes to a transaction's svn:date property will not affect - * its committed value.) + * time; see svn_fs_commit_txn.) * * Transaction names are guaranteed to contain only letters (upper- * and lower-case), digits, `-', and `.', from the ASCII character @@ -872,6 +1095,14 @@ typedef struct svn_fs_txn_t svn_fs_txn_t; */ #define SVN_FS_TXN_CHECK_LOCKS 0x00002 +/** Allow the client to specify the final svn:date of the revision by + * setting or deleting the corresponding transaction property rather + * than have it set automatically when the transaction is committed. + * + * @since New in 1.9. + */ +#define SVN_FS_TXN_CLIENT_DATE 0x00004 + /** @} */ /** @@ -925,6 +1156,17 @@ svn_fs_begin_txn(svn_fs_txn_t **txn_p, * a new filesystem revision containing the changes made in @a txn, * storing that new revision number in @a *new_rev, and return zero. * + * If #SVN_FS_TXN_CLIENT_DATE was passed to #svn_fs_begin_txn2 any + * svn:date on the transaction will be become the unversioned property + * svn:date on the revision. svn:date can have any value, it does not + * have to be a timestamp. If the transaction has no svn:date the + * revision will have no svn:date. + * + * If #SVN_FS_TXN_CLIENT_DATE was not passed to #svn_fs_begin_txn2 the + * new revision will have svn:date set to the current time at some + * point during the commit and any svn:date on the transaction will be + * lost. + * * If @a conflict_p is non-zero, use it to provide details on any * conflicts encountered merging @a txn with the most recent committed * revisions. If a conflict occurs, set @a *conflict_p to the path of @@ -962,6 +1204,7 @@ svn_fs_begin_txn(svn_fs_txn_t **txn_p, * ### conflict string * ### *new_rev will always be initialized to SVN_INVALID_REVNUM, or * ### to a valid, committed revision number + * */ svn_error_t * svn_fs_commit_txn(const char **conflict_p, @@ -1218,7 +1461,6 @@ typedef enum svn_fs_path_change_kind_t /** ignore all previous change items for path (internal-use only) */ svn_fs_path_change_reset - } svn_fs_path_change_kind_t; /** Change descriptor. @@ -1227,6 +1469,11 @@ typedef enum svn_fs_path_change_kind_t * versions. Therefore, to preserve binary compatibility, users * should not directly allocate structures of this type. * + * @note The @c text_mod, @c prop_mod and @c mergeinfo_mod flags mean the + * text, properties and mergeinfo property (respectively) were "touched" + * by the commit API; this does not mean the new value is different from + * the old value. + * * @since New in 1.6. */ typedef struct svn_fs_path_change2_t { @@ -1236,10 +1483,23 @@ typedef struct svn_fs_path_change2_t /** kind of change */ svn_fs_path_change_kind_t change_kind; - /** were there text mods? */ + /** was the text touched? + * For node_kind=dir: always false. For node_kind=file: + * modify: true iff text touched. + * add (copy): true iff text touched. + * add (plain): always true. + * delete: always false. + * replace: as for the add/copy part of the replacement. + */ svn_boolean_t text_mod; - /** were there property mods? */ + /** were the properties touched? + * modify: true iff props touched. + * add (copy): true iff props touched. + * add (plain): true iff props touched. + * delete: always false. + * replace: as for the add/copy part of the replacement. + */ svn_boolean_t prop_mod; /** what node kind is the path? @@ -1252,6 +1512,15 @@ typedef struct svn_fs_path_change2_t svn_revnum_t copyfrom_rev; const char *copyfrom_path; + /** was the mergeinfo property touched? + * modify: } true iff svn:mergeinfo property add/del/mod + * add (copy): } and fs format supports this flag. + * add (plain): } + * delete: always false. + * replace: as for the add/copy part of the replacement. + * (Note: Pre-1.9 repositories will report #svn_tristate_unknown.) + * @since New in 1.9. */ + svn_tristate_t mergeinfo_mod; /* NOTE! Please update svn_fs_path_change2_create() when adding new fields here. */ } svn_fs_path_change2_t; @@ -1349,9 +1618,25 @@ typedef struct svn_fs_history_t svn_fs_history_t; /** Set @a *history_p to an opaque node history object which * represents @a path under @a root. @a root must be a revision root. - * Use @a pool for all allocations. + * Allocate the result in @a result_pool and use @a scratch_pool for + * temporary allocations. + * + * @since New in 1.9. */ svn_error_t * +svn_fs_node_history2(svn_fs_history_t **history_p, + svn_fs_root_t *root, + const char *path, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** Same as svn_fs_node_history2() but using a single @a pool for all + * allocations. + * + * @deprecated Provided for backward compatibility with the 1.8 API. + */ +SVN_DEPRECATED +svn_error_t * svn_fs_node_history(svn_fs_history_t **history_p, svn_fs_root_t *root, const char *path, @@ -1383,7 +1668,25 @@ svn_fs_node_history(svn_fs_history_t **history_p, * the same age as the revision of that path in @a root. That is, if * @a root is a revision root based on revision X, and @a path was * modified in some revision(s) younger than X, those revisions - * younger than X will not be included for @a path. */ + * younger than X will not be included for @a path. + * + * Allocate the result in @a result_pool and use @a scratch_pool for + * temporary allocations. + * + * @since New in 1.9. */ +svn_error_t * +svn_fs_history_prev2(svn_fs_history_t **prev_history_p, + svn_fs_history_t *history, + svn_boolean_t cross_copies, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** Same as svn_fs_history_prev2() but using a single @a pool for all + * allocations. + * + * @deprecated Provided for backward compatibility with the 1.8 API. + */ +SVN_DEPRECATED svn_error_t * svn_fs_history_prev(svn_fs_history_t **prev_history_p, svn_fs_history_t *history, @@ -1437,12 +1740,34 @@ svn_fs_node_id(const svn_fs_id_t **id_p, const char *path, apr_pool_t *pool); -/** Set @a *revision to the revision in which @a path under @a root was - * created. Use @a pool for any temporary allocations. @a *revision will +/** Determine how @a path_a under @a root_a and @a path_b under @a root_b + * are related and return the result in @a relation. There is no restriction + * concerning the roots: They may refer to different repositories, be in + * arbitrary revision order and any of them may pertain to a transaction. + * @a scratch_pool is used for temporary allocations. + * + * @note Paths from different svn_fs_t will be reported as unrelated even + * if the underlying physical repository is the same. + * + * @since New in 1.9. + */ +svn_error_t * +svn_fs_node_relation(svn_fs_node_relation_t *relation, + svn_fs_root_t *root_a, + const char *path_a, + svn_fs_root_t *root_b, + const char *path_b, + apr_pool_t *scratch_pool); + +/** Set @a *revision to the revision in which the node-revision identified + * by @a path under @a root was created; that is, to the revision in which + * @a path under @a root was last modified. @a *revision will * be set to #SVN_INVALID_REVNUM for uncommitted nodes (i.e. modified nodes * under a transaction root). Note that the root of an unmodified transaction * is not itself considered to be modified; in that case, return the revision * upon which the transaction was based. + * + * Use @a pool for any temporary allocations. */ svn_error_t * svn_fs_node_created_rev(svn_revnum_t *revision, @@ -1501,6 +1826,18 @@ svn_fs_node_proplist(apr_hash_t **table_p, const char *path, apr_pool_t *pool); +/** Set @a *has_props to TRUE if the node @a path in @a root has properties + * and to FALSE if it doesn't have properties. Perform temporary allocations + * in @a scratch_pool. + * + * @since New in 1.9. + */ +svn_error_t * +svn_fs_node_has_props(svn_boolean_t *has_props, + svn_fs_root_t *root, + const char *path, + apr_pool_t *scratch_pool); + /** Change a node's property's value, or add/delete a property. * @@ -1521,10 +1858,53 @@ svn_fs_change_node_prop(svn_fs_root_t *root, /** Determine if the properties of two path/root combinations are different. * - * Set @a *changed_p to 1 if the properties at @a path1 under @a root1 differ - * from those at @a path2 under @a root2, or set it to 0 if they are the - * same. Both paths must exist under their respective roots, and both - * roots must be in the same filesystem. + * Set @a *different_p to #TRUE if the properties at @a path1 under @a root1 + * differ from those at @a path2 under @a root2, or set it to #FALSE if they + * are the same. Both paths must exist under their respective roots, and + * both roots must be in the same filesystem. + * Do any necessary temporary allocation in @a scratch_pool. + * + * @note For the purposes of preserving accurate history, certain bits of + * code (such as the repository dump code) need to care about the distinction + * between situations when the properties are "different" and "have changed + * across two points in history". We have a pair of functions that can + * answer both of these questions, svn_fs_props_different() and + * svn_fs_props_changed(). See issue 4598 for more details. + * + * @see svn_fs_props_changed + * + * @since New in 1.9. + */ +svn_error_t * +svn_fs_props_different(svn_boolean_t *different_p, + svn_fs_root_t *root1, + const char *path1, + svn_fs_root_t *root2, + const char *path2, + apr_pool_t *scratch_pool); + + +/** Determine if the properties of two path/root combinations have changed. + * + * Set @a *changed_p to #TRUE if the properties at @a path1 under @a root1 + * differ from those at @a path2 under @a root2, or set it to #FALSE if they + * are the same. Both paths must exist under their respective roots, and + * both roots must be in the same filesystem. + * Do any necessary temporary allocation in @a pool. + * + * @note For the purposes of preserving accurate history, certain bits of + * code (such as the repository dump code) need to care about the distinction + * between situations when the properties are "different" and "have changed + * across two points in history". We have a pair of functions that can + * answer both of these questions, svn_fs_props_different() and + * svn_fs_props_changed(). See issue 4598 for more details. + * + * @note This function can currently return false negatives for FSFS: + * If @a root1 and @a root2 were both transaction roots and the proplists + * of both paths had been changed in their respective transactions, + * @a changed_p would be set to #FALSE. + * + * @see svn_fs_props_different */ svn_error_t * svn_fs_props_changed(svn_boolean_t *changed_p, @@ -1624,12 +2004,14 @@ svn_fs_closest_copy(svn_fs_root_t **root_p, * * If @a adjust_inherited_mergeinfo is @c TRUE, then any inherited * mergeinfo returned in @a *catalog is normalized to represent the - * inherited mergeinfo on the path which inherits it. If + * inherited mergeinfo on the path which inherits it. This adjusted + * mergeinfo is keyed by the path which inherits it. If * @a adjust_inherited_mergeinfo is @c FALSE, then any inherited * mergeinfo is the raw explicit mergeinfo from the nearest parent * of the path with explicit mergeinfo, unadjusted for the path-wise * difference between the path and its parent. This may include - * non-inheritable mergeinfo. + * non-inheritable mergeinfo. This unadjusted mergeinfo is keyed by + * the path at which it was found. * * If @a include_descendants is TRUE, then additionally return the * mergeinfo for any descendant of any element of @a paths which has @@ -1738,6 +2120,21 @@ svn_fs_dir_entries(apr_hash_t **entries_p, const char *path, apr_pool_t *pool); +/** Take the #svn_fs_dirent_t structures in @a entries as returned by + * #svn_fs_dir_entries for @a root and determine an optimized ordering + * in which data access would most likely be efficient. Set @a *ordered_p + * to a newly allocated APR array of pointers to these #svn_fs_dirent_t + * structures. Allocate the array (but not its contents) in @a result_pool + * and use @a scratch_pool for temporaries. + * + * @since New in 1.9. + */ +svn_error_t * +svn_fs_dir_optimal_order(apr_array_header_t **ordered_p, + svn_fs_root_t *root, + apr_hash_t *entries, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /** Create a new directory named @a path in @a root. The new directory has * no entries, and no properties. @a root must be the root of a transaction, @@ -1811,6 +2208,7 @@ svn_fs_revision_link(svn_fs_root_t *from_root, svn_fs_root_t *to_root, const char *path, apr_pool_t *pool); + /* Files. */ @@ -1921,13 +2319,13 @@ typedef svn_error_t * * upon doing so. Use @a pool for allocations. * * This function is intended to support zero copy data processing. It may - * not be implemented for all data backends or not applicable for certain - * content. In that case, @a *success will always be @c FALSE. Also, this - * is a best-effort function which means that there is no guarantee that - * @a processor gets called at all for some content. + * not be implemented for all data backends or not be applicable for certain + * content. In those cases, @a *success will always be @c FALSE. Also, + * this is a best-effort function which means that there is no guarantee + * that @a processor gets called at all. * - * @note @a processor is expected to be relatively short function with - * at most O(content size) runtime. + * @note @a processor is expected to be a relatively simple function with + * a runtime of O(content size) or less. * * @since New in 1.8. */ @@ -2015,11 +2413,8 @@ svn_fs_apply_textdelta(svn_txdelta_window_handler_t *contents_p, * * Do any necessary temporary allocation in @a pool. * - * ### This is like svn_fs_apply_textdelta(), but takes the text - * straight. It is currently used only by the loader, see - * libsvn_repos/load.c. It should accept a checksum, of course, which - * would come from an (optional) header in the dump file. See - * http://subversion.tigris.org/issues/show_bug.cgi?id=1102 for more. + * @note This is like svn_fs_apply_textdelta(), but takes the text + * straight. */ svn_error_t * svn_fs_apply_text(svn_stream_t **contents_p, @@ -2029,12 +2424,54 @@ svn_fs_apply_text(svn_stream_t **contents_p, apr_pool_t *pool); +/** Check if the contents of two root/path combos are different. + * + * Set @a *different_p to #TRUE if the file contents at @a path1 under + * @a root1 differ from those at @a path2 under @a root2, or set it to + * #FALSE if they are the same. Both paths must exist under their + * respective roots, and both roots must be in the same filesystem. + * Do any necessary temporary allocation in @a scratch_pool. + * + * @note For the purposes of preserving accurate history, certain bits of + * code (such as the repository dump code) need to care about the distinction + * between situations when two files have "different" content and when the + * contents of a given file "have changed" across two points in its history. + * We have a pair of functions that can answer both of these questions, + * svn_fs_contents_different() and svn_fs_contents_changed(). See issue + * 4598 for more details. + * + * @see svn_fs_contents_changed + * + * @since New in 1.9. + */ +svn_error_t * +svn_fs_contents_different(svn_boolean_t *different_p, + svn_fs_root_t *root1, + const char *path1, + svn_fs_root_t *root2, + const char *path2, + apr_pool_t *scratch_pool); + /** Check if the contents of two root/path combos have changed. * - * Set @a *changed_p to 1 if the contents at @a path1 under @a root1 differ - * from those at @a path2 under @a root2, or set it to 0 if they are the - * same. Both paths must exist under their respective roots, and both - * roots must be in the same filesystem. + * Set @a *changed_p to #TRUE if the file contents at @a path1 under + * @a root1 differ from those at @a path2 under @a root2, or set it to + * #FALSE if they are the same. Both paths must exist under their + * respective roots, and both roots must be in the same filesystem. + * Do any necessary temporary allocation in @a pool. + * + * @note svn_fs_contents_changed() was not designed to be used to detect + * when two files have different content, but really to detect when the + * contents of a given file have changed across two points in its history. + * For the purposes of preserving accurate history, certain bits of code + * (such as the repository dump code) need to care about this distinction. + * For example, it's not an error from the FS API point of view to call + * svn_fs_apply_textdelta() and explicitly set a file's contents to exactly + * what they were before the edit was made. We have a pair of functions + * that can answer both of these questions, svn_fs_contents_changed() and + * svn_fs_contents_different(). See issue 4598 for more details. + * + * @see svn_fs_contents_different */ svn_error_t * svn_fs_contents_changed(svn_boolean_t *changed_p, @@ -2060,6 +2497,41 @@ svn_fs_youngest_rev(svn_revnum_t *youngest_p, apr_pool_t *pool); +/** + * Return filesystem format information for @a fs. + * + * Set @a *fs_format to the filesystem format number of @a fs, which is + * an integer that increases when incompatible changes are made (such as + * by #svn_fs_upgrade). + * + * Set @a *supports_version to the version number of the minimum Subversion GA + * release that can read and write @a fs. + * + * @see svn_repos_info_format + * + * @since New in 1.9. + */ +svn_error_t * +svn_fs_info_format(int *fs_format, + svn_version_t **supports_version, + svn_fs_t *fs, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** + * Return a list of admin-serviceable config files for @a fs. @a *files + * will be set to an array containing paths as C strings. + * + * @since New in 1.9. + */ +svn_error_t * +svn_fs_info_config_files(apr_array_header_t **files, + svn_fs_t *fs, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + + + /** Provide filesystem @a fs the opportunity to compress storage relating to * associated with @a revision in filesystem @a fs. Use @a pool for all * allocations. @@ -2186,12 +2658,6 @@ svn_fs_set_uuid(svn_fs_t *fs, apr_pool_t *pool); -/* Non-historical properties. */ - -/* [[Yes, do tell.]] */ - - - /** @defgroup svn_fs_locks Filesystem locks * @{ * @since New in 1.2. */ @@ -2210,7 +2676,7 @@ svn_fs_set_uuid(svn_fs_t *fs, * mainly due to the serialization for tokens for pre-commit hook. * * Locks are not secret; anyone can view existing locks in a - * filesystem. Locks are not omnipotent: they can broken and stolen + * filesystem. Locks are not omnipotent: they can be broken and stolen * by people who don't "own" the lock. (Though admins can tailor a * custom break/steal policy via libsvn_repos pre-lock hook script.) * @@ -2220,16 +2686,64 @@ svn_fs_set_uuid(svn_fs_t *fs, * expiration error (depending on the API). */ +/** Lock information for use with svn_fs_lock_many() [and svn_repos_fs_...]. + * + * @see svn_fs_lock_target_create + * + * @since New in 1.9. + */ +typedef struct svn_fs_lock_target_t svn_fs_lock_target_t; + +/** Create an <tt>svn_fs_lock_target_t</tt> allocated in @a result_pool. + * @a token can be NULL and @a current_rev can be SVN_INVALID_REVNUM. + * + * The @a token is not duplicated and so must have a lifetime at least as + * long as the returned target object. + * + * @since New in 1.9. + */ +svn_fs_lock_target_t *svn_fs_lock_target_create(const char *token, + svn_revnum_t current_rev, + apr_pool_t *result_pool); + +/** Update @a target changing the token to @a token, @a token can be NULL. + * + * The @a token is not duplicated and so must have a lifetime at least as + * long as @a target. + * + * @since New in 1.9. + */ +void svn_fs_lock_target_set_token(svn_fs_lock_target_t *target, + const char *token); -/** Lock @a path in @a fs, and set @a *lock to a lock - * representing the new lock, allocated in @a pool. +/** The callback invoked by svn_fs_lock_many() and svn_fs_unlock_many(). * - * @warning You may prefer to use svn_repos_fs_lock() instead, - * which see. + * @a path and @a lock are allocated in the result_pool passed to + * svn_fs_lock_many/svn_fs_unlock_many and so will persist beyond the + * callback invocation. @a fs_err will be cleared after the callback + * returns, use svn_error_dup() to preserve the error. + * + * If the callback returns an error no further callbacks will be made + * and svn_fs_lock_many/svn_fs_unlock_many will return an error. The + * caller cannot rely on any particular order for these callbacks and + * cannot rely on interrupting the underlying operation by returning + * an error. Returning an error stops the callbacks but any locks + * that would have been reported in further callbacks may, or may not, + * still be created/released. + * + * @since New in 1.9. + */ +typedef svn_error_t *(*svn_fs_lock_callback_t)(void *baton, + const char *path, + const svn_lock_t *lock, + svn_error_t *fs_err, + apr_pool_t *scratch_pool); + +/** Lock the paths in @a lock_targets in @a fs. * * @a fs must have a username associated with it (see * #svn_fs_access_t), else return #SVN_ERR_FS_NO_USER. Set the - * 'owner' field in the new lock to the fs username. + * 'owner' field in each new lock to the fs username. * * @a comment is optional: it's either an xml-escapable UTF8 string * which describes the lock, or it is @c NULL. @@ -2238,28 +2752,63 @@ svn_fs_set_uuid(svn_fs_t *fs, * generic DAV client; only mod_dav_svn's autoversioning feature needs * to use it. If in doubt, pass 0. * - * If path is already locked, then return #SVN_ERR_FS_PATH_ALREADY_LOCKED, + * The paths to be locked are passed as the <tt>const char *</tt> keys + * of the @a lock_targets hash. The hash values are + * <tt>svn_fs_lock_target_t *</tt> and provide the token and + * @a current_rev for each path. The token is a lock token such as can + * be generated using svn_fs_generate_lock_token() (indicating that + * the caller wants to dictate the lock token used), or it is @c NULL + * (indicating that the caller wishes to have a new token generated by + * this function). If the token is not @c NULL, and represents an + * existing lock, then the path must match the path associated with + * that existing lock. If @a current_rev is a valid revnum, then do an + * out-of-dateness check. If the revnum is less than the + * last-changed-revision of the path (or if the path doesn't exist in + * HEAD), yield an #SVN_ERR_FS_OUT_OF_DATE error for this path. + * + * If a path is already locked, then yield #SVN_ERR_FS_PATH_ALREADY_LOCKED, * unless @a steal_lock is TRUE, in which case "steal" the existing * lock, even if the FS access-context's username does not match the - * current lock's owner: delete the existing lock on @a path, and + * current lock's owner: delete the existing lock on the path, and * create a new one. * - * @a token is a lock token such as can be generated using - * svn_fs_generate_lock_token() (indicating that the caller wants to - * dictate the lock token used), or it is @c NULL (indicating that the - * caller wishes to have a new token generated by this function). If - * @a token is not @c NULL, and represents an existing lock, then @a - * path must match the path associated with that existing lock. - * * If @a expiration_date is zero, then create a non-expiring lock. * Else, the lock will expire at @a expiration_date. * - * If @a current_rev is a valid revnum, then do an out-of-dateness - * check. If the revnum is less than the last-changed-revision of @a - * path (or if @a path doesn't exist in HEAD), return - * #SVN_ERR_FS_OUT_OF_DATE. + * For each path in @a lock_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. + * + * The lock and path passed to @a lock_callback will be allocated in + * @a result_pool. Use @a scratch_pool for temporary allocations. * * @note At this time, only files can be locked. + * + * @note This function is not atomic. If it returns an error, some targets + * may remain unlocked while others may have been locked. + * + * @note You probably don't want to use this directly. Take a look at + * svn_repos_fs_lock_many() instead. + * + * @since New in 1.9. + */ +svn_error_t * +svn_fs_lock_many(svn_fs_t *fs, + 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_fs_lock_many() but locks only a single @a path and + * returns the lock in @a *lock, allocated in @a pool, or an error. + * + * @since New in 1.2. */ svn_error_t * svn_fs_lock(svn_lock_t **lock, @@ -2286,20 +2835,52 @@ svn_fs_generate_lock_token(const char **token, apr_pool_t *pool); -/** Remove the lock on @a path represented by @a token in @a fs. +/** Remove the locks on the paths in @a unlock_targets in @a fs. + * + * The paths to be unlocked are passed as <tt>const char *</tt> keys + * of the @a unlock_targets hash with the corresponding lock tokens as + * <tt>const char *</tt> values. If the token doesn't point to a + * lock, yield an #SVN_ERR_FS_BAD_LOCK_TOKEN error for this path. If + * the token points to an expired lock, yield an + * #SVN_ERR_FS_LOCK_EXPIRED error for this path. If @a fs has no + * username associated with it, yield an #SVN_ERR_FS_NO_USER unless @a + * break_lock is specified. + * + * If the token points to a lock, but the username of @a fs's access + * context doesn't match the lock's owner, yield an + * #SVN_ERR_FS_LOCK_OWNER_MISMATCH. If @a break_lock is TRUE, + * however, don't return error; allow the lock to be "broken" in any + * case. In the latter case, the token shall be @c NULL. * - * If @a token doesn't point to a lock, return #SVN_ERR_FS_BAD_LOCK_TOKEN. - * If @a token points to an expired lock, return #SVN_ERR_FS_LOCK_EXPIRED. - * If @a fs has no username associated with it, return #SVN_ERR_FS_NO_USER - * unless @a break_lock is specified. + * For each path in @a unlock_targets @a lock_callback will be invoked + * passing @a lock_baton and error that apply to path. The @a 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 @a token points to a lock, but the username of @a fs's access - * context doesn't match the lock's owner, return - * #SVN_ERR_FS_LOCK_OWNER_MISMATCH. If @a break_lock is TRUE, however, don't - * return error; allow the lock to be "broken" in any case. In the latter - * case, @a token shall be @c NULL. + * The path passed to 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 locked while others may have been unlocked. + * + * @note You probably don't want to use this directly. Take a look at + * svn_repos_fs_unlock_many() instead. * - * Use @a pool for temporary allocations. + * @since New in 1.9. + */ +svn_error_t * +svn_fs_unlock_many(svn_fs_t *fs, + 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_fs_unlock_many() but only unlocks a single path. + * + * @since New in 1.2. */ svn_error_t * svn_fs_unlock(svn_fs_t *fs, @@ -2312,7 +2893,7 @@ svn_fs_unlock(svn_fs_t *fs, /** If @a path is locked in @a fs, set @a *lock to an svn_lock_t which * represents the lock, allocated in @a pool. * - * If @a path is not locked, set @a *lock to NULL. + * If @a path is not locked or does not exist in HEAD, set @a *lock to NULL. */ svn_error_t * svn_fs_get_lock(svn_lock_t **lock, @@ -2523,6 +3104,113 @@ svn_fs_verify_root(svn_fs_root_t *root, /** @} */ +/** + * @defgroup fs_info Filesystem information subsystem + * @{ + */ + +/** + * A structure that provides some information about a filesystem. + * Returned by svn_fs_info() for #SVN_FS_TYPE_FSFS filesystems. + * + * @note Fields may be added to the end of this structure in future + * versions. Therefore, users shouldn't allocate structures of this + * type, to preserve binary compatibility. + * + * @since New in 1.9. + */ +typedef struct svn_fs_fsfs_info_t { + + /** Filesystem backend (#fs_type), i.e., the string #SVN_FS_TYPE_FSFS. */ + const char *fs_type; + + /** Shard size, or 0 if the filesystem is not currently sharded. */ + int shard_size; + + /** The smallest revision (as #svn_revnum_t) which is not in a pack file. + * @note Zero (0) if (but not iff) the format does not support packing. */ + svn_revnum_t min_unpacked_rev; + + /** TRUE if logical addressing is enabled for this repository. + * FALSE if repository uses physical addressing. */ + svn_boolean_t log_addressing; + /* ### TODO: information about fsfs.conf? rep-cache.db? write locks? */ + + /* If you add fields here, check whether you need to extend svn_fs_info() + or svn_fs_info_dup(). */ +} svn_fs_fsfs_info_t; + +/** + * A structure that provides some information about a filesystem. + * Returned by svn_fs_info() for #SVN_FS_TYPE_FSX filesystems. + * + * @note Fields may be added to the end of this structure in future + * versions. Therefore, users shouldn't allocate structures of this + * type, to preserve binary compatibility. + * + * @since New in 1.9. + */ +typedef struct svn_fs_fsx_info_t { + + /** Filesystem backend (#fs_type), i.e., the string #SVN_FS_TYPE_FSX. */ + const char *fs_type; + + /** Shard size, always > 0. */ + int shard_size; + + /** The smallest revision which is not in a pack file. */ + svn_revnum_t min_unpacked_rev; + + /* If you add fields here, check whether you need to extend svn_fs_info() + or svn_fs_info_dup(). */ + +} svn_fs_fsx_info_t; + +/** @see svn_fs_info + * @since New in 1.9. */ +typedef struct svn_fs_info_placeholder_t { + /** @see svn_fs_type */ + const char *fs_type; + + /* Do not add new fields here, to maintain compatibility with the first + released version of svn_fs_fsfs_info_t. */ +} svn_fs_info_placeholder_t; + +/** + * Set @a *fs_info to a struct describing @a fs. The type of the + * struct depends on the backend: for #SVN_FS_TYPE_FSFS, the struct will be + * of type #svn_fs_fsfs_info_t; for #SVN_FS_TYPE_FSX, it will be of type + * #svn_fs_fsx_info_t; otherwise, the struct is guaranteed to be + * (compatible with) #svn_fs_info_placeholder_t. + * + * @see #svn_fs_fsfs_info_t, #svn_fs_fsx_info_t + * + * @since New in 1.9. + */ +svn_error_t * +svn_fs_info(const svn_fs_info_placeholder_t **fs_info, + svn_fs_t *fs, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** + * Return a duplicate of @a info, allocated in @a result_pool. The returned + * struct will be of the same type as the passed-in struct, which itself + * must have been returned from svn_fs_info() or svn_fs_info_dup(). No part + * of the new structure will be shared with @a info (except static string + * constants). Use @a scratch_pool for temporary allocations. + * + * @see #svn_fs_info_placeholder_t, #svn_fs_fsfs_info_t + * + * @since New in 1.9. + */ +void * +svn_fs_info_dup(const void *info, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** @} */ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/subversion/include/svn_hash.h b/subversion/include/svn_hash.h index 46b4760..50ed10a 100644 --- a/subversion/include/svn_hash.h +++ b/subversion/include/svn_hash.h @@ -37,7 +37,6 @@ #include "svn_types.h" #include "svn_io.h" /* for svn_stream_t */ - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ diff --git a/subversion/include/svn_io.h b/subversion/include/svn_io.h index 0082917..42eb422 100644 --- a/subversion/include/svn_io.h +++ b/subversion/include/svn_io.h @@ -682,8 +682,15 @@ svn_io_files_contents_three_same_p(svn_boolean_t *same12, const char *file3, apr_pool_t *scratch_pool); -/** Create file at utf8-encoded @a file with contents @a contents. - * @a file must not already exist. +/** Create a file at utf8-encoded path @a file with the contents given + * by the null-terminated string @a contents. + * + * @a file must not already exist. If an error occurs while writing or + * closing the file, attempt to delete the file before returning the error. + * + * Write the data in 'binary' mode (#APR_FOPEN_BINARY). If @a contents + * is @c NULL, create an empty file. + * * Use @a pool for memory allocations. */ svn_error_t * @@ -691,6 +698,38 @@ svn_io_file_create(const char *file, const char *contents, apr_pool_t *pool); +/** Create a file at utf8-encoded path @a file with the contents given + * by @a contents of @a length bytes. + * + * @a file must not already exist. If an error occurs while writing or + * closing the file, attempt to delete the file before returning the error. + * + * Write the data in 'binary' mode (#APR_FOPEN_BINARY). If @a length is + * zero, create an empty file; in this case @a contents may be @c NULL. + * + * Use @a scratch_pool for temporary allocations. + * + * @since New in 1.9. + */ +svn_error_t * +svn_io_file_create_bytes(const char *file, + const void *contents, + apr_size_t length, + apr_pool_t *scratch_pool); + +/** Create an empty file at utf8-encoded path @a file. + * + * @a file must not already exist. If an error occurs while + * closing the file, attempt to delete the file before returning the error. + * + * Use @a scratch_pool for temporary allocations. + * + * @since New in 1.9. + */ +svn_error_t * +svn_io_file_create_empty(const char *file, + apr_pool_t *scratch_pool); + /** * Lock file at @a lock_file. If @a exclusive is TRUE, * obtain exclusive lock, otherwise obtain shared lock. @@ -759,6 +798,12 @@ svn_io_unlock_open_file(apr_file_t *lockfile_handle, * Flush any unwritten data from @a file to disk. Use @a pool for * memory allocations. * + * @note This function uses advanced file control operations to flush buffers + * to disk that aren't always accessible and can be very expensive on systems + * that implement flushing on all IO layers, like Windows. Please avoid using + * this function in cases where the file should just work on any network + * filesystem. In many cases a normal svn_io_file_flush() will work just fine. + * * @since New in 1.1. */ svn_error_t * @@ -804,14 +849,16 @@ svn_io_dir_file_copy(const char *src_path, * On entry to the handler, the pointed-to value should be the amount * of data which can be read or the amount of data to write. When the * handler returns, the value is reset to the amount of data actually - * read or written. Handlers are obliged to complete a read or write - * to the maximum extent possible; thus, a short read with no - * associated error implies the end of the input stream, and a short - * write should never occur without an associated error. + * read or written. The write and full read handler are obliged to + * complete a read or write to the maximum extent possible; thus, a + * short read with no associated error implies the end of the input + * stream, and a short write should never occur without an associated + * error. In Subversion 1.9 the stream api was extended to also support + * limited reads via the new svn_stream_read2() api. * - * In Subversion 1.7 reset support was added as an optional feature of - * streams. If a stream implements resetting it allows reading the data - * again after a successful call to svn_stream_reset(). + * In Subversion 1.7 mark, seek and reset support was added as an optional + * feature of streams. If a stream implements resetting it allows reading + * the data again after a successful call to svn_stream_reset(). */ typedef struct svn_stream_t svn_stream_t; @@ -861,7 +908,15 @@ typedef svn_error_t *(*svn_stream_mark_fn_t)(void *baton, * @since New in 1.7. */ typedef svn_error_t *(*svn_stream_seek_fn_t)(void *baton, - const svn_stream_mark_t *mark); + const svn_stream_mark_t *mark); + +/** Poll handler for generic streams that support incomplete reads, @see + * svn_stream_t and svn_stream_data_available(). + * + * @since New in 1.9. + */ +typedef svn_error_t *(*svn_stream_data_available_fn_t)(void *baton, + svn_boolean_t *data_available); /** Create a generic stream. @see svn_stream_t. */ svn_stream_t * @@ -873,7 +928,24 @@ void svn_stream_set_baton(svn_stream_t *stream, void *baton); -/** Set @a stream's read function to @a read_fn */ +/** Set @a stream's read functions to @a read_fn and @a read_full_fn. If + * @a read_full_fn is NULL a default implementation based on multiple calls + * to @a read_fn will be used. + * + * @since New in 1.9. + */ +void +svn_stream_set_read2(svn_stream_t *stream, + svn_read_fn_t read_fn, + svn_read_fn_t read_full_fn); + +/** Set @a stream's read function to @a read_fn. + * + * This function sets only the full read function to read_fn. + * + * @deprecated Provided for backward compatibility with the 1.8 API. + */ +SVN_DEPRECATED void svn_stream_set_read(svn_stream_t *stream, svn_read_fn_t read_fn); @@ -912,6 +984,14 @@ void svn_stream_set_seek(svn_stream_t *stream, svn_stream_seek_fn_t seek_fn); +/** Set @a stream's data available function to @a data_available_fn + * + * @since New in 1.9. + */ +void +svn_stream_set_data_available(svn_stream_t *stream, + svn_stream_data_available_fn_t data_available); + /** Create a stream that is empty for reading and infinite for writing. */ svn_stream_t * svn_stream_empty(apr_pool_t *pool); @@ -1049,6 +1129,20 @@ svn_error_t * svn_stream_for_stdout(svn_stream_t **out, apr_pool_t *pool); +/** Set @a *str to a string buffer allocated in @a result_pool that contains + * all data from the current position in @a stream to its end. @a len_hint + * specifies the initial capacity of the string buffer and may be 0. The + * buffer gets automatically resized to fit the actual amount of data being + * read from @a stream. + * + * @since New in 1.9. + */ +svn_error_t * +svn_stringbuf_from_stream(svn_stringbuf_t **str, + svn_stream_t *stream, + apr_size_t len_hint, + apr_pool_t *result_pool); + /** Return a generic stream connected to stringbuf @a str. Allocate the * stream in @a pool. */ @@ -1131,7 +1225,48 @@ svn_stream_checksummed(svn_stream_t *stream, svn_boolean_t read_all, apr_pool_t *pool); -/** Read from a generic stream. @see svn_stream_t. */ +/** Read from a generic stream until @a buffer is filled upto @a *len or + * until EOF is reached. @see svn_stream_t + * + * @since New in 1.9. + */ +svn_error_t * +svn_stream_read_full(svn_stream_t *stream, + char *buffer, + apr_size_t *len); + + +/** Returns @c TRUE if the generic @c stream supports svn_stream_read2(). + * + * @since New in 1.9. + */ +svn_boolean_t +svn_stream_supports_partial_read(svn_stream_t *stream); + +/** Read all currently available upto @a *len into @a buffer. Use + * svn_stream_read_full() if you want to wait for the buffer to be filled + * or EOF. If the stream doesn't support limited reads this function will + * return an #SVN_ERR_STREAM_NOT_SUPPORTED error. + * + * A 0 byte read signals the end of the stream. + * + * @since New in 1.9. + */ +svn_error_t * +svn_stream_read2(svn_stream_t *stream, + char *buffer, + apr_size_t *len); + + +/** Read from a generic stream until the buffer is completely filled or EOF. + * @see svn_stream_t. + * + * @note This function is a wrapper of svn_stream_read_full() now, which name + * better documents the behavior of this function. + * + * @deprecated Provided for backward compatibility with the 1.8 API + */ +SVN_DEPRECATED svn_error_t * svn_stream_read(svn_stream_t *stream, char *buffer, @@ -1209,6 +1344,20 @@ svn_stream_mark(svn_stream_t *stream, svn_error_t * svn_stream_seek(svn_stream_t *stream, const svn_stream_mark_t *mark); +/** When a stream supports polling for available data, obtain a boolean + * indicating whether data is waiting to be read. If the stream doesn't + * support polling this function returns a #SVN_ERR_STREAM_NOT_SUPPORTED + * error. + * + * If the data_available callback is implemented and the stream is at the end + * the stream will set @a *data_available to FALSE. + * + * @since New in 1.9. + */ +svn_error_t * +svn_stream_data_available(svn_stream_t *stream, + svn_boolean_t *data_available); + /** Return a writable stream which, when written to, writes to both of the * underlying streams. Both of these streams will be closed upon closure of * the returned stream; use svn_stream_disown() if this is not the desired @@ -1405,6 +1554,10 @@ typedef svn_error_t * * If the only "access" the returned stream gets is to close it * then @a open_func will only be called if @a open_on_close is TRUE. * + * Allocate the returned stream in @a result_pool. Also arrange for + * @a result_pool to be passed as the @c result_pool parameter to + * @a open_func when it is called. + * * @since New in 1.8. */ svn_stream_t * @@ -2067,6 +2220,28 @@ svn_io_file_seek(apr_file_t *file, apr_off_t *offset, apr_pool_t *pool); +/** Set the file pointer of the #APR_BUFFERED @a file to @a offset. In + * contrast to #svn_io_file_seek, this function will attempt to resize the + * internal data buffer to @a block_size bytes and to read data aligned to + * multiples of that value. The beginning of the block will be returned + * in @a buffer_start, if that is not NULL. + * Uses @a scratch_pool for temporary allocations. + * + * @note Due to limitations of the APR API, the alignment may not be + * successful. If you never use any other seek function on @a file, + * however, you are virtually guaranteed to get at least 4kByte alignment + * for all reads. + * + * @note Calling this for non-buffered files is legal but inefficient. + * + * @since New in 1.9 + */ +svn_error_t * +svn_io_file_aligned_seek(apr_file_t *file, + apr_off_t block_size, + apr_off_t *buffer_start, + apr_off_t offset, + apr_pool_t *scratch_pool); /** Wrapper for apr_file_write(). */ svn_error_t * @@ -2075,6 +2250,14 @@ svn_io_file_write(apr_file_t *file, apr_size_t *nbytes, apr_pool_t *pool); +/** Wrapper for apr_file_flush(). + * @since New in 1.9 + */ +svn_error_t * +svn_io_file_flush(apr_file_t *file, + apr_pool_t *scratch_pool); + + /** Wrapper for apr_file_write_full(). */ svn_error_t * @@ -2085,6 +2268,29 @@ svn_io_file_write_full(apr_file_t *file, apr_pool_t *pool); /** + * Writes @a nbytes bytes from @a *buf to a temporary file inside the same + * directory as @a *final_path. Then syncs the temporary file to disk and + * closes the file. After this rename the temporary file to @a final_path, + * possibly replacing an existing file. + * + * If @a copy_perms_path is not NULL, copy the permissions applied on @a + * @a copy_perms_path on the temporary file before renaming. + * + * @note This function uses advanced file control operations to flush buffers + * to disk that aren't always accessible and can be very expensive. Avoid + * using this function in cases where the file should just work on any + * network filesystem. + * + * @since New in 1.9. + */ +svn_error_t * +svn_io_write_atomic(const char *final_path, + const void *buf, + apr_size_t nbytes, + const char* copy_perms_path, + apr_pool_t *scratch_pool); + +/** * Open a unique file in @a dirpath, and write @a nbytes from @a buf to * the file before flushing it to disk and closing it. Return the name * of the newly created file in @a *tmp_path, allocated in @a pool. diff --git a/subversion/include/svn_iter.h b/subversion/include/svn_iter.h index ab88935..78044b8 100644 --- a/subversion/include/svn_iter.h +++ b/subversion/include/svn_iter.h @@ -77,7 +77,7 @@ svn_iter_apr_hash(svn_boolean_t *completed, void *baton, apr_pool_t *pool); -/** Iteration callback used in conjuction with svn_iter_apr_array(). +/** Iteration callback used in conjunction with svn_iter_apr_array(). * * Use @a pool for temporary allocation, it's cleared between invocations. * diff --git a/subversion/include/svn_mergeinfo.h b/subversion/include/svn_mergeinfo.h index ada70a2..ad1bd47 100644 --- a/subversion/include/svn_mergeinfo.h +++ b/subversion/include/svn_mergeinfo.h @@ -102,7 +102,7 @@ extern "C" { * both acceptable). */ -/* Suffix for SVN_PROP_MERGEINFO revision ranges indicating a given +/** Suffix for SVN_PROP_MERGEINFO revision ranges indicating a given range is non-inheritable. */ #define SVN_MERGEINFO_NONINHERITABLE_STR "*" @@ -113,39 +113,44 @@ extern "C" { * * (a) Strings (@c svn_string_t *) containing "unparsed mergeinfo". * - * (b) @c svn_rangelist_t, called a "rangelist". An array of non- - * overlapping merge ranges (@c svn_merge_range_t *), sorted as said by - * @c svn_sort_compare_ranges(). An empty range list is represented by - * an empty array. Unless specifically noted otherwise, all APIs require - * rangelists that describe only forward ranges, i.e. the range's start - * revision is less than its end revision. + * (b) @c svn_rangelist_t, called a "rangelist". * - * (c) @c svn_mergeinfo_t, called "mergeinfo". A hash mapping merge - * source paths (@c const char *, starting with slashes) to - * non-empty rangelist arrays. A @c NULL hash is used to represent - * no mergeinfo and an empty hash is used to represent empty - * mergeinfo. + * (c) @c svn_mergeinfo_t, called "mergeinfo". * - * (d) @c svn_mergeinfo_catalog_t, called a "mergeinfo catalog". A hash - * mapping paths (@c const char *) to @c svn_mergeinfo_t. + * (d) @c svn_mergeinfo_catalog_t, called a "mergeinfo catalog". * * Both @c svn_mergeinfo_t and @c svn_mergeinfo_catalog_t are just * typedefs for @c apr_hash_t *; there is no static type-checking, and * you still use standard @c apr_hash_t functions to interact with * them. - * - * Note that while the keys of mergeinfos are always absolute from the - * repository root, the keys of a catalog may be relative to something - * else, such as an RA session root. */ +/** An array of non-overlapping merge ranges (@c svn_merge_range_t *), + * sorted as said by @c svn_sort_compare_ranges(). An empty range list is + * represented by an empty array. + * + * Unless specifically noted otherwise, all APIs require rangelists that + * describe only forward ranges, i.e. the range's start revision is less + * than its end revision. */ typedef apr_array_header_t svn_rangelist_t; + +/** A hash mapping merge source paths to non-empty rangelist arrays. + * + * The keys are (@c const char *) absolute paths from the repository root, + * starting with slashes. A @c NULL hash represents no mergeinfo and an + * empty hash represents empty mergeinfo. */ typedef apr_hash_t *svn_mergeinfo_t; + +/** A hash mapping paths (@c const char *) to @c svn_mergeinfo_t. + * + * @note While the keys of #svn_mergeinfo_t are always absolute from the + * repository root, the keys of a catalog may be relative to something + * else, such as an RA session root. + * */ typedef apr_hash_t *svn_mergeinfo_catalog_t; /** Parse the mergeinfo from @a input into @a *mergeinfo. If no * mergeinfo is available, return an empty mergeinfo (never @c NULL). - * Perform temporary allocations in @a pool. * * If @a input is not a grammatically correct @c SVN_PROP_MERGEINFO * property, contains overlapping revision ranges of differing @@ -160,6 +165,9 @@ typedef apr_hash_t *svn_mergeinfo_catalog_t; * @a input may contain relative merge source paths, but these are * converted to absolute paths in @a *mergeinfo. * + * Allocate the result deeply in @a pool. Also perform temporary + * allocations in @a pool. + * * @since New in 1.5. */ svn_error_t * @@ -357,6 +365,8 @@ svn_rangelist_merge(svn_rangelist_t **rangelist, * @c svn_merge_range_t inheritable field when comparing @a whiteboard's * and @a *eraser's rangelists for equality. @see svn_mergeinfo_diff(). * + * Allocate the entire output in @a pool. + * * @since New in 1.5. */ svn_error_t * @@ -411,6 +421,9 @@ svn_mergeinfo_intersect(svn_mergeinfo_t *mergeinfo, * Note: @a rangelist1 and @a rangelist2 must be sorted as said by @c * svn_sort_compare_ranges(). @a *rangelist is guaranteed to be in sorted * order. + * + * Allocate the entire output in @a pool. + * * @since New in 1.5. */ svn_error_t * @@ -444,14 +457,21 @@ svn_rangelist_to_string(svn_string_t **output, const svn_rangelist_t *rangelist, apr_pool_t *pool); -/** Return a deep copy of @c svn_merge_range_t *'s in @a rangelist excluding +/** Remove non-inheritable or inheritable revision ranges from a rangelist. + * + * Set @a *inheritable_rangelist to a deep copy of @a rangelist, excluding * all non-inheritable @c svn_merge_range_t if @a inheritable is TRUE or - * excluding all inheritable @c svn_merge_range_t otherwise. If @a start and - * @a end are valid revisions and @a start is less than or equal to @a end, - * then exclude only the non-inheritable revision ranges that intersect - * inclusively with the range defined by @a start and @a end. If - * @a rangelist contains no elements, return an empty array. Allocate the - * copy in @a result_pool, use @a scratch_pool for temporary allocations. + * excluding all inheritable @c svn_merge_range_t otherwise. + * + * If @a start and @a end are valid revisions and @a start is less than or + * equal to @a end, then exclude only the (non-inheritable or inheritable) + * revision ranges that intersect inclusively with the range defined by + * @a start and @a end. + * + * If there are no remaining ranges, return an empty array. + * + * Allocate the copy in @a result_pool, and use @a scratch_pool for + * temporary allocations. * * @since New in 1.7. */ @@ -477,17 +497,26 @@ svn_rangelist_inheritable(svn_rangelist_t **inheritable_rangelist, svn_revnum_t end, apr_pool_t *pool); -/** Return a deep copy of @a mergeinfo, excluding all non-inheritable - * @c svn_merge_range_t if @a inheritable is TRUE or excluding all - * inheritable @c svn_merge_range_t otherwise. If @a start and @a end - * are valid revisions and @a start is less than or equal to @a end, - * then exclude only the non-inheritable revisions that intersect - * inclusively with the range defined by @a start and @a end. If @a path - * is not NULL remove non-inheritable ranges only for @a path. If all - * ranges are removed for a given path then remove that path as well. - * If all paths are removed or @a rangelist is empty then set - * @a *inheritable_rangelist to an empty array. Allocate the copy in - * @a result_pool, use @a scratch_pool for temporary allocations. +/** Remove non-inheritable or inheritable revision ranges from mergeinfo. + * + * Set @a *inheritable_mergeinfo to a deep copy of @a mergeinfo, excluding + * all non-inheritable @c svn_merge_range_t if @a inheritable is TRUE or + * excluding all inheritable @c svn_merge_range_t otherwise. + * + * If @a start and @a end are valid revisions and @a start is less than or + * equal to @a end, then exclude only the (non-inheritable or inheritable) + * revisions that intersect inclusively with the range defined by @a start + * and @a end. + * + * If @a path is not NULL remove (non-inheritable or inheritable) ranges + * only for @a path. + * + * If all ranges are removed for a given path then remove that path as well. + * If @a mergeinfo is initially empty or all paths are removed from it then + * set @a *inheritable_mergeinfo to an empty mergeinfo. + * + * Allocate the copy in @a result_pool, and use @a scratch_pool for + * temporary allocations. * * @since New in 1.7. */ diff --git a/subversion/include/svn_opt.h b/subversion/include/svn_opt.h index 25da44f..1c85b61 100644 --- a/subversion/include/svn_opt.h +++ b/subversion/include/svn_opt.h @@ -24,8 +24,8 @@ * @brief Option and argument parsing for Subversion command lines */ -#ifndef SVN_OPTS_H -#define SVN_OPTS_H +#ifndef SVN_OPT_H +#define SVN_OPT_H #include <apr.h> #include <apr_pools.h> @@ -656,6 +656,10 @@ svn_opt_parse_all_args(apr_array_header_t **args_p, * canonical form if @a path is in canonical form. * * @since New in 1.1. + * @since Since 1.6.5, this returns an error if @a path contains a peg + * specifier with no path before it, such as "@abc". + * @since Since 1.9.0, this no longer returns an error if @a path contains a peg + * specifier with no path before it, such as "@abc". */ svn_error_t * svn_opt_parse_path(svn_opt_revision_t *rev, @@ -776,4 +780,4 @@ svn_opt_print_help(apr_getopt_t *os, } #endif /* __cplusplus */ -#endif /* SVN_OPTS_H */ +#endif /* SVN_OPT_H */ diff --git a/subversion/include/svn_path.h b/subversion/include/svn_path.h index 3478003..20452c1 100644 --- a/subversion/include/svn_path.h +++ b/subversion/include/svn_path.h @@ -114,7 +114,7 @@ char * svn_path_join(const char *base, const char *component, apr_pool_t *pool); /** Join multiple components onto a @a base path, allocated in @a pool. The - * components are terminated by a @c NULL. + * components are terminated by a @c SVN_VA_NULL. * * If any component is the empty string, it will be ignored. * @@ -131,7 +131,9 @@ svn_path_join(const char *base, const char *component, apr_pool_t *pool); */ SVN_DEPRECATED char * -svn_path_join_many(apr_pool_t *pool, const char *base, ...); +svn_path_join_many(apr_pool_t *pool, + const char *base, + ...) SVN_NEEDS_SENTINEL_NULL; /** Get the basename of the specified canonicalized @a path. The @@ -716,10 +718,10 @@ svn_path_resolve_repos_relative_url(const char **absolute_url, const char *repos_root_url, apr_pool_t *pool); -/* Return a copy of @a path, allocated from @a pool, for which control - * characters have been escaped using the form \NNN (where NNN is the +/** Return a copy of @a path, allocated from @a pool, for which control + * characters have been escaped using the form "\NNN" (where NNN is the * octal representation of the byte's ordinal value). - * + * * @since New in 1.8. */ const char * svn_path_illegal_path_escape(const char *path, apr_pool_t *pool); diff --git a/subversion/include/svn_props.h b/subversion/include/svn_props.h index 1f2bbbf..e920b03 100644 --- a/subversion/include/svn_props.h +++ b/subversion/include/svn_props.h @@ -440,13 +440,20 @@ svn_prop_name_is_valid(const char *prop_name); * @verbatim /trunk: 1-6,9,37-38 /trunk/foo: 10 @endverbatim + * @since New in 1.5. */ #define SVN_PROP_MERGEINFO SVN_PROP_PREFIX "mergeinfo" -/** Property used to record inheritable configuration auto-props. */ +/** Property used to record inheritable configuration auto-props. + * + * @since New in 1.8. + */ #define SVN_PROP_INHERITABLE_AUTO_PROPS SVN_PROP_PREFIX "auto-props" -/** Property used to record inheritable configuration ignores. */ +/** Property used to record inheritable configuration ignores. + * + * @since New in 1.8. + */ #define SVN_PROP_INHERITABLE_IGNORES SVN_PROP_PREFIX "global-ignores" /** Meta-data properties. @@ -671,7 +678,7 @@ svn_prop_name_is_valid(const char *prop_name); */ #define SVN_PROP_TXN_PREFIX SVN_PROP_PREFIX "txn-" -/** Identifies the client version compability level. For clients +/** Identifies the client version compatibility level. For clients * compiled against Subversion libraries, this is @c SVN_VER_NUMBER. * Third-party implementations are advised to use similar formatting * for values of this property. diff --git a/subversion/include/svn_ra.h b/subversion/include/svn_ra.h index cf6f612..a3ab672 100644 --- a/subversion/include/svn_ra.h +++ b/subversion/include/svn_ra.h @@ -134,7 +134,10 @@ typedef svn_error_t * apr_pool_t *pool); -/** A function type for retrieving the youngest revision from a repos. */ +/** A function type for retrieving the youngest revision from a repos. + * @deprecated Provided for backward compatibility with the 1.8 API. + */ +/* ### It seems this type was never used by the API, since 1.0.0. */ typedef svn_error_t *(*svn_ra_get_latest_revnum_func_t)( void *session_baton, svn_revnum_t *latest_revnum); @@ -267,6 +270,64 @@ typedef svn_error_t *(*svn_ra_replay_revfinish_callback_t)( apr_hash_t *rev_props, apr_pool_t *pool); + +/** + * Callback function that checks if an ra_svn tunnel called + * @a tunnel_name is handled by the callbakcs or the default + * implementation. + * + * @a tunnel_baton is the baton as originally passed to ra_open. + * + * @since New in 1.9. + */ +typedef svn_boolean_t (*svn_ra_check_tunnel_func_t)( + void *tunnel_baton, const char *tunnel_name); + +/** + * Callback function for closing a tunnel in ra_svn. + * + * This function will be called when the pool that owns the tunnel + * connection is cleared or destroyed. + * + * @a close_baton is the baton as returned from the + * svn_ra_open_tunnel_func_t. + * + * @a tunnel_baton was returned by the open-tunnel callback. + * + * @since New in 1.9. + */ +typedef void (*svn_ra_close_tunnel_func_t)( + void *close_baton, void *tunnel_baton); + +/** + * Callback function for opening a tunnel in ra_svn. + * + * Given the @a tunnel_name, tunnel @a user and server @a hostname and + * @a port, open a tunnel to the server and return its file handles, + * which are owned by @a pool, in @a request and @a response. + * + * @a request and @a response represent the standard input and output, + * respectively, of the process on the other end of the tunnel. + * + * If @a *close_func is set it will be called with @a close_baton when + * the tunnel is closed. + * + * The optional @a cancel_func callback can be invoked as usual to allow + * the user to preempt potentially lengthy operations. + * + * @a tunnel_baton is the baton as set in the callbacks. + * + * @since New in 1.9. + */ +typedef svn_error_t *(*svn_ra_open_tunnel_func_t)( + svn_stream_t **request, svn_stream_t **response, + svn_ra_close_tunnel_func_t *close_func, void **close_baton, + void *tunnel_baton, + const char *tunnel_name, const char *user, + const char *hostname, int port, + svn_cancel_func_t cancel_func, void *cancel_baton, + apr_pool_t *pool); + /** * The update Reporter. @@ -535,6 +596,31 @@ typedef struct svn_ra_callbacks2_t */ svn_ra_get_wc_contents_func_t get_wc_contents; + /** Check-tunnel callback + * + * If not @c NULL, and open_tunnel_func is also not @c NULL, this + * callback will be invoked to check if open_tunnel_func should be + * used to create a specific tunnel, or if the default tunnel + * implementation (either built-in or configured in the client + * configuration file) should be used instead. + * @since New in 1.9. + */ + svn_ra_check_tunnel_func_t check_tunnel_func; + + /** Open-tunnel callback + * + * If not @c NULL, this callback will be invoked to create a tunnel + * for a ra_svn connection that needs one, overriding any tunnel + * definitions in the client config file. This callback is used only + * for ra_svn and ignored by the other RA modules. + * @since New in 1.9. + */ + svn_ra_open_tunnel_func_t open_tunnel_func; + + /** A baton used with open_tunnel_func and close_tunnel_func. + * @since New in 1.9. + */ + void *tunnel_baton; } svn_ra_callbacks2_t; /** Similar to svn_ra_callbacks2_t, except that the progress @@ -899,6 +985,10 @@ svn_ra_rev_prop(svn_ra_session_t *session, * Use @a pool for memory allocation. * * @since New in 1.5. + * + * @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 URL, not a relative path. */ svn_error_t * svn_ra_get_commit_editor3(svn_ra_session_t *session, @@ -1004,11 +1094,10 @@ svn_ra_get_file(svn_ra_session_t *session, * callers want to know, and some don't.) * * If @a props is non @c NULL, set @a *props to contain the properties of - * the directory. This means @em all properties: not just ones controlled by - * the user and stored in the repository fs, but non-tweakable ones - * generated by the SCM system itself (e.g. 'wcprops', 'entryprops', - * etc.) The keys are <tt>const char *</tt>, values are - * <tt>@c svn_string_t *</tt>. + * the directory, including properties that are non-tweakable and + * generated by the SCM system itself (such as #svn_prop_wc_kind and + * #svn_prop_entry_kind properties). The keys are <tt>const char *</tt>, + * values are <tt>@c svn_string_t *</tt>. * * @since New in 1.4. */ @@ -1463,8 +1552,8 @@ svn_ra_do_diff(svn_ra_session_t *session, * was added or deleted). Each path is an <tt>const char *</tt>, relative * to the @a session's common parent. * - * If @a limit is non-zero only invoke @a receiver on the first @a limit - * logs. + * If @a limit is greater than zero only invoke @a receiver on the first + * @a limit logs. * * If @a discover_changed_paths, then each call to @a receiver passes a * <tt>const apr_hash_t *</tt> for the receiver's @a changed_paths argument; @@ -1507,7 +1596,6 @@ svn_ra_do_diff(svn_ra_session_t *session, * * @since New in 1.5. */ - svn_error_t * svn_ra_get_log2(svn_ra_session_t *session, const apr_array_header_t *paths, @@ -1708,6 +1796,12 @@ svn_ra_get_location_segments(svn_ra_session_t *session, * to support reversion of the revision range for @a include_merged_revision * @c FALSE reporting by switching @a end with @a start. * + * @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 * @@ -1811,8 +1905,12 @@ svn_ra_unlock(svn_ra_session_t *session, /** * If @a path is locked, set @a *lock to an svn_lock_t which - * represents the lock, allocated in @a pool. If @a path is not - * locked, set @a *lock to NULL. + * represents the lock, allocated in @a pool. + * + * If @a path is not locked or does not exist in HEAD, set @a *lock to NULL. + * + * @note Before 1.9, this function could return SVN_ERR_FS_NOT_FOUND + * when @a path didn't exist in HEAD on specific ra layers. * * @since New in 1.2. */ diff --git a/subversion/include/svn_ra_svn.h b/subversion/include/svn_ra_svn.h index 9c556b8..c968e40 100644 --- a/subversion/include/svn_ra_svn.h +++ b/subversion/include/svn_ra_svn.h @@ -165,9 +165,9 @@ typedef struct svn_ra_svn_item_t typedef svn_error_t *(*svn_ra_svn_edit_callback)(void *baton); /** Initialize a connection structure for the given socket or - * input/output files. + * input/output streams. * - * Either @a sock or @a in_file/@a out_file must be set, not both. + * Either @a sock or @a in_stream/@a out_stream must be set, not both. * @a compression_level specifies the desired network data compression * level (zlib) from 0 (no compression) to 9 (best but slowest). * @@ -184,10 +184,29 @@ typedef svn_error_t *(*svn_ra_svn_edit_callback)(void *baton); * It defines the number of bytes that must have been sent since the last * check before the next check will be made. * + * @note If @a out_stream is an wrapped apr_file_t* the backing file will be + * used for some operations. + * * Allocate the result in @a pool. * + * @since New in 1.9 + */ +svn_ra_svn_conn_t *svn_ra_svn_create_conn4(apr_socket_t *sock, + svn_stream_t *in_stream, + svn_stream_t *out_stream, + int compression_level, + apr_size_t zero_copy_limit, + apr_size_t error_check_interval, + apr_pool_t *result_pool); + + +/** Similar to svn_ra_svn_create_conn4() but only supports apr_file_t handles + * instead of the more generic streams. + * * @since New in 1.8 + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_ra_svn_conn_t *svn_ra_svn_create_conn3(apr_socket_t *sock, apr_file_t *in_file, apr_file_t *out_file, @@ -268,6 +287,12 @@ svn_ra_svn_conn_remote_host(svn_ra_svn_conn_t *conn); * * Upon successful completion of the edit, the editor will invoke @a callback * with @a callback_baton as an argument. + * + * @note The @c copyfrom_path parameter passed to the @c add_file and + * @c add_directory methods of the returned editor may be either a URL or a + * relative path, and is transferred verbatim to the receiving end of the + * connection. See svn_ra_svn_drive_editor2() for information on the + * receiving end of the connection. */ void svn_ra_svn_get_editor(const svn_delta_editor_t **editor, @@ -283,6 +308,13 @@ svn_ra_svn_get_editor(const svn_delta_editor_t **editor, * if @a for_replay is TRUE. * * @since New in 1.4. + * + * @note The @c copyfrom_path parameter passed to the @c add_file and + * @c add_directory methods of the receiving editor will be canonicalized + * either as a URL or as a relative path (starting with a slash) according + * to which kind was sent by the driving end of the connection. See + * svn_ra_svn_get_editor() for information on the driving end of the + * connection. */ svn_error_t * svn_ra_svn_drive_editor2(svn_ra_svn_conn_t *conn, 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 } diff --git a/subversion/include/svn_sorts.h b/subversion/include/svn_sorts.h index b9e05e5..3a6a838 100644 --- a/subversion/include/svn_sorts.h +++ b/subversion/include/svn_sorts.h @@ -52,16 +52,7 @@ extern "C" { /** This structure is used to hold a key/value from a hash table. * @note Private. For use by Subversion's own code only. See issue #1644. */ -typedef struct svn_sort__item_t { - /** pointer to the key */ - const void *key; - - /** size of the key */ - apr_ssize_t klen; - - /** pointer to the value */ - void *value; -} svn_sort__item_t; +typedef struct svn_sort__item_t svn_sort__item_t; /** Compare two @c svn_sort__item_t's, returning an integer greater than, @@ -149,73 +140,6 @@ int svn_sort_compare_ranges(const void *a, const void *b); -/** Sort @a ht according to its keys, return an @c apr_array_header_t - * containing @c svn_sort__item_t structures holding those keys and values - * (i.e. for each @c svn_sort__item_t @a item in the returned array, - * @a item->key and @a item->size are the hash key, and @a item->value points to - * the hash value). - * - * Storage is shared with the original hash, not copied. - * - * @a comparison_func should take two @c svn_sort__item_t's and return an - * integer greater than, equal to, or less than 0, according as the first item - * is greater than, equal to, or less than the second. - * - * @note Private. For use by Subversion's own code only. See issue #1644. - * - * @note This function and the @c svn_sort__item_t should go over to APR. - */ -apr_array_header_t * -svn_sort__hash(apr_hash_t *ht, - int (*comparison_func)(const svn_sort__item_t *, - const svn_sort__item_t *), - apr_pool_t *pool); - -/* Return the lowest index at which the element @a *key should be inserted into - * the array @a array, according to the ordering defined by @a compare_func. - * The array must already be sorted in the ordering defined by @a compare_func. - * @a compare_func is defined as for the C stdlib function bsearch(). - * - * @note Private. For use by Subversion's own code only. - */ -int -svn_sort__bsearch_lower_bound(const void *key, - const apr_array_header_t *array, - int (*compare_func)(const void *, const void *)); - -/* Insert a shallow copy of @a *new_element into the array @a array at the index - * @a insert_index, growing the array and shuffling existing elements along to - * make room. - * - * @note Private. For use by Subversion's own code only. - */ -void -svn_sort__array_insert(const void *new_element, - apr_array_header_t *array, - int insert_index); - - -/* Remove @a elements_to_delete elements starting at @a delete_index from the - * array @a arr. If @a delete_index is not a valid element of @a arr, - * @a elements_to_delete is not greater than zero, or - * @a delete_index + @a elements_to_delete is greater than @a arr->nelts, - * then do nothing. - * - * @note Private. For use by Subversion's own code only. - */ -void -svn_sort__array_delete(apr_array_header_t *arr, - int delete_index, - int elements_to_delete); - -/* Reverse the order of elements in @a array, in place. - * - * @note Private. For use by Subversion's own code only. - */ -void -svn_sort__array_reverse(apr_array_header_t *array, - apr_pool_t *scratch_pool); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/subversion/include/svn_string.h b/subversion/include/svn_string.h index d8ce02b..82c6fd6 100644 --- a/subversion/include/svn_string.h +++ b/subversion/include/svn_string.h @@ -140,6 +140,8 @@ svn_string_create_empty(apr_pool_t *pool); /** Create a new string copied from a generic string of bytes, @a bytes, of * length @a size bytes. @a bytes is NOT assumed to be null-terminated, but * the new string will be. + * + * @since Since 1.9, @a bytes can be NULL if @a size is zero. */ svn_string_t * svn_string_ncreate(const char *bytes, apr_size_t size, apr_pool_t *pool); @@ -168,7 +170,11 @@ svn_string_createv(apr_pool_t *pool, const char *fmt, va_list ap) svn_boolean_t svn_string_isempty(const svn_string_t *str); -/** Return a duplicate of @a original_string. */ +/** Return a duplicate of @a original_string. + * + * @since Since 1.9, @a original_string can be NULL in which case NULL will + * be returned. + */ svn_string_t * svn_string_dup(const svn_string_t *original_string, apr_pool_t *pool); @@ -205,6 +211,8 @@ svn_stringbuf_create(const char *cstring, apr_pool_t *pool); /** Create a new stringbuf copied from the generic string of bytes, @a bytes, * of length @a size bytes. @a bytes is NOT assumed to be null-terminated, * but the new stringbuf will be. + * + * @since Since 1.9, @a bytes can be NULL if @a size is zero. */ svn_stringbuf_t * svn_stringbuf_ncreate(const char *bytes, apr_size_t size, apr_pool_t *pool); @@ -232,6 +240,15 @@ svn_stringbuf_create_ensure(apr_size_t minimum_size, apr_pool_t *pool); svn_stringbuf_t * svn_stringbuf_create_from_string(const svn_string_t *str, apr_pool_t *pool); +/** Create a new stringbuf using the given @a str as initial buffer. + * Allocate the result in @a pool. In contrast to #svn_stringbuf_create, + * the contents of @a str may change when the stringbuf gets modified. + * + * @since New in 1.9 + */ +svn_stringbuf_t * +svn_stringbuf_create_wrap(char *str, apr_pool_t *pool); + /** Create a new stringbuf by printf-style formatting using @a fmt and the * variable arguments, which are as appropriate for apr_psprintf(). */ @@ -288,25 +305,37 @@ svn_stringbuf_fillchar(svn_stringbuf_t *str, unsigned char c); * The advantages extend beyond the actual call because the reduced * register pressure allows for more optimization within the caller. * - * reallocs if necessary. @a targetstr is affected, nothing else is. + * Reallocs if necessary. @a targetstr is affected, nothing else is. * @since New in 1.7. */ void svn_stringbuf_appendbyte(svn_stringbuf_t *targetstr, char byte); -/** Append an array of bytes onto @a targetstr. +/** Append the array of bytes @a bytes of length @a count onto @a targetstr. * - * reallocs if necessary. @a targetstr is affected, nothing else is. + * Reallocs if necessary. @a targetstr is affected, nothing else is. + * + * @since 1.9 @a bytes can be NULL if @a count is zero. */ void svn_stringbuf_appendbytes(svn_stringbuf_t *targetstr, const char *bytes, apr_size_t count); +/** Append @a byte @a count times onto @a targetstr. + * + * Reallocs if necessary. @a targetstr is affected, nothing else is. + * @since New in 1.9. + */ +void +svn_stringbuf_appendfill(svn_stringbuf_t *targetstr, + char byte, + apr_size_t count); + /** Append the stringbuf @c appendstr onto @a targetstr. * - * reallocs if necessary. @a targetstr is affected, nothing else is. + * Reallocs if necessary. @a targetstr is affected, nothing else is. */ void svn_stringbuf_appendstr(svn_stringbuf_t *targetstr, @@ -314,22 +343,25 @@ svn_stringbuf_appendstr(svn_stringbuf_t *targetstr, /** Append the C string @a cstr onto @a targetstr. * - * reallocs if necessary. @a targetstr is affected, nothing else is. + * Reallocs if necessary. @a targetstr is affected, nothing else is. */ void svn_stringbuf_appendcstr(svn_stringbuf_t *targetstr, const char *cstr); -/** Read @a count bytes from @a bytes and insert them into @a str at - * position @a pos and following. The resulting string will be - * @c count+str->len bytes long. If @c pos is larger or equal to the - * number of bytes currently used in @a str, simply append @a bytes. +/** Insert into @a str at position @a pos an array of bytes @a bytes + * which is @a count bytes long. + * + * The resulting string will be @c count+str->len bytes long. If + * @a pos is larger than or equal to @c str->len, simply append @a bytes. * * Reallocs if necessary. @a str is affected, nothing else is. * - * @note The inserted string may be a sub-range if @a str. + * @note The inserted string may be a sub-range of @a str. * * @since New in 1.8. + * + * @since Since 1.9, @a bytes can be NULL if @a count is zero. */ void svn_stringbuf_insert(svn_stringbuf_t *str, @@ -337,9 +369,10 @@ svn_stringbuf_insert(svn_stringbuf_t *str, const char *bytes, apr_size_t count); -/** Removes @a count bytes from @a str, starting at position @a pos. - * If that range exceeds the current string data, @a str gets truncated - * at @a pos. If the latter is larger or equal to @c str->pos, this will +/** Remove @a count bytes from @a str, starting at position @a pos. + * + * If that range exceeds the current string data, truncate @a str at + * @a pos. If @a pos is larger than or equal to @c str->len, this will * be a no-op. Otherwise, the resulting string will be @c str->len-count * bytes long. * @@ -351,8 +384,8 @@ svn_stringbuf_remove(svn_stringbuf_t *str, apr_size_t count); /** Replace in @a str the substring which starts at @a pos and is @a - * old_count bytes long with a new substring @a bytes (which is @a - * new_count bytes long). + * old_count bytes long with a new substring @a bytes which is @a + * new_count bytes long. * * This is faster but functionally equivalent to the following sequence: * @code @@ -361,6 +394,8 @@ svn_stringbuf_remove(svn_stringbuf_t *str, * @endcode * * @since New in 1.8. + * + * @since Since 1.9, @a bytes can be NULL if @a new_count is zero. */ void svn_stringbuf_replace(svn_stringbuf_t *str, @@ -407,9 +442,11 @@ svn_string_compare_stringbuf(const svn_string_t *str1, * @{ */ -/** Divide @a input into substrings along @a sep_chars boundaries, return an - * array of copies of those substrings (plain const char*), allocating both - * the array and the copies in @a pool. +/** Divide @a input into substrings, interpreting any char from @a sep + * as a token separator. + * + * Return an array of copies of those substrings (plain const char*), + * allocating both the array and the copies in @a pool. * * None of the elements added to the array contain any of the * characters in @a sep_chars, and none of the new elements are empty @@ -504,6 +541,7 @@ svn_cstring_casecmp(const char *str1, const char *str2); * Assume that the number is represented in base @a base. * Raise an error if conversion fails (e.g. due to overflow), or if the * converted number is smaller than @a minval or larger than @a maxval. + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ @@ -516,6 +554,7 @@ svn_cstring_strtoi64(apr_int64_t *n, const char *str, * Parse the C string @a str into a 64 bit number, and return it in @a *n. * Assume that the number is represented in base 10. * Raise an error if conversion fails (e.g. due to overflow). + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ @@ -526,6 +565,7 @@ svn_cstring_atoi64(apr_int64_t *n, const char *str); * Parse the C string @a str into a 32 bit number, and return it in @a *n. * Assume that the number is represented in base 10. * Raise an error if conversion fails (e.g. due to overflow). + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ @@ -537,6 +577,7 @@ svn_cstring_atoi(int *n, const char *str); * it in @a *n. Assume that the number is represented in base @a base. * Raise an error if conversion fails (e.g. due to overflow), or if the * converted number is smaller than @a minval or larger than @a maxval. + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ @@ -549,6 +590,7 @@ svn_cstring_strtoui64(apr_uint64_t *n, const char *str, * Parse the C string @a str into an unsigned 64 bit number, and return * it in @a *n. Assume that the number is represented in base 10. * Raise an error if conversion fails (e.g. due to overflow). + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ @@ -559,12 +601,23 @@ svn_cstring_atoui64(apr_uint64_t *n, const char *str); * Parse the C string @a str into an unsigned 32 bit number, and return * it in @a *n. Assume that the number is represented in base 10. * Raise an error if conversion fails (e.g. due to overflow). + * Leading whitespace in @a str is skipped in a locale-dependent way. * * @since New in 1.7. */ svn_error_t * svn_cstring_atoui(unsigned int *n, const char *str); +/** + * Skip the common prefix @a prefix from the C string @a str, and return + * a pointer to the next character after the prefix. + * Return @c NULL if @a str does not start with @a prefix. + * + * @since New in 1.9. + */ +const char * +svn_cstring_skip_prefix(const char *str, const char *prefix); + /** @} */ /** @} */ diff --git a/subversion/include/svn_types.h b/subversion/include/svn_types.h index 1ad2194..f1a0850 100644 --- a/subversion/include/svn_types.h +++ b/subversion/include/svn_types.h @@ -32,6 +32,7 @@ #include <limits.h> /* for ULONG_MAX */ #include <apr.h> /* for apr_size_t, apr_int64_t, ... */ +#include <apr_version.h> #include <apr_errno.h> /* for apr_status_t */ #include <apr_pools.h> /* for apr_pool_t */ #include <apr_hash.h> /* for apr_hash_t */ @@ -64,6 +65,50 @@ extern "C" { #endif +/** Macro used to mark experimental functions. + * + * @since New in 1.9. + */ +#ifndef SVN_EXPERIMENTAL +# if !defined(SWIGPERL) && !defined(SWIGPYTHON) && !defined(SWIGRUBY) +# if defined(__has_attribute) +# if __has_attribute(__warning__) +# define SVN_EXPERIMENTAL __attribute__((warning("experimental function used"))) +# else +# define SVN_EXPERIMENTAL +# endif +# elif !defined(__llvm__) && defined(__GNUC__) \ + && (__GNUC__ >= 4 || (__GNUC__==3 && __GNUC_MINOR__>=1)) +# define SVN_EXPERIMENTAL __attribute__((warning("experimental function used"))) +# elif defined(_MSC_VER) && _MSC_VER >= 1300 +# define SVN_EXPERIMENTAL __declspec(deprecated("experimental function used")) +# else +# define SVN_EXPERIMENTAL +# endif +# else +# define SVN_EXPERIMENTAL +# endif +#endif + +/** Macro used to mark functions that require a final null sentinel argument. + * + * @since New in 1.9. + */ +#ifndef SVN_NEEDS_SENTINEL_NULL +# if defined(__has_attribute) +# if __has_attribute(__sentinel__) +# define SVN_NEEDS_SENTINEL_NULL __attribute__((sentinel)) +# else +# define SVN_NEEDS_SENTINEL_NULL +# endif +# elif defined(__GNUC__) && (__GNUC__ >= 4) +# define SVN_NEEDS_SENTINEL_NULL __attribute__((sentinel)) +# else +# define SVN_NEEDS_SENTINEL_NULL +# endif +#endif + + /** Indicate whether the current platform supports unaligned data access. * * On the majority of machines running SVN (x86 / x64), unaligned access @@ -105,6 +150,26 @@ typedef int svn_boolean_t; +/* Declaration of a unique type, never defined, for the SVN_VA_NULL macro. + * + * NOTE: Private. Not for direct use by third-party code. + */ +struct svn__null_pointer_constant_stdarg_sentinel_t; + +/** Null pointer constant used as a sentinel in variable argument lists. + * + * Use of this macro ensures that the argument is of the correct size when a + * pointer is expected. (The macro @c NULL is not defined as a pointer on + * all systems, and the arguments to variadic functions are not converted + * automatically to the expected type.) + * + * @since New in 1.9. + */ +#define SVN_VA_NULL ((struct svn__null_pointer_constant_stdarg_sentinel_t*)0) +/* See? (char*)NULL -- They have the same length, but the cast looks ugly. */ + + + /** Subversion error object. * * Defined here, rather than in svn_error.h, to avoid a recursive @#include @@ -186,21 +251,26 @@ typedef struct svn_version_t svn_version_t; * These functions enable the caller to dereference an APR hash table index * without type casts or temporary variables. * - * ### These are private, and may go away when APR implements them natively. + * These functions are provided by APR itself from version 1.5. + * Definitions are provided here for when using older versions of APR. * @{ */ +#if !APR_VERSION_AT_LEAST(1, 5, 0) + /** Return the key of the hash table entry indexed by @a hi. */ const void * -svn__apr_hash_index_key(const apr_hash_index_t *hi); +apr_hash_this_key(apr_hash_index_t *hi); /** Return the key length of the hash table entry indexed by @a hi. */ apr_ssize_t -svn__apr_hash_index_klen(const apr_hash_index_t *hi); +apr_hash_this_key_len(apr_hash_index_t *hi); /** Return the value of the hash table entry indexed by @a hi. */ void * -svn__apr_hash_index_val(const apr_hash_index_t *hi); +apr_hash_this_val(apr_hash_index_t *hi); + +#endif /** @} */ @@ -1001,7 +1071,6 @@ typedef svn_error_t *(*svn_log_message_receiver_t)( const char *message, apr_pool_t *pool); - /** Callback function type for commits. * diff --git a/subversion/include/svn_version.h b/subversion/include/svn_version.h index 6c34dc7..39f7154 100644 --- a/subversion/include/svn_version.h +++ b/subversion/include/svn_version.h @@ -61,7 +61,7 @@ extern "C" { * Modify when new functionality is added or new interfaces are * defined, but all changes are backward compatible. */ -#define SVN_VER_MINOR 8 +#define SVN_VER_MINOR 9 /** * Patch number. @@ -70,7 +70,7 @@ extern "C" { * * @since New in 1.1. */ -#define SVN_VER_PATCH 13 +#define SVN_VER_PATCH 7 /** @deprecated Provided for backward compatibility with the 1.0 API. */ @@ -82,7 +82,7 @@ extern "C" { /** Version tag: a string describing the version. * - * This tag remains " (dev build)" in the repository so that we can + * This tag remains " (under development)" in the repository so that we can * always see from "svn --version" that the software has been built * from the repository rather than a "blessed" distribution. * @@ -93,7 +93,7 @@ extern "C" { * * Always change this at the same time as SVN_VER_NUMTAG. */ -#define SVN_VER_TAG " (r1667537)" +#define SVN_VER_TAG " (r1800392)" /** Number tag: a string describing the version. @@ -114,12 +114,10 @@ extern "C" { /** Revision number: The repository revision number of this release. * * This constant is used to generate the build number part of the Windows - * file version. Its value remains 0 in the repository. - * - * When rolling a tarball, we automatically replace it with what we - * guess to be the correct revision number. + * file version. Its value remains 0 in the repository except in release + * tags where it is the revision from which the tag was created. */ -#define SVN_VER_REVISION 1667537 +#define SVN_VER_REVISION 1800392 /* Version strings composed from the above definitions. */ @@ -177,10 +175,25 @@ struct svn_version_t * Generate the implementation of a version query function. * * @since New in 1.1. + * @since Since 1.9, embeds a string into the compiled object + * file that can be queried with the 'what' utility. */ -#define SVN_VERSION_BODY \ - SVN_VERSION_DEFINE(versioninfo); \ - return &versioninfo +#define SVN_VERSION_BODY \ + static struct versioninfo_t \ + { \ + const char *const str; \ + const svn_version_t num; \ + } const versioninfo = \ + { \ + "@(#)" SVN_VERSION, \ + { \ + SVN_VER_MAJOR, \ + SVN_VER_MINOR, \ + SVN_VER_PATCH, \ + SVN_VER_NUMTAG \ + } \ + }; \ + return &versioninfo.num /** * Check library version compatibility. Return #TRUE if the client's @@ -192,6 +205,8 @@ struct svn_version_t * unreleased library. A development client is always compatible with * a previous released library. * + * @note Implements the #svn_ver_check_list2.@a comparator interface. + * * @since New in 1.1. */ svn_boolean_t @@ -201,6 +216,8 @@ svn_ver_compatible(const svn_version_t *my_version, /** * Check if @a my_version and @a lib_version encode the same version number. * + * @note Implements the #svn_ver_check_list2.@a comparator interface. + * * @since New in 1.2. */ svn_boolean_t @@ -228,11 +245,32 @@ typedef struct svn_version_checklist_t * my_version is compatible with each entry in @a checklist. @a * checklist must end with an entry whose label is @c NULL. * - * @see svn_ver_compatible() + * @a my_version is considered to be compatible with a version in @a checklist + * if @a comparator returns #TRUE when called with @a my_version as the first + * parammeter and the @a checklist version as the second parameter. * - * @since New in 1.1. + * @see svn_ver_compatible(), svn_ver_equal() + * + * @note Subversion's own code invariably uses svn_ver_equal() as @a comparator, + * since the cmdline tools sometimes use non-public APIs (such as utility + * functions that haven't been promoted to svn_cmdline.h). Third-party code + * SHOULD use svn_ver_compatible() as @a comparator. + * + * @since New in 1.9. */ svn_error_t * +svn_ver_check_list2(const svn_version_t *my_version, + const svn_version_checklist_t *checklist, + svn_boolean_t (*comparator)(const svn_version_t *, + const svn_version_t *)); + +/** Similar to svn_ver_check_list2(), with @a comparator set to + * #svn_ver_compatible. + * + * @deprecated Provided for backward compatibility with 1.8 API. + */ +SVN_DEPRECATED +svn_error_t * svn_ver_check_list(const svn_version_t *my_version, const svn_version_checklist_t *checklist); @@ -268,6 +306,11 @@ typedef struct svn_version_extended_t svn_version_extended_t; * retrieve (for example, the OS release name, list of shared * libraries, etc.). Use @a pool for all allocations. * + * @note This function may allocate significant auxiliary resources + * (memory and file descriptors) in @a pool. It is recommended to + * copy the returned data to suitable longer-lived memory and clear + * @a pool after calling this function. + * * @since New in 1.8. */ const svn_version_extended_t * diff --git a/subversion/include/svn_wc.h b/subversion/include/svn_wc.h index 37210ff..010597b 100644 --- a/subversion/include/svn_wc.h +++ b/subversion/include/svn_wc.h @@ -907,13 +907,15 @@ svn_wc_external_item_dup(const svn_wc_external_item_t *item, * * Allocate the table, keys, and values in @a pool. * - * Use @a parent_directory only in constructing error strings. + * @a defining_directory is the path or URL of the directory on which + * the svn:externals property corresponding to @a desc is set. + * @a defining_directory is only used when constructing error strings. * * @since New in 1.5. */ svn_error_t * svn_wc_parse_externals_description3(apr_array_header_t **externals_p, - const char *parent_directory, + const char *defining_directory, const char *desc, svn_boolean_t canonicalize_url, apr_pool_t *pool); @@ -1255,8 +1257,24 @@ typedef enum svn_wc_notify_action_t * copy + delete. The notified path is the move source (the deleted path). * ### TODO: Provide path to move destination as well? * @since New in 1.8. */ - svn_wc_notify_move_broken + svn_wc_notify_move_broken, + + /** Running cleanup on an external module. + * @since New in 1.9. */ + svn_wc_notify_cleanup_external, + + /** The operation failed because the operation (E.g. commit) is only valid + * if the operation includes this path. + * @since New in 1.9. */ + svn_wc_notify_failed_requires_target, + /** Running info on an external module. + * @since New in 1.9. */ + svn_wc_notify_info_external, + + /** Finalizing commit. + * @since New in 1.9. */ + svn_wc_notify_commit_finalizing } svn_wc_notify_action_t; @@ -1732,6 +1750,7 @@ svn_wc_conflict_version_t * svn_wc_conflict_version_dup(const svn_wc_conflict_version_t *version, apr_pool_t *pool); + /** A struct that describes a conflict that has occurred in the * working copy. * @@ -1756,8 +1775,10 @@ typedef struct svn_wc_conflict_description2_t /** The path that is in conflict (for a tree conflict, it is the victim) */ const char *local_abspath; - /** The node type of the path being operated on (for a tree conflict, - * ### which version?) */ + /** The node type of the local node involved in this conflict. + * For a tree conflict, this is the node kind of the tree conflict victim. + * For the left/right node kinds of the incoming conflicting change see + * src_left_version->node_kind and src_right_version->node_kind. */ svn_node_kind_t node_kind; /** What sort of conflict are we describing? */ @@ -1776,13 +1797,19 @@ typedef struct svn_wc_conflict_description2_t * (Only if @c kind is 'text', else undefined.) */ const char *mime_type; - /** The action being attempted on the conflicted node or property. - * (When @c kind is 'text', this action must be 'edit'.) */ + /** The incoming action being attempted on the conflicted node or property. + * When @c kind is 'text', this action must be 'edit', but generally it can + * be any kind of possible change. */ svn_wc_conflict_action_t action; - /** The state of the target node or property, relative to its merge-left - * source, that is the reason for the conflict. - * (When @c kind is 'text', this reason must be 'edited'.) */ + /** The local change or state of the target node or property, relative + * to its merge-left source, that conflicts with the incoming action. + * When @c kind is 'text', this must be 'edited', but generally it can + * be any kind of possible change. + * Note that 'local' does not always refer to a working copy. A change + * can be local to the target branch of a merge operation, for example, + * and is not necessarily visible in a working copy of the target branch + * at any given revision. */ svn_wc_conflict_reason_t reason; /** If this is text-conflict and involves the merging of two files @@ -1817,7 +1844,8 @@ typedef struct svn_wc_conflict_description2_t /** my locally-edited version of the file */ const char *my_abspath; - /** merged version; may contain conflict markers */ + /** merged version; may contain conflict markers + * ### For property conflicts, this contains 'their_abspath'. */ const char *merged_file; /** The operation that exposed the conflict. @@ -1831,8 +1859,44 @@ typedef struct svn_wc_conflict_description2_t /** Info on the "merge-right source" or "their" version of incoming change. */ const svn_wc_conflict_version_t *src_right_version; - /* Remember to adjust svn_wc__conflict_description2_dup() - * if you add new fields to this struct. */ + /** For property conflicts, the absolute path to the .prej file. + * @since New in 1.9. */ + const char *prop_reject_abspath; + + /** For property conflicts, the local base value of the property, i.e. the + * value of the property as of the BASE revision of the working copy. + * For conflicts created during update/switch this contains the + * post-update/switch property value. The pre-update/switch value can + * be found in prop_value_incoming_old. + * Only set if available, so might be @c NULL. + * @since New in 1.9. */ + const svn_string_t *prop_value_base; + + /** For property conflicts, the local working value of the property, + * i.e. the value of the property in the working copy, possibly with + * local modiciations. + * Only set if available, so might be @c NULL. + * @since New in 1.9. */ + const svn_string_t *prop_value_working; + + /** For property conflicts, the incoming old value of the property, + * i.e. the value the property had at @c src_left_version. + * Only set if available, so might be @c NULL. + * @since New in 1.9 */ + const svn_string_t *prop_value_incoming_old; + + /** For property conflicts, the incoming new value of the property, + * i.e. the value the property had at @c src_right_version. + * Only set if available, so might be @c NULL. + * @since New in 1.9 */ + const svn_string_t *prop_value_incoming_new; + +/* NOTE: Add new fields at the end to preserve binary compatibility. + Also, if you add fields here, you have to update + svn_wc_conflict_description2_dup and perhaps + svn_wc_conflict_description_create_text2, + svn_wc_conflict_description_create_prop2, and + svn_wc_conflict_description_create_tree2. */ } svn_wc_conflict_description2_t; @@ -1928,7 +1992,7 @@ typedef struct svn_wc_conflict_description_t } svn_wc_conflict_description_t; /** - * Allocate an #svn_wc_conflict_description_t structure in @a result_pool, + * Allocate an #svn_wc_conflict_description2_t structure in @a result_pool, * initialize to represent a text conflict, and return it. * * Set the @c local_abspath field of the created struct to @a local_abspath @@ -1960,7 +2024,7 @@ svn_wc_conflict_description_create_text(const char *path, apr_pool_t *pool); /** - * Allocate an #svn_wc_conflict_description_t structure in @a result_pool, + * Allocate an #svn_wc_conflict_description2_t structure in @a result_pool, * initialize to represent a property conflict, and return it. * * Set the @c local_abspath field of the created struct to @a local_abspath @@ -1994,13 +2058,13 @@ svn_wc_conflict_description_create_prop(const char *path, apr_pool_t *pool); /** - * Allocate an #svn_wc_conflict_description_t structure in @a pool, + * Allocate an #svn_wc_conflict_description2_t structure in @a pool, * initialize to represent a tree conflict, and return it. * * Set the @c local_abspath field of the created struct to @a local_abspath * (which must be an absolute path), the @c kind field to - * #svn_wc_conflict_kind_tree, the @c node_kind to @a node_kind, the @c - * operation to @a operation, the @c src_left_version field to + * #svn_wc_conflict_kind_tree, the @c local_node_kind to @a local_node_kind, + * the @c operation to @a operation, the @c src_left_version field to * @a src_left_version, and the @c src_right_version field to * @a src_right_version. * @@ -2040,8 +2104,21 @@ svn_wc_conflict_description_create_tree( /** Return a duplicate of @a conflict, allocated in @a result_pool. * A deep copy of all members will be made. * + * @since New in 1.9. + */ +svn_wc_conflict_description2_t * +svn_wc_conflict_description2_dup( + const svn_wc_conflict_description2_t *conflict, + apr_pool_t *result_pool); + + +/** Like svn_wc_conflict_description2_dup(), but is improperly named + * as a private function when it is intended to be a public API. + * * @since New in 1.7. + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_wc_conflict_description2_t * svn_wc__conflict_description2_dup( const svn_wc_conflict_description2_t *conflict, @@ -2054,9 +2131,15 @@ svn_wc__conflict_description2_dup( */ typedef enum svn_wc_conflict_choice_t { + /** Undefined; for internal use only. + This value is never returned in svn_wc_conflict_result_t. + * @since New in 1.9 + */ + svn_wc_conflict_choose_undefined = -1, + /** Don't resolve the conflict now. Let libsvn_wc mark the path 'conflicted', so user can run 'svn resolved' later. */ - svn_wc_conflict_choose_postpone, + svn_wc_conflict_choose_postpone = 0, /** If there were files to choose from, select one as a way of resolving the conflict here and now. libsvn_wc will then do the @@ -2069,7 +2152,7 @@ typedef enum svn_wc_conflict_choice_t svn_wc_conflict_choose_mine_conflict, /**< own (for conflicted hunks) */ svn_wc_conflict_choose_merged, /**< merged version */ - /* @since New in 1.8. */ + /** @since New in 1.8. */ svn_wc_conflict_choose_unspecified /**< undecided */ } svn_wc_conflict_choice_t; @@ -2102,6 +2185,14 @@ typedef struct svn_wc_conflict_result_t NULL) in the user's working copy. */ svn_boolean_t save_merged; + /** If not NULL, this is the new merged property, used when choosing + * #svn_wc_conflict_choose_merged. This value is prefered over using + * merged_file. + * + * @since New in 1.9. + */ + const svn_string_t *merged_value; + } svn_wc_conflict_result_t; @@ -2111,7 +2202,8 @@ typedef struct svn_wc_conflict_result_t * * Set the @c choice field of the structure to @a choice, @c merged_file * to @a merged_file, and @c save_merged to false. Make only a shallow - * copy of the pointer argument @a merged_file. + * copy of the pointer argument @a merged_file. @a merged_file may be + * NULL if setting merged_file is not needed. * * @since New in 1.5. */ @@ -3743,6 +3835,13 @@ typedef struct svn_wc_status3_t * @since New in 1.8. */ svn_boolean_t file_external; + + /** The actual kind of the node in the working copy. May differ from + * @a kind on obstructions, deletes, etc. #svn_node_unknown if unavailable. + * + * @since New in 1.9 */ + svn_node_kind_t actual_kind; + /* NOTE! Please update svn_wc_dup_status3() when adding new fields here. */ } svn_wc_status3_t; @@ -4544,10 +4643,9 @@ svn_wc_delete(const char *path, * addition to the working copy. The added node will have the properties * provided in @a props, or none if that is NULL. * - * Check and canonicalize the properties in the same way as - * svn_wc_prop_set4(). Return an error and don't add the node if the - * properties are not valid on this node. Unlike svn_wc_prop_set4() - * there is no option to skip some of the checks and canonicalizations. + * Unless @a skip_checks is TRUE, check and canonicalize the properties in the + * same way as svn_wc_prop_set4(). Return an error and don't add the node if + * the properties are not valid on this node. * * ### The error code on validity check failure should be specified, and * preferably should be a single code. @@ -4559,10 +4657,30 @@ svn_wc_delete(const char *path, * If @a local_abspath does not exist as file, directory or symlink, return * #SVN_ERR_WC_PATH_NOT_FOUND. * + * If @a notify_func is non-NULL, invoke it with @a notify_baton to report + * the item being added. + * * ### TODO: Split into add_dir, add_file, add_symlink? * + * @since New in 1.9. + */ +svn_error_t * +svn_wc_add_from_disk3(svn_wc_context_t *wc_ctx, + const char *local_abspath, + const apr_hash_t *props, + svn_boolean_t skip_checks, + svn_wc_notify_func2_t notify_func, + void *notify_baton, + apr_pool_t *scratch_pool); + +/** + * Similar to svn_wc_add_from_disk3(), but always passes FALSE for + * @a skip_checks + * * @since New in 1.8. + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_wc_add_from_disk2(svn_wc_context_t *wc_ctx, const char *local_abspath, @@ -5070,6 +5188,12 @@ svn_wc_committed_queue_create(apr_pool_t *pool); * ### seems to be not a set of changes but rather the new complete set of * ### props. And it's renamed to 'new_dav_cache' inside; why? * + * If @a is_committed is @c TRUE, the node will be processed as committed. This + * turns the node and its implied descendants as the new unmodified state at + * the new specified revision. Unless @a recurse is TRUE, changes on + * descendants are not committed as changes directly. In this case they should + * be queueud as their own changes. + * * If @a remove_lock is @c TRUE, any entryprops related to a repository * lock will be removed. * @@ -5107,7 +5231,25 @@ svn_wc_committed_queue_create(apr_pool_t *pool); * Temporary allocations will be performed in @a scratch_pool, and persistent * allocations will use the same pool as @a queue used when it was created. * + * @since New in 1.9. + */ +svn_error_t * +svn_wc_queue_committed4(svn_wc_committed_queue_t *queue, + svn_wc_context_t *wc_ctx, + const char *local_abspath, + svn_boolean_t recurse, + svn_boolean_t is_committed, + const apr_array_header_t *wcprop_changes, + svn_boolean_t remove_lock, + svn_boolean_t remove_changelist, + const svn_checksum_t *sha1_checksum, + apr_pool_t *scratch_pool); + +/** Similar to svn_wc_queue_committed4, but with is_committed always + * TRUE. + * * @since New in 1.7. + * @deprecated Provided for backwards compatibility with the 1.8 API. */ svn_error_t * svn_wc_queue_committed3(svn_wc_committed_queue_t *queue, @@ -7093,7 +7235,7 @@ svn_wc_merge_prop_diffs(svn_wc_notify_state_t *state, * the copy/move source (even if the copy-/move-here replaces a locally * deleted file). * - * If @a local_abspath refers to an unversioned or non-existing path, return + * If @a local_abspath refers to an unversioned or non-existent path, return * @c SVN_ERR_WC_PATH_NOT_FOUND. Use @a wc_ctx to access the working copy. * @a contents may not be @c NULL (unlike @a *contents). * @@ -7142,19 +7284,59 @@ svn_wc_get_pristine_copy_path(const char *path, /** - * Recurse from @a local_abspath, cleaning up unfinished log business. Perform - * any temporary allocations in @a scratch_pool. Any working copy locks under - * @a local_abspath will be taken over and then cleared by this function. + * Recurse from @a local_abspath, cleaning up unfinished tasks. Perform + * any temporary allocations in @a scratch_pool. If @a break_locks is TRUE + * Any working copy locks under @a local_abspath will be taken over and then + * cleared by this function. + * WARNING: If @a break_locks is TRUE there is no mechanism that will protect + * locks that are still being used. * - * WARNING: there is no mechanism that will protect locks that are still being - * used. + * If @a fix_recorded_timestamps is TRUE the recorded timestamps of unmodified + * files will be updated, which will improve performance of future is-modified + * checks. + * + * If @a clear_dav_cache is @c TRUE, the caching of DAV information for older + * mod_dav served repositories is cleared. This clearing invalidates some + * cached information used for pre-HTTPv2 repositories. + * + * If @a vacuum_pristines is TRUE, try to remove unreferenced pristines from + * the working copy. (Will not remove anything unless the obtained lock applies + * to the entire working copy) * * If @a cancel_func is non-NULL, invoke it with @a cancel_baton at various * points during the operation. If it returns an error (typically * #SVN_ERR_CANCELLED), return that error immediately. * + * If @a notify_func is non-NULL, invoke it with @a notify_baton to report + * the progress of the operation. + * + * @note In 1.9, @a notify_func does not get called at all. This may change + * in later releases. + * + * @since New in 1.9. + */ +svn_error_t * +svn_wc_cleanup4(svn_wc_context_t *wc_ctx, + const char *local_abspath, + svn_boolean_t break_locks, + svn_boolean_t fix_recorded_timestamps, + svn_boolean_t clear_dav_cache, + svn_boolean_t vacuum_pristines, + svn_cancel_func_t cancel_func, + void *cancel_baton, + svn_wc_notify_func2_t notify_func, + void *notify_baton, + apr_pool_t *scratch_pool); + +/** + * Similar to svn_wc_cleanup4() but will always break locks, fix recorded + * timestamps, clear the dav cache and vacuum pristines. This function also + * doesn't support notifications. + * * @since New in 1.7. + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_wc_cleanup3(svn_wc_context_t *wc_ctx, const char *local_abspath, @@ -7379,6 +7561,13 @@ svn_wc_relocate(const char *path, * changelists. If @a changelist_filter is empty (or altogether @c NULL), * no changelist filtering occurs. * + * If @a clear_changelists is TRUE, then changelist information for the + * paths is cleared. + * + * If @a metadata_only is TRUE, the working copy files are untouched, but + * if there are conflict marker files attached to these files these + * markers are removed. + * * If @a cancel_func is non-NULL, call it with @a cancel_baton at * various points during the reversion process. If it returns an * error (typically #SVN_ERR_CANCELLED), return that error @@ -7395,8 +7584,29 @@ svn_wc_relocate(const char *path, * If @a path is not under version control, return the error * #SVN_ERR_UNVERSIONED_RESOURCE. * + * @since New in 1.9. + */ +svn_error_t * +svn_wc_revert5(svn_wc_context_t *wc_ctx, + const char *local_abspath, + svn_depth_t depth, + svn_boolean_t use_commit_times, + const apr_array_header_t *changelist_filter, + svn_boolean_t clear_changelists, + svn_boolean_t metadata_only, + svn_cancel_func_t cancel_func, + void *cancel_baton, + svn_wc_notify_func2_t notify_func, + void *notify_baton, + apr_pool_t *scratch_pool); + +/** Similar to svn_wc_revert5() but with @a clear_changelists always set to + * FALSE and @a metadata_only set to FALSE. + * * @since New in 1.7. + * @deprecated Provided for backward compatibility with the 1.8 API. */ +SVN_DEPRECATED svn_error_t * svn_wc_revert4(svn_wc_context_t *wc_ctx, const char *local_abspath, @@ -7875,7 +8085,8 @@ typedef struct svn_wc_revision_status_t svn_boolean_t switched; /**< Is anything switched? */ svn_boolean_t modified; /**< Is anything modified? */ - /** Whether any WC paths are at a depth other than #svn_depth_infinity. + /** Whether any WC paths are at a depth other than #svn_depth_infinity or + * are user excluded. * @since New in 1.5. */ svn_boolean_t sparse_checkout; @@ -8020,7 +8231,17 @@ typedef svn_error_t *(*svn_changelist_receiver_t) (void *baton, /** - * ### TODO: Doc string, please. + * Beginning at @a local_abspath, crawl to @a depth to discover every path in + * or under @a local_abspath which belongs to one of the changelists in @a + * changelist_filter (an array of <tt>const char *</tt> changelist names). + * If @a changelist_filter is @c NULL, discover paths with any changelist. + * Call @a callback_func (with @a callback_baton) each time a + * changelist-having path is discovered. + * + * @a local_abspath is a local WC path. + * + * If @a cancel_func is not @c NULL, invoke it passing @a cancel_baton + * during the recursive walk. * * @since New in 1.7. */ diff --git a/subversion/include/svn_x509.h b/subversion/include/svn_x509.h new file mode 100644 index 0000000..eabe3ed --- /dev/null +++ b/subversion/include/svn_x509.h @@ -0,0 +1,201 @@ +/** + * @copyright + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + * @endcopyright + * + * @file svn_x509.h + * @brief Subversion's X509 parser + */ + +#ifndef SVN_X509_H +#define SVN_X509_H + +#include <apr_pools.h> +#include <apr_tables.h> +#include <apr_time.h> + +#include "svn_error.h" +#include "svn_checksum.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define SVN_X509_OID_COMMON_NAME "\x55\x04\x03" +#define SVN_X509_OID_COUNTRY "\x55\x04\x06" +#define SVN_X509_OID_LOCALITY "\x55\x04\x07" +#define SVN_X509_OID_STATE "\x55\x04\x08" +#define SVN_X509_OID_ORGANIZATION "\x55\x04\x0A" +#define SVN_X509_OID_ORG_UNIT "\x55\x04\x0B" +#define SVN_X509_OID_EMAIL "\x2A\x86\x48\x86\xF7\x0D\x01\x09\x01" + +/** + * Representation of parsed certificate info. + * + * @since New in 1.9. + */ +typedef struct svn_x509_certinfo_t svn_x509_certinfo_t; + +/** + * Representation of an atttribute in an X.509 name (e.g. Subject or Issuer) + * + * @since New in 1.9. + */ +typedef struct svn_x509_name_attr_t svn_x509_name_attr_t; + +/** + * Parse x509 @a der certificate data from @a buf with length @a + * buflen and return certificate information in @a *certinfo, + * allocated in @a result_pool. + * + * @note This function has been written with the intent of display data in a + * certificate for a user to see. As a result, it does not do much + * validation on the data it parses from the certificate. It does not + * for instance verify that the certificate is signed by the issuer. It + * does not verify a trust chain. It does not error on critical + * extensions it does not know how to parse. So while it can be used as + * part of a certificate validation scheme, it can't be used alone for + * that purpose. + * + * @since New in 1.9. + */ +svn_error_t * +svn_x509_parse_cert(svn_x509_certinfo_t **certinfo, + const char *buf, + apr_size_t buflen, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** + * Returns a deep copy of the @a attr, allocated in @a result_pool. + * May use @a scratch_pool for temporary allocations. + * @since New in 1.9. + */ +svn_x509_name_attr_t * +svn_x509_name_attr_dup(const svn_x509_name_attr_t *attr, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** + * Returns the OID of @a attr as encoded in the certificate. The + * length of the OID will be set in @a len. + * @since New in 1.9. + */ +const unsigned char * +svn_x509_name_attr_get_oid(const svn_x509_name_attr_t *attr, apr_size_t *len); + +/** + * Returns the value of @a attr as a UTF-8 C string. + * @since New in 1.9. + */ +const char * +svn_x509_name_attr_get_value(const svn_x509_name_attr_t *attr); + + +/** + * Returns a deep copy of @a certinfo, allocated in @a result_pool. + * May use @a scratch_pool for temporary allocations. + * @since New in 1.9. + */ +svn_x509_certinfo_t * +svn_x509_certinfo_dup(const svn_x509_certinfo_t *certinfo, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/** + * Returns the subject DN from @a certinfo. + * @since New in 1.9. + */ +const char * +svn_x509_certinfo_get_subject(const svn_x509_certinfo_t *certinfo, + apr_pool_t *result_pool); + +/** + * Returns a list of the attributes for the subject in the @a certinfo. + * Each member of the list is of type svn_x509_name_attr_t. + * + * @since New in 1.9. + */ +const apr_array_header_t * +svn_x509_certinfo_get_subject_attrs(const svn_x509_certinfo_t *certinfo); + +/** + * Returns the cerficiate issuer DN from @a certinfo. + * @since New in 1.9. + */ +const char * +svn_x509_certinfo_get_issuer(const svn_x509_certinfo_t *certinfo, + apr_pool_t *result_pool); + +/** + * Returns a list of the attributes for the issuer in the @a certinfo. + * Each member of the list is of type svn_x509_name_attr_t. + * + * @since New in 1.9. + */ +const apr_array_header_t * +svn_x509_certinfo_get_issuer_attrs(const svn_x509_certinfo_t *certinfo); + +/** + * Returns the start of the certificate validity period from @a certinfo. + * + * @since New in 1.9. + */ +apr_time_t +svn_x509_certinfo_get_valid_from(const svn_x509_certinfo_t *certinfo); + +/** + * Returns the end of the certificate validity period from @a certinfo. + * + * @since New in 1.9. + */ +const apr_time_t +svn_x509_certinfo_get_valid_to(const svn_x509_certinfo_t *certinfo); + +/** + * Returns the digest (fingerprint) from @a certinfo + * @since New in 1.9. + */ +const svn_checksum_t * +svn_x509_certinfo_get_digest(const svn_x509_certinfo_t *certinfo); + +/** + * Returns an array of (const char*) host names from @a certinfo. + * + * @since New in 1.9. + */ +const apr_array_header_t * +svn_x509_certinfo_get_hostnames(const svn_x509_certinfo_t *certinfo); + +/** + * Given an @a oid return a null-terminated C string representation. + * For example an OID with the bytes "\x2A\x86\x48\x86\xF7\x0D\x01\x09\x01" + * would be converted to the string "1.2.840.113549.1.9.1". Returns + * NULL if the @oid can't be represented as a string. + * + * @since New in 1.9. */ +const char * +svn_x509_oid_to_string(const unsigned char *oid, apr_size_t oid_len, + apr_pool_t *scratch_pool, apr_pool_t *result_pool); + +#ifdef __cplusplus +} +#endif +#endif /* SVN_X509_H */ diff --git a/subversion/include/svn_xml.h b/subversion/include/svn_xml.h index 90969be..8791b14 100644 --- a/subversion/include/svn_xml.h +++ b/subversion/include/svn_xml.h @@ -312,7 +312,7 @@ svn_xml_make_header(svn_stringbuf_t **str, * If @a *str is @c NULL, set @a *str to a new stringbuf allocated * in @a pool, else append to the existing stringbuf there. * - * Take the tag's attributes from varargs, a NULL-terminated list of + * Take the tag's attributes from varargs, a SVN_VA_NULL-terminated list of * alternating <tt>char *</tt> key and <tt>char *</tt> val. Do xml-escaping * on each val. * @@ -323,7 +323,7 @@ svn_xml_make_open_tag(svn_stringbuf_t **str, apr_pool_t *pool, enum svn_xml_open_tag_style style, const char *tagname, - ...); + ...) SVN_NEEDS_SENTINEL_NULL; /** Like svn_xml_make_open_tag(), but takes a @c va_list instead of being |