You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/01/13 22:40:38 UTC
svn commit: r1231318 [31/35] - in /subversion/branches/revprop-packing: ./
build/ build/ac-macros/ build/generator/ build/generator/templates/
build/win32/ contrib/client-side/emacs/ contrib/server-side/mod_dontdothat/
notes/ notes/http-and-webdav/ not...
Modified: subversion/branches/revprop-packing/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/patch_tests.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/patch_tests.py Fri Jan 13 21:40:26 2012
@@ -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 ')
@@ -3671,6 +3668,383 @@ def patch_lacking_trailing_eol(sbox):
1, # check-props
1) # dry-run
+@Issue(4003)
+def patch_deletes_prop(sbox):
+ "patch deletes prop, directly and via reversed add"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ patch_file_path = make_patch_path(sbox)
+ iota_path = os.path.join(wc_dir, 'iota')
+
+ svntest.main.run_svn(None, 'propset', 'propname', 'propvalue',
+ iota_path)
+ 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)
+
+ # Apply patch
+ unidiff_patch = [
+ "Index: iota\n",
+ "===================================================================\n",
+ "--- iota\t(revision 1)\n",
+ "+++ iota\t(working copy)\n",
+ "\n",
+ "Property changes on: iota\n",
+ "___________________________________________________________________\n",
+ "Deleted: propname\n",
+ "## -1 +0,0 ##\n",
+ "-propvalue\n",
+ ]
+ svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+ # Expect the original state of the working copy in r1, exception
+ # that iota is at r2 now.
+ expected_disk = svntest.main.greek_state.copy()
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.tweak('iota', status=' M')
+ expected_status.tweak('iota', wc_rev=2)
+ expected_skip = wc.State('', { })
+ expected_output = [
+ ' U %s\n' % os.path.join(wc_dir, 'iota'),
+ ]
+ 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
+ 0) # dry-run
+
+ # Revert any local mods, then try to reverse-apply a patch which
+ # *adds* the property.
+ svntest.main.run_svn(None, 'revert', iota_path)
+
+ # Apply patch
+ unidiff_patch = [
+ "Index: iota\n",
+ "===================================================================\n",
+ "--- iota\t(revision 1)\n",
+ "+++ iota\t(working copy)\n",
+ "\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))
+
+ 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
+ '--reverse-diff')
+
+@Issue(4004)
+def patch_reversed_add_with_props(sbox):
+ "reverse patch new file+props atop uncommitted"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+ patch_file_path = make_patch_path(sbox)
+
+ # Add a new file which also has props set on it.
+ newfile_path = os.path.join(wc_dir, 'newfile')
+ newfile_contents = ["This is the file 'newfile'.\n"]
+ svntest.main.file_write(newfile_path, ''.join(newfile_contents))
+ svntest.main.run_svn(None, 'add', newfile_path)
+ svntest.main.run_svn(None, 'propset', 'propname', 'propvalue',
+ newfile_path)
+
+ # Generate a patch file from our current diff (rooted at the working
+ # copy root).
+ cwd = os.getcwd()
+ try:
+ os.chdir(wc_dir)
+ exit_code, diff_output, err_output = svntest.main.run_svn(None, 'diff')
+ finally:
+ os.chdir(cwd)
+ svntest.main.file_write(patch_file_path, ''.join(diff_output))
+
+ # Okay, now commit up.
+ expected_output = svntest.wc.State(wc_dir, {
+ 'newfile' : Item(verb='Adding'),
+ })
+
+ # Now, we'll try to reverse-apply the very diff we just created. We
+ # expect the original state of the working copy in r1.
+ expected_disk = svntest.main.greek_state.copy()
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_skip = wc.State('', { })
+ expected_output = [
+ 'D %s\n' % newfile_path,
+ ]
+ 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
+ '--reverse-diff')
+
+@Issue(4004)
+def patch_reversed_add_with_props2(sbox):
+ "reverse patch new file+props"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+ patch_file_path = make_patch_path(sbox)
+
+ # Add a new file which also has props set on it.
+ newfile_path = os.path.join(wc_dir, 'newfile')
+ newfile_contents = ["This is the file 'newfile'.\n"]
+ svntest.main.file_write(newfile_path, ''.join(newfile_contents))
+ svntest.main.run_svn(None, 'add', newfile_path)
+ svntest.main.run_svn(None, 'propset', 'propname', 'propvalue',
+ newfile_path)
+
+ # Generate a patch file from our current diff (rooted at the working
+ # copy root).
+ cwd = os.getcwd()
+ try:
+ os.chdir(wc_dir)
+ exit_code, diff_output, err_output = svntest.main.run_svn(None, 'diff')
+ finally:
+ os.chdir(cwd)
+ svntest.main.file_write(patch_file_path, ''.join(diff_output))
+
+ # Okay, now commit up.
+ expected_output = svntest.wc.State(wc_dir, {
+ 'newfile' : Item(verb='Adding'),
+ })
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.add({'newfile' : Item(wc_rev=2, status=' ')})
+ svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+ expected_status, None, wc_dir)
+
+ # Now, we'll try to reverse-apply the very diff we just created. We
+ # expect the original state of the working copy in r1 plus 'newfile'
+ # scheduled for deletion.
+ expected_disk = svntest.main.greek_state.copy()
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.add({'newfile' : Item(status='D ', wc_rev=2)})
+ expected_skip = wc.State('', { })
+ expected_output = [
+ 'D %s\n' % newfile_path,
+ ]
+ 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
+ '--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
@@ -3708,6 +4082,12 @@ test_list = [ None,
patch_add_symlink,
patch_moved_away,
patch_lacking_trailing_eol,
+ 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/revprop-packing/subversion/tests/cmdline/prop_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/prop_tests.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/prop_tests.py Fri Jan 13 21:40:26 2012
@@ -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)
@@ -1125,7 +1124,7 @@ def recursive_base_wc_ops(sbox):
#----------------------------------------------------------------------
def url_props_ops(sbox):
- "property operations on an URL"
+ "property operations on a URL"
# Bootstrap
sbox.build()
Modified: subversion/branches/revprop-packing/subversion/tests/cmdline/resolve_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/resolve_tests.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/resolve_tests.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/resolve_tests.py Fri Jan 13 21:40:26 2012
@@ -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)
@@ -196,7 +195,7 @@ def prop_conflict_resolution(sbox):
# Update, postponing all conflict resolution.
svntest.actions.run_and_verify_svn(None, None, [], 'up',
'--accept=postpone', wc_dir)
- svntest.actions.run_and_verify_resolve([iota_path, mu_path, gamma_path], '-R',
+ svntest.actions.run_and_verify_resolve([iota_path, mu_path], '-R',
'--accept', resolve_accept, wc_dir)
svntest.actions.run_and_verify_svn(
'svn revolve -R --accept=' + resolve_accept + ' of prop conflict '
Modified: subversion/branches/revprop-packing/subversion/tests/cmdline/special_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/special_tests.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/special_tests.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/special_tests.py Fri Jan 13 21:40:26 2012
@@ -30,7 +30,7 @@ import sys, os, re
# Our testing module
import svntest
-from svntest.main import server_has_mergeinfo
+from svntest.main import server_has_mergeinfo, run_svn, file_write
# (abbreviation)
Skip = svntest.testcase.Skip_deco
@@ -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.
@@ -860,6 +862,166 @@ def symlink_to_wc_svnversion(sbox):
symlink_path, sbox.repo_url,
[ "1\n" ], [])
+# Regression in 1.7.0: Update fails to change a symlink
+@SkipUnless(svntest.main.is_posix_os)
+def update_symlink(sbox):
+ "update a symlink"
+
+ svntest.actions.do_sleep_for_timestamps()
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+ mu_path = sbox.ospath('A/mu')
+ iota_path = sbox.ospath('iota')
+ symlink_path = sbox.ospath('symlink')
+
+ # create a symlink to /A/mu
+ os.symlink("A/mu", symlink_path)
+ sbox.simple_add('symlink')
+ sbox.simple_commit()
+
+ # change the symlink to /iota
+ os.remove(symlink_path)
+ os.symlink("iota", symlink_path)
+ sbox.simple_commit()
+
+ # update back to r2
+ svntest.main.run_svn(False, 'update', '-r', '2', wc_dir)
+
+ # now update to head; 1.7.0 throws an assertion here
+ expected_output = svntest.wc.State(wc_dir, {
+ 'symlink' : Item(status='U '),
+ })
+ expected_disk = svntest.main.greek_state.copy()
+ expected_disk.add({'symlink': Item(contents="This is the file 'iota'.\n",
+ props={'svn:special' : '*'})})
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
+ expected_status.add({
+ 'symlink' : Item(status=' ', wc_rev='3'),
+ })
+ svntest.actions.run_and_verify_update(wc_dir,
+ expected_output,
+ expected_disk,
+ expected_status,
+ None, None, None,
+ None, None, 1)
+
+@XFail()
+@Issue(4091)
+@SkipUnless(svntest.main.is_posix_os)
+def replace_symlinks(sbox):
+ "replace symlinks"
+ sbox.build()
+ wc = sbox.ospath
+
+ # Some of these tests are implemented for git (in test script
+ # t/t9100-git-svn-basic.sh) using the Perl bindings for Subversion.
+ # Our issue #4091 is about 'svn update' failures in the git tests.
+
+ sbox.simple_mkdir('A/D/G/Z')
+ sbox.simple_mkdir('A/D/Gx')
+ sbox.simple_mkdir('A/D/Gx/Z')
+ sbox.simple_mkdir('A/D/Hx')
+ sbox.simple_mkdir('A/D/Y')
+ sbox.simple_mkdir('Ax')
+
+ os.symlink('../Y', wc('A/D/H/Z'))
+ os.symlink('../Y', wc('A/D/Hx/Z'))
+ sbox.simple_add('A/D/H/Z',
+ 'A/D/Hx/Z')
+
+ for p in ['Ax/mu',
+ 'A/D/Gx/pi',
+ 'A/D/Hx/chi',
+ ]:
+ file_write(wc(p), 'This starts as a normal file.\n')
+ sbox.simple_add(p)
+ for p in ['iota.sh',
+ 'A/mu.sh',
+ 'Ax/mu.sh',
+ 'A/D/gamma.sh',
+ 'A/B/E/beta.sh',
+ 'A/D/G/rho.sh',
+ 'A/D/Gx/rho.sh',
+ 'A/D/H/psi.sh',
+ 'A/D/Hx/psi.sh',
+ ]:
+ file_write(wc(p), '#!/bin/sh\necho "hello, svn!"\n')
+ os.chmod(wc(p), 0775)
+ sbox.simple_add(p)
+ sbox.simple_commit() # r2
+
+ # Failing git-svn test: 'new symlink is added to a file that was
+ # also just made executable', i.e., in the same revision.
+ sbox.simple_propset("svn:executable", "*", 'A/B/E/alpha')
+ os.symlink('alpha', wc('A/B/E/sym-alpha'))
+ sbox.simple_add('A/B/E/sym-alpha')
+
+ # Add a symlink to a file made non-executable in the same revision.
+ sbox.simple_propdel("svn:executable", 'A/B/E/beta.sh')
+ os.symlink('beta.sh', wc('A/B/E/sym-beta.sh'))
+ sbox.simple_add('A/B/E/sym-beta.sh')
+
+ # Replace a normal {file, exec, dir} with a symlink to the same kind
+ # via Subversion replacement.
+ sbox.simple_rm('A/D/G/pi',
+ 'A/D/G/rho.sh',
+ #'A/D/G/Z', # Ooops, not compatible with --bin=svn1.6.
+ )
+ os.symlink(wc('../gamma'), wc('A/D/G/pi'))
+ os.symlink(wc('../gamma.sh'), wc('A/D/G/rho.sh'))
+ #os.symlink(wc('../Y'), wc('A/D/G/Z'))
+ sbox.simple_add('A/D/G/pi',
+ 'A/D/G/rho.sh',
+ #'A/D/G/Z',
+ )
+
+ # Replace a symlink to {file, exec, dir} with a normal item of the
+ # same kind via Subversion replacement.
+ sbox.simple_rm('A/D/H/chi',
+ 'A/D/H/psi.sh',
+ #'A/D/H/Z',
+ )
+ os.symlink(wc('../gamma'), wc('A/D/H/chi'))
+ os.symlink(wc('../gamma.sh'), wc('A/D/H/psi.sh'))
+ #os.symlink(wc('../Y'), wc('A/D/H/Z'))
+ sbox.simple_add('A/D/H/chi',
+ 'A/D/H/psi.sh',
+ #'A/D/H/Z',
+ )
+
+ # Replace a normal {file, exec} with a symlink to {exec, file} via
+ # Subversion replacement.
+ sbox.simple_rm('A/mu',
+ 'A/mu.sh')
+ os.symlink('../iota2', wc('A/mu'))
+ os.symlink('../iota', wc('A/mu.sh'))
+ sbox.simple_add('A/mu',
+ 'A/mu.sh')
+
+ # Ditto, without the Subversion replacement. Failing git-svn test
+ # 'executable file becomes a symlink to bar/zzz (file)'.
+ os.remove(wc('Ax/mu'))
+ os.remove(wc('Ax/mu.sh'))
+ os.symlink('../iota2', wc('Ax/mu'))
+ os.symlink('../iota', wc('Ax/mu.sh'))
+ sbox.simple_propset('svn:special', '*',
+ 'Ax/mu',
+ 'Ax/mu.sh')
+ sbox.simple_propdel('svn:executable', 'Ax/mu.sh')
+
+ ### TODO Replace a normal {file, exec, dir, dir} with a symlink to
+ ### {dir, dir, file, exec}. And the same symlink-to-normal.
+
+ ### Commit fails as of r1226697 with either "svn: E145001: Entry
+ ### '.../A/D/Gx/Z' has unexpectedly changed special status" or "svn:
+ ### E155010: The node '.../Ax/mu' was not found".
+ sbox.simple_commit() # r3
+
+ # Try updating from HEAD-1 to HEAD.
+ run_svn(None, 'up', '-r2', sbox.wc_dir)
+ sbox.simple_update()
+
########################################################################
# Run the tests
@@ -887,6 +1049,8 @@ test_list = [ None,
merge_foreign_symlink,
symlink_to_wc_basic,
symlink_to_wc_svnversion,
+ update_symlink,
+ replace_symlinks,
]
if __name__ == '__main__':
Modified: subversion/branches/revprop-packing/subversion/tests/cmdline/stat_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/stat_tests.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/stat_tests.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/stat_tests.py Fri Jan 13 21:40:26 2012
@@ -117,6 +117,12 @@ def status_update_with_nested_adds(sbox)
svntest.actions.run_and_verify_unquiet_status(wc_backup,
expected_status)
+ # At one time an obstructing 'newdir' caused a SEGV on 'newdir/newfile'
+ os.makedirs(os.path.join(wc_backup, 'newdir'))
+ expected_status.tweak('newdir', status='? ')
+ svntest.actions.run_and_verify_unquiet_status(wc_backup,
+ expected_status)
+
#----------------------------------------------------------------------
# svn status -vN should include all entries in a directory
@@ -899,7 +905,7 @@ def missing_dir_in_anchor(sbox):
def status_in_xml(sbox):
"status output in XML format"
- sbox.build(read_only = True)
+ sbox.build()
wc_dir = sbox.wc_dir
file_name = "iota"
@@ -951,6 +957,44 @@ def status_in_xml(sbox):
print("ERROR: expected: %s actual: %s" % (template[i], output[i]))
raise svntest.Failure
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'cp', '-m', 'repo-to-repo copy',
+ sbox.repo_url + '/iota',
+ sbox.repo_url + '/iota2')
+
+ file_path = sbox.ospath('iota2')
+
+ template = ['<?xml version="1.0" encoding="UTF-8"?>\n',
+ "<status>\n",
+ "<target\n",
+ " path=\"%s\">\n" % (file_path),
+ "<entry\n",
+ " path=\"%s\">\n" % (file_path),
+ "<wc-status\n",
+ " props=\"none\"\n",
+ " item=\"none\">\n",
+ "</wc-status>\n",
+ "<repos-status\n",
+ " props=\"none\"\n",
+ " item=\"added\">\n",
+ "</repos-status>\n",
+ "</entry>\n",
+ "<against\n",
+ " revision=\"2\"/>\n",
+ "</target>\n",
+ "</status>\n",
+ ]
+
+ exit_code, output, error = svntest.actions.run_and_verify_svn(None, None, [],
+ 'status',
+ file_path,
+ '--xml', '-u')
+
+ for i in range(0, len(output)):
+ if output[i] != template[i]:
+ print("ERROR: expected: %s actual: %s" % (template[i], output[i]))
+ raise svntest.Failure
+
#----------------------------------------------------------------------
def status_ignored_dir(sbox):
@@ -1924,6 +1968,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 +2034,7 @@ test_list = [ None,
status_locked_deleted,
wc_wc_copy_timestamp,
wclock_status,
+ modified_modulo_translation,
]
if __name__ == '__main__':
Modified: subversion/branches/revprop-packing/subversion/tests/cmdline/svnadmin_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/svnadmin_tests.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/svnadmin_tests.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/svnadmin_tests.py Fri Jan 13 21:40:26 2012
@@ -46,6 +46,85 @@ Issue = svntest.testcase.Issue_deco
Wimp = svntest.testcase.Wimp_deco
Item = svntest.wc.StateItem
+def check_hotcopy_bdb(src, dst):
+ "Verify that the SRC BDB repository has been correctly copied to DST."
+ ### TODO: This function should be extended to verify all hotcopied files,
+ ### not just compare the output of 'svnadmin dump'. See check_hotcopy_fsfs().
+ exit_code, origout, origerr = svntest.main.run_svnadmin("dump", src,
+ '--quiet')
+ exit_code, backout, backerr = svntest.main.run_svnadmin("dump", dst,
+ '--quiet')
+ if origerr or backerr or origout != backout:
+ raise svntest.Failure
+
+def check_hotcopy_fsfs(src, dst):
+ "Verify that the SRC FSFS repository has been correctly copied to DST."
+ # Walk the source and compare all files to the destination
+ for src_dirpath, src_dirs, src_files in os.walk(src):
+ # Verify that the current directory exists in the destination
+ dst_dirpath = src_dirpath.replace(src, dst)
+ if not os.path.isdir(dst_dirpath):
+ raise svntest.Failure("%s does not exist in hotcopy "
+ "destination" % dst_dirpath)
+ # Verify that all dirents in the current directory also exist in source
+ for dst_dirent in os.listdir(dst_dirpath):
+ src_dirent = os.path.join(src_dirpath, dst_dirent)
+ if not os.path.exists(src_dirent):
+ raise svntest.Failure("%s does not exist in hotcopy "
+ "source" % src_dirent)
+ # Compare all files in this directory
+ for src_file in src_files:
+ src_path = os.path.join(src_dirpath, src_file)
+ dst_path = os.path.join(dst_dirpath, src_file)
+ if not os.path.isfile(dst_path):
+ raise svntest.Failure("%s does not exist in hotcopy "
+ "destination" % dst_path)
+
+ # Special case for rep-cache: It will always differ in a byte-by-byte
+ # comparison, so compare db tables instead.
+ if src_file == 'rep-cache.db':
+ db1 = svntest.sqlite3.connect(src_path)
+ db2 = svntest.sqlite3.connect(dst_path)
+ rows1 = []
+ rows2 = []
+ for row in db1.execute("select * from rep_cache order by hash"):
+ rows1.append(row)
+ for row in db2.execute("select * from rep_cache order by hash"):
+ rows2.append(row)
+ if len(rows1) != len(rows2):
+ raise svntest.Failure("number of rows in rep-cache differs")
+ for i in range(len(rows1)):
+ if rows1[i] != rows2[i]:
+ raise svntest.Failure("rep-cache row %i differs: '%s' vs. '%s'"
+ % (row, rows1[i]))
+ continue
+
+ f1 = open(src_path, 'r')
+ f2 = open(dst_path, 'r')
+ while True:
+ offset = 0
+ BUFSIZE = 1024
+ buf1 = f1.read(BUFSIZE)
+ buf2 = f2.read(BUFSIZE)
+ if not buf1 or not buf2:
+ if not buf1 and not buf2:
+ # both at EOF
+ break
+ elif buf1:
+ raise svntest.Failure("%s differs at offset %i" %
+ (dst_path, offset))
+ elif buf2:
+ raise svntest.Failure("%s differs at offset %i" %
+ (dst_path, offset))
+ if len(buf1) != len(buf2):
+ raise svntest.Failure("%s differs in length" % dst_path)
+ for i in range(len(buf1)):
+ if buf1[i] != buf2[i]:
+ raise svntest.Failure("%s differs at offset %i"
+ % (dst_path, offset))
+ offset += 1
+ f1.close()
+ f2.close()
#----------------------------------------------------------------------
@@ -359,17 +438,16 @@ def hotcopy_dot(sbox):
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 svntest.main.is_fs_type_fsfs():
+ check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
+ else:
+ check_hotcopy_bdb(sbox.repo_dir, backup_dir)
#----------------------------------------------------------------------
+# This test is redundant for FSFS. The hotcopy_dot and hotcopy_incremental
+# tests cover this check for FSFS already.
+@SkipUnless(svntest.main.is_fs_type_bdb)
def hotcopy_format(sbox):
"'svnadmin hotcopy' checking db/format file"
sbox.build()
@@ -1405,7 +1483,7 @@ def test_lslocks_and_rmlocks(sbox):
[], "lock", "-m", "Locking files",
iota_url, lambda_url)
- expected_output = svntest.verify.UnorderedRegexOutput([
+ expected_output_list = [
"Path: /A/B/lambda",
"UUID Token: opaquelocktoken",
"Owner: jrandom",
@@ -1416,7 +1494,7 @@ def test_lslocks_and_rmlocks(sbox):
"Path: /iota",
"UUID Token: opaquelocktoken.*",
"\n", # empty line
- ])
+ ]
# List all locks
exit_code, output, errput = svntest.main.run_svnadmin("lslocks",
@@ -1424,10 +1502,25 @@ def test_lslocks_and_rmlocks(sbox):
if errput:
raise SVNUnexpectedStderr(errput)
-
- svntest.verify.compare_and_display_lines('message', 'label',
- expected_output, output)
svntest.verify.verify_exit_code(None, exit_code, 0)
+
+ try:
+ expected_output = svntest.verify.UnorderedRegexOutput(expected_output_list)
+ svntest.verify.compare_and_display_lines('lslocks output mismatch',
+ 'output',
+ expected_output, output)
+ except:
+ # Usually both locks have the same timestamp but if the clock
+ # ticks between creating the two locks then the timestamps will
+ # differ. When the output has two identical "Created" lines
+ # UnorderedRegexOutput must have one matching regex, when the
+ # output has two different "Created" lines UnorderedRegexOutput
+ # must have two regex.
+ expected_output_list.append("Created:.*")
+ expected_output = svntest.verify.UnorderedRegexOutput(expected_output_list)
+ svntest.verify.compare_and_display_lines('lslocks output mismatch',
+ 'output',
+ expected_output, output)
# List lock in path /A
exit_code, output, errput = svntest.main.run_svnadmin("lslocks",
@@ -1463,6 +1556,227 @@ def test_lslocks_and_rmlocks(sbox):
"Unexpected output while running 'svnadmin rmlocks'.",
output, [], expected_output, None)
+#----------------------------------------------------------------------
+@Issue(3734)
+def load_ranges(sbox):
+ "'svnadmin load --revision X:Y'"
+
+ ## See http://subversion.tigris.org/issues/show_bug.cgi?id=3734. ##
+ test_create(sbox)
+
+ dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
+ 'svnadmin_tests_data',
+ 'skeleton_repos.dump')
+ dumplines = open(dumpfile_location).readlines()
+ dumpdata = "".join(dumplines)
+
+ # Load our dumpfile, 2 revisions at a time, verifying that we have
+ # the correct youngest revision after each load.
+ load_and_verify_dumpstream(sbox, [], [], None, dumpdata, '-r0:2')
+ svntest.actions.run_and_verify_svnlook("Unexpected output", ['2\n'],
+ None, 'youngest', sbox.repo_dir)
+ load_and_verify_dumpstream(sbox, [], [], None, dumpdata, '-r3:4')
+ svntest.actions.run_and_verify_svnlook("Unexpected output", ['4\n'],
+ None, 'youngest', sbox.repo_dir)
+ load_and_verify_dumpstream(sbox, [], [], None, dumpdata, '-r5:6')
+ svntest.actions.run_and_verify_svnlook("Unexpected output", ['6\n'],
+ None, 'youngest', sbox.repo_dir)
+
+ # There are ordering differences in the property blocks.
+ expected_dump = UnorderedOutput(dumplines)
+ new_dumpdata = svntest.actions.run_and_verify_dump(sbox.repo_dir)
+ 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)
+
+ check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
+
+ if i < 3:
+ sbox.simple_mkdir("newdir-%i" % i)
+ sbox.simple_commit()
+
+@SkipUnless(svntest.main.is_fs_type_fsfs)
+def hotcopy_incremental_packed(sbox):
+ "'svnadmin hotcopy --incremental' with packing"
+ sbox.build()
+
+ backup_dir, backup_url = sbox.add_repo_path('backup')
+ os.mkdir(backup_dir)
+ cwd = os.getcwd()
+ # Configure two files per shard to trigger packing
+ format_file = open(os.path.join(sbox.repo_dir, 'db', 'format'), 'wb')
+ format_file.write("4\nlayout sharded 2\n")
+ format_file.close()
+
+ # Pack revisions 0 and 1.
+ svntest.actions.run_and_verify_svnadmin(
+ None, None, [], "pack", os.path.join(cwd, sbox.repo_dir))
+
+ # Commit 5 more revs, hotcopy and pack after each commit.
+ for i in [1, 2, 3, 4, 5]:
+ os.chdir(backup_dir)
+ svntest.actions.run_and_verify_svnadmin(
+ None, None, [],
+ "hotcopy", "--incremental", os.path.join(cwd, sbox.repo_dir), '.')
+
+ os.chdir(cwd)
+
+ check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
+
+ if i < 5:
+ sbox.simple_mkdir("newdir-%i" % i)
+ sbox.simple_commit()
+ svntest.actions.run_and_verify_svnadmin(
+ None, None, [], "pack", os.path.join(cwd, sbox.repo_dir))
+
+
+def locking(sbox):
+ "svnadmin lock tests"
+ sbox.build(create_wc=False)
+
+ comment_path = os.path.join(svntest.main.temp_dir, "comment")
+ svntest.main.file_write(comment_path, "dummy comment")
+
+ invalid_comment_path = os.path.join(svntest.main.temp_dir, "invalid_comment")
+ svntest.main.file_write(invalid_comment_path, "character is invalid")
+
+ # Test illegal character in comment file.
+ expected_error = ".*svnadmin: E130004:.*"
+ svntest.actions.run_and_verify_svnadmin(None, None,
+ expected_error, "lock",
+ sbox.repo_dir,
+ "iota", "jrandom",
+ invalid_comment_path)
+
+ # Test locking path with --bypass-hooks
+ expected_output = "'iota' locked by user 'jrandom'."
+ svntest.actions.run_and_verify_svnadmin(None, expected_output,
+ None, "lock",
+ sbox.repo_dir,
+ "iota", "jrandom",
+ comment_path,
+ "--bypass-hooks")
+
+ # Remove lock
+ svntest.actions.run_and_verify_svnadmin(None, None,
+ None, "rmlocks",
+ sbox.repo_dir, "iota")
+
+ # Test locking path without --bypass-hooks
+ expected_output = "'iota' locked by user 'jrandom'."
+ svntest.actions.run_and_verify_svnadmin(None, expected_output,
+ None, "lock",
+ sbox.repo_dir,
+ "iota", "jrandom",
+ comment_path)
+
+ # Test locking already locked path.
+ expected_error = ".*svnadmin: E160035:.*"
+ svntest.actions.run_and_verify_svnadmin(None, None,
+ expected_error, "lock",
+ sbox.repo_dir,
+ "iota", "jrandom",
+ comment_path)
+
+ # Test locking non-existent path.
+ expected_error = ".*svnadmin: E160013:.*"
+ svntest.actions.run_and_verify_svnadmin(None, None,
+ expected_error, "lock",
+ sbox.repo_dir,
+ "non-existent", "jrandom",
+ comment_path)
+
+ # Test locking a path while specifying a lock token.
+ expected_output = "'A/D/G/rho' locked by user 'jrandom'."
+ lock_token = "opaquelocktoken:01234567-89ab-cdef-89ab-cdef01234567"
+ svntest.actions.run_and_verify_svnadmin(None, expected_output,
+ None, "lock",
+ sbox.repo_dir,
+ "A/D/G/rho", "jrandom",
+ comment_path, lock_token)
+
+ # Test unlocking a path, but provide the wrong lock token.
+ expected_error = ".*svnadmin: E160040:.*"
+ wrong_lock_token = "opaquelocktoken:12345670-9ab8-defc-9ab8-def01234567c"
+ svntest.actions.run_and_verify_svnadmin(None, None,
+ expected_error, "unlock",
+ sbox.repo_dir,
+ "A/D/G/rho", "jrandom",
+ wrong_lock_token)
+
+ # Test unlocking the path again, but this time provide the correct
+ # lock token.
+ expected_output = "'A/D/G/rho' unlocked."
+ svntest.actions.run_and_verify_svnadmin(None, expected_output,
+ None, "unlock",
+ sbox.repo_dir,
+ "A/D/G/rho", "jrandom",
+ lock_token)
+
+ # Install lock/unlock prevention hooks.
+ hook_path = svntest.main.get_pre_lock_hook_path(sbox.repo_dir)
+ svntest.main.create_python_hook_script(hook_path, 'import sys; sys.exit(1)')
+ hook_path = svntest.main.get_pre_unlock_hook_path(sbox.repo_dir)
+ svntest.main.create_python_hook_script(hook_path, 'import sys; sys.exit(1)')
+
+ # Test locking a path. Don't use --bypass-hooks, though, as we wish
+ # to verify that hook script is really getting executed.
+ expected_error = ".*svnadmin: E165001:.*"
+ svntest.actions.run_and_verify_svnadmin(None, None,
+ expected_error, "lock",
+ sbox.repo_dir,
+ "iota", "jrandom",
+ comment_path)
+
+ # Fetch the lock token for our remaining locked path. (We didn't
+ # explicitly set it, so it will vary from test run to test run.)
+ exit_code, output, errput = svntest.main.run_svnadmin("lslocks",
+ sbox.repo_dir,
+ "iota")
+ iota_token = None
+ for line in output:
+ if line.startswith("UUID Token: opaquelocktoken:"):
+ iota_token = line[12:].rstrip()
+ break
+ if iota_token is None:
+ raise svntest.Failure("Unable to lookup lock token for 'iota'")
+
+ # Try to unlock a path while providing the correct lock token but
+ # with a preventative hook in place.
+ expected_error = ".*svnadmin: E165001:.*"
+ svntest.actions.run_and_verify_svnadmin(None, None,
+ expected_error, "unlock",
+ sbox.repo_dir,
+ "iota", "jrandom",
+ iota_token)
+
+ # Finally, use --bypass-hooks to unlock the path (again using the
+ # correct lock token).
+ expected_output = "'iota' unlocked."
+ svntest.actions.run_and_verify_svnadmin(None, expected_output,
+ None, "unlock",
+ "--bypass-hooks",
+ sbox.repo_dir,
+ "iota", "jrandom",
+ iota_token)
+
+
########################################################################
# Run the tests
@@ -1493,6 +1807,10 @@ test_list = [ None,
load_bad_props,
verify_non_utf8_paths,
test_lslocks_and_rmlocks,
+ load_ranges,
+ hotcopy_incremental,
+ hotcopy_incremental_packed,
+ locking,
]
if __name__ == '__main__':
Modified: subversion/branches/revprop-packing/subversion/tests/cmdline/svnmucc_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/svnmucc_tests.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/svnmucc_tests.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/svnmucc_tests.py Fri Jan 13 21:40:26 2012
@@ -25,6 +25,7 @@
######################################################################
import svntest
+import re
XFail = svntest.testcase.XFail_deco
Issues = svntest.testcase.Issues_deco
@@ -46,10 +47,276 @@ def reject_bogus_mergeinfo(sbox):
'propset', 'svn:mergeinfo', '/B:0',
sbox.repo_url + '/A')
+_svnmucc_re = re.compile('^(r[0-9]+) committed by jrandom at (.*)$')
+_log_re = re.compile('^ ([ADRM] /[^\(]+($| \(from .*:[0-9]+\)$))')
+_err_re = re.compile('^svnmucc: (.*)$')
+
+def test_svnmucc(repo_url, expected_path_changes, *varargs):
+ """Run svnmucc with the list of SVNMUCC_ARGS arguments. Verify that
+ its run results in a new commit with 'svn log -rHEAD' changed paths
+ that match the list of EXPECTED_PATH_CHANGES."""
+
+ # First, run svnmucc.
+ exit_code, outlines, errlines = svntest.main.run_svnmucc('-U', repo_url,
+ *varargs)
+ if errlines:
+ raise svntest.main.SVNCommitFailure(str(errlines))
+ if len(outlines) != 1 or not _svnmucc_re.match(outlines[0]):
+ raise svntest.main.SVNLineUnequal(str(outlines))
+
+ # Now, run 'svn log -vq -rHEAD'
+ changed_paths = []
+ exit_code, outlines, errlines = \
+ svntest.main.run_svn(None, 'log', '-vqrHEAD', repo_url)
+ if errlines:
+ raise svntest.Failure("Unable to verify commit with 'svn log': %s"
+ % (str(errlines)))
+ for line in outlines:
+ match = _log_re.match(line)
+ if match:
+ changed_paths.append(match.group(1).rstrip('\n\r'))
+
+ expected_path_changes.sort()
+ changed_paths.sort()
+ if changed_paths != expected_path_changes:
+ raise svntest.Failure("Logged path changes differ from expectations\n"
+ " expected: %s\n"
+ " actual: %s" % (str(expected_path_changes),
+ str(changed_paths)))
+
+def xtest_svnmucc(repo_url, expected_errors, *varargs):
+ """Run svnmucc with the list of SVNMUCC_ARGS arguments. Verify that
+ its run results match the list of EXPECTED_ERRORS."""
+
+ # First, run svnmucc.
+ exit_code, outlines, errlines = svntest.main.run_svnmucc('-U', repo_url,
+ *varargs)
+ errors = []
+ for line in errlines:
+ match = _err_re.match(line)
+ if match:
+ errors.append(line.rstrip('\n\r'))
+ if errors != expected_errors:
+ raise svntest.main.SVNUnmatchedError(str(errors))
+
+
+def basic_svnmucc(sbox):
+ "basic svnmucc tests"
+
+ sbox.build()
+ empty_file = sbox.ospath('empty')
+ svntest.main.file_append(empty_file, '')
+
+ # revision 2
+ test_svnmucc(sbox.repo_url,
+ ['A /foo'
+ ], # ---------
+ 'mkdir', 'foo')
+
+ # revision 3
+ test_svnmucc(sbox.repo_url,
+ ['A /z.c',
+ ], # ---------
+ 'put', empty_file, 'z.c')
+
+ # revision 4
+ test_svnmucc(sbox.repo_url,
+ ['A /foo/z.c (from /z.c:3)',
+ 'A /foo/bar (from /foo:3)',
+ ], # ---------
+ 'cp', '3', 'z.c', 'foo/z.c',
+ 'cp', '3', 'foo', 'foo/bar')
+
+ # revision 5
+ test_svnmucc(sbox.repo_url,
+ ['A /zig (from /foo:4)',
+ 'D /zig/bar',
+ 'D /foo',
+ 'A /zig/zag (from /foo:4)',
+ ], # ---------
+ 'cp', '4', 'foo', 'zig',
+ 'rm', 'zig/bar',
+ 'mv', 'foo', 'zig/zag')
+
+ # revision 6
+ test_svnmucc(sbox.repo_url,
+ ['D /z.c',
+ 'A /zig/zag/bar/y.c (from /z.c:5)',
+ 'A /zig/zag/bar/x.c (from /z.c:3)',
+ ], # ---------
+ 'mv', 'z.c', 'zig/zag/bar/y.c',
+ 'cp', '3', 'z.c', 'zig/zag/bar/x.c')
+
+ # revision 7
+ test_svnmucc(sbox.repo_url,
+ ['D /zig/zag/bar/y.c',
+ 'A /zig/zag/bar/y y.c (from /zig/zag/bar/y.c:6)',
+ 'A /zig/zag/bar/y%20y.c (from /zig/zag/bar/y.c:6)',
+ ], # ---------
+ 'mv', 'zig/zag/bar/y.c', 'zig/zag/bar/y%20y.c',
+ 'cp', 'HEAD', 'zig/zag/bar/y.c', 'zig/zag/bar/y%2520y.c')
+
+ # revision 8
+ test_svnmucc(sbox.repo_url,
+ ['D /zig/zag/bar/y y.c',
+ 'A /zig/zag/bar/z z1.c (from /zig/zag/bar/y y.c:7)',
+ 'A /zig/zag/bar/z%20z.c (from /zig/zag/bar/y%20y.c:7)',
+ 'A /zig/zag/bar/z z2.c (from /zig/zag/bar/y y.c:7)',
+ ], #---------
+ 'mv', 'zig/zag/bar/y%20y.c', 'zig/zag/bar/z z1.c',
+ 'cp', 'HEAD', 'zig/zag/bar/y%2520y.c', 'zig/zag/bar/z%2520z.c',
+ 'cp', 'HEAD', 'zig/zag/bar/y y.c', 'zig/zag/bar/z z2.c')
+
+
+ # revision 9
+ test_svnmucc(sbox.repo_url,
+ ['D /zig/zag',
+ 'A /zig/foo (from /zig/zag:8)',
+ 'D /zig/foo/bar/z%20z.c',
+ 'D /zig/foo/bar/z z2.c',
+ 'R /zig/foo/bar/z z1.c (from /zig/zag/bar/x.c:6)',
+ ], #---------
+ 'mv', 'zig/zag', 'zig/foo',
+ 'rm', 'zig/foo/bar/z z1.c',
+ 'rm', 'zig/foo/bar/z%20z2.c',
+ 'rm', 'zig/foo/bar/z%2520z.c',
+ 'cp', '6', 'zig/zag/bar/x.c', 'zig/foo/bar/z%20z1.c')
+
+ # revision 10
+ test_svnmucc(sbox.repo_url,
+ ['R /zig/foo/bar (from /zig/z.c:9)',
+ ], #---------
+ 'rm', 'zig/foo/bar',
+ 'cp', '9', 'zig/z.c', 'zig/foo/bar')
+
+ # revision 11
+ test_svnmucc(sbox.repo_url,
+ ['R /zig/foo/bar (from /zig/foo/bar:9)',
+ 'D /zig/foo/bar/z z1.c',
+ ], #---------
+ 'rm', 'zig/foo/bar',
+ 'cp', '9', 'zig/foo/bar', 'zig/foo/bar',
+ 'rm', 'zig/foo/bar/z%20z1.c')
+
+ # revision 12
+ test_svnmucc(sbox.repo_url,
+ ['R /zig/foo (from /zig/foo/bar:11)',
+ ], #---------
+ 'rm', 'zig/foo',
+ 'cp', 'head', 'zig/foo/bar', 'zig/foo')
+
+ # revision 13
+ test_svnmucc(sbox.repo_url,
+ ['D /zig',
+ 'A /foo (from /foo:4)',
+ 'A /foo/foo (from /foo:4)',
+ 'A /foo/foo/foo (from /foo:4)',
+ 'D /foo/foo/bar',
+ 'R /foo/foo/foo/bar (from /foo:4)',
+ ], #---------
+ 'rm', 'zig',
+ 'cp', '4', 'foo', 'foo',
+ 'cp', '4', 'foo', 'foo/foo',
+ 'cp', '4', 'foo', 'foo/foo/foo',
+ 'rm', 'foo/foo/bar',
+ 'rm', 'foo/foo/foo/bar',
+ 'cp', '4', 'foo', 'foo/foo/foo/bar')
+
+ # revision 14
+ test_svnmucc(sbox.repo_url,
+ ['A /boozle (from /foo:4)',
+ 'A /boozle/buz',
+ 'A /boozle/buz/nuz',
+ ], #---------
+ 'cp', '4', 'foo', 'boozle',
+ 'mkdir', 'boozle/buz',
+ 'mkdir', 'boozle/buz/nuz')
+
+ # revision 15
+ test_svnmucc(sbox.repo_url,
+ ['A /boozle/buz/svnmucc-test.py',
+ 'A /boozle/guz (from /boozle/buz:14)',
+ 'A /boozle/guz/svnmucc-test.py',
+ ], #---------
+ 'put', empty_file, 'boozle/buz/svnmucc-test.py',
+ 'cp', '14', 'boozle/buz', 'boozle/guz',
+ 'put', empty_file, 'boozle/guz/svnmucc-test.py')
+
+ # revision 16
+ test_svnmucc(sbox.repo_url,
+ ['M /boozle/buz/svnmucc-test.py',
+ 'R /boozle/guz/svnmucc-test.py',
+ ], #---------
+ 'put', empty_file, 'boozle/buz/svnmucc-test.py',
+ 'rm', 'boozle/guz/svnmucc-test.py',
+ 'put', empty_file, 'boozle/guz/svnmucc-test.py')
+
+ # revision 17
+ test_svnmucc(sbox.repo_url,
+ ['R /foo/bar (from /foo/foo:16)'], #---------
+ 'rm', 'foo/bar',
+ 'cp', '16', 'foo/foo', 'foo/bar',
+ 'propset', 'testprop', 'true', 'foo/bar')
+
+ # revision 18
+ test_svnmucc(sbox.repo_url,
+ ['M /foo/bar'], #---------
+ 'propdel', 'testprop', 'foo/bar')
+
+ # revision 19
+ test_svnmucc(sbox.repo_url,
+ ['M /foo/z.c',
+ 'M /foo/foo',
+ ], #---------
+ 'propset', 'testprop', 'true', 'foo/z.c',
+ 'propset', 'testprop', 'true', 'foo/foo')
+
+ # revision 20
+ test_svnmucc(sbox.repo_url,
+ ['M /foo/z.c',
+ 'M /foo/foo',
+ ], #---------
+ 'propsetf', 'testprop', empty_file, 'foo/z.c',
+ 'propsetf', 'testprop', empty_file, 'foo/foo')
+
+ # Expected missing revision error
+ xtest_svnmucc(sbox.repo_url,
+ ["svnmucc: E200004: 'a' is not a revision"
+ ], #---------
+ 'cp', 'a', 'b')
+
+ # Expected cannot be younger error
+ xtest_svnmucc(sbox.repo_url,
+ ['svnmucc: E205000: Copy source revision cannot be younger ' +
+ 'than base revision',
+ ], #---------
+ 'cp', '42', 'a', 'b')
+
+ # Expected already exists error
+ xtest_svnmucc(sbox.repo_url,
+ ["svnmucc: E125002: 'foo' already exists",
+ ], #---------
+ 'cp', '17', 'a', 'foo')
+
+ # Expected copy_src already exists error
+ xtest_svnmucc(sbox.repo_url,
+ ["svnmucc: E125002: 'a/bar' (from 'foo/bar:17') already exists",
+ ], #---------
+ 'cp', '17', 'foo', 'a',
+ 'cp', '17', 'foo/foo', 'a/bar')
+
+ # Expected not found error
+ xtest_svnmucc(sbox.repo_url,
+ ["svnmucc: E125002: 'a' not found",
+ ], #---------
+ 'cp', '17', 'a', 'b')
+
+
######################################################################
test_list = [ None,
reject_bogus_mergeinfo,
+ basic_svnmucc,
]
if __name__ == '__main__':
Modified: subversion/branches/revprop-packing/subversion/tests/cmdline/svnrdump_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/svnrdump_tests.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/svnrdump_tests.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/svnrdump_tests.py Fri Jan 13 21:40:26 2012
@@ -70,6 +70,28 @@ def build_repos(sbox):
# Create an empty repository.
svntest.main.create_repos(sbox.repo_dir)
+def compare_repos_dumps(svnrdump_sbox, svnadmin_dumpfile):
+ """Compare two dumpfiles, one created from SVNRDUMP_SBOX, and other given
+ by SVNADMIN_DUMPFILE. The dumpfiles do not need to match linewise, as the
+ SVNADMIN_DUMPFILE contents will first be loaded into a repository and then
+ re-dumped to do the match, which should generate the same dumpfile as
+ dumping SVNRDUMP_SBOX."""
+
+ svnrdump_contents = svntest.actions.run_and_verify_dump(
+ svnrdump_sbox.repo_dir)
+
+ svnadmin_sbox = svnrdump_sbox.clone_dependent()
+ svntest.main.safe_rmtree(svnadmin_sbox.repo_dir)
+ svntest.main.create_repos(svnadmin_sbox.repo_dir)
+
+ svntest.actions.run_and_verify_load(svnadmin_sbox.repo_dir, svnadmin_dumpfile)
+
+ svnadmin_contents = svntest.actions.run_and_verify_dump(
+ svnadmin_sbox.repo_dir)
+
+ svntest.verify.compare_and_display_lines(
+ "Dump files", "DUMP", svnadmin_contents, svnrdump_contents)
+
def run_dump_test(sbox, dumpfile_name, expected_dumpfile_name = None,
subdir = None, bypass_prop_validation = False):
"""Load a dumpfile using 'svnadmin load', dump it with 'svnrdump
@@ -108,11 +130,13 @@ def run_dump_test(sbox, dumpfile_name, e
expected_dumpfile_name),
'rb').readlines()
svnadmin_dumpfile = svntest.verify.UnorderedOutput(svnadmin_dumpfile)
-
- # Compare the output from stdout
- svntest.verify.compare_and_display_lines(
- "Dump files", "DUMP", svnadmin_dumpfile, svnrdump_dumpfile,
- None, mismatched_headers_re)
+ # Compare the output from stdout
+ svntest.verify.compare_and_display_lines(
+ "Dump files", "DUMP", svnadmin_dumpfile, svnrdump_dumpfile,
+ None, mismatched_headers_re)
+
+ else:
+ compare_repos_dumps(sbox, svnadmin_dumpfile)
def run_load_test(sbox, dumpfile_name, expected_dumpfile_name = None,
expect_deltas = True):
@@ -155,9 +179,12 @@ def run_load_test(sbox, dumpfile_name, e
expected_dumpfile_name),
'rb').readlines()
- # Compare the output from stdout
- svntest.verify.compare_and_display_lines(
- "Dump files", "DUMP", svnrdump_dumpfile, svnadmin_dumpfile)
+ # Compare the output from stdout
+ svntest.verify.compare_and_display_lines(
+ "Dump files", "DUMP", svnrdump_dumpfile, svnadmin_dumpfile)
+
+ else:
+ compare_repos_dumps(sbox, svnrdump_dumpfile)
######################################################################
# Tests
@@ -297,11 +324,13 @@ def copy_revprops_load(sbox):
"load: copy revprops other than svn:*"
run_load_test(sbox, "revprops.dump")
+@XFail()
def only_trunk_dump(sbox):
"dump: subdirectory"
run_dump_test(sbox, "trunk-only.dump", subdir="/trunk",
expected_dumpfile_name="trunk-only.expected.dump")
+@XFail()
def only_trunk_A_with_changes_dump(sbox):
"dump: subdirectory with changes on root"
run_dump_test(sbox, "trunk-A-changes.dump", subdir="/trunk/A",
Modified: subversion/branches/revprop-packing/subversion/tests/cmdline/svnsync_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/svnsync_tests.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/svnsync_tests.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/svnsync_tests.py Fri Jan 13 21:40:26 2012
@@ -208,7 +208,7 @@ def setup_and_sync(sbox, dump_file_conte
return dest_sbox
-def verify_mirror(dest_sbox, exp_dump_file_contents):
+def verify_mirror(dest_sbox, src_sbox):
"""Compare the contents of the DEST_SBOX repository with EXP_DUMP_FILE_CONTENTS."""
# Remove some SVNSync-specific housekeeping properties from the
@@ -221,9 +221,10 @@ def verify_mirror(dest_sbox, exp_dump_fi
# Create a dump file from the mirror repository.
dest_dump = svntest.actions.run_and_verify_dump(dest_sbox.repo_dir)
+ src_dump = svntest.actions.run_and_verify_dump(src_sbox.repo_dir)
svntest.verify.compare_and_display_lines(
- "Dump files", "DUMP", exp_dump_file_contents, dest_dump)
+ "Dump files", "DUMP", src_dump, dest_dump)
def run_test(sbox, dump_file_name, subdir=None, exp_dump_file_name=None,
bypass_prop_validation=False, source_prop_encoding=None,
@@ -249,12 +250,16 @@ or another dump file."""
# dump file (used to create the master repository) or another specified dump
# file.
if exp_dump_file_name:
- exp_master_dumpfile_contents = open(os.path.join(svnsync_tests_dir,
- exp_dump_file_name)).readlines()
+ build_repos(sbox)
+ svntest.actions.run_and_verify_load(sbox.repo_dir,
+ open(os.path.join(svnsync_tests_dir,
+ exp_dump_file_name),
+ 'rb').readlines())
+ src_sbox = sbox
else:
- exp_master_dumpfile_contents = master_dumpfile_contents
+ src_sbox = sbox
- verify_mirror(dest_sbox, exp_master_dumpfile_contents)
+ verify_mirror(dest_sbox, sbox)
@@ -1012,7 +1017,9 @@ def delete_revprops(sbox):
run_copy_revprops(dest_sbox.repo_url, sbox.repo_url)
# Does the result look as we expected?
- verify_mirror(dest_sbox, expected_contents)
+ build_repos(sbox)
+ svntest.actions.run_and_verify_load(sbox.repo_dir, expected_contents)
+ verify_mirror(dest_sbox, sbox)
@Issue(3870)
@SkipUnless(svntest.main.is_posix_os)
Modified: subversion/branches/revprop-packing/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/svntest/actions.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/svntest/actions.py Fri Jan 13 21:40:26 2012
@@ -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:
@@ -1398,8 +1398,9 @@ def run_and_verify_commit(wc_dir_name, o
status_tree = status_tree.old_tree()
# Commit.
+ if '-m' not in args and '-F' not in args:
+ args = list(args) + ['-m', 'log msg']
exit_code, output, errput = main.run_svn(error_re_string, 'ci',
- '-m', 'log msg',
*args)
if error_re_string:
@@ -1747,6 +1748,11 @@ def lock_admin_dir(wc_dir, recursive=Fal
svntest.main.run_wc_lock_tester(recursive, wc_dir)
+def set_incomplete(wc_dir, revision):
+ "Make wc_dir incomplete at revision"
+
+ svntest.main.run_wc_incomplete_tester(wc_dir, revision)
+
def get_wc_uuid(wc_dir):
"Return the UUID of the working copy at WC_DIR."
return run_and_parse_info(wc_dir)[0]['Repository UUID']
@@ -1817,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
@@ -1827,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/revprop-packing/subversion/tests/cmdline/svntest/factory.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/svntest/factory.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/svntest/factory.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/svntest/factory.py Fri Jan 13 21:40:26 2012
@@ -288,7 +288,9 @@ class TestFactory:
# Any expected_disk still there from a previous verification
self.prev_disk = None
if prev_disk:
- self.prev_disk = [None, prev_disk] # svntest.wc.State
+ reparented_prev_disk = svntest.wc.State(prev_disk.wc_dir, {});
+ reparented_prev_disk.add_state(sbox.wc_dir, prev_disk);
+ self.prev_disk = [None, reparented_prev_disk]
# Those command line options that expect an argument following
# which is not a path. (don't expand args following these)
Modified: subversion/branches/revprop-packing/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/svntest/main.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/svntest/main.py Fri Jan 13 21:40:26 2012
@@ -165,6 +165,7 @@ entriesdump_binary = os.path.abspath('en
atomic_ra_revprop_change_binary = os.path.abspath('atomic-ra-revprop-change' + \
_exe)
wc_lock_tester_binary = os.path.abspath('../libsvn_wc/wc-lock-tester' + _exe)
+wc_incomplete_tester_binary = os.path.abspath('../libsvn_wc/wc-incomplete-tester' + _exe)
svnmucc_binary=os.path.abspath('../../../tools/client-side/svnmucc/svnmucc' + \
_exe)
@@ -318,6 +319,16 @@ def get_pre_revprop_change_hook_path(rep
return os.path.join(repo_dir, "hooks", "pre-revprop-change")
+def get_pre_lock_hook_path(repo_dir):
+ "Return the path of the pre-lock hook script in REPO_DIR."
+
+ return os.path.join(repo_dir, "hooks", "pre-lock")
+
+def get_pre_unlock_hook_path(repo_dir):
+ "Return the path of the pre-unlock hook script in REPO_DIR."
+
+ return os.path.join(repo_dir, "hooks", "pre-unlock")
+
def get_svnserve_conf_file_path(repo_dir):
"Return the path of the svnserve.conf file in REPO_DIR."
@@ -683,6 +694,10 @@ def run_wc_lock_tester(recursive, path):
option = "-1"
return run_command(wc_lock_tester_binary, False, False, option, path)
+def run_wc_incomplete_tester(wc_dir, revision):
+ "Run the wc-incomplete tool, returning its exit code, stdout and stderr"
+ return run_command(wc_incomplete_tester_binary, False, False,
+ wc_dir, revision)
def youngest(repos_path):
"run 'svnlook youngest' on REPOS_PATH, returns revision as int"
@@ -995,51 +1010,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/revprop-packing/subversion/tests/cmdline/tree_conflict_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/cmdline/tree_conflict_tests.py?rev=1231318&r1=1231317&r2=1231318&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/tests/cmdline/tree_conflict_tests.py (original)
+++ subversion/branches/revprop-packing/subversion/tests/cmdline/tree_conflict_tests.py Fri Jan 13 21:40:26 2012
@@ -278,6 +278,9 @@ f_moves = [
d_dels = [
( create_d, ['dD'] ),
+]
+
+d_moves = [
( create_d, ['dM'] ),
]
@@ -604,12 +607,12 @@ def up_sw_dir_mod_onto_del(sbox):
def up_sw_dir_del_onto_mod(sbox):
"up/sw dir: del/rpl/mv onto modify"
# WC state: any (D necessarily exists; children may have any state)
- test_tc_up_sw(sbox, d_dels + d_rpls, d_mods)
+ test_tc_up_sw(sbox, d_dels + d_moves + d_rpls, d_mods)
def up_sw_dir_del_onto_del(sbox):
"up/sw dir: del/rpl/mv onto del/rpl/mv"
# WC state: any (D necessarily exists; children may have any state)
- test_tc_up_sw(sbox, d_dels + d_rpls, d_dels + d_rpls)
+ test_tc_up_sw(sbox, d_dels + d_moves + d_rpls, d_dels + d_rpls)
# This is currently set as XFail over ra_dav because it hits
# issue #3314 'DAV can overwrite directories during copy'
@@ -690,8 +693,8 @@ def merge_file_add_onto_not_none(sbox):
def merge_dir_mod_onto_not_dir(sbox):
"merge dir: modify onto not-dir"
sbox2 = sbox.clone_dependent()
- test_tc_merge(sbox, d_mods, br_scen = d_dels + d_rpl_f)
- test_tc_merge(sbox2, d_mods, wc_scen = d_dels)
+ test_tc_merge(sbox, d_mods, br_scen = d_dels + d_moves + d_rpl_f)
+ test_tc_merge(sbox2, d_mods, wc_scen = d_dels + d_moves)
# Test for issue #3150 'tree conflicts with directories as victims'.
@XFail()
@@ -699,14 +702,14 @@ def merge_dir_mod_onto_not_dir(sbox):
def merge_dir_del_onto_not_same(sbox):
"merge dir: del/rpl/mv onto not-same"
sbox2 = sbox.clone_dependent()
- test_tc_merge(sbox, d_dels + d_rpls, br_scen = d_mods)
- test_tc_merge(sbox2, d_dels + d_rpls, wc_scen = d_mods)
+ test_tc_merge(sbox, d_dels + d_moves + d_rpls, br_scen = d_mods)
+ test_tc_merge(sbox2, d_dels + d_moves + d_rpls, wc_scen = d_mods)
def merge_dir_del_onto_not_dir(sbox):
"merge dir: del/rpl/mv onto not-dir"
sbox2 = sbox.clone_dependent()
- test_tc_merge(sbox, d_dels + d_rpls, br_scen = d_dels + d_rpl_f)
- test_tc_merge(sbox2, d_dels + d_rpls, wc_scen = d_dels)
+ test_tc_merge(sbox, d_dels + d_moves + d_rpls, br_scen = d_dels + d_moves + d_rpl_f)
+ test_tc_merge(sbox2, d_dels + d_moves + d_rpls, wc_scen = d_dels + d_moves)
def merge_dir_add_onto_not_none(sbox):
"merge dir: add onto not-none"
@@ -1255,7 +1258,7 @@ def actual_only_node_behaviour(sbox):
# merge
# note: this is intentionally a no-op merge that does not record mergeinfo
expected_stdout = None
- expected_stderr = ".*foo.*does not exist.*"
+ expected_stderr = ".*foo.*was not found.*"
run_and_verify_svn(None, expected_stdout, expected_stderr,
"merge", '--ignore-ancestry', '-c', '4',
A_copy_url + '/mu', foo_path)