Author: julianfoad
Date: Fri Sep  3 12:21:34 2010
New Revision: 992276

URL: http://svn.apache.org/viewvc?rev=992276&view=rev
Log:
Fix a bug introduced by incomplete transition to single-DB, and add a test
for it as it wasn't found by the test suite.

* subversion/libsvn_wc/update_editor.c
  (tweak_node): Assert that the caller didn't request the 'parent stub'.
  (tweak_entries): Don't special-case a call to tweak_node().
  (do_update_cleanup): Don't special-case a call to tweak_node().

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_temp_op_set_rev_and_repos_relpath): Note that the
    'update_stub' parameter should be removed.

* subversion/tests/cmdline/update_tests.py
  (update_with_excluded_subdir): New test.
  (test_list): Add the new test.

Modified:
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/tests/cmdline/update_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=992276&r1=992275&r2=992276&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Fri Sep  3 12:21:34 
2010
@@ -5361,6 +5361,8 @@ close_file(void *file_baton,
  * If ALLOW_REMOVAL is TRUE the tweaks might cause the node for
  * LOCAL_ABSPATH to be removed from the WC; if ALLOW_REMOVAL is FALSE this
  * will not happen.
+ *
+ * ### TODO(SINGLE_DB): Remove the 'parent_stub' argument.
  */
 static svn_error_t *
 tweak_node(svn_wc__db_t *db,
@@ -5381,6 +5383,10 @@ tweak_node(svn_wc__db_t *db,
   svn_boolean_t set_repos_relpath = FALSE;
   svn_error_t *err;
 
+#ifdef SVN_WC__SINGLE_DB
+  SVN_ERR_ASSERT(! parent_stub);
+#endif
+
   err = svn_wc__db_base_get_info(&status, &db_kind, &revision,
                                  &repos_relpath, &repos_root_url,
                                  &repos_uuid, NULL, NULL, NULL, NULL, NULL,
@@ -5534,14 +5540,14 @@ tweak_entries(svn_wc__db_t *db,
             || status == svn_wc__db_status_absent
             || status == svn_wc__db_status_excluded)
         {
-          
-
+#ifndef SVN_WC__SINGLE_DB
           if (kind == svn_wc__db_kind_dir)
             SVN_ERR(tweak_node(db, child_abspath, svn_wc__db_kind_dir, TRUE,
                                child_repos_relpath, new_repos_root_url,
                                new_repos_uuid, new_rev,
                                TRUE /* allow_removal */, iterpool));
           else
+#endif
             SVN_ERR(tweak_node(db, child_abspath, kind, FALSE,
                                child_repos_relpath, new_repos_root_url,
                                new_repos_uuid, new_rev,
@@ -5678,6 +5684,8 @@ do_update_cleanup(svn_wc__db_t *db,
       case svn_wc__db_status_absent:
       case svn_wc__db_status_not_present:
         return SVN_NO_ERROR;
+
+#ifndef SVN_WC__SINGLE_DB
       case svn_wc__db_status_obstructed:
       case svn_wc__db_status_obstructed_add:
       case svn_wc__db_status_obstructed_delete:
@@ -5688,6 +5696,7 @@ do_update_cleanup(svn_wc__db_t *db,
                            new_repos_uuid, new_revision,
                            FALSE /* allow_removal */, pool));
         return SVN_NO_ERROR;
+#endif
 
       /* Explicitly ignore other statii */
       default:

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=992276&r1=992275&r2=992276&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Fri Sep  3 12:21:34 2010
@@ -2445,6 +2445,8 @@ svn_wc__db_temp_set_parent_stub_to_norma
    LOCAL_ABSPATH's rev (REV) is valid, set is revision and if SET_REPOS_RELPATH
    is TRUE set its repository relative path to REPOS_RELPATH (and make sure its
    REPOS_ROOT_URL and REPOS_ROOT_UUID are still valid).
+
+   ### TODO(SINGLE_DB): Remove the 'update_stub' argument.
  */
 svn_error_t *
 svn_wc__db_temp_op_set_rev_and_repos_relpath(svn_wc__db_t *db,

Modified: subversion/trunk/subversion/tests/cmdline/update_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/update_tests.py?rev=992276&r1=992275&r2=992276&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/update_tests.py Fri Sep  3 
12:21:34 2010
@@ -5683,6 +5683,44 @@ def add_moved_file_has_props2(sbox):
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 
+# A regression test for a 1.7-dev crash upon updating a WC to a different
+# revision when it contained an excluded dir.
+def update_with_excluded_subdir(sbox):
+  """update with an excluded subdir"""
+  sbox.build()
+
+  wc_dir = sbox.wc_dir
+
+  G = os.path.join(os.path.join(wc_dir, 'A', 'D', 'G'))
+
+  # Make the directory 'G' excluded.
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/D/G' : Item(status='D '),
+    })
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.remove('A/D/G', 'A/D/G/pi', 'A/D/G/rho', 'A/D/G/tau')
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.remove('A/D/G', 'A/D/G/pi', 'A/D/G/rho', 'A/D/G/tau')
+  svntest.actions.run_and_verify_update(wc_dir, expected_output,
+                                        expected_disk, expected_status,
+                                        None, None, None, None, None, False,
+                                        '--set-depth=exclude', G)
+
+  # Commit a new revision so there is something to update to.
+  svntest.main.run_svn(None, 'mkdir', '-m', '', sbox.repo_url + '/New')
+
+  # Test updating the WC.
+  expected_output = svntest.wc.State(wc_dir, {
+    'New' : Item(status='A ') })
+  expected_disk.add({
+    'New' : Item() })
+  expected_status.add({
+    'New' : Item(status='  ') })
+  expected_status.tweak(wc_rev=2)
+  svntest.actions.run_and_verify_update(wc_dir, expected_output,
+                                        expected_disk, expected_status)
+
+
 #######################################################################
 # Run the tests
 
@@ -5753,6 +5791,7 @@ test_list = [ None,
               mergeinfo_updates_merge_with_local_mods,
               add_moved_file_has_props,
               XFail(add_moved_file_has_props2),
+              update_with_excluded_subdir,
              ]
 
 if __name__ == '__main__':


Reply via email to