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/12 15:25:24 UTC

svn commit: r1091399 - in /subversion/trunk/subversion: libsvn_wc/node.c libsvn_wc/wc_db.c libsvn_wc/wc_db.h tests/cmdline/checkout_tests.py tests/cmdline/commit_tests.py tests/cmdline/switch_tests.py tests/cmdline/update_tests.py

Author: rhuijben
Date: Tue Apr 12 13:25:23 2011
New Revision: 1091399

URL: http://svn.apache.org/viewvc?rev=1091399&view=rev
Log:
Properly calculate the replacement and added schedule for status by looking
at the tree immediately below the added node, instead of directly in the
base tree. This fixes the replacement reporting of mixed-revision and switched
copies which are really multiple operations.

* subversion/libsvn_wc/node.c
  (svn_wc__internal_node_get_schedule): Use a wc_db helper to look under the
    current node.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_temp_below_work): Rename to ...
  (svn_wc__db_info_below_working): ... this to match the implementation
    and to show that we can't just call it a temp function. Pass all the
    arguments to the implementation.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_temp_below_work): Rename to ...
  (svn_wc__db_info_below_working): ... this.

* subversion/tests/cmdline/checkout_tests.py
  (co_with_obstructing_local_adds): Expect the mixed rev op_root to be shown
     as addition.

* subversion/tests/cmdline/commit_tests.py
  (nested_dir_replacements): Assume that an addition below a copy is not
     reported as a replacement of BASE.

* subversion/tests/cmdline/switch_tests.py
  (switch_with_obstructing_local_adds): Update expected result.
  (copy_with_switched_subdir): Update expected result. Remove hack that
    should have been an indication that something was wrong.

* subversion/tests/cmdline/update_tests.py
  (update_with_obstructing_additions): Expect mixed revision op_root.

Modified:
    subversion/trunk/subversion/libsvn_wc/node.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/tests/cmdline/checkout_tests.py
    subversion/trunk/subversion/tests/cmdline/commit_tests.py
    subversion/trunk/subversion/tests/cmdline/switch_tests.py
    subversion/trunk/subversion/tests/cmdline/update_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1091399&r1=1091398&r2=1091399&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Tue Apr 12 13:25:23 2011
@@ -1288,26 +1288,12 @@ svn_wc__internal_node_get_schedule(svn_w
       case svn_wc__db_status_added:
         {
           const char *op_root_abspath;
-          const char *parent_abspath;
-          const char *parent_copyfrom_relpath;
-          const char *child_name;
 
-          if (schedule)
-            *schedule = svn_wc_schedule_add;
-
-          if (copyfrom_relpath != NULL)
-            {
-              status = svn_wc__db_status_copied; /* Or moved */
-              op_root_abspath = local_abspath;
-            }
-          else
-            SVN_ERR(svn_wc__db_scan_addition(&status,
-                                             &op_root_abspath,
-                                             NULL, NULL, NULL,
-                                             &copyfrom_relpath,
-                                             NULL, NULL, NULL,
-                                             db, local_abspath,
-                                             scratch_pool, scratch_pool));
+          SVN_ERR(svn_wc__db_scan_addition(&status, &op_root_abspath,
+                                           NULL, NULL, NULL, NULL,
+                                           NULL, NULL, NULL,
+                                           db, local_abspath,
+                                           scratch_pool, scratch_pool));
 
           if (copied && status != svn_wc__db_status_added)
             *copied = TRUE;
@@ -1315,89 +1301,32 @@ svn_wc__internal_node_get_schedule(svn_w
           if (!schedule)
             break;
 
-          if (has_base)
-            {
-              svn_wc__db_status_t base_status;
-              SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL, NULL, NULL,
-                                               NULL, NULL, NULL, NULL, NULL,
-                                               NULL, NULL, NULL, NULL, NULL,
-                                               NULL, NULL,
-                                               db, local_abspath,
-                                               scratch_pool, scratch_pool));
-
-              if (base_status != svn_wc__db_status_not_present)
-                *schedule = svn_wc_schedule_replace;
-            }
-          else
-            {
-              svn_boolean_t below_work;
-
-              SVN_ERR(svn_wc__db_temp_below_work(&below_work,
-                                                 db, local_abspath,
-                                                 scratch_pool));
-              /* Unlike base nodes above, not-present is considered a
-                 replace since working not-present represents a delete
-                 to be committed */
-              if (below_work)
-                *schedule = svn_wc_schedule_replace;
-            }
-
-          if (status == svn_wc__db_status_added)
-            break; /* Local addition */
+          *schedule = svn_wc_schedule_add;
 
-          /* Determine the parent status to check if we should show the
-             schedule of a child of a copy as normal. */
-          if (strcmp(op_root_abspath, local_abspath) != 0)
+          /* If this node is the op-root check for replaced */
+          if (status == svn_wc__db_status_added
+              || strcmp(op_root_abspath, local_abspath) == 0)
             {
-              *schedule = svn_wc_schedule_normal;
-              break; /* Part of parent copy */
-            }
-
-          /* When we used entries we didn't see just a different revision
-             as a new operational root, so we have to check if the parent
-             is from the same copy origin */
-          parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
-
-          SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL, NULL,
-                                       NULL, NULL, NULL,
-                                       &parent_copyfrom_relpath, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL, NULL,
-                                       db, parent_abspath,
-                                       scratch_pool, scratch_pool));
-
-          if (status != svn_wc__db_status_added)
-            break; /* Parent was not added */
-
-          if (!parent_copyfrom_relpath)
-            {
-              SVN_ERR(svn_wc__db_scan_addition(&status, &op_root_abspath, NULL,
-                                               NULL, NULL,
-                                               &parent_copyfrom_relpath, NULL,
-                                               NULL, NULL,
-                                               db, parent_abspath,
-                                               scratch_pool, scratch_pool));
-
-              if (!parent_copyfrom_relpath)
-                break; /* Parent is a local addition */
+              svn_boolean_t have_base, have_work;
+              svn_wc__db_status_t below_working;
+              SVN_ERR(svn_wc__db_info_below_working(&have_base, &have_work,
+                                                    &below_working,
+                                                    db, local_abspath,
+                                                    scratch_pool));
 
-              parent_copyfrom_relpath = svn_relpath_join(
-                                           parent_copyfrom_relpath,
-                                           svn_dirent_is_child(op_root_abspath,
-                                                               parent_abspath,
-                                                               NULL),
-                                           scratch_pool);
+              /* If the node is not present or deleted (read: not present
+                 in working), then the node is not a replacement */
+              if ((have_work || have_base)
+                  && below_working != svn_wc__db_status_not_present
+                  && below_working != svn_wc__db_status_deleted)
+                {
+                  *schedule = svn_wc_schedule_replace;
+                  break;
+                }
             }
+          else
+            *schedule = svn_wc_schedule_normal;
 
-
-          child_name = svn_relpath_is_child(parent_copyfrom_relpath,
-                                            copyfrom_relpath, NULL);
-
-          if (!child_name
-              || strcmp(child_name, svn_dirent_basename(local_abspath, NULL)))
-            break; /* Different operation */
-
-          *schedule = svn_wc_schedule_normal;
           break;
         }
       default:

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1091399&r1=1091398&r2=1091399&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Apr 12 13:25:23 2011
@@ -10146,13 +10146,13 @@ svn_wc__db_temp_op_set_new_dir_to_incomp
 
 
 svn_error_t *
-svn_wc__db_temp_below_work(svn_boolean_t *have_work,
-                           svn_wc__db_t *db,
-                           const char *local_abspath,
-                           apr_pool_t *scratch_pool)
+svn_wc__db_info_below_working(svn_boolean_t *have_base,
+                              svn_boolean_t *have_work,
+                              svn_wc__db_status_t *status,
+                              svn_wc__db_t *db,
+                              const char *local_abspath,
+                              apr_pool_t *scratch_pool)
 {
-  svn_boolean_t have_base;
-  svn_wc__db_status_t status;
   svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
 
@@ -10161,7 +10161,7 @@ svn_wc__db_temp_below_work(svn_boolean_t
   SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, scratch_pool, scratch_pool));
   VERIFY_USABLE_WCROOT(wcroot);
-  SVN_ERR(info_below_working(&have_base, have_work, &status,
+  SVN_ERR(info_below_working(have_base, have_work, status,
                              wcroot, local_relpath, scratch_pool));
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1091399&r1=1091398&r2=1091399&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue Apr 12 13:25:23 2011
@@ -2608,12 +2608,16 @@ svn_wc__db_drop_root(svn_wc__db_t *db,
 /* Return the OP_DEPTH for LOCAL_RELPATH. */
 int svn_wc__db_op_depth_for_upgrade(const char *local_relpath);
 
-/* Set *HAVE_WORK TRUE if there is a working layer below the top layer */
-svn_error_t *
-svn_wc__db_temp_below_work(svn_boolean_t *have_work,
-                           svn_wc__db_t *db,
-                           const char *local_abspath,
-                           apr_pool_t *scratch_pool);
+/* Set *HAVE_WORK TRUE if there is a working layer below the top layer and
+   *HAVE_BASE if there is a base layer. Set *STATUS to the status of the
+   highest layer below WORKING */
+svn_error_t *
+svn_wc__db_info_below_working(svn_boolean_t *have_base,
+                              svn_boolean_t *have_work,
+                              svn_wc__db_status_t *status,
+                              svn_wc__db_t *db,
+                              const char *local_abspath,
+                              apr_pool_t *scratch_pool);
 
 
 /* Gather revision status information about a working copy using DB.

Modified: subversion/trunk/subversion/tests/cmdline/checkout_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/checkout_tests.py?rev=1091399&r1=1091398&r2=1091399&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/checkout_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/checkout_tests.py Tue Apr 12 13:25:23 2011
@@ -919,7 +919,8 @@ def co_with_obstructing_local_adds(sbox)
     'A/D/M/psi'     : Item(status='  ', copied='+', wc_rev='-'),
     'A/D/M/chi'     : Item(status='  ', copied='+', wc_rev='-'),
     'A/D/M/omega'   : Item(status='  ', copied='+', wc_rev='-'),
-    'A/D/M/I'       : Item(status='  ', copied='+', wc_rev='-'),
+    'A/D/M/I'       : Item(status='A ', copied='+', wc_rev='-',
+                           entry_status='  '), # A/D/MI is a new op_root
     'A/D/M/I/J'     : Item(status='  ', copied='+', wc_rev='-'),
     'A/D/M/I/K'     : Item(status='  ', copied='+', wc_rev='-'),
     'A/D/M/I/K/xi'  : Item(status='  ', copied='+', wc_rev='-'),

Modified: subversion/trunk/subversion/tests/cmdline/commit_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/commit_tests.py?rev=1091399&r1=1091398&r2=1091399&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/commit_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/commit_tests.py Tue Apr 12 13:25:23 2011
@@ -477,9 +477,12 @@ def nested_dir_replacements(sbox):
 
   # Verify pre-commit status:
   #
-  #    - A/D and A/D/H should both be scheduled as "R" at rev 1
+  #    - A/D should both be scheduled as addition, A/D as "R" at rev 1
   #         (rev 1 because they both existed before at rev 1)
   #
+  #    - A/D/H should be a local addition "A"
+  #         (and exists as shadowed node in BASE)
+  #         
   #    - A/D/bloo scheduled as "A" at rev 0
   #         (rev 0 because it did not exist before)
   #
@@ -487,6 +490,9 @@ def nested_dir_replacements(sbox):
 
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.tweak('A/D', 'A/D/H', 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.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=1091399&r1=1091398&r2=1091399&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/switch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/switch_tests.py Tue Apr 12 13:25:23 2011
@@ -1693,8 +1693,8 @@ 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='R ', wc_rev='1'),
-    'A/B/F/G/tau'     : Item(status='R ', 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/rho'     : Item(status='D ', wc_rev='1'),
     'A/B/F/H'         : Item(status='  ', wc_rev='1'),
@@ -3119,7 +3119,7 @@ def copy_with_switched_subdir(sbox):
     'R/H/chi'   : Item(status='  ', copied='+', wc_rev='-'),
     'R/H/omega' : Item(status='  ', copied='+', wc_rev='-'),
     'R/H/psi'   : Item(status='  ', copied='+', wc_rev='-'),
-    'R/G'       : Item(status='R ', copied='+', wc_rev='-', entry_status='A '),
+    'R/G'       : Item(status='A ', copied='+', wc_rev='-'),
     })
 
   svntest.actions.run_and_verify_status(wc_dir, state)

Modified: subversion/trunk/subversion/tests/cmdline/update_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/update_tests.py?rev=1091399&r1=1091398&r2=1091399&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/update_tests.py Tue Apr 12 13:25:23 2011
@@ -2906,7 +2906,8 @@ def update_with_obstructing_additions(sb
     'A/D/H/I/L'     : Item(status='  ', wc_rev=4),
     'A/M'           : Item(status='R ', copied='+', wc_rev='-',
                            treeconflict='C'),
-    'A/M/I'         : Item(status='  ', copied='+', wc_rev='-'),
+    'A/M/I'         : Item(status='A ', copied='+', wc_rev='-',
+                           entry_status='  '), # New op_root
     'A/M/I/J'       : Item(status='  ', copied='+', wc_rev='-'),
     'A/M/I/J/eta'   : Item(status='  ', copied='+', wc_rev='-'),
     'A/M/I/K'       : Item(status='  ', copied='+', wc_rev='-'),