Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/tests/cmdline/prop_tests.py view on Meta::CPAN
svntest.actions.run_and_verify_svn('overlapping ranges', None,
"svn: E200020: Unable to parse overlapping "
"revision ranges "
"(('3' and '3\\*')|('3\\*' and '3')) "
"with different "
"inheritance types\n",
'propset', SVN_PROP_MERGEINFO,
'/branch:3,3*', path)
# ...contain revision ranges with start revisions greater than or
# equal to end revisions.
svntest.actions.run_and_verify_svn('range start >= range end', None,
"svn: E200020: Unable to parse reversed "
"revision range '20-5'\n",
'propset', SVN_PROP_MERGEINFO,
'/featureX:4,20-5', path)
# ...contain paths mapped to empty revision ranges
svntest.actions.run_and_verify_svn('empty ranges', None,
"svn: E200020: Mergeinfo for '/trunk' maps to "
"an empty revision range\n",
'propset', SVN_PROP_MERGEINFO,
'/trunk:', path)
# ...contain non-inheritable ranges when the target is a file.
svntest.actions.run_and_verify_svn('empty ranges', None,
"svn: E200020: Cannot set non-inheritable "
"mergeinfo on a non-directory*",
'propset', SVN_PROP_MERGEINFO,
'/A/D/H/psi:1*', iota_path)
#----------------------------------------------------------------------
# Issue #976. When copying a file, do not determine svn:executable
# and svn:mime-type values as though the file is brand new, instead
# use the copied file's property values.
@Issue(976)
def copy_inherits_special_props(sbox):
"file copies inherit (not re-derive) special props"
# Bootstrap
sbox.build()
wc_dir = sbox.wc_dir
orig_mime_type = 'image/fake_image'
# Create two paths
new_path1 = sbox.ospath('new_file1.bin')
new_path2 = sbox.ospath('new_file2.bin')
# Create the first path as a binary file. To have svn treat the
# file as binary, have a 0x00 in the file.
svntest.main.file_append(new_path1, "binary file\000")
sbox.simple_add('new_file1.bin')
# Add initial svn:mime-type to the file
sbox.simple_propset('svn:mime-type', orig_mime_type, 'new_file1.bin')
# Set the svn:executable property on the file if this is a system
# that can handle chmod, in which case svn will turn on the
# executable bits on the file. Then remove the executable bits
# manually on the file and see the value of svn:executable in the
# copied file.
if os.name == 'posix':
sbox.simple_propset('svn:executable', 'on', 'new_file1.bin')
os.chmod(new_path1, 0644)
# Commit the file
sbox.simple_commit()
# Copy the file
svntest.main.run_svn(None, 'cp', new_path1, new_path2)
# Check the svn:mime-type
actual_exit, actual_stdout, actual_stderr = svntest.main.run_svn(
None, 'pg', 'svn:mime-type', new_path2)
expected_stdout = [orig_mime_type + '\n']
if actual_stdout != expected_stdout:
logger.warn("svn pg svn:mime-type output does not match expected.")
logger.warn("Expected standard output: %s\n", expected_stdout)
logger.warn("Actual standard output: %s\n", actual_stdout)
raise svntest.verify.SVNUnexpectedOutput
# Check the svn:executable value.
# The value of the svn:executable property is now always forced to '*'
if os.name == 'posix':
actual_exit, actual_stdout, actual_stderr = svntest.main.run_svn(
None, 'pg', 'svn:executable', new_path2)
expected_stdout = ['*\n']
if actual_stdout != expected_stdout:
logger.warn("svn pg svn:executable output does not match expected.")
logger.warn("Expected standard output: %s\n", expected_stdout)
logger.warn("Actual standard output: %s\n", actual_stdout)
raise svntest.verify.SVNUnexpectedOutput
#----------------------------------------------------------------------
# Test for issue #3086 'mod-dav-svn ignores pre-revprop-change failure
# on revprop delete'
#
# If we learn how to write a pre-revprop-change hook for
# non-Posix platforms, we won't have to skip here:
@Skip(is_non_posix_and_non_windows_os)
@Issue(3086)
@XFail(svntest.main.is_ra_type_dav)
def revprop_change(sbox):
"set, get, and delete a revprop change"
sbox.build()
# First test the error when no revprop-change hook exists.
svntest.actions.run_and_verify_svn(None, None, '.*pre-revprop-change',
'propset', '--revprop', '-r', '0',
'cash-sound', 'cha-ching!', sbox.wc_dir)
# Now test error output from revprop-change hook.
svntest.actions.disable_revprop_changes(sbox.repo_dir)
svntest.actions.run_and_verify_svn(None, None, '.*pre-revprop-change.* 0 jrandom cash-sound A',
'propset', '--revprop', '-r', '0',
'cash-sound', 'cha-ching!', sbox.wc_dir)
# Create the revprop-change hook for this test
svntest.actions.enable_revprop_changes(sbox.repo_dir)
svntest.actions.run_and_verify_svn(None, None, [],
src/subversion/subversion/tests/cmdline/prop_tests.py view on Meta::CPAN
wc_dir = sbox.wc_dir
cwd = os.getcwd()
os.chdir(wc_dir)
propname = chr(8)
propval = 'foo'
expected_stdout = (".*Attempting to delete nonexistent property "
"'%s'.*" % (propname,))
svntest.actions.run_and_verify_svn(None, expected_stdout, [],
'propdel', propname)
expected_stderr = (".*'%s' is not a valid Subversion"
' property name' % (propname,))
svntest.actions.run_and_verify_svn(None, None, expected_stderr,
'propedit', propname)
svntest.actions.run_and_verify_svn(None, None, expected_stderr,
'propget', propname)
svntest.actions.run_and_verify_svn(None, None, expected_stderr,
'propset', propname, propval)
svntest.actions.run_and_verify_svn(None, None, expected_stderr,
'commit', '--with-revprop',
'='.join([propname, propval]))
# Now swap them: --with-revprop should accept propname as a property
# value; no concept of validity there.
svntest.actions.run_and_verify_svn(None, [], [],
'commit', '--with-revprop',
'='.join([propval, propname]))
os.chdir(cwd)
@SkipUnless(svntest.main.is_posix_os)
@Issue(2581)
def perms_on_symlink(sbox):
"propset shouldn't touch symlink perms"
sbox.build()
# We can't just run commands on absolute paths in the usual way
# (e.g., os.path.join(sbox.wc_dir, 'newdir')), because for some
# reason, if the symlink points to newdir as an absolute path, the
# bug doesn't reproduce. I have no idea why. Since it does have to
# point to newdir, the only other choice is to have it point to it
# in the same directory, so we have to run the test from inside the
# working copy.
saved_cwd = os.getcwd()
os.chdir(sbox.wc_dir)
try:
svntest.actions.run_and_verify_svn(None, None, [], 'mkdir', 'newdir')
os.symlink('newdir', 'symlink')
svntest.actions.run_and_verify_svn(None, None, [], 'add', 'symlink')
old_mode = os.stat('newdir')[stat.ST_MODE]
# The only property on 'symlink' is svn:special, so attempting to remove
# 'svn:executable' should result in an error
expected_stdout = (".*Attempting to delete nonexistent property "
"'svn:executable'.*")
svntest.actions.run_and_verify_svn(None, expected_stdout, [], 'propdel',
'svn:executable', 'symlink')
new_mode = os.stat('newdir')[stat.ST_MODE]
if not old_mode == new_mode:
# Chmod newdir back, so the test suite can remove this working
# copy when cleaning up later.
os.chmod('newdir', stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
raise svntest.Failure
finally:
os.chdir(saved_cwd)
# Use a property with a custom namespace, ie 'ns:prop' or 'mycompany:prop'.
def remove_custom_ns_props(sbox):
"remove a property with a custom namespace"
# Bootstrap
sbox.build()
wc_dir = sbox.wc_dir
# Add a property to a file
sbox.simple_propset('ns:cash-sound', 'cha-ching!', 'iota')
# Commit the file
sbox.simple_commit('iota')
# Now, make a backup copy of the working copy
wc_backup = sbox.add_wc_path('backup')
svntest.actions.duplicate_dir(wc_dir, wc_backup)
# Remove the property
sbox.simple_propdel('ns:cash-sound', 'iota')
# Create expected trees.
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('iota', wc_rev=3, status=' ')
# Commit the one file.
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status,
None, wc_dir)
# Create expected trees for the update.
expected_output = svntest.wc.State(wc_backup, {
'iota' : Item(status=' U'),
})
expected_disk = svntest.main.greek_state.copy()
expected_status = svntest.actions.get_virginal_state(wc_backup, 3)
expected_status.tweak('iota', wc_rev=3, status=' ')
# Do the update and check the results in three ways... INCLUDING PROPS
svntest.actions.run_and_verify_update(wc_backup,
expected_output,
expected_disk,
expected_status,
None, None, None, None, None, 1)
def props_over_time(sbox):
"property retrieval with peg and operative revs"
# Bootstrap
sbox.build()
wc_dir = sbox.wc_dir
# Convenience variables
( run in 1.003 second using v1.01-cache-2.11-cpan-9288abcf80b )