Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/tests/cmdline/lock_tests.py view on Meta::CPAN
svntest.actions.run_and_verify_svn2(None, [], expected_err, 0,
'unlock',
'--username', svntest.main.wc_author2,
pi_path)
svntest.actions.run_and_verify_status(wc_dir, expected_status)
#----------------------------------------------------------------------
def lock_funky_comment_chars(sbox):
"lock a file using a comment with xml special chars"
sbox.build()
wc_dir = sbox.wc_dir
# lock a file as wc_author
fname = 'iota'
file_path = os.path.join(sbox.wc_dir, fname)
svntest.main.file_append(file_path, "This represents a binary file\n")
svntest.main.run_svn(None, 'commit',
'-m', '', file_path)
svntest.actions.run_and_verify_svn(None, ".*locked by user", [], 'lock',
'-m', 'lock & load', file_path)
#----------------------------------------------------------------------
# Check that the svn:needs-lock usage applies to a specific location
# in a working copy, not to the working copy overall.
def lock_twice_in_one_wc(sbox):
"try to lock a file twice in one working copy"
sbox.build()
wc_dir = sbox.wc_dir
mu_path = sbox.ospath('A/mu')
mu2_path = sbox.ospath('A/B/mu')
# Create a needs-lock file
svntest.actions.set_prop('svn:needs-lock', '*', mu_path)
svntest.actions.run_and_verify_svn(None, None, [],
'commit', wc_dir, '-m', '')
# Mark the file readonly
svntest.actions.run_and_verify_svn(None, None, [],
'update', wc_dir)
# Switch a second location for the same file in the same working copy
svntest.actions.run_and_verify_svn(None, None, [],
'switch', sbox.repo_url + '/A',
sbox.ospath('A/B'),
'--ignore-ancestry')
# Lock location 1
svntest.actions.run_and_verify_svn(None, None, [],
'lock', mu_path, '-m', 'Locked here')
# Locking in location 2 should fail ### Currently returns exitcode 0
svntest.actions.run_and_verify_svn2(None, None, ".*is already locked.*", 0,
'lock', '-m', '', mu2_path)
# Change the file anyway
os.chmod(mu2_path, 0700)
svntest.main.file_append(mu2_path, "Updated text")
# Commit will just succeed as the DB owns the lock. It's a user decision
# to commit the other target instead of the one originally locked
svntest.actions.run_and_verify_svn(None, None, [],
'commit', mu2_path, '-m', '')
#----------------------------------------------------------------------
# Test for issue #3524 'Locking path via ra_serf which doesn't exist in
# HEAD triggers assert'
@Issue(3524)
def lock_path_not_in_head(sbox):
"lock path that does not exist in HEAD"
sbox.build()
wc_dir = sbox.wc_dir
D_path = sbox.ospath('A/D')
lambda_path = sbox.ospath('A/B/lambda')
# Commit deletion of A/D and A/B/lambda as r2, then update the WC
# back to r1. Then attempt to lock some paths that no longer exist
# in HEAD. These should fail gracefully.
svntest.actions.run_and_verify_svn(None, None, [],
'delete', lambda_path, D_path)
svntest.actions.run_and_verify_svn(None, None, [], 'commit',
'-m', 'Some deletions', wc_dir)
svntest.actions.run_and_verify_svn(None, None, [], 'up', '-r1', wc_dir)
expected_lock_fail_err_re = "svn: warning: W160042: " \
"((Path .* doesn't exist in HEAD revision)" \
"|(L(ock|OCK) request (on '.*' )?failed: 405 Method Not Allowed))"
# Issue #3524 These lock attemtps were triggering an assert over ra_serf:
#
# working_copies\lock_tests-37>svn lock A\D
# ..\..\..\subversion\libsvn_client\ra.c:275: (apr_err=235000)
# svn: In file '..\..\..\subversion\libsvn_ra_serf\util.c' line 1120:
# assertion failed (ctx->status_code)
#
# working_copies\lock_tests-37>svn lock A\B\lambda
# ..\..\..\subversion\libsvn_client\ra.c:275: (apr_err=235000)
# svn: In file '..\..\..\subversion\libsvn_ra_serf\util.c' line 1120:
# assertion failed (ctx->status_code)
svntest.actions.run_and_verify_svn2(None, None, expected_lock_fail_err_re,
0, 'lock', lambda_path)
expected_err = 'svn: E155008: The node \'.*D\' is not a file'
svntest.actions.run_and_verify_svn(None, None, expected_err,
'lock', D_path)
#----------------------------------------------------------------------
def verify_path_escaping(sbox):
"verify escaping of lock paths"
sbox.build()
wc_dir = sbox.wc_dir
# Add test paths using two characters that need escaping in a url, but
# are within the normal ascii range
( run in 1.244 second using v1.01-cache-2.11-cpan-9288abcf80b )