You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2015/06/18 12:35:33 UTC
svn commit: r1686174 [8/18] - in /subversion/branches/reuse-ra-session: ./
build/ build/ac-macros/ build/generator/ build/generator/templates/
subversion/bindings/javahl/ subversion/bindings/javahl/native/
subversion/bindings/javahl/native/jniwrapper/ ...
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/lock.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/lock.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/lock.c Thu Jun 18 10:35:30 2015
@@ -470,6 +470,12 @@ unlock_single(svn_fs_t *fs,
svn_lock_t *lock,
apr_pool_t *pool);
+/* Check if LOCK has been already expired. */
+static svn_boolean_t lock_expired(const svn_lock_t *lock)
+{
+ return lock->expiration_date && (apr_time_now() > lock->expiration_date);
+}
+
/* Set *LOCK_P to the lock for PATH in FS. HAVE_WRITE_LOCK should be
TRUE if the caller (or one of its callers) has taken out the
repository-wide write lock, FALSE otherwise. If MUST_EXIST is
@@ -499,7 +505,7 @@ get_lock(svn_lock_t **lock_p,
return must_exist ? SVN_FS__ERR_NO_SUCH_LOCK(fs, path) : SVN_NO_ERROR;
/* Don't return an expired lock. */
- if (lock->expiration_date && (apr_time_now() > lock->expiration_date))
+ if (lock_expired(lock))
{
/* Only remove the lock if we have the write lock.
Read operations shouldn't change the filesystem. */
@@ -546,68 +552,17 @@ get_lock_helper(svn_fs_t *fs,
}
-/* Baton for locks_walker(). */
-typedef struct walk_locks_baton_t
-{
- svn_fs_get_locks_callback_t get_locks_func;
- void *get_locks_baton;
- svn_fs_t *fs;
-} walk_locks_baton_t;
-
-/* Implements walk_digests_callback_t. */
-static svn_error_t *
-locks_walker(void *baton,
- const char *fs_path,
- const char *digest_path,
- svn_lock_t *lock,
- svn_boolean_t have_write_lock,
- apr_pool_t *pool)
-{
- walk_locks_baton_t *wlb = baton;
-
- if (lock)
- {
- /* Don't report an expired lock. */
- if (lock->expiration_date == 0
- || (apr_time_now() <= lock->expiration_date))
- {
- if (wlb->get_locks_func)
- SVN_ERR(wlb->get_locks_func(wlb->get_locks_baton, lock, pool));
- }
- else
- {
- /* Only remove the lock if we have the write lock.
- Read operations shouldn't change the filesystem. */
- if (have_write_lock)
- SVN_ERR(unlock_single(wlb->fs, lock, pool));
- }
- }
-
- return SVN_NO_ERROR;
-}
-
-/* Callback type for walk_digest_files().
- *
- * LOCK come from a read_digest_file(digest_path) call.
- */
-typedef svn_error_t *(*walk_digests_callback_t)(void *baton,
- const char *fs_path,
- const char *digest_path,
- svn_lock_t *lock,
- svn_boolean_t have_write_lock,
- apr_pool_t *pool);
-
-/* A function that calls WALK_DIGESTS_FUNC/WALK_DIGESTS_BATON for
- all lock digest files in and under PATH in FS.
+/* A function that calls GET_LOCKS_FUNC/GET_LOCKS_BATON for
+ all locks in and under PATH in FS.
HAVE_WRITE_LOCK should be true if the caller (directly or indirectly)
has the FS write lock. */
static svn_error_t *
-walk_digest_files(const char *fs_path,
- const char *digest_path,
- walk_digests_callback_t walk_digests_func,
- void *walk_digests_baton,
- svn_boolean_t have_write_lock,
- apr_pool_t *pool)
+walk_locks(svn_fs_t *fs,
+ const char *digest_path,
+ svn_fs_get_locks_callback_t get_locks_func,
+ void *get_locks_baton,
+ svn_boolean_t have_write_lock,
+ apr_pool_t *pool)
{
apr_hash_index_t *hi;
apr_hash_t *children;
@@ -615,10 +570,19 @@ walk_digest_files(const char *fs_path,
svn_lock_t *lock;
/* First, send up any locks in the current digest file. */
- SVN_ERR(read_digest_file(&children, &lock, fs_path, digest_path, pool));
+ SVN_ERR(read_digest_file(&children, &lock, fs->path, digest_path, pool));
- SVN_ERR(walk_digests_func(walk_digests_baton, fs_path, digest_path, lock,
- have_write_lock, pool));
+ if (lock && lock_expired(lock))
+ {
+ /* Only remove the lock if we have the write lock.
+ Read operations shouldn't change the filesystem. */
+ if (have_write_lock)
+ SVN_ERR(unlock_single(fs, lock, pool));
+ }
+ else if (lock)
+ {
+ SVN_ERR(get_locks_func(get_locks_baton, lock, pool));
+ }
/* Now, report all the child entries (if any; bail otherwise). */
if (! apr_hash_count(children))
@@ -630,39 +594,25 @@ walk_digest_files(const char *fs_path,
svn_pool_clear(subpool);
SVN_ERR(read_digest_file
- (NULL, &lock, fs_path,
- digest_path_from_digest(fs_path, digest, subpool), subpool));
+ (NULL, &lock, fs->path,
+ digest_path_from_digest(fs->path, digest, subpool), subpool));
- SVN_ERR(walk_digests_func(walk_digests_baton, fs_path, digest_path, lock,
- have_write_lock, subpool));
+ if (lock && lock_expired(lock))
+ {
+ /* Only remove the lock if we have the write lock.
+ Read operations shouldn't change the filesystem. */
+ if (have_write_lock)
+ SVN_ERR(unlock_single(fs, lock, pool));
+ }
+ else if (lock)
+ {
+ SVN_ERR(get_locks_func(get_locks_baton, lock, pool));
+ }
}
svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}
-/* A function that calls GET_LOCKS_FUNC/GET_LOCKS_BATON for
- all locks in and under PATH in FS.
- HAVE_WRITE_LOCK should be true if the caller (directly or indirectly)
- has the FS write lock. */
-static svn_error_t *
-walk_locks(svn_fs_t *fs,
- const char *digest_path,
- svn_fs_get_locks_callback_t get_locks_func,
- void *get_locks_baton,
- svn_boolean_t have_write_lock,
- apr_pool_t *pool)
-{
- walk_locks_baton_t wlb;
-
- wlb.get_locks_func = get_locks_func;
- wlb.get_locks_baton = get_locks_baton;
- wlb.fs = fs;
- SVN_ERR(walk_digest_files(fs->path, digest_path, locks_walker, &wlb,
- have_write_lock, pool));
- return SVN_NO_ERROR;
-}
-
-
/* Utility function: verify that a lock can be used. Interesting
errors returned from this function:
@@ -737,6 +687,35 @@ svn_fs_x__allow_locked_operation(const c
return SVN_NO_ERROR;
}
+/* Helper function called from the lock and unlock code.
+ UPDATES is a map from "const char *" parent paths to "apr_array_header_t *"
+ arrays of child paths. For all of the parent paths of PATH this function
+ adds PATH to the corresponding array of child paths. */
+static void
+schedule_index_update(apr_hash_t *updates,
+ const char *path,
+ apr_pool_t *scratch_pool)
+{
+ apr_pool_t *hashpool = apr_hash_pool_get(updates);
+ const char *parent_path = path;
+
+ while (! svn_fspath__is_root(parent_path, strlen(parent_path)))
+ {
+ apr_array_header_t *children;
+
+ parent_path = svn_fspath__dirname(parent_path, scratch_pool);
+ children = svn_hash_gets(updates, parent_path);
+
+ if (! children)
+ {
+ children = apr_array_make(hashpool, 8, sizeof(const char *));
+ svn_hash_sets(updates, apr_pstrdup(hashpool, parent_path), children);
+ }
+
+ APR_ARRAY_PUSH(children, const char *) = path;
+ }
+}
+
/* The effective arguments for lock_body() below. */
typedef struct lock_baton_t {
svn_fs_t *fs;
@@ -755,6 +734,7 @@ check_lock(svn_error_t **fs_err,
const svn_fs_lock_target_t *target,
lock_baton_t *lb,
svn_fs_root_t *root,
+ svn_revnum_t youngest_rev,
apr_pool_t *pool)
{
svn_node_kind_t kind;
@@ -791,6 +771,15 @@ check_lock(svn_error_t **fs_err,
if (SVN_IS_VALID_REVNUM(target->current_rev))
{
svn_revnum_t created_rev;
+
+ if (target->current_rev > youngest_rev)
+ {
+ *fs_err = svn_error_createf(SVN_ERR_FS_NO_SUCH_REVISION, NULL,
+ _("No such revision %ld"),
+ target->current_rev);
+ return SVN_NO_ERROR;
+ }
+
SVN_ERR(svn_fs_x__node_created_rev(&created_rev, root, path,
pool));
@@ -849,7 +838,6 @@ check_lock(svn_error_t **fs_err,
typedef struct lock_info_t {
const char *path;
- const char *component;
svn_lock_t *lock;
svn_error_t *fs_err;
} lock_info_t;
@@ -872,12 +860,11 @@ lock_body(void *baton, apr_pool_t *pool)
svn_fs_root_t *root;
svn_revnum_t youngest;
const char *rev_0_path;
- int i, outstanding = 0;
+ int i;
+ apr_hash_t *index_updates = apr_hash_make(pool);
+ apr_hash_index_t *hi;
apr_pool_t *iterpool = svn_pool_create(pool);
- lb->infos = apr_array_make(lb->result_pool, lb->targets->nelts,
- sizeof(lock_info_t));
-
/* Until we implement directory locks someday, we only allow locks
on files or non-existent paths. */
/* Use fs->vtable->foo instead of svn_fs_foo to avoid circular
@@ -889,34 +876,28 @@ lock_body(void *baton, apr_pool_t *pool)
{
const svn_sort__item_t *item = &APR_ARRAY_IDX(lb->targets, i,
svn_sort__item_t);
- const svn_fs_lock_target_t *target = item->value;
lock_info_t info;
svn_pool_clear(iterpool);
info.path = item->key;
- SVN_ERR(check_lock(&info.fs_err, info.path, target, lb, root, iterpool));
info.lock = NULL;
- info.component = NULL;
- APR_ARRAY_PUSH(lb->infos, lock_info_t) = info;
+ info.fs_err = SVN_NO_ERROR;
+
+ SVN_ERR(check_lock(&info.fs_err, info.path, item->value, lb, root,
+ youngest, iterpool));
+
+ /* If no error occurred while pre-checking, schedule the index updates for
+ this path. */
if (!info.fs_err)
- ++outstanding;
+ schedule_index_update(index_updates, info.path, iterpool);
+
+ APR_ARRAY_PUSH(lb->infos, lock_info_t) = info;
}
rev_0_path = svn_fs_x__path_rev_absolute(lb->fs, 0, pool);
- /* Given the paths:
-
- /foo/bar/f
- /foo/bar/g
- /zig/x
-
- we loop through repeatedly. The first pass sees '/' on all paths
- and writes the '/' index. The second pass sees '/foo' twice and
- writes that index followed by '/zig' and that index. The third
- pass sees '/foo/bar' twice and writes that index, and then writes
- the lock for '/zig/x'. The fourth pass writes the locks for
- '/foo/bar/f' and '/foo/bar/g'.
+ /* We apply the scheduled index updates before writing the actual locks.
Writing indices before locks is correct: if interrupted it leaves
indices without locks rather than locks without indices. An
@@ -925,88 +906,46 @@ lock_body(void *baton, apr_pool_t *pool)
index is inconsistent, svn_fs_x__allow_locked_operation will
show locked on the file but unlocked on the parent. */
+ for (hi = apr_hash_first(pool, index_updates); hi; hi = apr_hash_next(hi))
+ {
+ const char *path = apr_hash_this_key(hi);
+ apr_array_header_t *children = apr_hash_this_val(hi);
+
+ svn_pool_clear(iterpool);
+ SVN_ERR(add_to_digest(lb->fs->path, children, path, rev_0_path,
+ iterpool));
+ }
- while (outstanding)
+ for (i = 0; i < lb->infos->nelts; ++i)
{
- const char *last_path = NULL;
- apr_array_header_t *paths;
+ struct lock_info_t *info = &APR_ARRAY_IDX(lb->infos, i,
+ struct lock_info_t);
+ svn_sort__item_t *item = &APR_ARRAY_IDX(lb->targets, i, svn_sort__item_t);
+ svn_fs_lock_target_t *target = item->value;
svn_pool_clear(iterpool);
- paths = apr_array_make(iterpool, 1, sizeof(const char *));
- for (i = 0; i < lb->infos->nelts; ++i)
+ if (! info->fs_err)
{
- lock_info_t *info = &APR_ARRAY_IDX(lb->infos, i, lock_info_t);
- const svn_sort__item_t *item = &APR_ARRAY_IDX(lb->targets, i,
- svn_sort__item_t);
- const svn_fs_lock_target_t *target = item->value;
-
- if (!info->fs_err && !info->lock)
- {
- if (!info->component)
- {
- info->component = info->path;
- APR_ARRAY_PUSH(paths, const char *) = info->path;
- last_path = "/";
- }
- else
- {
- info->component = strchr(info->component + 1, '/');
- if (!info->component)
- {
- /* The component is a path to lock, this cannot
- match a previous path that need to be indexed. */
- if (paths->nelts)
- {
- SVN_ERR(add_to_digest(lb->fs->path, paths, last_path,
- rev_0_path, iterpool));
- apr_array_clear(paths);
- last_path = NULL;
- }
-
- info->lock = svn_lock_create(lb->result_pool);
- if (target->token)
- info->lock->token = target->token;
- else
- SVN_ERR(svn_fs_x__generate_lock_token(
- &(info->lock->token), lb->fs,
- lb->result_pool));
- info->lock->path = info->path;
- info->lock->owner = lb->fs->access_ctx->username;
- info->lock->comment = lb->comment;
- info->lock->is_dav_comment = lb->is_dav_comment;
- info->lock->creation_date = apr_time_now();
- info->lock->expiration_date = lb->expiration_date;
-
- info->fs_err = set_lock(lb->fs->path, info->lock,
- rev_0_path, iterpool);
- --outstanding;
- }
- else
- {
- /* The component is a path to an index. */
- apr_size_t len = info->component - info->path;
-
- if (last_path
- && (strncmp(last_path, info->path, len)
- || strlen(last_path) != len))
- {
- /* No match to the previous paths to index. */
- SVN_ERR(add_to_digest(lb->fs->path, paths, last_path,
- rev_0_path, iterpool));
- apr_array_clear(paths);
- last_path = NULL;
- }
- APR_ARRAY_PUSH(paths, const char *) = info->path;
- if (!last_path)
- last_path = apr_pstrndup(iterpool, info->path, len);
- }
- }
- }
-
- if (last_path && i == lb->infos->nelts - 1)
- SVN_ERR(add_to_digest(lb->fs->path, paths, last_path,
- rev_0_path, iterpool));
+ info->lock = svn_lock_create(lb->result_pool);
+ if (target->token)
+ info->lock->token = apr_pstrdup(lb->result_pool, target->token);
+ else
+ SVN_ERR(svn_fs_x__generate_lock_token(&(info->lock->token), lb->fs,
+ lb->result_pool));
+
+ /* The INFO->PATH is already allocated in LB->RESULT_POOL as a result
+ of svn_fspath__canonicalize() (see svn_fs_fs__lock()). */
+ info->lock->path = info->path;
+ info->lock->owner = apr_pstrdup(lb->result_pool,
+ lb->fs->access_ctx->username);
+ info->lock->comment = apr_pstrdup(lb->result_pool, lb->comment);
+ info->lock->is_dav_comment = lb->is_dav_comment;
+ info->lock->creation_date = apr_time_now();
+ info->lock->expiration_date = lb->expiration_date;
+
+ info->fs_err = set_lock(lb->fs->path, info->lock, rev_0_path,
+ iterpool);
}
}
@@ -1050,10 +989,8 @@ check_unlock(svn_error_t **fs_err,
typedef struct unlock_info_t {
const char *path;
- const char *component;
svn_error_t *fs_err;
svn_boolean_t done;
- int components;
} unlock_info_t;
/* The body of svn_fs_x__unlock(), which see.
@@ -1074,12 +1011,11 @@ unlock_body(void *baton, apr_pool_t *poo
svn_fs_root_t *root;
svn_revnum_t youngest;
const char *rev_0_path;
- int i, max_components = 0, outstanding = 0;
+ int i;
+ apr_hash_t *indices_updates = apr_hash_make(pool);
+ apr_hash_index_t *hi;
apr_pool_t *iterpool = svn_pool_create(pool);
- ub->infos = apr_array_make(ub->result_pool, ub->targets->nelts,
- sizeof( unlock_info_t));
-
SVN_ERR(ub->fs->vtable->youngest_rev(&youngest, ub->fs, pool));
SVN_ERR(ub->fs->vtable->revision_root(&root, ub->fs, youngest, pool));
@@ -1088,95 +1024,56 @@ unlock_body(void *baton, apr_pool_t *poo
const svn_sort__item_t *item = &APR_ARRAY_IDX(ub->targets, i,
svn_sort__item_t);
const char *token = item->value;
- unlock_info_t info = { 0 };
+ unlock_info_t info;
svn_pool_clear(iterpool);
info.path = item->key;
+ info.fs_err = SVN_NO_ERROR;
+ info.done = FALSE;
+
if (!ub->skip_check)
SVN_ERR(check_unlock(&info.fs_err, info.path, token, ub, root,
iterpool));
- if (!info.fs_err)
- {
- const char *s;
- info.components = 1;
- info.component = info.path;
- while((s = strchr(info.component + 1, '/')))
- {
- info.component = s;
- ++info.components;
- }
-
- if (info.components > max_components)
- max_components = info.components;
+ /* If no error occurred while pre-checking, schedule the index updates for
+ this path. */
+ if (!info.fs_err)
+ schedule_index_update(indices_updates, info.path, iterpool);
- ++outstanding;
- }
APR_ARRAY_PUSH(ub->infos, unlock_info_t) = info;
}
rev_0_path = svn_fs_x__path_rev_absolute(ub->fs, 0, pool);
- for (i = max_components; i >= 0; --i)
+ /* Unlike the lock_body(), we need to delete locks *before* we start to
+ update indices. */
+
+ for (i = 0; i < ub->infos->nelts; ++i)
{
- const char *last_path = NULL;
- apr_array_header_t *paths;
- int j;
+ struct unlock_info_t *info = &APR_ARRAY_IDX(ub->infos, i,
+ struct unlock_info_t);
svn_pool_clear(iterpool);
- paths = apr_array_make(pool, 1, sizeof(const char *));
- for (j = 0; j < ub->infos->nelts; ++j)
+ if (! info->fs_err)
{
- unlock_info_t *info = &APR_ARRAY_IDX(ub->infos, j, unlock_info_t);
+ SVN_ERR(delete_lock(ub->fs->path, info->path, iterpool));
+ info->done = TRUE;
+ }
+ }
- if (!info->fs_err && info->path)
- {
+ for (hi = apr_hash_first(pool, indices_updates); hi; hi = apr_hash_next(hi))
+ {
+ const char *path = apr_hash_this_key(hi);
+ apr_array_header_t *children = apr_hash_this_val(hi);
- if (info->components == i)
- {
- SVN_ERR(delete_lock(ub->fs->path, info->path, iterpool));
- info->done = TRUE;
- }
- else if (info->components > i)
- {
- apr_size_t len = info->component - info->path;
-
- if (last_path
- && strcmp(last_path, "/")
- && (strncmp(last_path, info->path, len)
- || strlen(last_path) != len))
- {
- SVN_ERR(delete_from_digest(ub->fs->path, paths, last_path,
- rev_0_path, iterpool));
- apr_array_clear(paths);
- last_path = NULL;
- }
- APR_ARRAY_PUSH(paths, const char *) = info->path;
- if (!last_path)
- {
- if (info->component > info->path)
- last_path = apr_pstrndup(pool, info->path, len);
- else
- last_path = "/";
- }
-
- if (info->component > info->path)
- {
- --info->component;
- while(info->component[0] != '/')
- --info->component;
- }
- }
- }
-
- if (last_path && j == ub->infos->nelts - 1)
- SVN_ERR(delete_from_digest(ub->fs->path, paths, last_path,
- rev_0_path, iterpool));
- }
+ svn_pool_clear(iterpool);
+ SVN_ERR(delete_from_digest(ub->fs->path, children, path, rev_0_path,
+ iterpool));
}
+ svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
@@ -1200,6 +1097,8 @@ unlock_single(svn_fs_t *fs,
ub.fs = fs;
ub.targets = targets;
+ ub.infos = apr_array_make(scratch_pool, targets->nelts,
+ sizeof(struct unlock_info_t));
ub.skip_check = TRUE;
ub.result_pool = scratch_pool;
@@ -1228,6 +1127,7 @@ svn_fs_x__lock(svn_fs_t *fs,
apr_array_header_t *sorted_targets;
apr_hash_t *canonical_targets = apr_hash_make(scratch_pool);
apr_hash_index_t *hi;
+ apr_pool_t *iterpool;
svn_error_t *err, *cb_err = SVN_NO_ERROR;
int i;
@@ -1260,17 +1160,21 @@ svn_fs_x__lock(svn_fs_t *fs,
lb.fs = fs;
lb.targets = sorted_targets;
+ lb.infos = apr_array_make(scratch_pool, sorted_targets->nelts,
+ sizeof(struct lock_info_t));
lb.comment = comment;
lb.is_dav_comment = is_dav_comment;
lb.expiration_date = expiration_date;
lb.steal_lock = steal_lock;
lb.result_pool = result_pool;
- err = svn_fs_x__with_write_lock(fs, lock_body, &lb, scratch_pool);
+ iterpool = svn_pool_create(scratch_pool);
+ err = svn_fs_x__with_write_lock(fs, lock_body, &lb, iterpool);
for (i = 0; i < lb.infos->nelts; ++i)
{
struct lock_info_t *info = &APR_ARRAY_IDX(lb.infos, i,
struct lock_info_t);
+ svn_pool_clear(iterpool);
if (!cb_err && lock_callback)
{
if (!info->lock && !info->fs_err)
@@ -1279,10 +1183,11 @@ svn_fs_x__lock(svn_fs_t *fs,
info->path);
cb_err = lock_callback(lock_baton, info->path, info->lock,
- info->fs_err, scratch_pool);
+ info->fs_err, iterpool);
}
svn_error_clear(info->fs_err);
}
+ svn_pool_destroy(iterpool);
if (err && cb_err)
svn_error_compose(err, cb_err);
@@ -1322,6 +1227,7 @@ svn_fs_x__unlock(svn_fs_t *fs,
apr_array_header_t *sorted_targets;
apr_hash_t *canonical_targets = apr_hash_make(scratch_pool);
apr_hash_index_t *hi;
+ apr_pool_t *iterpool;
svn_error_t *err, *cb_err = SVN_NO_ERROR;
int i;
@@ -1350,14 +1256,18 @@ svn_fs_x__unlock(svn_fs_t *fs,
ub.fs = fs;
ub.targets = sorted_targets;
+ ub.infos = apr_array_make(scratch_pool, sorted_targets->nelts,
+ sizeof(struct unlock_info_t));
ub.skip_check = FALSE;
ub.break_lock = break_lock;
ub.result_pool = result_pool;
- err = svn_fs_x__with_write_lock(fs, unlock_body, &ub, scratch_pool);
+ iterpool = svn_pool_create(scratch_pool);
+ err = svn_fs_x__with_write_lock(fs, unlock_body, &ub, iterpool);
for (i = 0; i < ub.infos->nelts; ++i)
{
unlock_info_t *info = &APR_ARRAY_IDX(ub.infos, i, unlock_info_t);
+ svn_pool_clear(iterpool);
if (!cb_err && lock_callback)
{
if (!info->done && !info->fs_err)
@@ -1365,10 +1275,11 @@ svn_fs_x__unlock(svn_fs_t *fs,
0, _("Failed to unlock '%s'"),
info->path);
cb_err = lock_callback(lock_baton, info->path, NULL, info->fs_err,
- scratch_pool);
+ iterpool);
}
svn_error_clear(info->fs_err);
}
+ svn_pool_destroy(iterpool);
if (err && cb_err)
svn_error_compose(err, cb_err);
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/pack.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/pack.c Thu Jun 18 10:35:30 2015
@@ -625,13 +625,14 @@ compare_dir_entries(const svn_sort__item
apr_array_header_t *
svn_fs_x__order_dir_entries(svn_fs_t *fs,
apr_hash_t *directory,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
apr_array_header_t *ordered
- = svn_sort__hash(directory, compare_dir_entries, pool);
+ = svn_sort__hash(directory, compare_dir_entries, scratch_pool);
apr_array_header_t *result
- = apr_array_make(pool, ordered->nelts, sizeof(svn_fs_dirent_t *));
+ = apr_array_make(result_pool, ordered->nelts, sizeof(svn_fs_dirent_t *));
int i;
for (i = 0; i < ordered->nelts; ++i)
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/pack.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/pack.h?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/pack.h (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/pack.h Thu Jun 18 10:35:30 2015
@@ -51,13 +51,15 @@ svn_fs_x__get_packed_offset(apr_off_t *r
apr_pool_t *scratch_pool);
/* Return the svn_dir_entry_t* objects of DIRECTORY in an APR array
- * allocated in POOL with entries added in storage (on-disk) order.
- * FS format will be used to pick the optimal ordering strategy.
+ * allocated in RESULT_POOL with entries added in storage (on-disk) order.
+ * FS' format will be used to pick the optimal ordering strategy. Use
+ * SCRATCH_POOL for temporary allocations.
*/
apr_array_header_t *
svn_fs_x__order_dir_entries(svn_fs_t *fs,
apr_hash_t *directory,
- apr_pool_t *pool);
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
#endif
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache-db.sql
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache-db.sql?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache-db.sql (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache-db.sql Thu Jun 18 10:35:30 2015
@@ -65,3 +65,6 @@ WHERE revision > ?1
-- STMT_LOCK_REP
BEGIN TRANSACTION;
INSERT INTO rep_cache VALUES ('dummy', 0, 0, 0, 0)
+
+-- STMT_UNLOCK_REP
+ROLLBACK TRANSACTION;
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache.c Thu Jun 18 10:35:30 2015
@@ -369,16 +369,48 @@ svn_fs_x__del_rep_reference(svn_fs_t *fs
return SVN_NO_ERROR;
}
-svn_error_t *
-svn_fs_x__lock_rep_cache(svn_fs_t *fs,
- apr_pool_t *scratch_pool)
+/* Start a transaction to take an SQLite reserved lock that prevents
+ other writes.
+
+ See unlock_rep_cache(). */
+static svn_error_t *
+lock_rep_cache(svn_fs_t *fs,
+ apr_pool_t *pool)
{
svn_fs_x__data_t *ffd = fs->fsap_data;
if (! ffd->rep_cache_db)
- SVN_ERR(svn_fs_x__open_rep_cache(fs, scratch_pool));
+ SVN_ERR(svn_fs_x__open_rep_cache(fs, pool));
SVN_ERR(svn_sqlite__exec_statements(ffd->rep_cache_db, STMT_LOCK_REP));
return SVN_NO_ERROR;
}
+
+/* End the transaction started by lock_rep_cache(). */
+static svn_error_t *
+unlock_rep_cache(svn_fs_t *fs,
+ apr_pool_t *pool)
+{
+ svn_fs_x__data_t *ffd = fs->fsap_data;
+
+ SVN_ERR_ASSERT(ffd->rep_cache_db); /* was opened by lock_rep_cache() */
+
+ SVN_ERR(svn_sqlite__exec_statements(ffd->rep_cache_db, STMT_UNLOCK_REP));
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_fs_x__with_rep_cache_lock(svn_fs_t *fs,
+ svn_error_t *(*body)(void *,
+ apr_pool_t *),
+ void *baton,
+ apr_pool_t *pool)
+{
+ svn_error_t *err;
+
+ SVN_ERR(lock_rep_cache(fs, pool));
+ err = body(baton, pool);
+ return svn_error_compose_create(err, unlock_rep_cache(fs, pool));
+}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache.h?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache.h (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/rep-cache.h Thu Jun 18 10:35:30 2015
@@ -88,12 +88,16 @@ svn_fs_x__del_rep_reference(svn_fs_t *fs
svn_revnum_t youngest,
apr_pool_t *scratch_pool);
+
/* Start a transaction to take an SQLite reserved lock that prevents
- other writes. */
+ other writes, call BODY, end the transaction, and return what BODY returned.
+ */
svn_error_t *
-svn_fs_x__lock_rep_cache(svn_fs_t *fs,
- apr_pool_t *scratch_pool);
-
+svn_fs_x__with_rep_cache_lock(svn_fs_t *fs,
+ svn_error_t *(*body)(void *baton,
+ apr_pool_t *pool),
+ void *baton,
+ apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/revprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/revprops.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/revprops.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/revprops.c Thu Jun 18 10:35:30 2015
@@ -895,7 +895,8 @@ parse_packed_revprops(svn_fs_t *fs,
* length header to remove) */
svn_stringbuf_t *compressed = revprops->packed_revprops;
svn_stringbuf_t *uncompressed = svn_stringbuf_create_empty(result_pool);
- SVN_ERR(svn__decompress(compressed, uncompressed, APR_SIZE_MAX));
+ SVN_ERR(svn__decompress(compressed->data, compressed->len,
+ uncompressed, APR_SIZE_MAX));
/* read first revision number and number of revisions in the pack */
stream = svn_stream_from_stringbuf(uncompressed, scratch_pool);
@@ -1178,20 +1179,26 @@ write_non_packed_revprop(const char **fi
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
+ apr_file_t *file;
svn_stream_t *stream;
*final_path = svn_fs_x__path_revprops(fs, rev, result_pool);
/* ### do we have a directory sitting around already? we really shouldn't
### have to get the dirname here. */
- SVN_ERR(svn_stream_open_unique(&stream, tmp_path,
- svn_dirent_dirname(*final_path,
- scratch_pool),
- svn_io_file_del_none,
- result_pool, scratch_pool));
+ SVN_ERR(svn_io_open_unique_file3(&file, tmp_path,
+ svn_dirent_dirname(*final_path,
+ scratch_pool),
+ svn_io_file_del_none,
+ scratch_pool, scratch_pool));
+ stream = svn_stream_from_aprfile2(file, TRUE, scratch_pool);
SVN_ERR(svn_hash_write2(proplist, stream, SVN_HASH_TERMINATOR,
scratch_pool));
SVN_ERR(svn_stream_close(stream));
+ /* Flush temporary file to disk and close it. */
+ SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
+ SVN_ERR(svn_io_file_close(file, scratch_pool));
+
return SVN_NO_ERROR;
}
@@ -1287,7 +1294,7 @@ serialize_revprops_header(svn_stream_t *
return SVN_NO_ERROR;
}
-/* Writes the a pack file to FILE_STREAM. It copies the serialized data
+/* Writes the a pack file to FILE. It copies the serialized data
* from REVPROPS for the indexes [START,END) except for index CHANGED_INDEX.
*
* The data for the latter is taken from NEW_SERIALIZED. Note, that
@@ -1305,7 +1312,7 @@ repack_revprops(svn_fs_t *fs,
int changed_index,
svn_stringbuf_t *new_serialized,
apr_off_t new_total_size,
- svn_stream_t *file_stream,
+ apr_file_t *file,
apr_pool_t *scratch_pool)
{
svn_fs_x__data_t *ffd = fs->fsap_data;
@@ -1348,15 +1355,17 @@ repack_revprops(svn_fs_t *fs,
SVN_ERR(svn_stream_close(stream));
/* compress / store the data */
- SVN_ERR(svn__compress(uncompressed,
+ SVN_ERR(svn__compress(uncompressed->data, uncompressed->len,
compressed,
ffd->compress_packed_revprops
? SVN_DELTA_COMPRESSION_LEVEL_DEFAULT
: SVN_DELTA_COMPRESSION_LEVEL_NONE));
- /* finally, write the content to the target stream and close it */
- SVN_ERR(svn_stream_write(file_stream, compressed->data, &compressed->len));
- SVN_ERR(svn_stream_close(file_stream));
+ /* finally, write the content to the target file, flush and close it */
+ SVN_ERR(svn_io_file_write_full(file, compressed->data, compressed->len,
+ NULL, scratch_pool));
+ SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
+ SVN_ERR(svn_io_file_close(file, scratch_pool));
return SVN_NO_ERROR;
}
@@ -1364,27 +1373,26 @@ repack_revprops(svn_fs_t *fs,
/* Allocate a new pack file name for revisions
* [REVPROPS->START_REVISION + START, REVPROPS->START_REVISION + END - 1]
* of REVPROPS->MANIFEST. Add the name of old file to FILES_TO_DELETE,
- * auto-create that array if necessary. Return an open file stream to
- * the new file in *STREAM allocated in RESULT_POOL. Allocate the paths
- * in *FILES_TO_DELETE from the same pool that contains the array itself.
+ * auto-create that array if necessary. Return an open file *FILE that is
+ * allocated in RESULT_POOL. Allocate the paths in *FILES_TO_DELETE from
+ * the same pool that contains the array itself.
*
* Use SCRATCH_POOL for temporary allocations.
*/
static svn_error_t *
-repack_stream_open(svn_stream_t **stream,
- svn_fs_t *fs,
- packed_revprops_t *revprops,
- int start,
- int end,
- apr_array_header_t **files_to_delete,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+repack_file_open(apr_file_t **file,
+ svn_fs_t *fs,
+ packed_revprops_t *revprops,
+ int start,
+ int end,
+ apr_array_header_t **files_to_delete,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
apr_int64_t tag;
const char *tag_string;
svn_string_t *new_filename;
int i;
- apr_file_t *file;
int manifest_offset
= (int)(revprops->start_revision - revprops->manifest_start);
@@ -1418,13 +1426,12 @@ repack_stream_open(svn_stream_t **stream
APR_ARRAY_IDX(revprops->manifest, i + manifest_offset, const char*)
= new_filename->data;
- /* create a file stream for the new file */
- SVN_ERR(svn_io_file_open(&file, svn_dirent_join(revprops->folder,
- new_filename->data,
- scratch_pool),
+ /* open the file */
+ SVN_ERR(svn_io_file_open(file, svn_dirent_join(revprops->folder,
+ new_filename->data,
+ scratch_pool),
APR_WRITE | APR_CREATE, APR_OS_DEFAULT,
result_pool));
- *stream = svn_stream_from_aprfile2(file, FALSE, result_pool);
return SVN_NO_ERROR;
}
@@ -1450,6 +1457,7 @@ write_packed_revprop(const char **final_
packed_revprops_t *revprops;
apr_int64_t generation = 0;
svn_stream_t *stream;
+ apr_file_t *file;
svn_stringbuf_t *serialized;
apr_off_t new_total_size;
int changed_index;
@@ -1487,12 +1495,12 @@ write_packed_revprop(const char **final_
*final_path = svn_dirent_join(revprops->folder, revprops->filename,
result_pool);
- SVN_ERR(svn_stream_open_unique(&stream, tmp_path, revprops->folder,
- svn_io_file_del_none, result_pool,
- scratch_pool));
+ SVN_ERR(svn_io_open_unique_file3(&file, tmp_path, revprops->folder,
+ svn_io_file_del_none, result_pool,
+ scratch_pool));
SVN_ERR(repack_revprops(fs, revprops, 0, revprops->sizes->nelts,
changed_index, serialized, new_total_size,
- stream, scratch_pool));
+ file, scratch_pool));
}
else
{
@@ -1544,54 +1552,57 @@ write_packed_revprop(const char **final_
/* write the new, split files */
if (left_count)
{
- SVN_ERR(repack_stream_open(&stream, fs, revprops, 0,
- left_count, files_to_delete,
- scratch_pool, scratch_pool));
+ SVN_ERR(repack_file_open(&file, fs, revprops, 0,
+ left_count, files_to_delete,
+ scratch_pool, scratch_pool));
SVN_ERR(repack_revprops(fs, revprops, 0, left_count,
changed_index, serialized, new_total_size,
- stream, scratch_pool));
+ file, scratch_pool));
}
if (left_count + right_count < revprops->sizes->nelts)
{
- SVN_ERR(repack_stream_open(&stream, fs, revprops, changed_index,
- changed_index + 1, files_to_delete,
- scratch_pool, scratch_pool));
+ SVN_ERR(repack_file_open(&file, fs, revprops, changed_index,
+ changed_index + 1, files_to_delete,
+ scratch_pool, scratch_pool));
SVN_ERR(repack_revprops(fs, revprops, changed_index,
changed_index + 1,
changed_index, serialized, new_total_size,
- stream, scratch_pool));
+ file, scratch_pool));
}
if (right_count)
{
- SVN_ERR(repack_stream_open(&stream, fs, revprops,
- revprops->sizes->nelts - right_count,
- revprops->sizes->nelts,
- files_to_delete, scratch_pool,
- scratch_pool));
+ SVN_ERR(repack_file_open(&file, fs, revprops,
+ revprops->sizes->nelts - right_count,
+ revprops->sizes->nelts,
+ files_to_delete, scratch_pool,
+ scratch_pool));
SVN_ERR(repack_revprops(fs, revprops,
revprops->sizes->nelts - right_count,
revprops->sizes->nelts, changed_index,
- serialized, new_total_size, stream,
+ serialized, new_total_size, file,
scratch_pool));
}
/* write the new manifest */
*final_path = svn_dirent_join(revprops->folder, PATH_MANIFEST,
result_pool);
- SVN_ERR(svn_stream_open_unique(&stream, tmp_path, revprops->folder,
- svn_io_file_del_none, result_pool,
- scratch_pool));
+ SVN_ERR(svn_io_open_unique_file3(&file, tmp_path, revprops->folder,
+ svn_io_file_del_none, result_pool,
+ scratch_pool));
for (i = 0; i < revprops->manifest->nelts; ++i)
{
const char *filename = APR_ARRAY_IDX(revprops->manifest, i,
const char*);
- SVN_ERR(svn_stream_printf(stream, scratch_pool, "%s\n", filename));
+ SVN_ERR(svn_io_file_write_full(file, filename, strlen(filename),
+ NULL, scratch_pool));
+ SVN_ERR(svn_io_file_putc('\n', file, scratch_pool));
}
- SVN_ERR(svn_stream_close(stream));
+ SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
+ SVN_ERR(svn_io_file_close(file, scratch_pool));
}
return SVN_NO_ERROR;
@@ -1793,7 +1804,8 @@ svn_fs_x__copy_revprops(const char *pack
SVN_ERR(svn_stream_close(pack_stream));
/* compress the content (or just store it for COMPRESSION_LEVEL 0) */
- SVN_ERR(svn__compress(uncompressed, compressed, compression_level));
+ SVN_ERR(svn__compress(uncompressed->data, uncompressed->len,
+ compressed, compression_level));
/* write the pack file content to disk */
stream = svn_stream_from_aprfile2(pack_file, FALSE, scratch_pool);
@@ -1932,7 +1944,7 @@ svn_fs_x__delete_revprops_shard(const ch
apr_psprintf(iterpool, "%d", i),
iterpool);
if (cancel_func)
- SVN_ERR((*cancel_func)(cancel_baton));
+ SVN_ERR(cancel_func(cancel_baton));
SVN_ERR(svn_io_remove_file2(path, TRUE, iterpool));
}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/tree.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_fs_x/tree.c Thu Jun 18 10:35:30 2015
@@ -1342,20 +1342,19 @@ x_node_relation(svn_fs_node_relation_t *
return SVN_NO_ERROR;
}
- /* Nodes from different transactions are never related. */
- if (root_a->is_txn_root && root_b->is_txn_root
- && strcmp(root_a->txn, root_b->txn))
- {
- *relation = svn_fs_node_unrelated;
- return SVN_NO_ERROR;
- }
-
/* Are both (!) root paths? Then, they are related and we only test how
* direct the relation is. */
if (a_is_root_dir && b_is_root_dir)
{
- *relation = root_a->rev == root_b->rev
- ? svn_fs_node_same
+ svn_boolean_t different_txn
+ = root_a->is_txn_root && root_b->is_txn_root
+ && strcmp(root_a->txn, root_b->txn);
+
+ /* For txn roots, root->REV is the base revision of that TXN. */
+ *relation = ( (root_a->rev == root_b->rev)
+ && (root_a->is_txn_root == root_b->is_txn_root)
+ && !different_txn)
+ ? svn_fs_node_unchanged
: svn_fs_node_common_ancestor;
return SVN_NO_ERROR;
}
@@ -1370,8 +1369,10 @@ x_node_relation(svn_fs_node_relation_t *
noderev_id_b = *svn_fs_x__dag_get_id(node);
SVN_ERR(svn_fs_x__dag_get_node_id(&node_id_b, node));
+ /* In FSX, even in-txn IDs are globally unique.
+ * So, we can simply compare them. */
if (svn_fs_x__id_eq(&noderev_id_a, &noderev_id_b))
- *relation = svn_fs_node_same;
+ *relation = svn_fs_node_unchanged;
else if (svn_fs_x__id_eq(&node_id_a, &node_id_b))
*relation = svn_fs_node_common_ancestor;
else
@@ -1499,6 +1500,20 @@ x_node_proplist(apr_hash_t **table_p,
return SVN_NO_ERROR;
}
+static svn_error_t *
+x_node_has_props(svn_boolean_t *has_props,
+ svn_fs_root_t *root,
+ const char *path,
+ apr_pool_t *scratch_pool)
+{
+ apr_hash_t *props;
+
+ SVN_ERR(x_node_proplist(&props, root, path, scratch_pool));
+
+ *has_props = (0 < apr_hash_count(props));
+
+ return SVN_NO_ERROR;
+}
static svn_error_t *
increment_mergeinfo_up_tree(parent_path_t *pp,
@@ -1679,6 +1694,15 @@ compare_dir_structure(svn_boolean_t *cha
SVN_ERR(svn_fs_x__dag_dir_entries(&rhs_entries, rhs, scratch_pool,
iterpool));
+ /* different number of entries -> some addition / removal */
+ if (lhs_entries->nelts != rhs_entries->nelts)
+ {
+ svn_pool_destroy(iterpool);
+ *changed = TRUE;
+
+ return SVN_NO_ERROR;
+ }
+
/* Since directories are sorted by name, we can simply compare their
entries one-by-one without binary lookup etc. */
for (i = 0; i < lhs_entries->nelts; ++i)
@@ -1713,7 +1737,9 @@ compare_dir_structure(svn_boolean_t *cha
/* This is a different entry. */
*changed = TRUE;
- break;
+ svn_pool_destroy(iterpool);
+
+ return SVN_NO_ERROR;
}
svn_pool_destroy(iterpool);
@@ -2410,9 +2436,11 @@ static svn_error_t *
x_dir_optimal_order(apr_array_header_t **ordered_p,
svn_fs_root_t *root,
apr_hash_t *entries,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- *ordered_p = svn_fs_x__order_dir_entries(root->fs, entries, pool);
+ *ordered_p = svn_fs_x__order_dir_entries(root->fs, entries, result_pool,
+ scratch_pool);
return SVN_NO_ERROR;
}
@@ -4211,6 +4239,7 @@ static root_vtable_t root_vtable = {
x_closest_copy,
x_node_prop,
x_node_proplist,
+ x_node_has_props,
x_change_node_prop,
x_props_changed,
x_dir_entries,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra/ra_loader.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra/ra_loader.c Thu Jun 18 10:35:30 2015
@@ -143,7 +143,7 @@ load_ra_module(svn_ra__init_func_t *func
const char *compat_funcname;
apr_status_t status;
- libname = apr_psprintf(pool, "libsvn_ra_%s-%d.so.%d",
+ libname = apr_psprintf(pool, "libsvn_ra_%s-" SVN_DSO_SUFFIX_FMT,
ra_name, SVN_VER_MAJOR, SVN_SOVERSION);
funcname = apr_psprintf(pool, "svn_ra_%s__init", ra_name);
compat_funcname = apr_psprintf(pool, "svn_ra_%s_init", ra_name);
@@ -268,6 +268,7 @@ svn_error_t *svn_ra_open4(svn_ra_session
apr_pool_t *pool)
{
apr_pool_t *sesspool = svn_pool_create(pool);
+ apr_pool_t *scratch_pool = svn_pool_create(sesspool);
svn_ra_session_t *session;
const struct ra_lib_defn *defn;
const svn_ra__vtable_t *vtable = NULL;
@@ -277,6 +278,7 @@ svn_error_t *svn_ra_open4(svn_ra_session
#ifdef CHOOSABLE_DAV_MODULE
const char *http_library = DEFAULT_HTTP_LIBRARY;
#endif
+ svn_auth_baton_t *auth_baton;
/* Initialize the return variable. */
*session_p = NULL;
@@ -292,8 +294,12 @@ svn_error_t *svn_ra_open4(svn_ra_session
repos_URL);
if (callbacks->auth_baton)
- SVN_ERR(svn_auth__apply_config_for_server(callbacks->auth_baton, config,
- repos_URI.hostname, sesspool));
+ SVN_ERR(svn_auth__make_session_auth(&auth_baton,
+ callbacks->auth_baton, config,
+ repos_URI.hostname,
+ sesspool, scratch_pool));
+ else
+ auth_baton = NULL;
#ifdef CHOOSABLE_DAV_MODULE
if (config)
@@ -346,16 +352,16 @@ svn_error_t *svn_ra_open4(svn_ra_session
if (! initfunc)
SVN_ERR(load_ra_module(&initfunc, NULL, defn->ra_name,
- sesspool));
+ scratch_pool));
if (! initfunc)
/* Library not found. */
continue;
- SVN_ERR(initfunc(svn_ra_version(), &vtable, sesspool));
+ SVN_ERR(initfunc(svn_ra_version(), &vtable, scratch_pool));
SVN_ERR(check_ra_version(vtable->get_version(), scheme));
- if (! has_scheme_of(vtable->get_schemes(sesspool), repos_URL))
+ if (! has_scheme_of(vtable->get_schemes(scratch_pool), repos_URL))
/* Library doesn't support the scheme at runtime. */
continue;
@@ -379,10 +385,12 @@ svn_error_t *svn_ra_open4(svn_ra_session
/* Ask the library to open the session. */
err = vtable->open_session(session, corrected_url_p,
repos_URL,
- callbacks, callback_baton, config, sesspool);
+ callbacks, callback_baton, auth_baton,
+ config, sesspool, scratch_pool);
if (err)
{
+ svn_pool_destroy(sesspool); /* Includes scratch_pool */
if (err->apr_err == SVN_ERR_RA_SESSION_URL_MISMATCH)
return svn_error_trace(err);
@@ -400,7 +408,7 @@ svn_error_t *svn_ra_open4(svn_ra_session
{
/* *session_p = NULL; */
*corrected_url_p = apr_pstrdup(pool, *corrected_url_p);
- svn_pool_destroy(sesspool);
+ svn_pool_destroy(sesspool); /* Includes scratch_pool */
return SVN_NO_ERROR;
}
@@ -414,7 +422,7 @@ svn_error_t *svn_ra_open4(svn_ra_session
{
/* Duplicate the uuid as it is allocated in sesspool */
repository_uuid = apr_pstrdup(pool, repository_uuid);
- svn_pool_destroy(sesspool);
+ svn_pool_destroy(sesspool); /* includes scratch_pool */
return svn_error_createf(SVN_ERR_RA_UUID_MISMATCH, NULL,
_("Repository UUID '%s' doesn't match "
"expected UUID '%s'"),
@@ -422,6 +430,7 @@ svn_error_t *svn_ra_open4(svn_ra_session
}
}
+ svn_pool_destroy(scratch_pool);
*session_p = session;
return SVN_NO_ERROR;
}
@@ -946,6 +955,7 @@ svn_error_t *svn_ra_get_locations(svn_ra
{
svn_error_t *err;
+ SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(peg_revision));
SVN_ERR_ASSERT(svn_relpath_is_canonical(path));
err = session->vtable->get_locations(session, locations, path,
peg_revision, location_revisions, pool);
@@ -1113,6 +1123,8 @@ svn_error_t *svn_ra_replay(svn_ra_sessio
void *edit_baton,
apr_pool_t *pool)
{
+ SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision)
+ && SVN_IS_VALID_REVNUM(low_water_mark));
return session->vtable->replay(session, revision, low_water_mark,
text_deltas, editor, edit_baton, pool);
}
@@ -1180,7 +1192,14 @@ svn_ra_replay_range(svn_ra_session_t *se
void *replay_baton,
apr_pool_t *pool)
{
- svn_error_t *err =
+ svn_error_t *err;
+
+ SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(start_revision)
+ && SVN_IS_VALID_REVNUM(end_revision)
+ && start_revision <= end_revision
+ && SVN_IS_VALID_REVNUM(low_water_mark));
+
+ err =
session->vtable->replay_range(session, start_revision, end_revision,
low_water_mark, text_deltas,
revstart_func, revfinish_func,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra/ra_loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra/ra_loader.h?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra/ra_loader.h (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra/ra_loader.h Thu Jun 18 10:35:30 2015
@@ -61,8 +61,10 @@ typedef struct svn_ra__vtable_t {
const char *session_URL,
const svn_ra_callbacks2_t *callbacks,
void *callback_baton,
+ svn_auth_baton_t *auth_baton,
apr_hash_t *config,
- apr_pool_t *pool);
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Backs svn_ra_dup_session */
svn_error_t * (*dup_session)(svn_ra_session_t *new_session,
svn_ra_session_t *old_session,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra/wrapper_template.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra/wrapper_template.h?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra/wrapper_template.h (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra/wrapper_template.h Thu Jun 18 10:35:30 2015
@@ -91,7 +91,9 @@ static svn_error_t *compat_open(void **s
callbacks2->progress_baton = NULL;
SVN_ERR(VTBL.open_session(sess, &session_url, repos_URL,
- callbacks2, callback_baton, config, sesspool));
+ callbacks2, callback_baton,
+ callbacks ? callbacks->auth_baton : NULL,
+ config, sesspool, sesspool));
if (strcmp(repos_URL, session_url) != 0)
{
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_local/ra_local.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_local/ra_local.h?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_local/ra_local.h (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_local/ra_local.h Thu Jun 18 10:35:30 2015
@@ -63,6 +63,9 @@ typedef struct svn_ra_local__session_bat
const svn_ra_callbacks2_t *callbacks;
void *callback_baton;
+ /* Slave auth baton */
+ svn_auth_baton_t *auth_baton;
+
const char *useragent;
} svn_ra_local__session_baton_t;
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_local/ra_plugin.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_local/ra_plugin.c Thu Jun 18 10:35:30 2015
@@ -41,6 +41,7 @@
#include "private/svn_repos_private.h"
#include "private/svn_fspath.h"
#include "private/svn_atomic.h"
+#include "private/svn_subr_private.h"
#define APR_WANT_STRFUNC
#include <apr_want.h>
@@ -86,7 +87,7 @@ get_username(svn_ra_session_t *session,
{
/* Get a username somehow, so we have some svn:author property to
attach to a commit. */
- if (sess->callbacks->auth_baton)
+ if (sess->auth_baton)
{
void *creds;
svn_auth_cred_username_t *username_creds;
@@ -95,7 +96,7 @@ get_username(svn_ra_session_t *session,
SVN_ERR(svn_auth_first_credentials(&creds, &iterstate,
SVN_AUTH_CRED_USERNAME,
sess->uuid, /* realmstring */
- sess->callbacks->auth_baton,
+ sess->auth_baton,
scratch_pool));
/* No point in calling next_creds(), since that assumes that the
@@ -551,13 +552,16 @@ svn_ra_local__open(svn_ra_session_t *ses
const char *repos_URL,
const svn_ra_callbacks2_t *callbacks,
void *callback_baton,
+ svn_auth_baton_t *auth_baton,
apr_hash_t *config,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
const char *client_string;
svn_ra_local__session_baton_t *sess;
const char *fs_path;
static volatile svn_atomic_t cache_init_state = 0;
+ apr_pool_t *pool = result_pool;
/* Initialise the FSFS memory cache size. We can only do this once
so one CONFIG will win the race and all others will be ignored
@@ -572,6 +576,7 @@ svn_ra_local__open(svn_ra_session_t *ses
sess = apr_pcalloc(pool, sizeof(*sess));
sess->callbacks = callbacks;
sess->callback_baton = callback_baton;
+ sess->auth_baton = auth_baton;
/* Look through the URL, figure out which part points to the
repository, and which part is the path *within* the
@@ -1305,7 +1310,6 @@ svn_ra_local__get_dir(svn_ra_session_t *
apr_hash_t *entries;
apr_hash_index_t *hi;
svn_ra_local__session_baton_t *sess = session->priv;
- apr_pool_t *subpool;
const char *abs_path = svn_fspath__join(sess->fs_path->data, path, pool);
/* Open the revision's root. */
@@ -1321,29 +1325,28 @@ svn_ra_local__get_dir(svn_ra_session_t *
if (dirents)
{
+ apr_pool_t *iterpool = svn_pool_create(pool);
/* Get the dir's entries. */
SVN_ERR(svn_fs_dir_entries(&entries, root, abs_path, pool));
/* Loop over the fs dirents, and build a hash of general
svn_dirent_t's. */
*dirents = apr_hash_make(pool);
- subpool = svn_pool_create(pool);
for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
{
const void *key;
void *val;
- apr_hash_t *prophash;
const char *datestring, *entryname, *fullpath;
svn_fs_dirent_t *fs_entry;
svn_dirent_t *entry = svn_dirent_create(pool);
- svn_pool_clear(subpool);
+ svn_pool_clear(iterpool);
apr_hash_this(hi, &key, NULL, &val);
entryname = (const char *) key;
fs_entry = (svn_fs_dirent_t *) val;
- fullpath = svn_dirent_join(abs_path, entryname, subpool);
+ fullpath = svn_dirent_join(abs_path, entryname, iterpool);
if (dirent_fields & SVN_DIRENT_KIND)
{
@@ -1358,15 +1361,15 @@ svn_ra_local__get_dir(svn_ra_session_t *
entry->size = 0;
else
SVN_ERR(svn_fs_file_length(&(entry->size), root,
- fullpath, subpool));
+ fullpath, iterpool));
}
if (dirent_fields & SVN_DIRENT_HAS_PROPS)
{
/* has_props? */
- SVN_ERR(svn_fs_node_proplist(&prophash, root, fullpath,
- subpool));
- entry->has_props = (apr_hash_count(prophash) != 0);
+ SVN_ERR(svn_fs_node_has_props(&entry->has_props,
+ root, fullpath,
+ iterpool));
}
if ((dirent_fields & SVN_DIRENT_TIME)
@@ -1377,7 +1380,7 @@ svn_ra_local__get_dir(svn_ra_session_t *
SVN_ERR(svn_repos_get_committed_info(&(entry->created_rev),
&datestring,
&(entry->last_author),
- root, fullpath, subpool));
+ root, fullpath, iterpool));
if (datestring)
SVN_ERR(svn_time_from_cstring(&(entry->time), datestring,
pool));
@@ -1388,7 +1391,7 @@ svn_ra_local__get_dir(svn_ra_session_t *
/* Store. */
svn_hash_sets(*dirents, entryname, entry);
}
- svn_pool_destroy(subpool);
+ svn_pool_destroy(iterpool);
}
/* Handle props if requested. */
@@ -1692,23 +1695,13 @@ svn_ra_local__get_inherited_props(svn_ra
apr_pool_t *scratch_pool)
{
svn_fs_root_t *root;
- svn_revnum_t youngest_rev;
svn_ra_local__session_baton_t *sess = session->priv;
const char *abs_path = svn_fspath__join(sess->fs_path->data, path,
scratch_pool);
svn_node_kind_t node_kind;
/* Open the revision's root. */
- if (! SVN_IS_VALID_REVNUM(revision))
- {
- SVN_ERR(svn_fs_youngest_rev(&youngest_rev, sess->fs, scratch_pool));
- SVN_ERR(svn_fs_revision_root(&root, sess->fs, youngest_rev,
- scratch_pool));
- }
- else
- {
- SVN_ERR(svn_fs_revision_root(&root, sess->fs, revision, scratch_pool));
- }
+ SVN_ERR(svn_fs_revision_root(&root, sess->fs, revision, scratch_pool));
SVN_ERR(svn_fs_check_path(&node_kind, root, abs_path, scratch_pool));
if (node_kind == svn_node_none)
@@ -1876,8 +1869,8 @@ svn_ra_local__init(const svn_version_t *
SVN_ERR(svn_ver_check_list2(ra_local_version(), checklist, svn_ver_equal));
#ifndef SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL
- /* This assumes that POOL was the pool used to load the dso. */
- SVN_ERR(svn_fs_initialize(pool));
+ /* This means the library was loaded as a DSO, so use the DSO pool. */
+ SVN_ERR(svn_fs_initialize(svn_dso__pool()));
#endif
*vtable = &ra_local_vtable;
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/commit.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/commit.c Thu Jun 18 10:35:30 2015
@@ -71,6 +71,7 @@ typedef struct commit_context_t {
const char *checked_in_url; /* checked-in root to base CHECKOUTs from */
const char *vcc_url; /* vcc url */
+ int open_batons; /* Number of open batons */
} commit_context_t;
#define USING_HTTPV2_COMMIT_SUPPORT(commit_ctx) ((commit_ctx)->txn_url != NULL)
@@ -117,9 +118,6 @@ typedef struct dir_context_t {
HTTP v2, for PROPPATCH in HTTP v2). */
const char *url;
- /* How many pending changes we have left in this directory. */
- unsigned int ref_count;
-
/* Is this directory being added? (Otherwise, just opened.) */
svn_boolean_t added;
@@ -1258,6 +1256,8 @@ open_root(void *edit_baton,
const char *proppatch_target = NULL;
apr_pool_t *scratch_pool = svn_pool_create(dir_pool);
+ commit_ctx->open_batons++;
+
if (SVN_RA_SERF__HAVE_HTTPV2_SUPPORT(commit_ctx->session))
{
post_response_ctx_t *prc;
@@ -1533,6 +1533,8 @@ add_directory(const char *path,
dir->name = svn_relpath_basename(dir->relpath, NULL);
dir->prop_changes = apr_hash_make(dir->pool);
+ dir->commit_ctx->open_batons++;
+
if (USING_HTTPV2_COMMIT_SUPPORT(dir->commit_ctx))
{
dir->url = svn_path_url_add_component2(parent->commit_ctx->txn_root_url,
@@ -1623,6 +1625,8 @@ open_directory(const char *path,
dir->name = svn_relpath_basename(dir->relpath, NULL);
dir->prop_changes = apr_hash_make(dir->pool);
+ dir->commit_ctx->open_batons++;
+
if (USING_HTTPV2_COMMIT_SUPPORT(dir->commit_ctx))
{
dir->url = svn_path_url_add_component2(parent->commit_ctx->txn_root_url,
@@ -1701,6 +1705,8 @@ close_directory(void *dir_baton,
proppatch_ctx, dir->pool));
}
+ dir->commit_ctx->open_batons--;
+
return SVN_NO_ERROR;
}
@@ -1720,8 +1726,6 @@ add_file(const char *path,
new_file = apr_pcalloc(file_pool, sizeof(*new_file));
new_file->pool = file_pool;
- dir->ref_count++;
-
new_file->parent_dir = dir;
new_file->commit_ctx = dir->commit_ctx;
new_file->relpath = apr_pstrdup(new_file->pool, path);
@@ -1732,6 +1736,8 @@ add_file(const char *path,
new_file->copy_revision = copy_revision;
new_file->prop_changes = apr_hash_make(new_file->pool);
+ dir->commit_ctx->open_batons++;
+
/* Ensure that the file doesn't exist by doing a HEAD on the
resource. If we're using HTTP v2, we'll just look into the
transaction root tree for this thing. */
@@ -1842,8 +1848,6 @@ open_file(const char *path,
new_file = apr_pcalloc(file_pool, sizeof(*new_file));
new_file->pool = file_pool;
- parent->ref_count++;
-
new_file->parent_dir = parent;
new_file->commit_ctx = parent->commit_ctx;
new_file->relpath = apr_pstrdup(new_file->pool, path);
@@ -1852,6 +1856,8 @@ open_file(const char *path,
new_file->base_revision = base_revision;
new_file->prop_changes = apr_hash_make(new_file->pool);
+ parent->commit_ctx->open_batons++;
+
if (USING_HTTPV2_COMMIT_SUPPORT(parent->commit_ctx))
{
new_file->url = svn_path_url_add_component2(parent->commit_ctx->txn_root_url,
@@ -2014,6 +2020,8 @@ close_file(void *file_baton,
proppatch, scratch_pool));
}
+ ctx->commit_ctx->open_batons--;
+
return SVN_NO_ERROR;
}
@@ -2027,6 +2035,11 @@ close_edit(void *edit_baton,
const svn_commit_info_t *commit_info;
svn_error_t *err = NULL;
+ if (ctx->open_batons > 0)
+ return svn_error_create(
+ SVN_ERR_FS_INCORRECT_EDITOR_COMPLETION, NULL,
+ _("Closing editor with directories or files open"));
+
/* MERGE our activity */
SVN_ERR(svn_ra_serf__run_merge(&commit_info,
ctx->session,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/get_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/get_file.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/get_file.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/get_file.c Thu Jun 18 10:35:30 2015
@@ -321,17 +321,19 @@ svn_ra_serf__get_file(svn_ra_session_t *
svn_stream_t *stream,
svn_revnum_t *fetched_rev,
apr_hash_t **props,
- apr_pool_t *pool)
+ apr_pool_t *result_pool)
{
svn_ra_serf__session_t *session = ra_session->priv;
const char *fetch_url;
const svn_ra_serf__dav_props_t *which_props;
svn_ra_serf__handler_t *propfind_handler;
+ apr_pool_t *scratch_pool = svn_pool_create(result_pool);
struct file_prop_baton_t fb;
/* Fetch properties. */
- fetch_url = svn_path_url_add_component2(session->session_url.path, path, pool);
+ fetch_url = svn_path_url_add_component2(session->session_url.path, path,
+ scratch_pool);
/* The simple case is if we want HEAD - then a GET on the fetch_url is fine.
*
@@ -343,7 +345,7 @@ svn_ra_serf__get_file(svn_ra_session_t *
SVN_ERR(svn_ra_serf__get_stable_url(&fetch_url, fetched_rev,
session,
fetch_url, revision,
- pool, pool));
+ scratch_pool, scratch_pool));
revision = SVN_INVALID_REVNUM;
}
/* REVISION is always SVN_INVALID_REVNUM */
@@ -356,8 +358,8 @@ svn_ra_serf__get_file(svn_ra_session_t *
else
which_props = check_path_props;
- fb.result_pool = pool;
- fb.props = props ? apr_hash_make(pool) : NULL;
+ fb.result_pool = result_pool;
+ fb.props = props ? apr_hash_make(result_pool) : NULL;
fb.kind = svn_node_unknown;
fb.sha1_checksum = NULL;
@@ -365,9 +367,9 @@ svn_ra_serf__get_file(svn_ra_session_t *
fetch_url, SVN_INVALID_REVNUM,
"0", which_props,
get_file_prop_cb, &fb,
- pool));
+ scratch_pool));
- SVN_ERR(svn_ra_serf__context_run_one(propfind_handler, pool));
+ SVN_ERR(svn_ra_serf__context_run_one(propfind_handler, scratch_pool));
/* Verify that resource type is not collection. */
if (fb.kind != svn_node_file)
@@ -382,7 +384,8 @@ svn_ra_serf__get_file(svn_ra_session_t *
if (stream)
{
svn_boolean_t found;
- SVN_ERR(try_get_wc_contents(&found, session, fb.sha1_checksum, stream, pool));
+ SVN_ERR(try_get_wc_contents(&found, session, fb.sha1_checksum, stream,
+ scratch_pool));
/* No contents found in the WC, let's fetch from server. */
if (!found)
@@ -391,11 +394,11 @@ svn_ra_serf__get_file(svn_ra_session_t *
svn_ra_serf__handler_t *handler;
/* Create the fetch context. */
- stream_ctx = apr_pcalloc(pool, sizeof(*stream_ctx));
+ stream_ctx = apr_pcalloc(scratch_pool, sizeof(*stream_ctx));
stream_ctx->result_stream = stream;
stream_ctx->using_compression = session->using_compression;
- handler = svn_ra_serf__create_handler(session, pool);
+ handler = svn_ra_serf__create_handler(session, scratch_pool);
handler->method = "GET";
handler->path = fetch_url;
@@ -414,12 +417,14 @@ svn_ra_serf__get_file(svn_ra_session_t *
stream_ctx->handler = handler;
- SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
+ SVN_ERR(svn_ra_serf__context_run_one(handler, scratch_pool));
if (handler->sline.code != 200)
return svn_error_trace(svn_ra_serf__unexpected_status(handler));
}
}
+ svn_pool_destroy(scratch_pool);
+
return SVN_NO_ERROR;
}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/getlocations.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/getlocations.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/getlocations.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/getlocations.c Thu Jun 18 10:35:30 2015
@@ -193,9 +193,8 @@ svn_ra_serf__get_locations(svn_ra_sessio
SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
- SVN_ERR(svn_ra_serf__error_on_status(handler->sline,
- handler->path,
- handler->location));
+ if (handler->sline.code != 200)
+ SVN_ERR(svn_ra_serf__unexpected_status(handler));
return SVN_NO_ERROR;
}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/getlocationsegments.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/getlocationsegments.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/getlocationsegments.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/getlocationsegments.c Thu Jun 18 10:35:30 2015
@@ -196,12 +196,8 @@ svn_ra_serf__get_location_segments(svn_r
err = svn_ra_serf__context_run_one(handler, pool);
- if (!err)
- {
- err = svn_ra_serf__error_on_status(handler->sline,
- handler->path,
- handler->location);
- }
+ if (!err && handler->sline.code != 200)
+ err = svn_ra_serf__unexpected_status(handler);
if (err && (err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE))
return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, err, NULL);
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/lock.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/lock.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/lock.c Thu Jun 18 10:35:30 2015
@@ -291,6 +291,7 @@ run_locks(svn_ra_serf__session_t *sess,
ctx->handler->sline.reason);
break;
+ case 404:
case 409:
case 500:
if (server_err)
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/log.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/log.c Thu Jun 18 10:35:30 2015
@@ -272,7 +272,7 @@ log_closed(svn_ra_serf__xml_estate_t *xe
svn_log_entry_t *log_entry;
const char *rev_str;
- if (log_ctx->limit && (log_ctx->nest_level == 0)
+ if ((log_ctx->limit > 0) && (log_ctx->nest_level == 0)
&& (++log_ctx->count > log_ctx->limit))
{
return SVN_NO_ERROR;
@@ -598,8 +598,8 @@ svn_ra_serf__get_log(svn_ra_session_t *r
SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
- return svn_error_trace(
- svn_ra_serf__error_on_status(handler->sline,
- req_url,
- handler->location));
+ if (handler->sline.code != 200)
+ SVN_ERR(svn_ra_serf__unexpected_status(handler));
+
+ return SVN_NO_ERROR;
}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/mergeinfo.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/mergeinfo.c Thu Jun 18 10:35:30 2015
@@ -228,8 +228,8 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
- SVN_ERR(svn_ra_serf__error_on_status(handler->sline, handler->path,
- handler->location));
+ if (handler->sline.code != 200)
+ SVN_ERR(svn_ra_serf__unexpected_status(handler));
if (apr_hash_count(mergeinfo_ctx->result_catalog))
*catalog = mergeinfo_ctx->result_catalog;
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/ra_serf.h?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/ra_serf.h Thu Jun 18 10:35:30 2015
@@ -154,6 +154,7 @@ struct svn_ra_serf__session_t {
/* Callback functions to get info from WC */
const svn_ra_callbacks2_t *wc_callbacks;
void *wc_callback_baton;
+ svn_auth_baton_t *auth_baton;
/* Callback function to send progress info to the client */
svn_ra_progress_notify_func_t progress_func;
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/replay.c?rev=1686174&r1=1686173&r2=1686174&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_serf/replay.c Thu Jun 18 10:35:30 2015
@@ -427,10 +427,11 @@ replay_closed(svn_ra_serf__xml_estate_t
{
struct replay_node_t *node = ctx->current_node;
- if (! node || ! node->file || ! node->stream)
+ if (! node || ! node->file)
return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL);
- SVN_ERR(svn_stream_close(node->stream));
+ if (node->stream)
+ SVN_ERR(svn_stream_close(node->stream));
node->stream = NULL;
}
@@ -565,10 +566,10 @@ svn_ra_serf__replay(svn_ra_session_t *ra
SVN_ERR(svn_ra_serf__context_run_one(handler, scratch_pool));
- return svn_error_trace(
- svn_ra_serf__error_on_status(handler->sline,
- handler->path,
- handler->location));
+ if (handler->sline.code != 200)
+ SVN_ERR(svn_ra_serf__unexpected_status(handler));
+
+ return SVN_NO_ERROR;
}
/* The maximum number of outstanding requests at any time. When this
@@ -646,9 +647,10 @@ svn_ra_serf__replay_range(svn_ra_session
int active_reports = 0;
const char *include_path;
svn_boolean_t done;
+ apr_pool_t *subpool = svn_pool_create(scratch_pool);
SVN_ERR(svn_ra_serf__report_resource(&report_target, session,
- scratch_pool));
+ subpool));
/* Prior to 1.8, mod_dav_svn expect to get replay REPORT requests
aimed at the session URL. But that's incorrect -- these reports
@@ -671,7 +673,7 @@ svn_ra_serf__replay_range(svn_ra_session
{
SVN_ERR(svn_ra_serf__get_relative_path(&include_path,
session->session_url.path,
- session, scratch_pool));
+ session, subpool));
}
else
{
@@ -689,7 +691,7 @@ svn_ra_serf__replay_range(svn_ra_session
{
struct revision_report_t *rev_ctx;
svn_ra_serf__handler_t *handler;
- apr_pool_t *rev_pool = svn_pool_create(scratch_pool);
+ apr_pool_t *rev_pool = svn_pool_create(subpool);
svn_ra_serf__xml_context_t *xmlctx;
const char *replay_target;
@@ -769,13 +771,23 @@ svn_ra_serf__replay_range(svn_ra_session
/* Run the serf loop. */
done = FALSE;
- SVN_ERR(svn_ra_serf__context_run_wait(&done, session, scratch_pool));
+ {
+ svn_error_t *err = svn_ra_serf__context_run_wait(&done, session,
+ subpool);
+
+ if (err)
+ {
+ svn_pool_destroy(subpool); /* Unregister all requests! */
+ return svn_error_trace(err);
+ }
+ }
/* The done handler of reports decrements active_reports when a report
is done. This same handler reports (fatal) report errors, so we can
just loop here. */
}
+ svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}
#undef MAX_OUTSTANDING_REQUESTS