subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1432102 - in /subversion/trunk/subversion/tests/cmdline: copy_tests.py patch_tests.py revert_tests.py svntest/actions.py svntest/tree.py svntest/wc.py update_tests.py
Date Fri, 11 Jan 2013 15:43:54 GMT
Author: rhuijben
Date: Fri Jan 11 15:43:53 2013
New Revision: 1432102

URL: http://svn.apache.org/viewvc?rev=1432102&view=rev
Log:
Extend the test suite status processing to read the moved to and moved from
lines, and assert their values in the test suite.

* subversion/tests/cmdline/copy_tests.py
  (*): Update expected results.

* subversion/tests/cmdline/patch_tests.py
  (*): Update expected results.

* subversion/tests/cmdline/revert_tests.py
  (*): Update expected results.


* subversion/tests/cmdline/svntest/actions.py
  (run_and_verify_status,
   run_and_verify_unquiet_status): Pass wc_dir.

* subversion/tests/cmdline/svntest/tree.py
  (build_tree_from_status): Forward wc_dir.

* subversion/tests/cmdline/svntest/wc.py
  (_re_parse_status_ex): New regex.
  (normalize): Add TODO.
  (from_status): Add moved to and from to the last read node. Add optional
    argument to skip common prefix.
  (StateItem): Add moved_from and moved_to support.

* subversion/tests/cmdline/update_tests.py
  (*): Update expected results.

Modified:
    subversion/trunk/subversion/tests/cmdline/copy_tests.py
    subversion/trunk/subversion/tests/cmdline/patch_tests.py
    subversion/trunk/subversion/tests/cmdline/revert_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/actions.py
    subversion/trunk/subversion/tests/cmdline/svntest/tree.py
    subversion/trunk/subversion/tests/cmdline/svntest/wc.py
    subversion/trunk/subversion/tests/cmdline/update_tests.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=1432102&r1=1432101&r2=1432102&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/copy_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/copy_tests.py Fri Jan 11 15:43:53 2013
@@ -769,9 +769,11 @@ def mv_and_revert_directory(sbox):
   svntest.actions.run_and_verify_svn(None, None, [], 'move',
                                      E_path, F_path)
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.tweak('A/B/E', 'A/B/E/alpha', 'A/B/E/beta', status='D ')
+  expected_status.tweak('A/B/E/alpha', 'A/B/E/beta', status='D ')
+  expected_status.tweak('A/B/E', status='D ', moved_to='A/B/F/E')
   expected_status.add({
-    'A/B/F/E' : Item(status='A ', wc_rev='-', copied='+'),
+    'A/B/F/E' : Item(status='A ', wc_rev='-', copied='+',
+                     moved_from='A/B/E'),
     'A/B/F/E/alpha' : Item(status='  ', wc_rev='-', copied='+'),
     'A/B/F/E/beta' : Item(status='  ', wc_rev='-', copied='+'),
     })
@@ -781,6 +783,7 @@ def mv_and_revert_directory(sbox):
   svntest.actions.run_and_verify_svn(None, None, [], 'revert', '--recursive',
                                      new_E_path)
   expected_status.remove('A/B/F/E', 'A/B/F/E/alpha', 'A/B/F/E/beta')
+  expected_status.tweak('A/B/E', moved_to=None)
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 
@@ -2420,7 +2423,8 @@ def move_file_back_and_forth(sbox):
   # Check expected status before commit
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.add({
-    'A/D/G/rho' : Item(status='R ', copied='+', wc_rev='-'),
+    'A/D/G/rho' : Item(status='R ', copied='+', wc_rev='-',
+                       moved_from='A/D/G/rho', moved_to='A/D/G/rho'),
     })
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
@@ -2463,7 +2467,8 @@ def move_dir_back_and_forth(sbox):
   # Verify that the status indicates a replace with history
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.add({
-      'A/D'               : Item(status='R ', copied='+', wc_rev='-'),
+      'A/D'               : Item(status='R ', copied='+', wc_rev='-',
+                                 moved_from='A/D', moved_to='A/D'),
       'A/D/G'             : Item(status='  ', copied='+', wc_rev='-'),
       'A/D/G/pi'          : Item(status='  ', copied='+', wc_rev='-'),
       'A/D/G/rho'         : Item(status='  ', copied='+', wc_rev='-'),
@@ -2860,8 +2865,9 @@ def move_to_relative_paths(sbox):
 
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.add({
-    'beta'        : Item(status='A ', copied='+', wc_rev='-'),
-    'A/B/E/beta'  : Item(status='D ', wc_rev='1')
+    'beta'        : Item(status='A ', copied='+', wc_rev='-',
+                         moved_from='A/B/E/beta'),
+    'A/B/E/beta'  : Item(status='D ', wc_rev='1', moved_to='beta')
   })
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
@@ -2882,8 +2888,9 @@ def move_from_relative_paths(sbox):
 
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.add({
-    'A/B/F/beta'  : Item(status='A ', copied='+', wc_rev='-'),
-    'A/B/E/beta'  : Item(status='D ', wc_rev='1')
+    'A/B/F/beta'  : Item(status='A ', copied='+', wc_rev='-',
+                         moved_from='A/B/E/beta'),
+    'A/B/E/beta'  : Item(status='D ', wc_rev='1', moved_to='A/B/F/beta')
   })
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
@@ -4436,22 +4443,27 @@ def move_dir_containing_move(sbox):
                                      sbox.ospath('A/B_tmp'))
 
   expected_status = svntest.actions.get_virginal_state(sbox.wc_dir, 1)
-  expected_status.tweak('A/B',
-                        'A/B/E',
+  expected_status.tweak('A/B', status='D ', moved_to='A/B_tmp')
+  expected_status.tweak('A/B/E',
                         'A/B/E/alpha',
                         'A/B/E/beta',
                         'A/B/F',
                         'A/B/lambda',
                         status='D ')
   expected_status.add({
-      'A/B_tmp'               : Item(status='A ', copied='+', wc_rev='-'),
+      'A/B_tmp'               : Item(status='A ', copied='+', wc_rev='-',
+                                     moved_from='A/B'),
       # alpha has a revision that isn't reported by status.
       'A/B_tmp/E'             : Item(status='  ', copied='+', wc_rev='-'),
-      'A/B_tmp/E/alpha'       : Item(status='D ', copied='+', wc_rev='-'),
-      'A/B_tmp/E/alpha_moved' : Item(status='A ', copied='+', wc_rev='-'),
+      'A/B_tmp/E/alpha'       : Item(status='D ', copied='+', wc_rev='-',
+                                     moved_to='A/B_tmp/E/alpha_moved'),
+      'A/B_tmp/E/alpha_moved' : Item(status='A ', copied='+', wc_rev='-',
+                                     moved_from='A/B_tmp/E/alpha'),
       'A/B_tmp/E/beta'        : Item(status='  ', copied='+', wc_rev='-'),
-      'A/B_tmp/F'             : Item(status='D ', copied='+', wc_rev='-'),
-      'A/B_tmp/F_moved'       : Item(status='A ', copied='+', wc_rev='-'),
+      'A/B_tmp/F'             : Item(status='D ', copied='+', wc_rev='-',
+                                     moved_to='A/B_tmp/F_moved'),
+      'A/B_tmp/F_moved'       : Item(status='A ', copied='+', wc_rev='-',
+                                     moved_from='A/B_tmp/F'),
       'A/B_tmp/lambda'        : Item(status='  ', copied='+', wc_rev='-'),
     })
 
@@ -4460,6 +4472,7 @@ def move_dir_containing_move(sbox):
   svntest.actions.run_and_verify_svn(None, None, [], 'mv',
                                      sbox.ospath('A/B_tmp'),
                                      sbox.ospath('A/B_moved'))
+  expected_status.tweak('A/B', moved_to='A/B_moved')
   expected_status.remove('A/B_tmp',
                          'A/B_tmp/E',
                          'A/B_tmp/E/alpha',
@@ -4469,13 +4482,18 @@ def move_dir_containing_move(sbox):
                          'A/B_tmp/F_moved',
                          'A/B_tmp/lambda')
   expected_status.add({
-      'A/B_moved'               : Item(status='A ', copied='+', wc_rev='-'),
+      'A/B_moved'               : Item(status='A ', copied='+', wc_rev='-',
+                                       moved_from='A/B'),
       'A/B_moved/E'             : Item(status='  ', copied='+', wc_rev='-'),
-      'A/B_moved/E/alpha'       : Item(status='D ', copied='+', wc_rev='-'),
-      'A/B_moved/E/alpha_moved' : Item(status='A ', copied='+', wc_rev='-'),
+      'A/B_moved/E/alpha'       : Item(status='D ', copied='+', wc_rev='-',
+                                       moved_to='A/B_moved/E/alpha_moved'),
+      'A/B_moved/E/alpha_moved' : Item(status='A ', copied='+', wc_rev='-',
+                                       moved_from='A/B_moved/E/alpha'),
       'A/B_moved/E/beta'        : Item(status='  ', copied='+', wc_rev='-'),
-      'A/B_moved/F'             : Item(status='D ', copied='+', wc_rev='-'),
-      'A/B_moved/F_moved'       : Item(status='A ', copied='+', wc_rev='-'),
+      'A/B_moved/F'             : Item(status='D ', copied='+', wc_rev='-',
+                                       moved_to='A/B_moved/F_moved'),
+      'A/B_moved/F_moved'       : Item(status='A ', copied='+', wc_rev='-',
+                                       moved_from='A/B_moved/F'),
       'A/B_moved/lambda'        : Item(status='  ', copied='+', wc_rev='-'),
     })
 
@@ -4505,6 +4523,8 @@ def move_dir_containing_move(sbox):
                          'A/B/lambda',
                          'A/B_moved/E/alpha',
                          'A/B_moved/F')
+  expected_status.tweak('A/B_moved', 'A/B_moved/E/alpha_moved',
+                        'A/B_moved/F_moved', moved_from=None)
   svntest.actions.run_and_verify_commit(sbox.wc_dir,
                                         expected_output,
                                         expected_status,
@@ -5148,8 +5168,8 @@ def deleted_file_with_case_clash(sbox):
 
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.add({
-    'iota' : Item(status='D ', wc_rev=1),
-    'IOTA' : Item(status='A ', copied='+', wc_rev='-'),
+    'iota' : Item(status='D ', wc_rev=1, moved_to='IOTA'),
+    'IOTA' : Item(status='A ', copied='+', wc_rev='-', moved_from='iota'),
     })
 
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
@@ -5211,15 +5231,16 @@ def case_only_rename(sbox):
   # Create expected status.
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.add({
-    'iota'              : Item(status='D ', wc_rev=1),
-    'IoTa'              : Item(status='A ', copied='+', wc_rev='-'),
-    'A/B'               : Item(status='D ', wc_rev='1'),
+  
+    'iota'              : Item(status='D ', wc_rev=1, moved_to='IoTa'),
+    'IoTa'              : Item(status='A ', copied='+', wc_rev='-', moved_from='iota'),
+    'A/B'               : Item(status='D ', wc_rev='1', moved_to='A/b'),
     'A/B/lambda'        : Item(status='D ', wc_rev='1'),
     'A/B/E'             : Item(status='D ', wc_rev='1'),
     'A/B/E/alpha'       : Item(status='D ', wc_rev='1'),
     'A/B/E/beta'        : Item(status='D ', wc_rev='1'),
     'A/B/F'             : Item(status='D ', wc_rev='1'),
-    'A/b'               : Item(status='A ', copied='+', wc_rev='-'),
+    'A/b'               : Item(status='A ', copied='+', wc_rev='-', moved_from='A/B'),
     'A/b/E'             : Item(status='  ', copied='+', wc_rev='-'),
     'A/b/E/beta'        : Item(status='  ', copied='+', wc_rev='-'),
     'A/b/E/alpha'       : Item(status='  ', copied='+', wc_rev='-'),

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1432102&r1=1432101&r2=1432102&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Fri Jan 11 15:43:53 2013
@@ -3601,9 +3601,11 @@ def patch_moved_away(sbox):
   expected_disk.remove('A/mu')
 
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.add({'A/mu2' : Item(status='A ', copied='+', wc_rev='-')})
+  expected_status.add({
+    'A/mu2' : Item(status='A ', copied='+', wc_rev='-', moved_from='A/mu'),
+  })
 
-  expected_status.tweak('A/mu', status='D ', wc_rev=2)
+  expected_status.tweak('A/mu', status='D ', wc_rev=2, moved_to='A/mu2')
 
   expected_skip = wc.State('', { })
 

Modified: subversion/trunk/subversion/tests/cmdline/revert_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/revert_tests.py?rev=1432102&r1=1432101&r2=1432102&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/revert_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/revert_tests.py Fri Jan 11 15:43:53 2013
@@ -398,9 +398,10 @@ def revert_moved_file(sbox):
   # svn st
   expected_status = actions.get_virginal_state(wc_dir, 1)
   expected_status.add({
-    'iota_moved'        : Item(status='A ', copied='+', wc_rev='-'),
+    'iota_moved'        : Item(status='A ', copied='+', wc_rev='-',
+                               moved_from='iota'),
   })
-  expected_status.tweak('iota', status='D ')
+  expected_status.tweak('iota', status='D ', moved_to='iota_moved')
 
   actions.run_and_verify_unquiet_status(wc_dir, expected_status)
 

Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1432102&r1=1432101&r2=1432102&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Fri Jan 11 15:43:53 2013
@@ -1475,7 +1475,7 @@ def run_and_verify_status(wc_dir_name, o
   exit_code, output, errput = main.run_svn(None, 'status', '-v', '-u', '-q',
                                            wc_dir_name)
 
-  actual = tree.build_tree_from_status(output)
+  actual = tree.build_tree_from_status(output, wc_dir_name=wc_dir_name)
 
   # Verify actual output against expected output.
   try:
@@ -1514,7 +1514,7 @@ def run_and_verify_unquiet_status(wc_dir
   exit_code, output, errput = main.run_svn(None, 'status', '-v',
                                            '-u', wc_dir_name)
 
-  actual = tree.build_tree_from_status(output)
+  actual = tree.build_tree_from_status(output, wc_dir_name=wc_dir_name)
 
   # Verify actual output against expected output.
   try:

Modified: subversion/trunk/subversion/tests/cmdline/svntest/tree.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/tree.py?rev=1432102&r1=1432101&r2=1432102&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/tree.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/tree.py Fri Jan 11 15:43:53 2013
@@ -834,10 +834,11 @@ def build_tree_from_commit(lines):
 #             IFF columns non-empty.
 #
 
-def build_tree_from_status(lines):
+def build_tree_from_status(lines, wc_dir_name=None):
   "Return a tree derived by parsing the output LINES from 'st -vuq'."
 
-  return svntest.wc.State.from_status(lines).old_tree()
+  return svntest.wc.State.from_status(lines,
+                                       wc_dir_name=wc_dir_name).old_tree()
 
 
 # Parse merge "skipped" output

Modified: subversion/trunk/subversion/tests/cmdline/svntest/wc.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/wc.py?rev=1432102&r1=1432101&r2=1432102&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/wc.py Fri Jan 11 15:43:53 2013
@@ -94,6 +94,11 @@ _re_parse_status = re.compile('^([?!MACD
                               '((?P<wc_rev>\d+|-|\?) +(\d|-|\?)+ +(\S+) +)?'
                               '(?P<path>.+)$')
 
+_re_parse_status_ex = re.compile('^      ('
+               '(  \> moved (from (?P<moved_from>.+)|to (?P<moved_to>.*)))'
+              '|(\>   (?P<tc>.+))'
+  ')$')
+
 _re_parse_skipped = re.compile("^(Skipped[^']*) '(.+)'( --.*)?\n")
 
 _re_parse_summarize = re.compile("^([MAD ][M ])      (.+)\n")
@@ -254,8 +259,11 @@ class State:
 
     base = to_relpath(os.path.normpath(self.wc_dir))
 
+    # TODO: We should probably normalize the paths in moved_from and moved_to.
+
     desc = dict([(repos_join(base, path), item)
                  for path, item in self.desc.items()])
+
     return State('', desc)
 
   def compare(self, other):
@@ -362,6 +370,8 @@ class State:
           item.writelocked = 'K'
         elif item.writelocked == 'O':
           item.writelocked = None
+      item.moved_from = None
+      item.moved_to = None
 
   def old_tree(self):
     "Return an old-style tree (for compatibility purposes)."
@@ -397,7 +407,7 @@ class State:
     return not self.__eq__(other)
 
   @classmethod
-  def from_status(cls, lines):
+  def from_status(cls, lines, wc_dir_name=None):
     """Create a State object from 'svn status' output."""
 
     def not_space(value):
@@ -406,6 +416,7 @@ class State:
       return None
 
     desc = { }
+    last = None
     for line in lines:
       if line.startswith('DBG:'):
         continue
@@ -418,6 +429,25 @@ class State:
 
       match = _re_parse_status.search(line)
       if not match or match.group(10) == '-':
+
+        ex_match = _re_parse_status_ex.search(line)
+
+        if ex_match:
+          if ex_match.group('moved_from'):
+            path = ex_match.group('moved_from')
+            if wc_dir_name and path.startswith(wc_dir_name + os.path.sep):
+              path = path[len(wc_dir_name) + 1:]
+            
+            last.tweak(moved_from = to_relpath(path))
+          elif ex_match.group('moved_to'):
+            path = ex_match.group('moved_to')
+            if wc_dir_name and path.startswith(wc_dir_name + os.path.sep):
+              path = path[len(wc_dir_name) + 1:]
+            
+            last.tweak(moved_to = to_relpath(path))
+
+          # Parse TC description?
+
         # ignore non-matching lines, or items that only exist on repos
         continue
 
@@ -430,6 +460,7 @@ class State:
                        wc_rev=not_space(match.group('wc_rev')),
                        )
       desc[to_relpath(match.group('path'))] = item
+      last = item
 
     return cls('', desc)
 
@@ -647,7 +678,7 @@ class StateItem:
                status=None, verb=None, wc_rev=None,
                entry_rev=None, entry_status=None,
                locked=None, copied=None, switched=None, writelocked=None,
-               treeconflict=None):
+               treeconflict=None, moved_from=None, moved_to=None):
     # provide an empty prop dict if it wasn't provided
     if props is None:
       props = { }
@@ -680,6 +711,9 @@ class StateItem:
     self.writelocked = writelocked
     # Value 'C' or ' ', or None as an expected status meaning 'do not check'.
     self.treeconflict = treeconflict
+    # Relative paths to the move locations
+    self.moved_from = moved_from
+    self.moved_to = moved_to
 
   def copy(self):
     "Make a deep copy of self."
@@ -731,6 +765,10 @@ class StateItem:
       atts['writelocked'] = self.writelocked
     if self.treeconflict is not None:
       atts['treeconflict'] = self.treeconflict
+    if self.moved_from is not None:
+      atts['moved_from'] = self.moved_from
+    if self.moved_to is not None:
+      atts['moved_to'] = self.moved_to
 
     return (os.path.normpath(path), self.contents, self.props, atts)
 

Modified: subversion/trunk/subversion/tests/cmdline/update_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/update_tests.py?rev=1432102&r1=1432101&r2=1432102&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/update_tests.py Fri Jan 11 15:43:53 2013
@@ -5578,11 +5578,12 @@ def update_moved_dir_dir_add(sbox):
   })
   expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
   expected_status.tweak('A/B/E', 'A/B/E/alpha', 'A/B/E/beta', status='D ')
-  expected_status.tweak('A/B/E', treeconflict='C')
+  expected_status.tweak('A/B/E', treeconflict='C', moved_to='A/B/E2')
   expected_status.add({
     'A/B/E/foo'         : Item(status='D ', wc_rev='2'),
     'A/B/E/foo/bar'     : Item(status='D ', wc_rev='2'),
-    'A/B/E2'            : Item(status='A ', copied='+', wc_rev='-'),
+    'A/B/E2'            : Item(status='A ', copied='+', wc_rev='-',
+                               moved_from='A/B/E'),
     'A/B/E2/beta'       : Item(status='  ', copied='+', wc_rev='-'),
     'A/B/E2/alpha'      : Item(status='  ', copied='+', wc_rev='-'),
   })
@@ -5633,11 +5634,13 @@ def update_moved_dir_file_move(sbox):
   })
   expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
   expected_status.remove('A/B/E/alpha')
-  expected_status.tweak('A/B/E', status='D ', treeconflict='C')
+  expected_status.tweak('A/B/E', status='D ', treeconflict='C',
+                        moved_to='A/B/E2')
   expected_status.tweak('A/B/E/beta', status='D ')
   expected_status.add({
     'A/B/F/alpha'       : Item(status='  ', wc_rev='2'),
-    'A/B/E2'            : Item(status='A ', copied='+', wc_rev='-'),
+    'A/B/E2'            : Item(status='A ', copied='+', wc_rev='-',
+                               moved_from='A/B/E'),
     'A/B/E2/alpha'      : Item(status='  ', copied='+', wc_rev='-'),
     'A/B/E2/beta'       : Item(status='  ', copied='+', wc_rev='-'),
   })



Mime
View raw message