summaryrefslogtreecommitdiff
path: root/subversion/tests/cmdline/info_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/tests/cmdline/info_tests.py')
-rwxr-xr-xsubversion/tests/cmdline/info_tests.py111
1 files changed, 92 insertions, 19 deletions
diff --git a/subversion/tests/cmdline/info_tests.py b/subversion/tests/cmdline/info_tests.py
index aa1c924..8feaf46 100755
--- a/subversion/tests/cmdline/info_tests.py
+++ b/subversion/tests/cmdline/info_tests.py
@@ -27,11 +27,15 @@
# See basic-tests.py for more svn info tests.
# General modules
-import shutil, stat, re, os
+import shutil, stat, re, os, logging
+
+logger = logging.getLogger()
# Our testing module
import svntest
+from prop_tests import binary_mime_type_on_text_file_warning
+
# (abbreviation)
Skip = svntest.testcase.Skip_deco
SkipUnless = svntest.testcase.SkipUnless_deco
@@ -74,9 +78,9 @@ def verify_xml_elements(lines, exprs):
str = str[m.end():] # skip xml version tag
(unmatched_str, unmatched_exprs) = match_xml_element(str, exprs)
if unmatched_exprs:
- print("Failed to find the following expressions:")
+ logger.warn("Failed to find the following expressions:")
for expr in unmatched_exprs:
- print(expr)
+ logger.warn(expr)
raise svntest.tree.SVNTreeUnequal
def match_xml_element(str, exprs):
@@ -115,7 +119,7 @@ def match_xml_element(str, exprs):
content_re = re.compile(content_re_str % name, re.DOTALL)
m = content_re.match(str)
if not m:
- print("No XML end-tag for '%s' found in '%s...'" % (name, str[:100]))
+ logger.warn("No XML end-tag for '%s' found in '%s...'" % (name, str[:100]))
raise(svntest.tree.SVNTreeUnequal)
content = m.group('content')
str = str[m.end():]
@@ -171,7 +175,7 @@ def info_with_tree_conflicts(sbox):
path = os.path.join(G, fname)
# check plain info
- expected_str1 = ".*local %s, incoming %s.*" % (reason, action)
+ expected_str1 = ".*local file %s, incoming file %s.*" % (reason, action)
expected_info = { 'Tree conflict' : expected_str1 }
svntest.actions.run_and_verify_info([expected_info], path)
@@ -195,7 +199,7 @@ def info_with_tree_conflicts(sbox):
expected_infos = [{ 'Path' : re.escape(G) }]
for fname, action, reason in scenarios:
path = os.path.join(G, fname)
- tree_conflict_re = ".*local %s, incoming %s.*" % (reason, action)
+ tree_conflict_re = ".*local file %s, incoming file %s.*" % (reason, action)
expected_infos.append({ 'Path' : re.escape(path),
'Tree conflict' : tree_conflict_re })
expected_infos.sort(key=lambda info: info['Path'])
@@ -219,6 +223,7 @@ def info_on_added_file(sbox):
expected = {'Path' : re.escape(new_file),
'Name' : 'new_file',
'URL' : '.*/new_file',
+ 'Relative URL' : '.*/new_file',
'Repository Root' : '.*',
'Node Kind' : 'file',
'Schedule' : 'add',
@@ -238,6 +243,7 @@ def info_on_added_file(sbox):
'path' : new_file,
'revision' : 'Resource is not under version control.'}),
('url', {}, '.*/new_file'),
+ ('relative-url', {}, '.*/new_file'),
('root', {}, '.*'),
('uuid', {}, uuid_regex),
('depth', {}, 'infinity'),
@@ -257,6 +263,7 @@ def info_on_mkdir(sbox):
# check that we have a Repository Root and Repository UUID
expected = {'Path' : re.escape(new_dir),
'URL' : '.*/new_dir',
+ 'Relative URL' : '.*/new_dir',
'Repository Root' : '.*',
'Node Kind' : 'directory',
'Schedule' : 'add',
@@ -275,6 +282,7 @@ def info_on_mkdir(sbox):
'path' : new_dir,
'revision' : 'Resource is not under version control.'}),
('url', {}, '.*/new_dir'),
+ ('relative-url', {}, '.*/new_dir'),
('root', {}, '.*'),
('uuid', {}, uuid_regex),
('depth', {}, 'infinity'),
@@ -299,13 +307,13 @@ def info_wcroot_abspaths(sbox):
target = "(UNKNOWN)"
if path is None:
- print "No WC root path for '%s'" % (target)
+ logger.warn("No WC root path for '%s'", target)
raise svntest.Failure
if path != wcroot_abspath:
- print("For target '%s'..." % (target))
- print(" Reported WC root path: %s" % (path))
- print(" Expected WC root path: %s" % (wcroot_abspath))
+ logger.warn("For target '%s'...", target)
+ logger.warn(" Reported WC root path: %s", path)
+ logger.warn(" Expected WC root path: %s", wcroot_abspath)
raise svntest.Failure
sbox.build(read_only=True)
@@ -394,6 +402,7 @@ def info_repos_root_url(sbox):
'Path' : re.escape(os.path.basename(sbox.repo_dir)),
'Repository Root' : re.escape(sbox.repo_url),
'URL' : re.escape(sbox.repo_url),
+ 'Relative URL' : '\^/', # escape ^ -- this isn't a regexp
'Revision' : '1',
'Node Kind' : 'directory',
'Last Changed Rev' : '1',
@@ -403,6 +412,7 @@ def info_repos_root_url(sbox):
'Name' : 'iota',
'Repository Root' : re.escape(sbox.repo_url),
'URL' : re.escape(sbox.repo_url + '/iota'),
+ 'Relative URL' : '\^/iota', # escape ^ -- this isn't a regexp
'Revision' : '1',
'Node Kind' : 'file',
'Last Changed Rev' : '1',
@@ -449,8 +459,8 @@ def info_show_exclude(sbox):
expected_info = [{
'Path' : '.*%siota' % re.escape(os.sep),
- 'Repository Root' : sbox.repo_url,
- 'Repository UUID' : wc_uuid,
+ 'Repository Root' : sbox.repo_url,
+ 'Repository UUID' : wc_uuid,
}]
svntest.main.run_svn(None, 'up', '--set-depth', 'exclude', iota)
svntest.actions.run_and_verify_info(expected_info, iota)
@@ -470,17 +480,15 @@ def info_show_exclude(sbox):
sbox.simple_rm('iota')
sbox.simple_commit()
+ expected_error = 'svn: E200009: Could not display info for all targets.*'
+
# Expect error on iota (status = not-present)
- svntest.actions.run_and_verify_svn(None, [],
- 'svn: E200009: Could not display info for all targets.*',
- 'info', iota)
+ svntest.actions.run_and_verify_svn(None, [], expected_error, 'info', iota)
sbox.simple_update()
# Expect error on iota (unversioned)
- svntest.actions.run_and_verify_svn(None, [],
- 'svn: E200009: Could not display info for all targets.*',
- 'info', iota)
+ svntest.actions.run_and_verify_svn(None, [], expected_error, 'info', iota)
@Issue(3998)
def binary_tree_conflict(sbox):
@@ -488,7 +496,9 @@ def binary_tree_conflict(sbox):
sbox.build()
wc_dir = sbox.wc_dir
- sbox.simple_propset('svn:mime-type', 'binary/octet-stream', 'iota')
+ svntest.main.run_svn(binary_mime_type_on_text_file_warning,
+ 'propset', 'svn:mime-type', 'binary/octet-stream',
+ sbox.ospath('iota'))
sbox.simple_commit()
iota = sbox.ospath('iota')
@@ -516,8 +526,70 @@ def binary_tree_conflict(sbox):
}]
svntest.actions.run_and_verify_info(expected_info, iota)
+ expected_info = [{
+ 'Path' : '%s' % re.escape(wc_dir),
+ }]
+ svntest.actions.run_and_verify_info(expected_info, wc_dir)
+
+def relpath_escaping(sbox):
+ "relpath escaping should be usable as-is"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ name = 'path with space, +, % and #'
+ name2 = 'path with %20'
+ sbox.simple_copy('iota', name)
+ sbox.simple_copy('iota', name2)
+ sbox.simple_commit()
+
+ testpath = sbox.ospath(name)
+
+ expected = {'Path' : re.escape(testpath),
+ 'URL' : '.*/path.*with.*space.*',
+ 'Relative URL' : '.*/path.*with.*space.*',
+ }
+
+ svntest.actions.run_and_verify_info([expected], sbox.ospath(name))
+
+ info = svntest.actions.run_and_parse_info(sbox.ospath(name), sbox.ospath(name2))
+
+ # And now verify that the returned URL and relative url are usable
+
+ # Also test the local path (to help resolving the relative path) and an
+ # unescaped path which the client should automatically encode
+ svntest.actions.run_and_verify_svn(None, None, [], 'info',
+ info[0]['Relative URL'],
+ info[0]['URL'],
+ testpath,
+ '^/' + name,
+ info[1]['Relative URL'],
+ info[1]['URL'])
+
+ # And now do the same thing with a the file external handling
+ sbox.simple_propset('svn:externals',
+ info[0]['Relative URL'] + " f1\n" +
+ info[0]['URL'] + " f2\n" +
+ '"^/' + name + "\" f3\n" +
+
+ info[1]['Relative URL'] + " g1\n" +
+ info[1]['URL'] + " g2\n",
+ ''
+ )
+
+ # And now we expect to see 3 file externals
+ expected_output = svntest.wc.State(wc_dir, {
+ 'f1' : Item(status='A '),
+ 'f2' : Item(status='A '),
+ 'f3' : Item(status='A '),
+
+ 'g1' : Item(status='A '),
+ 'g2' : Item(status='A '),
+ })
+ svntest.actions.run_and_verify_update(wc_dir,
+ expected_output, None, None)
########################################################################
# Run the tests
@@ -533,6 +605,7 @@ test_list = [ None,
info_repos_root_url,
info_show_exclude,
binary_tree_conflict,
+ relpath_escaping,
]
if __name__ == '__main__':