You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/12/18 18:36:29 UTC
svn commit: r1220465 [12/13] - in /subversion/branches/file-handle-cache: ./
build/ build/ac-macros/ contrib/client-side/emacs/
contrib/server-side/mod_dontdothat/ notes/
subversion/bindings/javahl/tests/org/apache/subversion/javahl/
subversion/binding...
Modified: subversion/branches/file-handle-cache/subversion/tests/cmdline/mergeinfo_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/cmdline/mergeinfo_tests.py?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/cmdline/mergeinfo_tests.py (original)
+++ subversion/branches/file-handle-cache/subversion/tests/cmdline/mergeinfo_tests.py Sun Dec 18 17:36:24 2011
@@ -68,8 +68,11 @@ def no_mergeinfo(sbox):
"'mergeinfo' on a URL that lacks mergeinfo"
sbox.build(create_wc=False)
+ sbox.simple_repo_copy('A', 'A2')
svntest.actions.run_and_verify_mergeinfo(adjust_error_for_server_version(""),
- [], sbox.repo_url, sbox.repo_url)
+ [],
+ sbox.repo_url + '/A',
+ sbox.repo_url + '/A2')
def mergeinfo(sbox):
"'mergeinfo' on a path with mergeinfo"
@@ -77,41 +80,65 @@ def mergeinfo(sbox):
sbox.build()
wc_dir = sbox.wc_dir
+ # make a branch 'A2'
+ sbox.simple_repo_copy('A', 'A2') # r2
+ # make a change in branch 'A'
+ sbox.simple_mkdir('A/newdir')
+ sbox.simple_commit() # r3
+ sbox.simple_update()
+
# Dummy up some mergeinfo.
- svntest.actions.run_and_verify_svn(None, None, [], 'ps', SVN_PROP_MERGEINFO,
- '/:1', wc_dir)
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'ps', SVN_PROP_MERGEINFO, '/A:3',
+ sbox.ospath('A2'))
svntest.actions.run_and_verify_mergeinfo(adjust_error_for_server_version(""),
- ['1'], sbox.repo_url, wc_dir)
+ ['3'],
+ sbox.repo_url + '/A',
+ sbox.ospath('A2'))
@SkipUnless(server_has_mergeinfo)
def explicit_mergeinfo_source(sbox):
"'mergeinfo' with source selection"
+ # The idea is the target has mergeinfo pertaining to two or more different
+ # source branches and we're asking about just one of them.
+
sbox.build()
- wc_dir = sbox.wc_dir
- H_path = os.path.join(wc_dir, 'A', 'D', 'H')
- H2_path = os.path.join(wc_dir, 'A', 'D', 'H2')
- B_url = sbox.repo_url + '/A/B'
- B_path = os.path.join(wc_dir, 'A', 'B')
- G_url = sbox.repo_url + '/A/D/G'
- G_path = os.path.join(wc_dir, 'A', 'D', 'G')
- H2_url = sbox.repo_url + '/A/D/H2'
- # Make a copy, and dummy up some mergeinfo.
- mergeinfo = '/A/B:1\n/A/D/G:1\n'
- svntest.actions.set_prop(SVN_PROP_MERGEINFO, mergeinfo, H_path)
- svntest.main.run_svn(None, "cp", H_path, H2_path)
- svntest.main.run_svn(None, "ci", "-m", "r2", wc_dir)
+ def url(relpath):
+ return sbox.repo_url + '/' + relpath
+ def path(relpath):
+ return sbox.ospath(relpath)
+
+ B = 'A/B'
+
+ # make some branches
+ B2 = 'A/B2'
+ B3 = 'A/B3'
+ sbox.simple_repo_copy(B, B2) # r2
+ sbox.simple_repo_copy(B, B3) # r3
+ sbox.simple_update()
+
+ # make changes in the branches
+ sbox.simple_mkdir('A/B2/newdir')
+ sbox.simple_commit() # r4
+ sbox.simple_mkdir('A/B3/newdir')
+ sbox.simple_commit() # r5
+
+ # Put dummy mergeinfo on branch root
+ mergeinfo = '/A/B2:2-5\n/A/B3:2-5\n'
+ sbox.simple_propset(SVN_PROP_MERGEINFO, mergeinfo, B)
+ sbox.simple_commit()
# Check using each of our recorded merge sources (as paths and URLs).
svntest.actions.run_and_verify_mergeinfo(adjust_error_for_server_version(""),
- ['1'], B_url, H_path)
+ ['2', '4'], url(B2), path(B))
svntest.actions.run_and_verify_mergeinfo(adjust_error_for_server_version(""),
- ['1'], B_path, H_path)
+ ['2', '4'], path(B2), path(B))
svntest.actions.run_and_verify_mergeinfo(adjust_error_for_server_version(""),
- ['1'], G_url, H_path)
+ ['3', '5'], url(B3), path(B))
svntest.actions.run_and_verify_mergeinfo(adjust_error_for_server_version(""),
- ['1'], G_path, H_path)
+ ['3', '5'], path(B3), path(B))
@SkipUnless(server_has_mergeinfo)
def mergeinfo_non_source(sbox):
@@ -679,6 +706,54 @@ def natural_history_is_not_eligible_nor_
['3','4','5','6','7','9'], sbox.repo_url + '/A',
A_COPY_path, '--show-revs', 'merged', '-R')
+#----------------------------------------------------------------------
+# A test for issue 4050 "'svn mergeinfo' always considers non-inheritable
+# ranges as partially merged".
+@Issue(4050)
+@SkipUnless(server_has_mergeinfo)
+def noninheritabled_mergeinfo_not_always_eligible(sbox):
+ "noninheritabled mergeinfo not always eligible"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ A_path = os.path.join(wc_dir, 'A')
+ branch_path = os.path.join(wc_dir, 'branch')
+
+ # r2 - Branch ^/A to ^/branch.
+ svntest.main.run_svn(None, 'copy', sbox.repo_url + '/A',
+ sbox.repo_url + '/branch', '-m', 'make a branch')
+
+ # r3 - Make prop edit to A.
+ svntest.main.run_svn(None, 'ps', 'prop', 'val', A_path)
+ svntest.main.run_svn(None, 'commit', '-m', 'file edit', wc_dir)
+ svntest.main.run_svn(None, 'up', wc_dir)
+
+ # r4 - Merge r3 from ^/A to branch at depth=empty.
+ svntest.actions.run_and_verify_svn(None, None, [], 'merge',
+ sbox.repo_url + '/A', branch_path,
+ '-c3', '--depth=empty')
+ # Forcibly set non-inheritable mergeinfo to replicate the pre-1.8 behavior,
+ # where prior to the fix for issue #4057, non-inheritable mergeinfo was
+ # unconditionally set for merges with shallow operational depths.
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'propset', SVN_PROP_MERGEINFO,
+ '/A:3*\n', branch_path)
+ svntest.main.run_svn(None, 'commit', '-m', 'shallow merge', wc_dir)
+
+ # Now check that r3 is reported as fully merged from ^/A to ^/branch
+ # and does not show up all when asking for eligible revs.
+ svntest.actions.run_and_verify_mergeinfo(
+ adjust_error_for_server_version(''),
+ ['3'], sbox.repo_url + '/A', sbox.repo_url + '/branch',
+ '--show-revs', 'merged', '-R')
+ # Likewise r3 shows up as partially eligible when asking about
+ # for --show-revs=eligible.
+ svntest.actions.run_and_verify_mergeinfo(
+ adjust_error_for_server_version(''),
+ [], sbox.repo_url + '/A', sbox.repo_url + '/branch',
+ '--show-revs', 'eligible', '-R')
+
########################################################################
# Run the tests
@@ -695,6 +770,7 @@ test_list = [ None,
mergeinfo_on_pegged_wc_path,
wc_target_inherits_mergeinfo_from_repos,
natural_history_is_not_eligible_nor_merged,
+ noninheritabled_mergeinfo_not_always_eligible,
]
if __name__ == '__main__':
Modified: subversion/branches/file-handle-cache/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/cmdline/patch_tests.py?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/branches/file-handle-cache/subversion/tests/cmdline/patch_tests.py Sun Dec 18 17:36:24 2011
@@ -3427,7 +3427,6 @@ def patch_strip_cwd(sbox):
"patch --strip propchanges cwd"
return patch_one_property(sbox, True)
-@XFail()
@Issue(3814)
def patch_set_prop_no_eol(sbox):
"patch doesn't append newline to properties"
@@ -3615,7 +3614,6 @@ def patch_moved_away(sbox):
1, # check-props
1) # dry-run
-@XFail()
@Issue(3991)
def patch_lacking_trailing_eol(sbox):
"patch file lacking trailing eol"
@@ -3650,12 +3648,11 @@ def patch_lacking_trailing_eol(sbox):
expected_output = [
'U %s\n' % os.path.join(wc_dir, 'iota'),
- 'svn: W[0-9]+: .*', # warning about appending a newline to iota's last line
]
# Expect a newline to be appended
expected_disk = svntest.main.greek_state.copy()
- expected_disk.tweak('iota', contents=iota_contents+"Some more bytes\n")
+ expected_disk.tweak('iota', contents=iota_contents + "Some more bytes")
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('iota', status='M ')
@@ -3858,6 +3855,196 @@ def patch_reversed_add_with_props2(sbox)
1, # dry-run
'--reverse-diff')
+def patch_dev_null(sbox):
+ "patch with /dev/null filenames"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ patch_file_path = make_patch_path(sbox)
+
+ # Git (and maybe other tools) use '/dev/null' as the old path for
+ # newly added files, and as the new path for deleted files.
+ # The path selection algorithm in 'svn patch' must detect this and
+ # avoid using '/dev/null' as a patch target.
+ unidiff_patch = [
+ "Index: new\n",
+ "===================================================================\n",
+ "--- /dev/null\n",
+ "+++ new (revision 0)\n",
+ "@@ -0,0 +1 @@\n",
+ "+new\n",
+ "\n",
+ "Index: A/B/E/beta\n",
+ "===================================================================\n",
+ "--- A/B/E/beta (revision 1)\n",
+ "+++ /dev/null\n",
+ "@@ -1 +0,0 @@\n",
+ "-This is the file 'beta'.\n",
+ ]
+
+ svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+ new_contents = "new\n"
+ expected_output = [
+ 'A %s\n' % os.path.join(wc_dir, 'new'),
+ 'D %s\n' % os.path.join(wc_dir, 'A', 'B', 'E', 'beta'),
+ ]
+
+ expected_disk = svntest.main.greek_state.copy()
+ expected_disk.add({'new' : Item(contents=new_contents)})
+ expected_disk.remove('A/B/E/beta')
+
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.add({'new' : Item(status='A ', wc_rev=0)})
+ expected_status.tweak('A/B/E/beta', status='D ')
+
+ expected_skip = wc.State('', { })
+
+ svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+ expected_output,
+ expected_disk,
+ expected_status,
+ expected_skip,
+ None, # expected err
+ 1, # check-props
+ 1) # dry-run
+
+@Issue(4049)
+def patch_delete_and_skip(sbox):
+ "patch that deletes and skips"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ patch_file_path = make_patch_path(sbox)
+
+ os.chdir(wc_dir)
+
+ # We need to use abspaths to trigger the segmentation fault.
+ abs = os.path.abspath('.')
+ if sys.platform == 'win32':
+ abs = abs.replace("\\", "/")
+
+ outside_wc = os.path.join(os.pardir, 'X')
+ if sys.platform == 'win32':
+ outside_wc = outside_wc.replace("\\", "/")
+
+ unidiff_patch = [
+ "Index: %s/A/B/E/alpha\n" % abs,
+ "===================================================================\n",
+ "--- %s/A/B/E/alpha\t(revision 1)\n" % abs,
+ "+++ %s/A/B/E/alpha\t(working copy)\n" % abs,
+ "@@ -1 +0,0 @@\n",
+ "-This is the file 'alpha'.\n",
+ "Index: %s/A/B/E/beta\n" % abs,
+ "===================================================================\n",
+ "--- %s/A/B/E/beta\t(revision 1)\n" % abs,
+ "+++ %s/A/B/E/beta\t(working copy)\n" % abs,
+ "@@ -1 +0,0 @@\n",
+ "-This is the file 'beta'.\n",
+ "Index: %s/A/B/E/out-of-reach\n" % abs,
+ "===================================================================\n",
+ "--- %s/iota\t(revision 1)\n" % outside_wc,
+ "+++ %s/iota\t(working copy)\n" % outside_wc,
+ "\n",
+ "Property changes on: iota\n",
+ "___________________________________________________________________\n",
+ "Added: propname\n",
+ "## -0,0 +1 ##\n",
+ "+propvalue\n",
+ ]
+
+ svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+ skipped_path = os.path.join(os.pardir, 'X', 'iota')
+ expected_output = [
+ 'D %s\n' % os.path.join('A', 'B', 'E', 'alpha'),
+ 'D %s\n' % os.path.join('A', 'B', 'E', 'beta'),
+ 'Skipped missing target: \'%s\'\n' % skipped_path,
+ 'D %s\n' % os.path.join('A', 'B', 'E'),
+ 'Summary of conflicts:\n',
+ ' Skipped paths: 1\n'
+ ]
+
+ expected_disk = svntest.main.greek_state.copy()
+ expected_disk.remove('A/B/E/alpha')
+ expected_disk.remove('A/B/E/beta')
+ expected_disk.remove('A/B/E')
+
+ expected_status = svntest.actions.get_virginal_state('.', 1)
+ expected_status.tweak('A/B/E', status='D ')
+ expected_status.tweak('A/B/E/alpha', status='D ')
+ expected_status.tweak('A/B/E/beta', status='D ')
+
+ expected_skip = wc.State('', {skipped_path: Item()})
+
+ svntest.actions.run_and_verify_patch('.', os.path.abspath(patch_file_path),
+ expected_output,
+ expected_disk,
+ expected_status,
+ expected_skip,
+ None, # expected err
+ 1, # check-props
+ 1) # dry-run
+
+def patch_target_no_eol_at_eof(sbox):
+ "patch target with no eol at eof"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ patch_file_path = make_patch_path(sbox)
+ iota_path = os.path.join(wc_dir, 'iota')
+
+ iota_contents = [
+ "This is the file iota."
+ ]
+
+ svntest.main.file_write(iota_path, ''.join(iota_contents))
+ 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=2)
+ svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+ expected_status, None, wc_dir)
+ unidiff_patch = [
+ "--- iota\t(revision 1)\n",
+ "+++ iota\t(working copy)\n",
+ "@@ -1,7 +1,7 @@\n",
+ "-This is the file iota.\n"
+ "\\ No newline at end of file\n",
+ "+It is really the file 'iota'.\n",
+ "\\ No newline at end of file\n",
+ ]
+
+ svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+ iota_contents = [
+ "It is really the file 'iota'."
+ ]
+ expected_output = [
+ 'U %s\n' % os.path.join(wc_dir, 'iota'),
+ ]
+
+ expected_disk = svntest.main.greek_state.copy()
+ expected_disk.tweak('iota', contents=''.join(iota_contents))
+
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.tweak('iota', status='M ', wc_rev=2)
+
+ expected_skip = wc.State('', { })
+
+ svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+ expected_output,
+ expected_disk,
+ expected_status,
+ expected_skip,
+ None, # expected err
+ 1, # check-props
+ 1) # dry-run
+
########################################################################
#Run the tests
@@ -3898,6 +4085,9 @@ test_list = [ None,
patch_deletes_prop,
patch_reversed_add_with_props,
patch_reversed_add_with_props2,
+ patch_dev_null,
+ patch_delete_and_skip,
+ patch_target_no_eol_at_eof,
]
if __name__ == '__main__':
Modified: subversion/branches/file-handle-cache/subversion/tests/cmdline/prop_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/cmdline/prop_tests.py?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/branches/file-handle-cache/subversion/tests/cmdline/prop_tests.py Sun Dec 18 17:36:24 2011
@@ -893,8 +893,7 @@ def prop_value_conversions(sbox):
svntest.actions.set_prop('svn:executable', '*', lambda_path)
for pval in (' ', '', 'no', 'off', 'false'):
svntest.actions.set_prop('svn:executable', pval, mu_path,
- ["svn: warning: To turn off the svn:executable property, use 'svn propdel';\n",
- "setting the property to '" + pval + "' will not turn it off.\n"])
+ "svn: warning: W125005.*use 'svn propdel'")
# Anything else should be untouched
svntest.actions.set_prop('svn:some-prop', 'bar', lambda_path)
Modified: subversion/branches/file-handle-cache/subversion/tests/cmdline/resolve_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/cmdline/resolve_tests.py?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/cmdline/resolve_tests.py (original)
+++ subversion/branches/file-handle-cache/subversion/tests/cmdline/resolve_tests.py Sun Dec 18 17:36:24 2011
@@ -42,6 +42,7 @@ Issue = svntest.testcase.Issue_deco
Wimp = svntest.testcase.Wimp_deco
from merge_tests import set_up_branch
+from merge_tests import expected_merge_output
# 'svn resolve --accept [ base | mine-full | theirs-full ]' was segfaulting
# on 1.6.x. Prior to this test, the bug was only caught by the Ruby binding
@@ -69,12 +70,10 @@ def automatic_conflict_resolution(sbox):
'revert', '--recursive', A_COPY_path)
svntest.actions.run_and_verify_svn(
None,
- "(--- Merging r3 into .*A_COPY':\n)|"
- "(C .*psi\n)|"
- "(--- Recording mergeinfo for merge of r3 into .*A_COPY':\n)|"
- "( U .*A_COPY\n)|"
- "(Summary of conflicts:\n)|"
- "( Text conflicts: 1\n)",
+ expected_merge_output([[3]], [
+ "C %s\n" % psi_COPY_path,
+ " U %s\n" % A_COPY_path],
+ target=A_COPY_path, text_conflicts=1),
[], 'merge', '-c3', '--allow-mixed-revisions',
sbox.repo_url + '/A',
A_COPY_path)
Modified: subversion/branches/file-handle-cache/subversion/tests/cmdline/special_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/cmdline/special_tests.py?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/cmdline/special_tests.py (original)
+++ subversion/branches/file-handle-cache/subversion/tests/cmdline/special_tests.py Sun Dec 18 17:36:24 2011
@@ -551,7 +551,9 @@ def diff_symlink_to_dir(sbox):
"___________________________________________________________________\n",
"Added: svn:special\n",
"## -0,0 +1 ##\n",
- "+*\n" ]
+ "+*\n",
+ "\\ No newline at end of property\n"
+ ]
svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff',
'.')
# We should get the same output if we the diff the symlink itself.
Modified: subversion/branches/file-handle-cache/subversion/tests/cmdline/stat_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/cmdline/stat_tests.py?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/cmdline/stat_tests.py (original)
+++ subversion/branches/file-handle-cache/subversion/tests/cmdline/stat_tests.py Sun Dec 18 17:36:24 2011
@@ -1924,6 +1924,31 @@ def wclock_status(sbox):
'status', wc_dir)
+@Issue(4072)
+@XFail()
+def modified_modulo_translation(sbox):
+ "modified before translation, unmodified after"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ # iota is a shell script.
+ sbox.simple_propset('svn:eol-style', 'LF', 'iota')
+ sbox.simple_commit()
+
+ # CRLF it.
+ open(sbox.ospath('iota'), 'wb').write("This is the file 'iota'.\r\n")
+
+ # Run status. Expect some output.
+ # TODO: decide how such files should show in the output; whether they
+ # always show, or only with some --flag; and adjust this accordingly.
+ svntest.actions.run_and_verify_svn(None, svntest.verify.AnyOutput, [],
+ 'status', wc_dir)
+
+ # Expect the file to be renormalized (to LF) after a revert.
+ sbox.simple_revert('iota')
+ svntest.actions.run_and_verify_svn(None, [], [], 'status', wc_dir)
+
########################################################################
# Run the tests
@@ -1965,6 +1990,7 @@ test_list = [ None,
status_locked_deleted,
wc_wc_copy_timestamp,
wclock_status,
+ modified_modulo_translation,
]
if __name__ == '__main__':
Modified: subversion/branches/file-handle-cache/subversion/tests/cmdline/svnadmin_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/cmdline/svnadmin_tests.py?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/cmdline/svnadmin_tests.py (original)
+++ subversion/branches/file-handle-cache/subversion/tests/cmdline/svnadmin_tests.py Sun Dec 18 17:36:24 2011
@@ -1510,6 +1510,36 @@ def load_ranges(sbox):
svntest.verify.compare_and_display_lines("Dump files", "DUMP",
expected_dump, new_dumpdata)
+@SkipUnless(svntest.main.is_fs_type_fsfs)
+def hotcopy_incremental(sbox):
+ "'svnadmin hotcopy --incremental PATH .'"
+ sbox.build()
+
+ backup_dir, backup_url = sbox.add_repo_path('backup')
+ os.mkdir(backup_dir)
+ cwd = os.getcwd()
+
+ for i in [1, 2, 3]:
+ os.chdir(backup_dir)
+ svntest.actions.run_and_verify_svnadmin(
+ None, None, [],
+ "hotcopy", "--incremental", os.path.join(cwd, sbox.repo_dir), '.')
+
+ os.chdir(cwd)
+
+ exit_code, origout, origerr = svntest.main.run_svnadmin("dump",
+ sbox.repo_dir,
+ '--quiet')
+ exit_code, backout, backerr = svntest.main.run_svnadmin("dump",
+ backup_dir,
+ '--quiet')
+ if origerr or backerr or origout != backout:
+ raise svntest.Failure
+
+ if i < 3:
+ sbox.simple_mkdir("newdir-%i" % i)
+ sbox.simple_commit()
+
########################################################################
# Run the tests
@@ -1541,6 +1571,7 @@ test_list = [ None,
verify_non_utf8_paths,
test_lslocks_and_rmlocks,
load_ranges,
+ hotcopy_incremental,
]
if __name__ == '__main__':
Modified: subversion/branches/file-handle-cache/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/cmdline/svntest/actions.py?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/branches/file-handle-cache/subversion/tests/cmdline/svntest/actions.py Sun Dec 18 17:36:24 2011
@@ -1258,7 +1258,7 @@ def run_and_verify_mergeinfo(error_re_st
verify.verify_outputs(None, None, err, None, expected_err)
return
- out = sorted([_f for _f in [x.rstrip()[1:] for x in out] if _f])
+ out = [_f for _f in [x.rstrip()[1:] for x in out] if _f]
expected_output.sort()
extra_out = []
if out != expected_output:
@@ -1823,7 +1823,7 @@ 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_err=None):
+def set_prop(name, value, path, expected_re_string=None):
"""Set a property with specified value"""
if value and (value[0] == '-' or '\x00' in value or sys.platform == 'win32'):
from tempfile import mkstemp
@@ -1833,10 +1833,17 @@ def set_prop(name, value, path, expected
value_file.write(value)
value_file.flush()
value_file.close()
- main.run_svn(expected_err, 'propset', '-F', value_file_path, name, path)
+ exit_code, out, err = main.run_svn(expected_re_string, 'propset',
+ '-F', value_file_path, name, path)
os.remove(value_file_path)
else:
- main.run_svn(expected_err, 'propset', name, value, path)
+ exit_code, out, err = main.run_svn(expected_re_string, 'propset',
+ name, value, path)
+ if expected_re_string:
+ if not expected_re_string.startswith(".*"):
+ expected_re_string = ".*(" + expected_re_string + ")"
+ expected_err = verify.RegexOutput(expected_re_string, match_all=False)
+ verify.verify_outputs(None, None, err, None, expected_err)
def check_prop(name, path, exp_out, revprop=None):
"""Verify that property NAME on PATH has a value of EXP_OUT.
Modified: subversion/branches/file-handle-cache/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/cmdline/svntest/main.py?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/branches/file-handle-cache/subversion/tests/cmdline/svntest/main.py Sun Dec 18 17:36:24 2011
@@ -998,51 +998,60 @@ def use_editor(func):
os.environ['SVNTEST_EDITOR_FUNC'] = func
os.environ['SVN_TEST_PYTHON'] = sys.executable
-def mergeinfo_notify_line(revstart, revend):
+def mergeinfo_notify_line(revstart, revend, target=None):
"""Return an expected output line that describes the beginning of a
mergeinfo recording notification on revisions REVSTART through REVEND."""
+ if target:
+ target_re = re.escape(target)
+ else:
+ target_re = ".+"
if (revend is None):
if (revstart < 0):
revstart = abs(revstart)
- return "--- Recording mergeinfo for reverse merge of r%ld .*:\n" \
- % (revstart)
+ return "--- Recording mergeinfo for reverse merge of r%ld into '%s':\n" \
+ % (revstart, target_re)
else:
- return "--- Recording mergeinfo for merge of r%ld .*:\n" % (revstart)
+ return "--- Recording mergeinfo for merge of r%ld into '%s':\n" \
+ % (revstart, target_re)
elif (revstart < revend):
- return "--- Recording mergeinfo for merge of r%ld through r%ld .*:\n" \
- % (revstart, revend)
+ return "--- Recording mergeinfo for merge of r%ld through r%ld into '%s':\n" \
+ % (revstart, revend, target_re)
else:
return "--- Recording mergeinfo for reverse merge of r%ld through " \
- "r%ld .*:\n" % (revstart, revend)
+ "r%ld into '%s':\n" % (revstart, revend, target_re)
def merge_notify_line(revstart=None, revend=None, same_URL=True,
- foreign=False):
+ foreign=False, target=None):
"""Return an expected output line that describes the beginning of a
merge operation on revisions REVSTART through REVEND. Omit both
REVSTART and REVEND for the case where the left and right sides of
the merge are from different URLs."""
from_foreign_phrase = foreign and "\(from foreign repository\) " or ""
+ if target:
+ target_re = re.escape(target)
+ else:
+ target_re = ".+"
if not same_URL:
- return "--- Merging differences between %srepository URLs into '.+':\n" \
- % (foreign and "foreign " or "")
+ return "--- Merging differences between %srepository URLs into '%s':\n" \
+ % (foreign and "foreign " or "", target_re)
if revend is None:
if revstart is None:
# The left and right sides of the merge are from different URLs.
- return "--- Merging differences between %srepository URLs into '.+':\n" \
- % (foreign and "foreign " or "")
+ return "--- Merging differences between %srepository URLs into '%s':\n" \
+ % (foreign and "foreign " or "", target_re)
elif revstart < 0:
- return "--- Reverse-merging %sr%ld into '.+':\n" \
- % (from_foreign_phrase, abs(revstart))
+ return "--- Reverse-merging %sr%ld into '%s':\n" \
+ % (from_foreign_phrase, abs(revstart), target_re)
else:
- return "--- Merging %sr%ld into '.+':\n" \
- % (from_foreign_phrase, revstart)
+ return "--- Merging %sr%ld into '%s':\n" \
+ % (from_foreign_phrase, revstart, target_re)
else:
if revstart > revend:
- return "--- Reverse-merging %sr%ld through r%ld into '.+':\n" \
- % (from_foreign_phrase, revstart, revend)
+ return "--- Reverse-merging %sr%ld through r%ld into '%s':\n" \
+ % (from_foreign_phrase, revstart, revend, target_re)
else:
- return "--- Merging %sr%ld through r%ld into '.+':\n" \
- % (from_foreign_phrase, revstart, revend)
+ return "--- Merging %sr%ld through r%ld into '%s':\n" \
+ % (from_foreign_phrase, revstart, revend, target_re)
def make_log_msg():
Modified: subversion/branches/file-handle-cache/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/libsvn_client/client-test.c?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/branches/file-handle-cache/subversion/tests/libsvn_client/client-test.c Sun Dec 18 17:36:24 2011
@@ -28,6 +28,7 @@
#include <limits.h>
#include "svn_mergeinfo.h"
#include "../../libsvn_client/mergeinfo.h"
+#include "../../libsvn_client/client.h"
#include "svn_pools.h"
#include "svn_client.h"
#include "svn_repos.h"
@@ -102,26 +103,28 @@ test_elide_mergeinfo_catalog(apr_pool_t
i < sizeof(elide_testcases) / sizeof(elide_testcases[0]);
i++)
{
- apr_hash_t *catalog;
+ svn_mergeinfo_catalog_t mergeinfo_catalog;
mergeinfo_catalog_item *item;
svn_pool_clear(iterpool);
- catalog = apr_hash_make(iterpool);
+ mergeinfo_catalog = apr_hash_make(iterpool);
for (item = elide_testcases[i]; item->path; item++)
{
- apr_hash_t *mergeinfo;
+ svn_mergeinfo_t mergeinfo;
SVN_ERR(svn_mergeinfo_parse(&mergeinfo, item->unparsed_mergeinfo,
iterpool));
- apr_hash_set(catalog, item->path, APR_HASH_KEY_STRING, mergeinfo);
+ apr_hash_set(mergeinfo_catalog, item->path, APR_HASH_KEY_STRING,
+ mergeinfo);
}
- SVN_ERR(svn_client__elide_mergeinfo_catalog(catalog, iterpool));
+ SVN_ERR(svn_client__elide_mergeinfo_catalog(mergeinfo_catalog,
+ iterpool));
for (item = elide_testcases[i]; item->path; item++)
{
- apr_hash_t *mergeinfo = apr_hash_get(catalog, item->path,
+ apr_hash_t *mergeinfo = apr_hash_get(mergeinfo_catalog, item->path,
APR_HASH_KEY_STRING);
if (item->remains && !mergeinfo)
return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
@@ -648,6 +651,71 @@ test_16k_add(const svn_test_opts_t *opts
}
#endif
+static svn_error_t *
+test_youngest_common_ancestor(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ const char *repos_url;
+ svn_client_ctx_t *ctx;
+ svn_opt_revision_t head_rev = { svn_opt_revision_head, { 0 } };
+ svn_opt_revision_t zero_rev = { svn_opt_revision_number, { 0 } };
+ svn_client_copy_source_t source;
+ apr_array_header_t *sources;
+ const char *dest;
+ const char *yc_ancestor_relpath;
+ svn_revnum_t yc_ancestor_rev;
+
+ /* Create a filesytem and repository containing the Greek tree. */
+ SVN_ERR(create_greek_repos(&repos_url, "test-youngest-common-ancestor", opts, pool));
+
+ svn_client_create_context(&ctx, pool);
+
+ /* Copy a file into dir 'A', keeping its own basename. */
+ sources = apr_array_make(pool, 1, sizeof(svn_client_copy_source_t *));
+ source.path = svn_path_url_add_component2(repos_url, "iota", pool);
+ source.peg_revision = &head_rev;
+ source.revision = &head_rev;
+ APR_ARRAY_PUSH(sources, svn_client_copy_source_t *) = &source;
+ dest = svn_path_url_add_component2(repos_url, "A", pool);
+ SVN_ERR(svn_client_copy6(sources, dest, TRUE /* copy_as_child */,
+ FALSE /* make_parents */,
+ FALSE /* ignore_externals */,
+ NULL, NULL, NULL, ctx, pool));
+
+ /* Test: YCA(iota@2, A/iota@2) is iota@1. */
+ SVN_ERR(svn_client__get_youngest_common_ancestor(
+ &yc_ancestor_relpath, NULL, &yc_ancestor_rev,
+ svn_path_url_add_component2(repos_url, "iota", pool), 2,
+ svn_path_url_add_component2(repos_url, "A/iota", pool), 2,
+ ctx, pool));
+ SVN_TEST_STRING_ASSERT(yc_ancestor_relpath, "iota");
+ SVN_TEST_ASSERT(yc_ancestor_rev == 1);
+
+ /* Copy the root directory (at revision 0) into A as 'ROOT'. */
+ sources = apr_array_make(pool, 1, sizeof(svn_client_copy_source_t *));
+ source.path = repos_url;
+ source.peg_revision = &zero_rev;
+ source.revision = &zero_rev;
+ APR_ARRAY_PUSH(sources, svn_client_copy_source_t *) = &source;
+ dest = svn_path_url_add_component2(repos_url, "A/ROOT", pool);
+ SVN_ERR(svn_client_copy6(sources, dest, FALSE /* copy_as_child */,
+ FALSE /* make_parents */,
+ FALSE /* ignore_externals */,
+ NULL, NULL, NULL, ctx, pool));
+
+ /* Test: YCA(''@0, A/ROOT@3) is ''@0 (handled as a special case). */
+ SVN_ERR(svn_client__get_youngest_common_ancestor(
+ &yc_ancestor_relpath, NULL, &yc_ancestor_rev,
+ svn_path_url_add_component2(repos_url, "", pool), 0,
+ svn_path_url_add_component2(repos_url, "A/ROOT", pool), 3,
+ ctx, pool));
+ SVN_TEST_STRING_ASSERT(yc_ancestor_relpath, "");
+ SVN_TEST_ASSERT(yc_ancestor_rev == 0);
+
+ return SVN_NO_ERROR;
+}
+
+
/* ========================================================================== */
struct svn_test_descriptor_t test_funcs[] =
@@ -663,5 +731,6 @@ struct svn_test_descriptor_t test_funcs[
#ifdef TEST16K_ADD
SVN_TEST_OPTS_PASS(test_16k_add, "test adding 16k files"),
#endif
+ SVN_TEST_OPTS_PASS(test_youngest_common_ancestor, "test youngest_common_ancestor"),
SVN_TEST_NULL
};
Modified: subversion/branches/file-handle-cache/subversion/tests/libsvn_diff/parse-diff-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/libsvn_diff/parse-diff-test.c?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/branches/file-handle-cache/subversion/tests/libsvn_diff/parse-diff-test.c Sun Dec 18 17:36:24 2011
@@ -314,7 +314,8 @@ check_content(svn_diff_hunk_t *hunk, svn
SVN_TEST_STRING_ASSERT(exp_buf->data, hunk_buf->data);
}
- SVN_TEST_ASSERT(hunk_buf->len == 0);
+ if (!hunk_eof)
+ SVN_TEST_ASSERT(hunk_buf->len == 0);
return SVN_NO_ERROR;
}
@@ -946,11 +947,9 @@ test_parse_unidiff_lacking_trailing_eol(
"This is the file 'gamma'." NL,
pool));
- /* Verify that the contents are as expected, with a NL appended.
- TODO: test for notification about the NL silently appended */
SVN_ERR(check_content(hunk, reverse,
"This is the file 'gamma'." NL
- "some more bytes to 'gamma'" NL,
+ "some more bytes to 'gamma'",
pool));
reverse = !reverse;
@@ -981,7 +980,7 @@ struct svn_test_descriptor_t test_funcs[
"test property diffs with odd symbols"),
SVN_TEST_PASS2(test_git_diffs_with_spaces_diff,
"test git diffs with spaces in paths"),
- SVN_TEST_XFAIL2(test_parse_unidiff_lacking_trailing_eol,
+ SVN_TEST_PASS2(test_parse_unidiff_lacking_trailing_eol,
"test parsing unidiffs lacking trailing eol"),
SVN_TEST_NULL
};
Modified: subversion/branches/file-handle-cache/subversion/tests/libsvn_fs/locks-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/libsvn_fs/locks-test.c?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/libsvn_fs/locks-test.c (original)
+++ subversion/branches/file-handle-cache/subversion/tests/libsvn_fs/locks-test.c Sun Dec 18 17:36:24 2011
@@ -358,6 +358,18 @@ get_locks(const svn_test_opts_t *opts,
num_expected_paths, pool));
}
+ /* A path that is longer and alphabetically earlier than some locked
+ paths, this exercises the r1205848 BDB lock code. */
+ {
+ static const char *expected_paths[] = { 0 };
+ num_expected_paths = 0;
+ get_locks_baton = make_get_locks_baton(pool);
+ SVN_ERR(svn_fs_get_locks(fs, "A/D/H/ABCDEFGHIJKLMNOPQR", get_locks_callback,
+ get_locks_baton, pool));
+ SVN_ERR(verify_matching_lock_paths(get_locks_baton, expected_paths,
+ num_expected_paths, pool));
+ }
+
return SVN_NO_ERROR;
}
Modified: subversion/branches/file-handle-cache/subversion/tests/libsvn_repos/repos-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/libsvn_repos/repos-test.c?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/libsvn_repos/repos-test.c (original)
+++ subversion/branches/file-handle-cache/subversion/tests/libsvn_repos/repos-test.c Sun Dec 18 17:36:24 2011
@@ -1348,6 +1348,149 @@ commit_authz_cb(svn_repos_authz_access_t
+enum action_t {
+ A_DELETE,
+ A_ADD_FILE,
+ A_ADD_DIR,
+ A_CHANGE_FILE_PROP
+};
+struct authz_path_action_t
+{
+ enum action_t action;
+ const char *path;
+ svn_boolean_t authz_error_expected;
+ const char *copyfrom_path;
+};
+
+/* Return the appropriate dir baton for the parent of PATH in *DIR_BATON,
+ allocated in POOL. */
+static svn_error_t *
+get_dir_baton(void **dir_baton,
+ const char *path,
+ const svn_delta_editor_t *editor,
+ void *root_baton,
+ apr_pool_t *pool)
+{
+ int i;
+ apr_array_header_t *path_bits = svn_path_decompose(path, pool);
+ const char *path_so_far = "";
+
+ *dir_baton = root_baton;
+ for (i = 0; i < (path_bits->nelts - 1); i++)
+ {
+ const char *path_bit = APR_ARRAY_IDX(path_bits, i, const char *);
+ path_so_far = svn_path_join(path_so_far, path_bit, pool);
+ SVN_ERR(editor->open_directory(path_so_far, *dir_baton,
+ SVN_INVALID_REVNUM, pool, dir_baton));
+ }
+
+ return SVN_NO_ERROR;
+}
+
+/* Return the appropriate file baton for PATH in *FILE_BATON, allocated in
+ POOL. */
+static svn_error_t *
+get_file_baton(void **file_baton,
+ const char *path,
+ const svn_delta_editor_t *editor,
+ void *root_baton,
+ apr_pool_t *pool)
+{
+ void *dir_baton;
+
+ SVN_ERR(get_dir_baton(&dir_baton, path, editor, root_baton, pool));
+
+ SVN_ERR(editor->open_file(path, dir_baton, SVN_INVALID_REVNUM, pool,
+ file_baton));
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_path_authz(svn_repos_t *repos,
+ struct authz_path_action_t *path_action,
+ svn_authz_t *authz_file,
+ svn_revnum_t youngest_rev,
+ apr_pool_t *scratch_pool)
+{
+ void *edit_baton;
+ void *root_baton;
+ void *dir_baton;
+ void *file_baton;
+ void *out_baton;
+ const svn_delta_editor_t *editor;
+ svn_error_t *err;
+ svn_error_t *err2;
+
+ /* Create a new commit editor in which we're going to play with
+ authz */
+ SVN_ERR(svn_repos_get_commit_editor4(&editor, &edit_baton, repos,
+ NULL, "file://test", "/",
+ "plato", "test commit", NULL,
+ NULL, commit_authz_cb, authz_file,
+ scratch_pool));
+
+ /* Start fiddling. First get the root, which is readonly. */
+ SVN_ERR(editor->open_root(edit_baton, 1, scratch_pool, &root_baton));
+
+ /* Fetch the appropriate baton for our action. This may involve opening
+ intermediate batons, but we only care about the final one for the
+ cooresponding action. */
+ if (path_action->action == A_CHANGE_FILE_PROP)
+ SVN_ERR(get_file_baton(&file_baton, path_action->path, editor, root_baton,
+ scratch_pool));
+ else
+ SVN_ERR(get_dir_baton(&dir_baton, path_action->path, editor, root_baton,
+ scratch_pool));
+
+ /* Test the appropriate action. */
+ switch (path_action->action)
+ {
+ case A_DELETE:
+ err = editor->delete_entry(path_action->path, SVN_INVALID_REVNUM,
+ dir_baton, scratch_pool);
+ break;
+
+ case A_CHANGE_FILE_PROP:
+ err = editor->change_file_prop(file_baton, "svn:test",
+ svn_string_create("test", scratch_pool),
+ scratch_pool);
+ break;
+
+ case A_ADD_FILE:
+ err = editor->add_file(path_action->path, dir_baton,
+ path_action->copyfrom_path, youngest_rev,
+ scratch_pool, &out_baton);
+ break;
+
+ case A_ADD_DIR:
+ err = editor->add_directory(path_action->path, dir_baton,
+ path_action->copyfrom_path, youngest_rev,
+ scratch_pool, &out_baton);
+ break;
+ }
+
+ /* Don't worry about closing batons, just abort the edit. Since errors
+ may be delayed, we need to capture results of the abort as well. */
+ err2 = editor->abort_edit(edit_baton, scratch_pool);
+ if (!err)
+ err = err2;
+ else
+ svn_error_clear(err2);
+
+ /* Check for potential errors. */
+ if (path_action->authz_error_expected)
+ {
+ SVN_TEST_ASSERT_ERROR(err, SVN_ERR_AUTHZ_UNWRITABLE);
+ svn_error_clear(err);
+ }
+ else
+ SVN_ERR(err);
+
+ return SVN_NO_ERROR;
+}
+
+
/* Test that the commit editor is taking authz into account
properly */
static svn_error_t *
@@ -1359,13 +1502,26 @@ commit_editor_authz(const svn_test_opts_
svn_fs_txn_t *txn;
svn_fs_root_t *txn_root;
svn_revnum_t youngest_rev;
- void *edit_baton;
- void *root_baton, *dir_baton, *dir2_baton, *file_baton;
- svn_error_t *err;
- const svn_delta_editor_t *editor;
svn_authz_t *authz_file;
- apr_pool_t *subpool = svn_pool_create(pool);
+ apr_pool_t *iterpool;
const char *authz_contents;
+ int i;
+ struct authz_path_action_t path_actions[] = {
+ { A_DELETE, "/iota", TRUE },
+ { A_CHANGE_FILE_PROP, "/iota", TRUE },
+ { A_ADD_FILE, "/alpha", TRUE },
+ { A_ADD_FILE, "/alpha", TRUE, "file://test/A/B/lambda" },
+ { A_ADD_DIR, "/I", TRUE },
+ { A_ADD_DIR, "/J", TRUE, "file://test/A/D" },
+ { A_ADD_FILE, "/A/alpha", TRUE },
+ { A_ADD_FILE, "/A/B/theta", FALSE },
+ { A_DELETE, "/A/mu", FALSE },
+ { A_ADD_DIR, "/A/E", FALSE },
+ { A_ADD_DIR, "/A/J", FALSE, "file://test/A/D" },
+ { A_DELETE, "A/D/G", TRUE },
+ { A_DELETE, "A/D/H", FALSE },
+ { A_CHANGE_FILE_PROP, "A/D/gamma", FALSE }
+ };
/* The Test Plan
*
@@ -1375,25 +1531,24 @@ commit_editor_authz(const svn_test_opts_
* authorized/denied when necessary. We don't try to be exhaustive
* in the kinds of authz lookups. We just make sure that the editor
* replies to the calls in a way that proves it is doing authz
- * lookups.
+ * lookups. Some actions are tested implicitly (such as open_file being
+ * required for change_file_props).
*
- * Note that this use of the commit editor is not kosher according
- * to the generic editor API (we aren't allowed to continue editing
- * after an error, nor are we allowed to assume that errors are
- * returned by the operations which caused them). But it should
- * work fine with this particular editor implementation.
+ * Note that because of the error handling requirements of the generic
+ * editor API, each operation needs its own editor, which is handled by
+ * a helper function above.
*/
/* Create a filesystem and repository. */
SVN_ERR(svn_test__create_repos(&repos, "test-repo-commit-authz",
- opts, subpool));
+ opts, pool));
fs = svn_repos_fs(repos);
/* Prepare a txn to receive the greek tree. */
- SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, subpool));
- SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
- SVN_ERR(svn_test__create_greek_tree(txn_root, subpool));
- SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, subpool));
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, pool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ SVN_ERR(svn_test__create_greek_tree(txn_root, pool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
/* Load the authz rules for the greek tree. */
@@ -1419,147 +1574,18 @@ commit_editor_authz(const svn_test_opts_
"[/A/D/G]" NL
"plato = r"; /* No newline at end of file. */
- SVN_ERR(authz_get_handle(&authz_file, authz_contents, subpool));
+ SVN_ERR(authz_get_handle(&authz_file, authz_contents, pool));
- /* Create a new commit editor in which we're going to play with
- authz */
- SVN_ERR(svn_repos_get_commit_editor4(&editor, &edit_baton, repos,
- NULL, "file://test", "/",
- "plato", "test commit", NULL,
- NULL, commit_authz_cb, authz_file,
- subpool));
-
- /* Start fiddling. First get the root, which is readonly. All
- write operations fail because of the root's permissions. */
- SVN_ERR(editor->open_root(edit_baton, 1, subpool, &root_baton));
-
- /* Test denied file deletion. */
- err = editor->delete_entry("/iota", SVN_INVALID_REVNUM, root_baton, subpool);
- if (err == SVN_NO_ERROR || err->apr_err != SVN_ERR_AUTHZ_UNWRITABLE)
- return svn_error_createf(SVN_ERR_TEST_FAILED, err,
- "Got %s error instead of expected "
- "SVN_ERR_AUTHZ_UNWRITABLE",
- err ? "unexpected" : "no");
- svn_error_clear(err);
-
- /* Test authorized file open. */
- SVN_ERR(editor->open_file("/iota", root_baton, SVN_INVALID_REVNUM,
- subpool, &file_baton));
-
- /* Test unauthorized file prop set. */
- err = editor->change_file_prop(file_baton, "svn:test",
- svn_string_create("test", subpool),
- subpool);
- if (err == SVN_NO_ERROR || err->apr_err != SVN_ERR_AUTHZ_UNWRITABLE)
- return svn_error_createf(SVN_ERR_TEST_FAILED, err,
- "Got %s error instead of expected "
- "SVN_ERR_AUTHZ_UNWRITABLE",
- err ? "unexpected" : "no");
- svn_error_clear(err);
-
- /* Test denied file addition. */
- err = editor->add_file("/alpha", root_baton, NULL, SVN_INVALID_REVNUM,
- subpool, &file_baton);
- if (err == SVN_NO_ERROR || err->apr_err != SVN_ERR_AUTHZ_UNWRITABLE)
- return svn_error_createf(SVN_ERR_TEST_FAILED, err,
- "Got %s error instead of expected "
- "SVN_ERR_AUTHZ_UNWRITABLE",
- err ? "unexpected" : "no");
- svn_error_clear(err);
-
- /* Test denied file copy. */
- err = editor->add_file("/alpha", root_baton, "file://test/A/B/lambda",
- youngest_rev, subpool, &file_baton);
- if (err == SVN_NO_ERROR || err->apr_err != SVN_ERR_AUTHZ_UNWRITABLE)
- return svn_error_createf(SVN_ERR_TEST_FAILED, err,
- "Got %s error instead of expected "
- "SVN_ERR_AUTHZ_UNWRITABLE",
- err ? "unexpected" : "no");
- svn_error_clear(err);
-
- /* Test denied directory addition. */
- err = editor->add_directory("/I", root_baton, NULL,
- SVN_INVALID_REVNUM, subpool, &dir_baton);
- if (err == SVN_NO_ERROR || err->apr_err != SVN_ERR_AUTHZ_UNWRITABLE)
- return svn_error_createf(SVN_ERR_TEST_FAILED, err,
- "Got %s error instead of expected "
- "SVN_ERR_AUTHZ_UNWRITABLE",
- err ? "unexpected" : "no");
- svn_error_clear(err);
-
- /* Test denied directory copy. */
- err = editor->add_directory("/J", root_baton, "file://test/A/D",
- youngest_rev, subpool, &dir_baton);
- if (err == SVN_NO_ERROR || err->apr_err != SVN_ERR_AUTHZ_UNWRITABLE)
- return svn_error_createf(SVN_ERR_TEST_FAILED, err,
- "Got %s error instead of expected "
- "SVN_ERR_AUTHZ_UNWRITABLE",
- err ? "unexpected" : "no");
- svn_error_clear(err);
-
- /* Open directory /A, to which we have read/write access. */
- SVN_ERR(editor->open_directory("/A", root_baton,
- SVN_INVALID_REVNUM,
- subpool, &dir_baton));
-
- /* Test denied file addition. Denied because of a conflicting rule
- on the file path itself. */
- err = editor->add_file("/A/alpha", dir_baton, NULL,
- SVN_INVALID_REVNUM, subpool, &file_baton);
- if (err == SVN_NO_ERROR || err->apr_err != SVN_ERR_AUTHZ_UNWRITABLE)
- return svn_error_createf(SVN_ERR_TEST_FAILED, err,
- "Got %s error instead of expected "
- "SVN_ERR_AUTHZ_UNWRITABLE",
- err ? "unexpected" : "no");
- svn_error_clear(err);
-
- /* Test authorized file addition. */
- SVN_ERR(editor->add_file("/A/B/theta", dir_baton, NULL,
- SVN_INVALID_REVNUM, subpool,
- &file_baton));
-
- /* Test authorized file deletion. */
- SVN_ERR(editor->delete_entry("/A/mu", SVN_INVALID_REVNUM, dir_baton,
- subpool));
-
- /* Test authorized directory creation. */
- SVN_ERR(editor->add_directory("/A/E", dir_baton, NULL,
- SVN_INVALID_REVNUM, subpool,
- &dir2_baton));
-
- /* Test authorized copy of a tree. */
- SVN_ERR(editor->add_directory("/A/J", dir_baton, "file://test/A/D",
- youngest_rev, subpool,
- &dir2_baton));
-
- /* Open /A/D. This should be granted. */
- SVN_ERR(editor->open_directory("/A/D", dir_baton, SVN_INVALID_REVNUM,
- subpool, &dir_baton));
-
- /* Test denied recursive deletion. */
- err = editor->delete_entry("/A/D/G", SVN_INVALID_REVNUM, dir_baton,
- subpool);
- if (err == SVN_NO_ERROR || err->apr_err != SVN_ERR_AUTHZ_UNWRITABLE)
- return svn_error_createf(SVN_ERR_TEST_FAILED, err,
- "Got %s error instead of expected "
- "SVN_ERR_AUTHZ_UNWRITABLE",
- err ? "unexpected" : "no");
- svn_error_clear(err);
-
- /* Test authorized recursive deletion. */
- SVN_ERR(editor->delete_entry("/A/D/H", SVN_INVALID_REVNUM,
- dir_baton, subpool));
-
- /* Test authorized propset (open the file first). */
- SVN_ERR(editor->open_file("/A/D/gamma", dir_baton, SVN_INVALID_REVNUM,
- subpool, &file_baton));
- SVN_ERR(editor->change_file_prop(file_baton, "svn:test",
- svn_string_create("test", subpool),
- subpool));
+ iterpool = svn_pool_create(pool);
+ for (i = 0; i < (sizeof(path_actions) / sizeof(struct authz_path_action_t));
+ i++)
+ {
+ svn_pool_clear(iterpool);
+ SVN_ERR(test_path_authz(repos, &path_actions[i], authz_file,
+ youngest_rev, iterpool));
+ }
- /* Done. */
- SVN_ERR(editor->abort_edit(edit_baton, subpool));
- svn_pool_destroy(subpool);
+ svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
@@ -2495,6 +2521,45 @@ test_get_file_revs(const svn_test_opts_t
return SVN_NO_ERROR;
}
+static svn_error_t *
+issue_4060(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ apr_pool_t *subpool = svn_pool_create(pool);
+ svn_authz_t *authz_cfg;
+ svn_boolean_t allowed;
+ const char *authz_contents =
+ "[/A/B]" NL
+ "ozymandias = rw" NL
+ "[/]" NL
+ "ozymandias = r" NL
+ "" NL;
+
+ SVN_ERR(authz_get_handle(&authz_cfg, authz_contents, subpool));
+
+ SVN_ERR(svn_repos_authz_check_access(authz_cfg, "babylon",
+ "/A/B/C", "ozymandias",
+ svn_authz_write | svn_authz_recursive,
+ &allowed, subpool));
+ SVN_TEST_ASSERT(allowed);
+
+ SVN_ERR(svn_repos_authz_check_access(authz_cfg, "",
+ "/A/B/C", "ozymandias",
+ svn_authz_write | svn_authz_recursive,
+ &allowed, subpool));
+ SVN_TEST_ASSERT(allowed);
+
+ SVN_ERR(svn_repos_authz_check_access(authz_cfg, NULL,
+ "/A/B/C", "ozymandias",
+ svn_authz_write | svn_authz_recursive,
+ &allowed, subpool));
+ SVN_TEST_ASSERT(allowed);
+
+ svn_pool_destroy(subpool);
+
+ return SVN_NO_ERROR;
+}
+
/* The test table. */
@@ -2529,5 +2594,7 @@ struct svn_test_descriptor_t test_funcs[
"test svn_repos_get_logs ranges and limits"),
SVN_TEST_OPTS_PASS(test_get_file_revs,
"test svn_repos_get_file_revsN"),
+ SVN_TEST_OPTS_PASS(issue_4060,
+ "test issue 4060"),
SVN_TEST_NULL
};
Modified: subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/cache-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/cache-test.c?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/cache-test.c (original)
+++ subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/cache-test.c Sun Dec 18 17:36:24 2011
@@ -193,6 +193,7 @@ test_membuffer_cache_basic(apr_pool_t *p
deserialize_revnum,
APR_HASH_KEY_STRING,
"cache:",
+ FALSE,
pool));
return basic_cache_test(cache, FALSE, pool);
Modified: subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/config-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/config-test.c?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/config-test.c (original)
+++ subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/config-test.c Sun Dec 18 17:36:24 2011
@@ -211,7 +211,7 @@ test_boolean_retrieval(apr_pool_t *pool)
}
static svn_error_t *
-test_has_section(apr_pool_t *pool)
+test_has_section_case_insensitive(apr_pool_t *pool)
{
svn_config_t *cfg;
const char *cfg_file;
@@ -225,12 +225,50 @@ test_has_section(apr_pool_t *pool)
if (! svn_config_has_section(cfg, "section1"))
return fail(pool, "Failed to find section1");
+ if (! svn_config_has_section(cfg, "SECTION1"))
+ return fail(pool, "Failed to find SECTION1");
+
+ if (! svn_config_has_section(cfg, "UpperCaseSection"))
+ return fail(pool, "Failed to find UpperCaseSection");
+
+ if (! svn_config_has_section(cfg, "uppercasesection"))
+ return fail(pool, "Failed to find UpperCaseSection");
+
if (svn_config_has_section(cfg, "notthere"))
return fail(pool, "Returned true on missing section");
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_has_section_case_sensitive(apr_pool_t *pool)
+{
+ svn_config_t *cfg;
+ const char *cfg_file;
+
+ if (!srcdir)
+ SVN_ERR(init_params(pool));
+
+ cfg_file = apr_pstrcat(pool, srcdir, "/", "config-test.cfg", (char *)NULL);
+ SVN_ERR(svn_config_read2(&cfg, cfg_file, TRUE, TRUE, pool));
+
+ if (! svn_config_has_section(cfg, "section1"))
+ return fail(pool, "Failed to find section1");
+
+ if (svn_config_has_section(cfg, "SECTION1"))
+ return fail(pool, "Returned true on missing section");
+
+ if (! svn_config_has_section(cfg, "UpperCaseSection"))
+ return fail(pool, "Failed to find UpperCaseSection");
+
+ if (svn_config_has_section(cfg, "uppercasesection"))
+ return fail(pool, "Returned true on missing section");
+
+ if (svn_config_has_section(cfg, "notthere"))
+ return fail(pool, "Returned true on missing section");
+
+ return SVN_NO_ERROR;
+}
/*
====================================================================
If you add a new test to this file, update this array.
@@ -246,7 +284,9 @@ struct svn_test_descriptor_t test_funcs[
"test svn_config"),
SVN_TEST_PASS2(test_boolean_retrieval,
"test svn_config boolean conversion"),
- SVN_TEST_PASS2(test_has_section,
- "test svn_config_has_section"),
+ SVN_TEST_PASS2(test_has_section_case_insensitive,
+ "test svn_config_has_section (case insensitive)"),
+ SVN_TEST_PASS2(test_has_section_case_sensitive,
+ "test svn_config_has_section (case sensitive)"),
SVN_TEST_NULL
};
Modified: subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/config-test.cfg
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/config-test.cfg?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/config-test.cfg (original)
+++ subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/config-test.cfg Sun Dec 18 17:36:24 2011
@@ -41,6 +41,9 @@ h= %(unterminated
# Multiple expansions
i=%(a)s %(b)s
+[UpperCaseSection]
+a=Aa
+
[booleans]
true1 = true
true2 = Yes
Modified: subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/branches/file-handle-cache/subversion/tests/libsvn_subr/dirent_uri-test.c Sun Dec 18 17:36:24 2011
@@ -1838,56 +1838,6 @@ test_dirent_is_child(apr_pool_t *pool)
}
static svn_error_t *
-test_uri_is_child(apr_pool_t *pool)
-{
- int i, j;
-
- static const char * const paths[] = {
- "http://foo/bar",
- "http://foo/bar%20bell",
- "http://foo/baz",
- "http://foo",
- "http://f",
- "file://foo/bar",
- "file://foo/bar/baz%20bol",
- };
-
- static const char * const
- remainders[COUNT_OF(paths)][COUNT_OF(paths)] = {
- { 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0 },
- { "bar", "bar bell", "baz", 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, "baz bol" },
- { 0, 0, 0, 0, 0, 0, 0 },
- };
-
- for (i = 0; i < COUNT_OF(paths); i++)
- {
- for (j = 0; j < COUNT_OF(paths); j++)
- {
- const char *remainder;
-
- remainder = svn_uri__is_child(paths[i], paths[j], pool);
-
- if (((remainder) && (! remainders[i][j]))
- || ((! remainder) && (remainders[i][j]))
- || (remainder && strcmp(remainder, remainders[i][j])))
- return svn_error_createf
- (SVN_ERR_TEST_FAILED, NULL,
- "svn_uri_is_child (%s, %s) [%d,%d] "
- "returned '%s' instead of '%s'",
- paths[i], paths[j], i, j,
- remainder ? remainder : "(null)",
- remainders[i][j] ? remainders[i][j] : "(null)" );
- }
- }
-
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
test_dirent_get_absolute(apr_pool_t *pool)
{
int i;
@@ -2762,8 +2712,6 @@ struct svn_test_descriptor_t test_funcs[
"test svn_uri_get_longest_ancestor"),
SVN_TEST_PASS2(test_dirent_is_child,
"test svn_dirent_is_child"),
- SVN_TEST_PASS2(test_uri_is_child,
- "test svn_uri_is_child"),
SVN_TEST_PASS2(test_dirent_is_ancestor,
"test svn_dirent_is_ancestor"),
SVN_TEST_PASS2(test_uri_is_ancestor,
Propchange: subversion/branches/file-handle-cache/subversion/tests/libsvn_wc/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Dec 18 17:36:24 2011
@@ -8,3 +8,4 @@ svn-test-work
entries-compat-test
op-depth-test
wc-lock-tester
+wc-incomplete-tester
Modified: subversion/branches/file-handle-cache/subversion/tests/libsvn_wc/db-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/file-handle-cache/subversion/tests/libsvn_wc/db-test.c?rev=1220465&r1=1220464&r2=1220465&view=diff
==============================================================================
--- subversion/branches/file-handle-cache/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/branches/file-handle-cache/subversion/tests/libsvn_wc/db-test.c Sun Dec 18 17:36:24 2011
@@ -1053,7 +1053,7 @@ test_scan_deletion(apr_pool_t *pool)
©_op_root_abspath,
db, svn_dirent_join(local_abspath, "J/J-e", pool),
pool, pool));
- SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-e",
+ SVN_TEST_ASSERT(validate_abspath(local_abspath, "J",
base_del_abspath, pool));
SVN_TEST_ASSERT(validate_abspath(local_abspath, "other/place",
moved_to_abspath, pool));
@@ -1070,7 +1070,7 @@ test_scan_deletion(apr_pool_t *pool)
©_op_root_abspath,
db, svn_dirent_join(local_abspath, "J/J-e/J-e-a", pool),
pool, pool));
- SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-e",
+ SVN_TEST_ASSERT(validate_abspath(local_abspath, "J",
base_del_abspath, pool));
SVN_TEST_ASSERT(validate_abspath(local_abspath, "other/place/J-e-a",
moved_to_abspath, pool));
@@ -1120,7 +1120,7 @@ test_scan_deletion(apr_pool_t *pool)
/* ### I don't understand this. "J/J-e/J-e-b/Jeba" is a deleted
base node that is not overlayed by the replacement rooted at "J".
Why does base_del_abspath refer to "J-e"? */
- SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-e",
+ SVN_TEST_ASSERT(validate_abspath(local_abspath, "J",
base_del_abspath, pool));
SVN_TEST_ASSERT(validate_abspath(local_abspath, "other/place/J-e-b/Jeba",
moved_to_abspath, pool));
@@ -1174,7 +1174,7 @@ test_scan_deletion(apr_pool_t *pool)
©_op_root_abspath,
db, svn_dirent_join(local_abspath, "K/K-b", pool),
pool, pool));
- SVN_TEST_ASSERT(validate_abspath(local_abspath, "K/K-b",
+ SVN_TEST_ASSERT(validate_abspath(local_abspath, "K",
base_del_abspath, pool));
SVN_TEST_ASSERT(validate_abspath(local_abspath, "moved/away",
moved_to_abspath, pool));