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 15:11:35 UTC

svn commit: r1095399 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_wc/node.c svn/status-cmd.c tests/cmdline/commit_tests.py tests/cmdline/switch_tests.py

Author: rhuijben
Date: Wed Apr 20 13:11:35 2011
New Revision: 1095399

URL: http://svn.apache.org/viewvc?rev=1095399&view=rev
Log:
Reduce the number of cases where svn overlays the output of the status
api to just replacements and deletions.

* subversion/include/private/svn_wc_private.h
  (svn_wc__node_get_working_rev_info): Rename to ...
  (svn_wc__node_get_pre_ng_status_data): ... this to show that it is only
    used for status compatibility.

* subversion/libsvn_wc/node.c
  (svn_wc__node_get_working_rev_info): Rename to ...
  (svn_wc__node_get_pre_ng_status_data): ... this to show that it is only
    used for status compatibility. Simplify code to just work as fast as
    possible on the statee where we use it for.

* subversion/svn/status-cmd.c
  (print_status): Make it explicit what we override in which case. Don't
    hide last modified information from copy-replacements. Update caller.

* subversion/tests/cmdline/commit_tests.py
  (nested_dir_replacements): Simple additions (shadowing other layers)
    shouldn't report r1.
  (switch_with_obstructing_local_adds): Local adds with somewhere deep
    below a BASE layer shouldn't report the BASE layer revision.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_wc/node.c
    subversion/trunk/subversion/svn/status-cmd.c
    subversion/trunk/subversion/tests/cmdline/commit_tests.py
    subversion/trunk/subversion/tests/cmdline/switch_tests.py

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1095399&r1=1095398&r2=1095399&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Wed Apr 20 13:11:35 2011
@@ -531,14 +531,14 @@ svn_wc__node_get_base_rev(svn_revnum_t *
  * changed_rev.
  */
 svn_error_t *
-svn_wc__node_get_working_rev_info(svn_revnum_t *revision,
-                                  svn_revnum_t *changed_rev,
-                                  apr_time_t *changed_date,
-                                  const char **changed_author,
-                                  svn_wc_context_t *wc_ctx,
-                                  const char *local_abspath,
-                                  apr_pool_t *result_pool,
-                                  apr_pool_t *scratch_pool);
+svn_wc__node_get_pre_ng_status_data(svn_revnum_t *revision,
+                                    svn_revnum_t *changed_rev,
+                                    apr_time_t *changed_date,
+                                    const char **changed_author,
+                                    svn_wc_context_t *wc_ctx,
+                                    const char *local_abspath,
+                                    apr_pool_t *result_pool,
+                                    apr_pool_t *scratch_pool);
 
 
 /** This whole function is for legacy, and it sucks. It does not really

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1095399&r1=1095398&r2=1095399&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Wed Apr 20 13:11:35 2011
@@ -922,81 +922,50 @@ svn_wc__node_get_base_rev(svn_revnum_t *
 }
 
 svn_error_t *
-svn_wc__node_get_working_rev_info(svn_revnum_t *revision,
-                                  svn_revnum_t *changed_rev,
-                                  apr_time_t *changed_date,
-                                  const char **changed_author,
-                                  svn_wc_context_t *wc_ctx,
-                                  const char *local_abspath,
-                                  apr_pool_t *result_pool,
-                                  apr_pool_t *scratch_pool)
+svn_wc__node_get_pre_ng_status_data(svn_revnum_t *revision,
+                                   svn_revnum_t *changed_rev,
+                                   apr_time_t *changed_date,
+                                   const char **changed_author,
+                                   svn_wc_context_t *wc_ctx,
+                                   const char *local_abspath,
+                                   apr_pool_t *result_pool,
+                                   apr_pool_t *scratch_pool)
 {
   svn_wc__db_status_t status;
-  svn_boolean_t have_base;
+  svn_boolean_t have_base, have_more_work, have_work;
 
   SVN_ERR(svn_wc__db_read_info(&status, NULL, revision, NULL, NULL, NULL,
                                changed_rev, changed_date, changed_author,
                                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               &have_base, NULL, NULL,
-                               wc_ctx->db, local_abspath, result_pool,
-                               scratch_pool));
-
-  if (SVN_IS_VALID_REVNUM(*changed_rev) && SVN_IS_VALID_REVNUM(*revision))
-    return SVN_NO_ERROR; /* We got everything we need */
+                               &have_base, &have_more_work, &have_work,
+                               wc_ctx->db, local_abspath,
+                               result_pool, scratch_pool));
 
-  if (status == svn_wc__db_status_deleted)
+  if (!have_work
+      || (!changed_rev || SVN_IS_VALID_REVNUM(*changed_rev)
+          && !revision || SVN_IS_VALID_REVNUM(*revision))
+      || ((status != svn_wc__db_status_added)
+          && (status != svn_wc__db_status_deleted)))
+    {
+      return SVN_NO_ERROR; /* We got everything we need */
+    }
+
+  if (have_base && !have_more_work)
+    SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, revision, NULL, NULL, NULL,
+                                     changed_rev, changed_date, changed_author,
+                                     NULL, NULL, NULL, NULL, NULL, NULL,
+                                     NULL, NULL, NULL,
+                                     wc_ctx->db, local_abspath,
+                                     result_pool, scratch_pool));
+  else
     {
-      const char *work_del_abspath;
-      const char *base_del_abspath;
+      /* Sorry, we need a function to peek below the current working and
+         the BASE layer. And we don't have one yet.
 
-      SVN_ERR(svn_wc__db_scan_deletion(&base_del_abspath, NULL,
-                                       &work_del_abspath, wc_ctx->db,
-                                       local_abspath, scratch_pool,
-                                       scratch_pool));
-      if (work_del_abspath)
-        {
-          /* ### This is not going to return any useful data
-             ### We need to look one layer down */
-          SVN_ERR(svn_wc__db_read_info(&status, NULL, revision, NULL, NULL,
-                                       NULL, changed_rev, changed_date,
-                                       changed_author, NULL, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL, NULL,
-                                       NULL, NULL, NULL,
-                                       wc_ctx->db, work_del_abspath,
-                                       result_pool, scratch_pool));
-        }
-      else
-        {
-          SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, revision, NULL,
-                                           NULL, NULL, changed_rev,
-                                           changed_date, changed_author,
-                                           NULL, NULL, NULL, NULL, NULL,
-                                           NULL, NULL, NULL, NULL,
-                                           wc_ctx->db, base_del_abspath,
-                                           result_pool, scratch_pool));
-        }
+         ### Better to report nothing, than the wrong information */
     }
-  else if (have_base)
-    {
-      svn_wc__db_status_t base_status;
-      svn_revnum_t base_rev;
-      SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL, &base_rev, NULL, NULL,
-                                       NULL, changed_rev, changed_date,
-                                       changed_author, NULL, NULL, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL,
-                                       wc_ctx->db, local_abspath,
-                                       result_pool, scratch_pool));
 
-      if (revision && !SVN_IS_VALID_REVNUM(*revision)
-          && base_status != svn_wc__db_status_not_present)
-        {
-          /* When we used entries we reset the revision to 0 when we added a new
-             node over an existing not present node */
-          *revision = base_rev;
-        }
-    }
   return SVN_NO_ERROR;
 }
 

Modified: subversion/trunk/subversion/svn/status-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status-cmd.c?rev=1095399&r1=1095398&r2=1095399&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/status-cmd.c (original)
+++ subversion/trunk/subversion/svn/status-cmd.c Wed Apr 20 13:11:35 2011
@@ -181,21 +181,42 @@ print_status(void *baton,
    * ### with our testsuite. */
   if (status->versioned
       && !SVN_IS_VALID_REVNUM(status->revision)
-      && !status->copied)
+      && !status->copied
+      && (status->node_status == svn_wc_status_deleted
+          || status->node_status == svn_wc_status_replaced))
     {
-      svn_client_status_t *tweaked_status
-                 = svn_client_status_dup(status, sb->cl_pool);
+      svn_client_status_t *twks = svn_client_status_dup(status, sb->cl_pool);
 
-      /* Retrieve some data from the original version of the replaced node */
-      SVN_ERR(svn_wc__node_get_working_rev_info(&tweaked_status->revision,
-                                                &tweaked_status->changed_rev,
-                                                &tweaked_status->changed_date,
-                                                &tweaked_status->changed_author,
-                                                sb->ctx->wc_ctx,
-                                                local_abspath, sb->cl_pool,
-                                                pool));
+      /* Copied is FALSE, so either we have a local addition, or we have
+         a delete that directly shadows a BASE node */
 
-      status = tweaked_status;
+      switch(status->node_status)
+        {
+          case svn_wc_status_replaced:
+            /* Just retrieve the revision below the replacement.
+               The other fields are filled by a copy.
+               (With ! copied, we know we have a BASE node)
+
+               ### Is this really what we want to provide? */
+            SVN_ERR(svn_wc__node_get_pre_ng_status_data(&twks->revision,
+                                                        NULL, NULL, NULL,
+                                                        sb->ctx->wc_ctx,
+                                                        local_abspath,
+                                                        sb->cl_pool, pool));
+            break;
+          case svn_wc_status_deleted:
+            /* Retrieve some data from the original version below the delete */
+            SVN_ERR(svn_wc__node_get_pre_ng_status_data(&twks->revision,
+                                                        &twks->changed_rev,
+                                                        &twks->changed_date,
+                                                        &twks->changed_author,
+                                                        sb->ctx->wc_ctx,
+                                                        local_abspath, 
+                                                        sb->cl_pool, pool));
+            break;
+        }
+
+      status = twks;
     }
 
   /* If the path is part of a changelist, then we don't print

Modified: subversion/trunk/subversion/tests/cmdline/commit_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/commit_tests.py?rev=1095399&r1=1095398&r2=1095399&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/commit_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/commit_tests.py Wed Apr 20 13:11:35 2011
@@ -489,10 +489,11 @@ def nested_dir_replacements(sbox):
   #    - ALL other children of A/D scheduled as "D" at rev 1
 
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.tweak('A/D', 'A/D/H', status='R ', wc_rev=1)
+  expected_status.tweak('A/D', status='R ', wc_rev=1)
   # In the entries world we couldn't represent H properly, so it shows
   # A/D/H as a replacement against BASE
-  expected_status.tweak('A/D/H', status='A ', wc_rev=1, entry_status='R ')
+  expected_status.tweak('A/D/H', status='A ', wc_rev='-',
+                                 entry_status='R ', entry_rev='1')
   expected_status.add({
     'A/D/bloo' : Item(status='A ', wc_rev=0),
     })

Modified: subversion/trunk/subversion/tests/cmdline/switch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/switch_tests.py?rev=1095399&r1=1095398&r2=1095399&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/switch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/switch_tests.py Wed Apr 20 13:11:35 2011
@@ -1693,15 +1693,15 @@ def switch_with_obstructing_local_adds(s
   expected_status.add({
     'A/B/F/gamma'     : Item(status='R ', treeconflict='C', wc_rev='1'),
     'A/B/F/G'         : Item(status='R ', treeconflict='C', wc_rev='1'),
-    'A/B/F/G/pi'      : Item(status='A ', wc_rev='1'),
-    'A/B/F/G/tau'     : Item(status='A ', wc_rev='1'),
-    'A/B/F/G/upsilon' : Item(status='A ', wc_rev='0'),
+    'A/B/F/G/pi'      : Item(status='A ', wc_rev='-'),
+    'A/B/F/G/tau'     : Item(status='A ', wc_rev='-'),
+    'A/B/F/G/upsilon' : Item(status='A ', wc_rev='-'),
     'A/B/F/G/rho'     : Item(status='D ', wc_rev='1'),
     'A/B/F/H'         : Item(status='  ', wc_rev='1'),
     'A/B/F/H/chi'     : Item(status='  ', wc_rev='1'),
     'A/B/F/H/omega'   : Item(status='  ', wc_rev='1'),
     'A/B/F/H/psi'     : Item(status='  ', wc_rev='1'),
-    'A/B/F/I'         : Item(status='A ', wc_rev='0'),
+    'A/B/F/I'         : Item(status='A ', wc_rev='-'),
   })
 
   # "Extra" files that we expect to result from the conflicts.