Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Commit

Permalink
Replace another use of access batons with the working copy locking APIs.
Browse files Browse the repository at this point in the history
This has the side effect of allowing behavior that would otherwise error, so
update a test to expect the (improved) behavior.

* subversion/tests/cmdline/schedule_tests.py
  (revert_inside_newly_added_dir): Update docs and expectation.

* subversion/libsvn_client/revert.c
  (revert): Use the locking APIs in place of access batons.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@882232 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Hyrum Kurt Wright committed Nov 19, 2009
1 parent d41f4ff commit 217fce5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
15 changes: 5 additions & 10 deletions subversion/libsvn_client/revert.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,13 @@ revert(const char *path,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
svn_wc_adm_access_t *adm_access, *target_access;
const char *target, *local_abspath;
const char *local_abspath;
svn_error_t *err;
int adm_lock_level = SVN_WC__LEVELS_TO_LOCK_FROM_DEPTH(depth);

SVN_ERR(svn_wc__adm_open_anchor_in_context(
&adm_access, &target_access, &target,
ctx->wc_ctx, path, TRUE, adm_lock_level,
ctx->cancel_func, ctx->cancel_baton,
pool));

SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));

SVN_ERR(svn_wc__acquire_write_lock(ctx->wc_ctx, local_abspath, pool));

err = svn_wc_revert4(ctx->wc_ctx,
local_abspath,
depth,
Expand Down Expand Up @@ -108,7 +102,8 @@ revert(const char *path,
return svn_error_return(err);
}

return svn_wc_adm_close2(adm_access, pool);
return svn_error_return(
svn_wc__release_write_lock(ctx->wc_ctx, local_abspath, pool));
}


Expand Down
6 changes: 4 additions & 2 deletions subversion/tests/cmdline/schedule_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,8 @@ def delete_missing(sbox):
#----------------------------------------------------------------------
# Regression test for issue #854:
# Revert . inside an svn added empty directory should generate an error.
# Not anymore! wc-ng uses absolute paths for everything, which means we
# can handle this case without too much trouble.

def revert_inside_newly_added_dir(sbox):
"revert inside a newly added dir"
Expand All @@ -511,9 +513,9 @@ def revert_inside_newly_added_dir(sbox):
svntest.main.run_svn(None, 'add', 'foo')

# Now change into the newly added directory, revert and make sure
# an error is output.
# no error is output.
os.chdir('foo')
svntest.actions.run_and_verify_svn(None, None, svntest.verify.AnyOutput,
svntest.actions.run_and_verify_svn(None, None, [],
'revert', '.')

#----------------------------------------------------------------------
Expand Down

0 comments on commit 217fce5

Please sign in to comment.