You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/04/20 14:03:59 UTC

svn commit: r1095384 - in /subversion/trunk/subversion: svn/status.c tests/cmdline/stat_tests.py tests/cmdline/svntest/tree.py tests/cmdline/upgrade_tests.py

Author: rhuijben
Date: Wed Apr 20 12:03:58 2011
New Revision: 1095384

URL: http://svn.apache.org/viewvc?rev=1095384&view=rev
Log:
Update the svn status output to provide revision '-' for added and replaced
nodes and fix the test suite.

Pre wc-ng svn_wc_add3() changed the revision for added nodes into 0,
which found its way all the way in the user interface.

This also fixes the revision reporting on conflicts on added and replaced
files. Until this patch these would be reported as "?", while they are now
handled like their normal status.

* subversion/svn/status.c
  (print_status): Remove hack.

* subversion/tests/cmdline/stat_tests.py
  (status_nonrecursive_update_different_cwd,
   missing_dir_in_anchor): Update expected output.

* subversion/tests/cmdline/svntest/tree.py
  (compare_file_nodes): Assume that an expected wc_rev '0' is ok for an add
    with revision '-'.
  (compare_dir_nodes): New function like compare_file_nodes.
  (compare_trees): Use compare_dir_nodes.

* subversion/tests/cmdline/upgrade_tests.py
  (missing_dirs,
   missing_dirs2): Fix expectations. Assume single-db
  (replaced_files): Assume revision '-'.

Modified:
    subversion/trunk/subversion/svn/status.c
    subversion/trunk/subversion/tests/cmdline/stat_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/tree.py
    subversion/trunk/subversion/tests/cmdline/upgrade_tests.py

Modified: subversion/trunk/subversion/svn/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status.c?rev=1095384&r1=1095383&r2=1095384&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/status.c (original)
+++ subversion/trunk/subversion/svn/status.c Wed Apr 20 12:03:58 2011
@@ -191,23 +191,11 @@ print_status(const char *path,
       char ood_status, lock_status;
       const char *working_rev;
 
-      /* ### FIXME: For now, we'll tweak an SVN_INVALID_REVNUM and make it
-         ### 0. In WC-1, files scheduled for addition were assigned
-         ### revision=0.  This is wrong, and we're trying to remedy that,
-         ### but for the sake of test suite and code sanity now in WC-NG,
-         ### we'll just maintain the old behavior. */
       if (! status->versioned)
         working_rev = "";
-      else if (status->copied)
+      else if (status->copied
+               || ! SVN_IS_VALID_REVNUM(status->revision))
         working_rev = "-";
-      else if (! SVN_IS_VALID_REVNUM(status->revision))
-        {
-          if (node_status == svn_wc_status_added ||
-              node_status == svn_wc_status_replaced)
-            working_rev = "0";
-          else
-            working_rev = " ? ";
-        }
       else
         working_rev = apr_psprintf(pool, "%ld", status->revision);
 

Modified: subversion/trunk/subversion/tests/cmdline/stat_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/stat_tests.py?rev=1095384&r1=1095383&r2=1095384&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/stat_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/stat_tests.py Wed Apr 20 12:03:58 2011
@@ -433,7 +433,7 @@ def status_nonrecursive_update_different
 
   expected_output = [
     '        *                                %s\n' % os.path.join("C", "J"),
-    'A                0       ?   ?           %s\n' % os.path.join("C", "K"),
+    'A                -       ?   ?           %s\n' % os.path.join("C", "K"),
     '        *        1        1 jrandom      C\n',
     'Status against revision:      2\n' ]
 
@@ -445,7 +445,7 @@ def status_nonrecursive_update_different
 
   expected_output = [
     '        *                                J\n',
-    'A                0       ?   ?           K\n',
+    'A                -       ?   ?           K\n',
     '        *        1        1 jrandom      .\n',
     'Status against revision:      2\n']
 
@@ -889,11 +889,9 @@ def missing_dir_in_anchor(sbox):
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
   # At one point this caused a "foo not locked" error
-  is_singledb = svntest.main.wc_is_singledb(foo_path)
   svntest.main.safe_rmtree(foo_path)
-  expected_status.tweak('foo', status='! ', wc_rev='?')
-  if is_singledb:
-    expected_status.tweak('foo', entry_status='A ', entry_rev='0')
+  expected_status.tweak('foo', status='! ', entry_status='A ',
+                               wc_rev='-',  entry_rev='0')
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 

Modified: subversion/trunk/subversion/tests/cmdline/svntest/tree.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/tree.py?rev=1095384&r1=1095383&r2=1095384&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/tree.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/tree.py Wed Apr 20 12:03:58 2011
@@ -424,9 +424,34 @@ def compare_file_nodes(a, b):
     return 1
   if a.props != b.props:
     return 1
-  if a.atts != b.atts:
+  if a.atts == b.atts:
+    # No fixes necessary
+    return 0
+
+  # Fix a pre-WC-NG assumptions in our testsuite
+  if (b.atts == {'status': 'A ', 'wc_rev': '0'})     \
+     and (a.atts == {'status': 'A ', 'wc_rev': '-'}):
+    return 0
+  return 1
+
+# Helper for compare_trees
+def compare_dir_nodes(a, b):
+  """Compare two nodes, A (actual) and B (expected). Compare their names,
+  properties and attributes, ignoring children.  Return 0 if the
+  same, 1 otherwise."""
+  if a.name != b.name:
+    return 1
+  if (a.props != b.props):
     return 1
-  return 0
+  if (a.atts == b.atts):
+    # No fixes necessary
+    return 0
+
+  # Fix a pre-WC-NG assumptions in our testsuite
+  if (b.atts == {'status': 'A ', 'wc_rev': '0'})     \
+     and (a.atts == {'status': 'A ', 'wc_rev': '-'}):
+    return 0
+  return 1
 
 
 # Internal utility used by most build_tree_from_foo() routines.
@@ -642,8 +667,7 @@ def compare_trees(label,
       raise SVNTypeMismatch
     # They're both directories.
     else:
-      # First, compare the directories' two hashes.
-      if (a.props != b.props) or (a.atts != b.atts):
+      if compare_dir_nodes(a, b):
         display_nodes(a, b)
         raise SVNTreeUnequal
 

Modified: subversion/trunk/subversion/tests/cmdline/upgrade_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/upgrade_tests.py?rev=1095384&r1=1095383&r2=1095384&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/upgrade_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/upgrade_tests.py Wed Apr 20 12:03:58 2011
@@ -601,19 +601,17 @@ def missing_dirs(sbox):
       'A'                 : Item(status='  ', wc_rev='1'),
       'A/mu'              : Item(status='  ', wc_rev='1'),
       'A/C'               : Item(status='  ', wc_rev='1'),
-      'A/D'               : Item(status='~ ', wc_rev='?'),
+      'A/D'               : Item(status='! ', wc_rev='-'),
       'A/B'               : Item(status='  ', wc_rev='1'),
       'A/B/F'             : Item(status='  ', wc_rev='1'),
-      'A/B/E'             : Item(status='! ', wc_rev='?'),
+      'A/B/E'             : Item(status='! ', wc_rev='-'),
       'A/B/lambda'        : Item(status='  ', wc_rev='1'),
       'iota'              : Item(status='  ', wc_rev='1'),
       'A/B_new'           : Item(status='A ', wc_rev='-', copied='+'),
-      'A/B_new/E'         : Item(status='! ', wc_rev='?'),
-      'A/B_new/F'         : Item(status='~ ', wc_rev='?'),
+      'A/B_new/E'         : Item(status='! ', wc_rev='-'),
+      'A/B_new/F'         : Item(status='! ', wc_rev='-'),
       'A/B_new/lambda'    : Item(status='  ', wc_rev='-', copied='+'),
     })
-  if svntest.main.wc_is_singledb(sbox.wc_dir):
-    expected_status.tweak('A/D', 'A/B_new/F', status='! ')
   run_and_verify_status_no_server(sbox.wc_dir, expected_status)
 
 def missing_dirs2(sbox):
@@ -633,19 +631,17 @@ def missing_dirs2(sbox):
       'A'                 : Item(status='  ', wc_rev='1'),
       'A/mu'              : Item(status='  ', wc_rev='1'),
       'A/C'               : Item(status='  ', wc_rev='1'),
-      'A/D'               : Item(status='~ ', wc_rev='?'),
+      'A/D'               : Item(status='! ', wc_rev='-'),
       'A/B'               : Item(status='  ', wc_rev='1'),
       'A/B/F'             : Item(status='  ', wc_rev='1'),
-      'A/B/E'             : Item(status='! ', wc_rev='?'),
+      'A/B/E'             : Item(status='! ', wc_rev='-'),
       'A/B/lambda'        : Item(status='  ', wc_rev='1'),
       'iota'              : Item(status='  ', wc_rev='1'),
       'A/B_new'           : Item(status='A ', wc_rev='-', copied='+'),
-      'A/B_new/E'         : Item(status='! ', wc_rev='?'),
-      'A/B_new/F'         : Item(status='~ ', wc_rev='?'),
+      'A/B_new/E'         : Item(status='! ', wc_rev='-'),
+      'A/B_new/F'         : Item(status='! ', wc_rev='-'),
       'A/B_new/lambda'    : Item(status='  ', wc_rev='-', copied='+'),
     })
-  if svntest.main.wc_is_singledb(sbox.wc_dir):
-    expected_status.tweak('A/D', 'A/B_new/F', status='! ')
   run_and_verify_status_no_server(sbox.wc_dir, expected_status)
 
 @XFail()
@@ -807,7 +803,7 @@ def replaced_files(sbox):
       'A/g' : Item(status='RM', wc_rev='5'),
       'B'   : Item(status='A ', wc_rev='-', copied='+'),
       'B/f' : Item(status='R ', wc_rev='-', copied='+'),
-      'B/g' : Item(status='RM', wc_rev='0'),
+      'B/g' : Item(status='RM', wc_rev='-'),
   })
   run_and_verify_status_no_server(sbox.wc_dir, expected_status)