-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bert Huijben wrote:
[..]
> In entries we have two storage locations: On the parent entries file and on
> the entries file of the directory itself.
> 
> For the depth argument the parent can only contain exclude and infinity. The
> more detailed statuses are in the second location.
> 
> So this part is not necessary and likely to break old code relying on depth
> stored in entries. (WC-NG stores excluded as a separate status).
> 
>>    /* ### setting depth exclude on a wcroot breaks svn_wc_crop() */
>> Index: subversion/libsvn_wc/wc_db.c
>> ===================================================================
>> --- subversion/libsvn_wc/wc_db.c     (revision 893084)
>> +++ subversion/libsvn_wc/wc_db.c     (working copy)
>> @@ -3120,9 +3120,6 @@
>>        if (flush_entry_cache)
>>          flush_entries(pdh);
>>  
>> -      depth = (depth == svn_depth_exclude) ? svn_depth_exclude
>> -                                           : svn_depth_infinity;
>> -
>>        VERIFY_USABLE_PDH(pdh);
>>        wcroot = pdh->wcroot;
>>        sdb = wcroot->sdb;
> 
> This code does the same thing on the WC-NG level. It updates the parent
> data, which in this case should only contain infinity, as with excluded the
> depth would be NULL.

Thank you Philip/Bert for the feedback. Attaching an updated patch
herewith as per Bert's comments.

[[[
Log:
Make `--set-depth (empty|files|immediates) DIR' work, where DIR's depth
had already been set as `exclude'. Only `infinity' works as of now.
Adding a test for the same.

* subversion/libsvn_wc/crop.c
  (svn_wc_crop_tree2): Check the 'base status' of the node here and
   remove the check done using `svn_wc__db_node_hidden()' as it
   marks  a node as 'hidden' if status is set as
   `svn_wc__db_status_excluded'.

* subversion/libsvn_wc/update_editor.c
  (complete_directory): Call `svn_wc__set_depth' with the requested
   depth rather than `infinity' by default.

* subversion/tests/cmdline/depth_tests.py
  (update_excluded_path_sticky_depths): New test.

  (info_excluded): Remove the locally imported module `re' and make it
   globally available.

Suggested by: rhuijben
Patch by: Kannan R <kann...@collab.net>
]]]

- --
Thanks & Regards,
Kannan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEVAwUBS0S5GXlTqcY7ytmIAQIgOwf/aNtDA8BZPoEWJ4aOYH11Rvlp4/Inojoj
dj1JXO/6S0xcRQQ067pFpmiFyJuoVrYdndIcTurW1z7A+V7+yZ1vr3+2lI6FXnp/
AyAuOMr1n1qOJ1ttPAR9lAjOXMe76EXNig6NdOF9U5FxAedWwIv+XYLoQdAjETmy
yDLK/E5FPt0UIhWfn4S2gGGW1rKlfV1mne4L5Yp0itUZ4A81yjD1Y0KUCV0cH48b
Tf+mv1Tae1LBLTGq/IVl5Flf1WA/Cqsx7McGUVr/1VlShMb+WtSOeoTcLkL/TjDf
aptuyCKdwCQfpRH1XW6HqFKAu+Dl7bhmd0DBzD35VgETb9veK6Pdew==
=FpYH
-----END PGP SIGNATURE-----
Index: subversion/libsvn_wc/crop.c
===================================================================
--- subversion/libsvn_wc/crop.c	(revision 896322)
+++ subversion/libsvn_wc/crop.c	(working copy)
@@ -335,17 +335,6 @@
       _("Can only crop a working copy with a restrictive depth"));
 
   {
-    svn_boolean_t hidden;
-    SVN_ERR(svn_wc__db_node_hidden(&hidden, db, local_abspath, scratch_pool));
-
-    if (hidden)
-      return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
-                               _("The node '%s' was not found."),
-                               svn_dirent_local_style(local_abspath,
-                                                      scratch_pool));
-  }
-
-  {
     svn_wc__db_status_t status;
     svn_wc__db_kind_t kind;
 
@@ -360,6 +349,13 @@
       return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
         _("Can only crop directories"));
 
+    if (status == svn_wc__db_status_not_present
+        || status == svn_wc__db_status_absent)
+      return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+                               _("The node '%s' was not found."),
+                               svn_dirent_local_style(local_abspath,
+                                                      scratch_pool));
+
     if (status == svn_wc__db_status_deleted ||
         status == svn_wc__db_status_obstructed_delete)
       return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
Index: subversion/libsvn_wc/update_editor.c
===================================================================
--- subversion/libsvn_wc/update_editor.c	(revision 896322)
+++ subversion/libsvn_wc/update_editor.c	(working copy)
@@ -706,7 +706,7 @@
           else
             {
               SVN_ERR(svn_wc__set_depth(eb->db, eb->target_abspath,
-                                        svn_depth_infinity, pool));
+                                        eb->requested_depth, pool));
             }
         }
 
Index: subversion/tests/cmdline/depth_tests.py
===================================================================
--- subversion/tests/cmdline/depth_tests.py	(revision 896322)
+++ subversion/tests/cmdline/depth_tests.py	(working copy)
@@ -28,6 +28,7 @@
 
 # General modules
 import os
+import re
 
 # Our testing module
 import svntest
@@ -2342,7 +2343,6 @@
   A_path = os.path.join(wc_dir, 'A')
   svntest.main.run_svn(None, 'up', '--set-depth', 'exclude', A_path)
 
-  import re
   expected_info = {
       'Path' : re.escape(A_path),
       'Repository Root' : sbox.repo_url,
@@ -2502,7 +2502,162 @@
 
   svntest.actions.run_and_verify_resolved([m, B, g], '--depth=infinity', A)
 
+def update_excluded_path_sticky_depths(sbox):
+  """test update on excluded path to all depths"""
 
+  ign_a, ign_b, ign_c, wc_dir = set_up_depthy_working_copies(sbox,
+                                                             infinity=True)
+  A_path = os.path.join(wc_dir, 'A')
+  B_path = os.path.join(A_path, 'B')
+
+  # Exclude the subtree 'A/B'
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/B'            : Item(status='D '),
+    })
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.remove('A/B/lambda', 'A/B/E/alpha', 'A/B/E/beta', 'A/B/E',
+                         'A/B/F', 'A/B')
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.remove('A/B/lambda', 'A/B/E/alpha', 'A/B/E/beta', 'A/B/E',
+                       'A/B/F', 'A/B')
+
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output,
+                                        expected_disk,
+                                        expected_status,
+                                        None, None,
+                                        None, None, None, None,
+                                        '--set-depth', 'exclude', B_path)
+
+  # Update to depth 'empty' for the excluded path A/B
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/B'         : Item(status='A '),
+    })
+  expected_status.add({
+    'A/B'         : Item(status='  ', wc_rev=1)
+    })
+  expected_disk.add({
+    'A/B'         : Item(contents=None),
+    })
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output,
+                                        expected_disk,
+                                        expected_status,
+                                        None, None,
+                                        None, None, None, None,
+                                        '--set-depth', 'empty', B_path)
+  verify_depth(None, "empty", B_path)
+  expected_info = {
+      'Path' : re.escape(B_path),
+      'Repository Root' : sbox.repo_url,
+      'Repository UUID' : svntest.actions.get_wc_uuid(wc_dir),
+      'Depth' : 'empty',
+  }
+  svntest.actions.run_and_verify_info([expected_info], B_path)
+
+  # Exclude A/B again
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'up', '--set-depth', 'exclude', B_path)
+
+  # Update to depth 'files' for the excluded path A/B
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/B'              : Item(status='A '),
+    'A/B/lambda'       : Item(status='A '),
+    })
+  expected_status.add({
+    'A/B'              : Item(status='  ', wc_rev=1),
+    'A/B/lambda'       : Item(status='  ', wc_rev=1),
+    })
+  expected_disk.add({
+    'A/B'            : Item(contents=None),
+    'A/B/lambda'     : Item(contents="This is the file 'lambda'.\n"),
+    })
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output,
+                                        expected_disk,
+                                        expected_status,
+                                        None, None,
+                                        None, None, None, None,
+                                        '--set-depth', 'files', B_path)
+  verify_depth(None, "files", B_path)
+  expected_info = {
+      'Path' : re.escape(B_path),
+      'Repository Root' : sbox.repo_url,
+      'Repository UUID' : svntest.actions.get_wc_uuid(wc_dir),
+      'Depth' : 'files',
+  }
+  svntest.actions.run_and_verify_info([expected_info], B_path)
+
+  # Exclude A/B again
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'up', '--set-depth', 'exclude', B_path)
+
+  # Update to depth 'immediates' for the excluded path A/B
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/B'              : Item(status='A '),
+    'A/B/lambda'       : Item(status='A '),
+    'A/B/E'            : Item(status='A '),
+    'A/B/F'            : Item(status='A '),
+    })
+  expected_status.add({
+    'A/B'              : Item(status='  ', wc_rev=1),
+    'A/B/lambda'       : Item(status='  ', wc_rev=1),
+    'A/B/E'            : Item(status='  ', wc_rev=1),
+    'A/B/F'            : Item(status='  ', wc_rev=1),
+    })
+  expected_disk.add({
+    'A/B'              : Item(contents=None),
+    'A/B/lambda'       : Item(contents="This is the file 'lambda'.\n"),
+    'A/B/E'            : Item(contents=None),
+    'A/B/F'            : Item(contents=None),
+    })
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output,
+                                        expected_disk,
+                                        expected_status,
+                                        None, None,
+                                        None, None, None, None,
+                                        '--set-depth', 'immediates', B_path)
+  verify_depth(None, "immediates", B_path)
+  expected_info = {
+      'Path' : re.escape(B_path),
+      'Repository Root' : sbox.repo_url,
+      'Repository UUID' : svntest.actions.get_wc_uuid(wc_dir),
+      'Depth' : 'immediates',
+  }
+  svntest.actions.run_and_verify_info([expected_info], B_path)
+
+  # Exclude A/B again
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'up', '--set-depth', 'exclude', B_path)
+
+  # Update to depth 'infinity' for the excluded path A/B
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/B'              : Item(status='A '),
+    'A/B/lambda'       : Item(status='A '),
+    'A/B/E'            : Item(status='A '),
+    'A/B/E/beta'       : Item(status='A '),
+    'A/B/E/alpha'      : Item(status='A '),
+    'A/B/F'            : Item(status='A '),
+    })
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_disk = svntest.main.greek_state.copy()
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output,
+                                        expected_disk,
+                                        expected_status,
+                                        None, None,
+                                        None, None, None, None,
+                                        '--set-depth', 'infinity', B_path)
+  verify_depth(None, "infinity", B_path)
+  expected_info = {
+      'Path' : re.escape(B_path),
+      'Repository Root' : sbox.repo_url,
+      'Repository UUID' : svntest.actions.get_wc_uuid(wc_dir),
+  #   'Depth' value is absent for 'infinity'
+  }
+  svntest.actions.run_and_verify_info([expected_info], B_path)
+
 #----------------------------------------------------------------------
 # list all tests here, starting with None:
 test_list = [ None,
@@ -2546,6 +2701,7 @@
               tree_conflicts_resolved_depth_files,
               tree_conflicts_resolved_depth_immediates,
               tree_conflicts_resolved_depth_infinity,
+              update_excluded_path_sticky_depths,
             ]
 
 if __name__ == "__main__":

Reply via email to