Author: rhuijben
Date: Thu Feb 19 10:17:27 2015
New Revision: 1660828

URL: http://svn.apache.org/r1660828
Log:
Properly record upgrade copies of excluded nodes to the op-depth of
their parent node on upgrade.

This fixes a database inconsistency after upgrade_tests.py 22
"upgrade 1.6.x wc that has depth=exclude"
where an exclude was recorded as op-root.

I haven't tested this, but I think we would have tried to commit
the exclude as delete after upgrade without this patch.

* subversion/libsvn_wc/entries.c
  (write_entry): Handle excluded nodes as descendant instead of their
    own operation.

* subversion/tests/cmdline/depth_tests.py
  (commit_excluded): Add (unrelated) regression test on how an
    excluded directory should be handled over commits.
  (test_list): Add commit_excluded.

Modified:
    subversion/trunk/subversion/libsvn_wc/entries.c
    subversion/trunk/subversion/tests/cmdline/depth_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/entries.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=1660828&r1=1660827&r2=1660828&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.c (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.c Thu Feb 19 10:17:27 2015
@@ -2293,6 +2293,11 @@ write_entry(struct write_baton **entry_n
         {
           working_node->op_depth = parent_node->work->op_depth;
         }
+      else if (working_node->presence == svn_wc__db_status_excluded
+               && parent_node->work)
+        {
+          working_node->op_depth = parent_node->work->op_depth;
+        }
       else if (!entry->copied)
         {
           working_node->op_depth

Modified: subversion/trunk/subversion/tests/cmdline/depth_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/depth_tests.py?rev=1660828&r1=1660827&r2=1660828&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/depth_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/depth_tests.py Thu Feb 19 
10:17:27 2015
@@ -2886,6 +2886,82 @@ def spurious_nodes_row(sbox):
     # ra_neon added a spurious not-present row that does not show up in status
     raise svntest.Failure("count changed from '%s' to '%s'" % (val1, val2))
 
+def commit_excluded(sbox):
+  "commit an excluded node"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/D/G' : Item(status='D '),
+  })
+  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,
+                                        None,
+                                        expected_status,
+                                        None, None, None, None, None, False,
+                                        "--set-depth=exclude",
+                                        sbox.ospath('A/D/G'))
+
+  sbox.simple_copy('A/D', 'D')
+
+  expected_output = svntest.wc.State(wc_dir, {
+    'D' : Item(verb='Adding'),
+  })
+  
+  expected_status.add({
+    'D'          : Item(status='  ', wc_rev='2'),
+    'D/H'        : Item(status='  ', wc_rev='2'),
+    'D/H/chi'    : Item(status='  ', wc_rev='2'),
+    'D/H/psi'    : Item(status='  ', wc_rev='2'),
+    'D/H/omega'  : Item(status='  ', wc_rev='2'),
+    'D/gamma'    : Item(status='  ', wc_rev='2')
+  })
+
+  svntest.actions.run_and_verify_commit(wc_dir,
+                                        expected_output,
+                                        expected_status,
+                                        None, wc_dir)
+
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/D/G'     : Item(status='A '),
+    'A/D/G/pi'  : Item(status='A '),
+    'A/D/G/tau' : Item(status='A '),
+    'A/D/G/rho' : Item(status='A '),
+    'D/G'       : Item(status='A '),
+    'D/G/pi'    : Item(status='A '),
+    'D/G/tau'   : Item(status='A '),
+    'D/G/rho'   : Item(status='A ')
+  })
+
+  expected_status.tweak(wc_rev=2)
+
+  expected_status.add({
+    'D'         : Item(status='  ', wc_rev='2'),
+    'D/G'       : Item(status='  ', wc_rev='2'),
+    'D/G/pi'    : Item(status='  ', wc_rev='2'),
+    'D/G/rho'   : Item(status='  ', wc_rev='2'),
+    'D/G/tau'   : Item(status='  ', wc_rev='2'),
+    'D/H'       : Item(status='  ', wc_rev='2'),
+    'D/H/chi'   : Item(status='  ', wc_rev='2'),
+    'D/H/psi'   : Item(status='  ', wc_rev='2'),
+    'D/H/omega' : Item(status='  ', wc_rev='2'),
+    'D/gamma'   : Item(status='  ', wc_rev='2'),
+    'A/D/G'     : Item(status='  ', wc_rev='2'),
+    'A/D/G/rho' : Item(status='  ', wc_rev='2'),
+    'A/D/G/tau' : Item(status='  ', wc_rev='2'),
+    'A/D/G/pi'  : Item(status='  ', wc_rev='2')
+  })
+
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output,
+                                        None,
+                                        expected_status,
+                                        None, None, None, None, None, False,
+                                        "--set-depth=infinity", wc_dir)
 
 #----------------------------------------------------------------------
 # list all tests here, starting with None:
@@ -2937,6 +3013,7 @@ test_list = [ None,
               commit_then_immediates_update,
               revert_depth_files,
               spurious_nodes_row,
+              commit_excluded,
               ]
 
 if __name__ == "__main__":


Reply via email to