Author: rhuijben
Date: Mon Feb 16 21:32:44 2015
New Revision: 1660207
URL: http://svn.apache.org/r1660207
Log:
Fix "../" style relative moved_to and moved_from parsing in the test suite's
status handling. "../" paths are relative from the passed target, while all
other relative paths are relative from cwd.
* subversion/tests/cmdline/copy_tests.py
(copy_and_move_conflicts): Update expected move statee, so the test
fails for the originally intended reasons.
* subversion/tests/cmdline/svntest/actions.py
(run_and_verify_status,
run_and_verify_unquiet_status): Pass wc_dir to allow move parsing.
* subversion/tests/cmdline/svntest/factory.py
(get_current_status): Pass wc_dir.
* subversion/tests/cmdline/svntest/wc.py
(from_status): Properly handle "../" paths.
Modified:
subversion/trunk/subversion/tests/cmdline/copy_tests.py
subversion/trunk/subversion/tests/cmdline/svntest/actions.py
subversion/trunk/subversion/tests/cmdline/svntest/factory.py
subversion/trunk/subversion/tests/cmdline/svntest/wc.py
Modified: subversion/trunk/subversion/tests/cmdline/copy_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/copy_tests.py?rev=1660207&r1=1660206&r2=1660207&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/copy_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/copy_tests.py Mon Feb 16 21:32:44
2015
@@ -5430,6 +5430,13 @@ def copy_and_move_conflicts(sbox):
'D/G/pi',
'D/G/rho',
'D/G/tau')
+ expected_status.tweak('B', moved_from='../A/B')
+ expected_status.tweak('D', moved_from='../A/D')
+ expected_status.tweak('H', moved_from='D/H')
+ expected_status.tweak('Q', moved_from='../A/Q')
+ expected_status.tweak('D/H', moved_to='H')
+ expected_status.tweak('alpha', moved_from='B/E/alpha')
+ expected_status.tweak('B/E/alpha', moved_to='alpha')
svntest.actions.run_and_verify_status(wc('move-dest'), expected_status)
expected_disk = svntest.wc.State('', {
Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1660207&r1=1660206&r2=1660207&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Mon Feb 16
21:32:44 2015
@@ -1524,7 +1524,7 @@ def run_and_verify_status(wc_dir_name, s
exit_code, output, errput = main.run_svn(None, 'status', '-v', '-u', '-q',
wc_dir_name)
- actual_status = svntest.wc.State.from_status(output)
+ actual_status = svntest.wc.State.from_status(output, wc_dir=wc_dir_name)
# Verify actual output against expected output.
if isinstance(status_tree, wc.State):
@@ -1569,7 +1569,7 @@ def run_and_verify_unquiet_status(wc_dir
exit_code, output, errput = main.run_svn(None, 'status', '-v',
'-u', wc_dir_name)
- actual_status = svntest.wc.State.from_status(output)
+ actual_status = svntest.wc.State.from_status(output, wc_dir=wc_dir_name)
# Verify actual output against expected output.
if isinstance(status_tree, wc.State):
Modified: subversion/trunk/subversion/tests/cmdline/svntest/factory.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/factory.py?rev=1660207&r1=1660206&r2=1660207&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/factory.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/factory.py Mon Feb 16
21:32:44 2015
@@ -1035,7 +1035,7 @@ class TestFactory:
make_py, prev_status = self.get_prev_status(wc)
- actual_status = svntest.wc.State.from_status(output)
+ actual_status = svntest.wc.State.from_status(output, wc_dir=wc.realpath)
# The tests currently compare SVNTreeNode trees, so let's do that too.
prev_status_tree = prev_status.old_tree()
Modified: subversion/trunk/subversion/tests/cmdline/svntest/wc.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/wc.py?rev=1660207&r1=1660206&r2=1660207&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/wc.py Mon Feb 16 21:32:44
2015
@@ -434,7 +434,7 @@ class State:
return not self.__eq__(other)
@classmethod
- def from_status(cls, lines):
+ def from_status(cls, lines, wc_dir=None):
"""Create a State object from 'svn status' output."""
def not_space(value):
@@ -442,6 +442,17 @@ class State:
return value
return None
+ def parse_move(path, wc_dir):
+ if path.startswith('../'):
+ # ../ style paths are relative from the status root
+ return to_relpath(os.path.normpath(repos_join(wc_dir, path)))
+ else:
+ # Other paths are just relative from cwd
+ return to_relpath(path)
+
+ if not wc_dir:
+ wc_dir = ''
+
desc = { }
last = None
for line in lines:
@@ -455,15 +466,15 @@ class State:
if ex_match:
if ex_match.group('moved_from'):
- path = ex_match.group('moved_from')
- last.tweak(moved_from = to_relpath(path))
+ path = to_relpath(ex_match.group('moved_from'))
+ last.tweak(moved_from = parse_move(path, wc_dir))
elif ex_match.group('moved_to'):
- path = ex_match.group('moved_to')
- last.tweak(moved_to = to_relpath(path))
+ path = to_relpath(ex_match.group('moved_to'))
+ last.tweak(moved_to = parse_move(path, wc_dir))
elif ex_match.group('swapped_with'):
- path = ex_match.group('swapped_with')
- last.tweak(moved_to = to_relpath(path))
- last.tweak(moved_from = to_relpath(path))
+ path = to_relpath(ex_match.group('swapped_with'))
+ last.tweak(moved_to = parse_move(path, wc_dir))
+ last.tweak(moved_from = parse_move(path, wc_dir))
# Parse TC description?