Author: brane
Date: Fri Nov 23 18:24:40 2012
New Revision: 1413015
URL: http://svn.apache.org/viewvc?rev=1413015&view=rev
Log:
Fix issue #4261 (require --force to set unknown svn: prop names).
* subversion/svn/propedit-cmd.c (svn_cl__propedit):
When --force'd, call svn_cl__check_svn_prop_name
* subversion/svn/propset-cmd.c (svn_cl__propset): Likewise.
* subversion/tests/cmdline/stat_tests.py: Add --force to propset where needed.
* subversion/tests/cmdline/prop_tests.py: Likewise.
(almost_known_prop_names): New test; first cut, will be expanded.
Modified:
subversion/trunk/subversion/svn/propedit-cmd.c
subversion/trunk/subversion/svn/propset-cmd.c
subversion/trunk/subversion/tests/cmdline/prop_tests.py
subversion/trunk/subversion/tests/cmdline/stat_tests.py
subversion/trunk/subversion/tests/cmdline/svntest/actions.py
Modified: subversion/trunk/subversion/svn/propedit-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propedit-cmd.c?rev=1413015&r1=1413014&r2=1413015&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propedit-cmd.c (original)
+++ subversion/trunk/subversion/svn/propedit-cmd.c Fri Nov 23 18:24:40 2012
@@ -84,6 +84,9 @@ svn_cl__propedit(apr_getopt_t *os,
return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
_("'%s' is not a valid Subversion property name"),
pname_utf8);
+ if (!opt_state->force)
+ SVN_ERR(svn_cl__check_svn_prop_name(pname_utf8, opt_state->revprop, pool));
+
if (opt_state->encoding && !svn_prop_needs_translation(pname_utf8))
return svn_error_create
(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
Modified: subversion/trunk/subversion/svn/propset-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propset-cmd.c?rev=1413015&r1=1413014&r2=1413015&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propset-cmd.c (original)
+++ subversion/trunk/subversion/svn/propset-cmd.c Fri Nov 23 18:24:40 2012
@@ -67,6 +67,9 @@ svn_cl__propset(apr_getopt_t *os,
return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
_("'%s' is not a valid Subversion property name"),
pname_utf8);
+ if (!opt_state->force)
+ SVN_ERR(svn_cl__check_svn_prop_name(pname_utf8, opt_state->revprop,
+ scratch_pool));
/* Get the PROPVAL from either an external file, or from the command
line. */
Modified: subversion/trunk/subversion/tests/cmdline/prop_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/prop_tests.py?rev=1413015&r1=1413014&r2=1413015&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/prop_tests.py Fri Nov 23 18:24:40
2012
@@ -900,9 +900,9 @@ def prop_value_conversions(sbox):
"svn: warning: W125005.*use 'svn propdel'")
# Anything else should be untouched
- svntest.actions.set_prop('svn:some-prop', 'bar', lambda_path)
- svntest.actions.set_prop('svn:some-prop', ' bar baz', mu_path)
- svntest.actions.set_prop('svn:some-prop', 'bar\n', iota_path)
+ svntest.actions.set_prop('svn:some-prop', 'bar', lambda_path, force=True)
+ svntest.actions.set_prop('svn:some-prop', ' bar baz', mu_path, force=True)
+ svntest.actions.set_prop('svn:some-prop', 'bar\n', iota_path, force=True)
svntest.actions.set_prop('some-prop', 'bar', lambda_path)
svntest.actions.set_prop('some-prop', ' bar baz', mu_path)
svntest.actions.set_prop('some-prop', 'bar\n', iota_path)
@@ -2670,6 +2670,20 @@ def inheritable_ignores(sbox):
[], 'add', '.', '--force','--no-ignore',
'--config-dir', config_dir)
+def almost_known_prop_names(sbox):
+ "propset with svn: prefix but unknown name"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+ iota_path = sbox.ospath('iota')
+
+ # Node properties
+ svntest.actions.set_prop('svn:exemutable', 'x', iota_path,
+ "svn: E195011: 'svn:exemutable' "
+ "is not a valid svn: property name")
+ svntest.actions.set_prop('svn:exemutable', 'x', iota_path, force=True)
+ svntest.actions.set_prop('tsvn:exemutable', 'x', iota_path)
+
########################################################################
# Run the tests
@@ -2713,6 +2727,7 @@ test_list = [ None,
file_matching_dir_prop_reject,
pristine_props_listed,
inheritable_ignores,
+ almost_known_prop_names,
]
if __name__ == '__main__':
Modified: subversion/trunk/subversion/tests/cmdline/stat_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/stat_tests.py?rev=1413015&r1=1413014&r2=1413015&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/stat_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/stat_tests.py Fri Nov 23 18:24:40
2012
@@ -1441,8 +1441,8 @@ def status_depth_local(sbox):
# make some changes to the greek tree
change_files(wc_dir, ['A/mu', 'A/D/gamma'])
- svntest.main.run_svn(None, 'propset', 'svn:test', 'value', A_path)
- svntest.main.run_svn(None, 'propset', 'svn:test', 'value', D_path)
+ svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', A_path)
+ svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', D_path)
# for all the possible types of depth, check the status
@@ -1501,8 +1501,8 @@ def status_depth_update(sbox):
# add some files, change directory properties
change_files_and_commit(wc_dir, ['A/mu', 'A/D/gamma'])
svntest.main.run_svn(None, 'up', wc_dir)
- svntest.main.run_svn(None, 'propset', 'svn:test', 'value', A_path)
- svntest.main.run_svn(None, 'propset', 'svn:test', 'value', D_path)
+ svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', A_path)
+ svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', D_path)
svntest.main.run_svn(None, 'ci', '-m', 'log message', wc_dir)
# update to r1
@@ -1572,8 +1572,8 @@ def status_depth_update_local_modificati
mu_path = os.path.join(A_path, 'mu')
gamma_path = os.path.join(D_path, 'gamma')
- svntest.main.run_svn(None, 'propset', 'svn:test', 'value', A_path)
- svntest.main.run_svn(None, 'propset', 'svn:test', 'value', D_path)
+ svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', A_path)
+ svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', D_path)
svntest.main.file_append(mu_path, 'modified')
svntest.main.file_append(gamma_path, 'modified')
Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1413015&r1=1413014&r2=1413015&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Fri Nov 23
18:24:40 2012
@@ -1985,8 +1985,12 @@ def create_failing_post_commit_hook(repo
# set_prop can be used for properties with NULL characters which are not
# handled correctly when passed to subprocess.Popen() and values like "*"
# which are not handled correctly on Windows.
-def set_prop(name, value, path, expected_re_string=None):
+def set_prop(name, value, path, expected_re_string=None, force=None):
"""Set a property with specified value"""
+ if not force:
+ propset = ('propset',)
+ else:
+ propset = ('propset', '--force')
if value and (value[0] == '-' or '\x00' in value or sys.platform == 'win32'):
from tempfile import mkstemp
(fd, value_file_path) = mkstemp()
@@ -1995,12 +1999,12 @@ def set_prop(name, value, path, expected
value_file.write(value)
value_file.flush()
value_file.close()
- exit_code, out, err = main.run_svn(expected_re_string, 'propset',
- '-F', value_file_path, name, path)
+ propset += ('-F', value_file_path, name, path)
+ exit_code, out, err = main.run_svn(expected_re_string, *propset)
os.remove(value_file_path)
else:
- exit_code, out, err = main.run_svn(expected_re_string, 'propset',
- name, value, path)
+ propset += (name, value, path)
+ exit_code, out, err = main.run_svn(expected_re_string, *propset)
if expected_re_string:
if not expected_re_string.startswith(".*"):
expected_re_string = ".*(" + expected_re_string + ")"