[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] making depth upgrades work (sparse-directories)

From: Karl Fogel <kfogel_at_red-bean.com>
Date: 2007-05-19 10:38:37 CEST

This is a patch-in-progress, and it fails some tests right now,
specifically:

   checkout_tests.py 13: co handles obstructing paths scheduled for add
   update_tests.py 18: non-recursive update
   update_tests.py 34: update handles obstructing paths scheduled for add
   diff_tests.py 6: non-recursive behaviour
   stat_tests.py 29: run 'status --depth=X -u' with incoming changes

Nevertheless, I think it gets things moving in the right direction,
and I'm posting it because I'm about to go to bed. Others in
different time zones may be able to take it farther. Feel free to
commit if you get it passing the tests -- and especially if you get
any of the "upgrade" scenarios working! depth_update_to_more_depth()
in depth_tests.py, currently set to XFAIL, is what I'm aiming at.

-Karl

[[[
Start work on the problem that 'svn up --depth=files' in a depth-empty
working copy does not bring in the expected files. (These changes
will probably help all the "request a deeper depth" cases, but right
now I'm only testing with the one mentioned above.)

* subversion/libsvn_wc/adm_crawler.c
  (svn_wc_crawl_revisions3): Report svn_depth_infinity for paths where
    it doesn't matter; report entry->depth for paths where it does
    matter. Remove obsolete "TODO(sd)" comments; add some regular
    comments.
  (report_revisions_and_depths): Document depth behavior. Don't
    report differing depth for files, that's pointless. Recurse
    correctly based on depth. Remove obsolete "TODO(sd)" comments.
]]]

Index: subversion/libsvn_wc/adm_crawler.c
===================================================================
--- subversion/libsvn_wc/adm_crawler.c (revision 25067)
+++ subversion/libsvn_wc/adm_crawler.c (working copy)
@@ -137,6 +137,24 @@
    Alternatively, if REPORT_EVERYTHING is set, then report all
    children unconditionally.
 
+ DEPTH is actually the *requested* depth for the update-like
+ operation for which we are reporting working copy state. However,
+ certain requested depths affect the depth of the report crawl. For
+ example, if the requested depth is svn_depth_empty, there's no
+ point descending into subdirs, no matter what their depths. So:
+
+ If DEPTH is svn_depth_empty, don't report any files and don't
+ descend into any subdirs. If svn_depth_files, report files but
+ still don't descend into subdirs. If svn_depth_immediates, report
+ files, and report subdirs themselves but not their entries. If
+ svn_depth_infinity or svn_depth_unknown, report everything all the
+ way down. (That last sentence might sound counterintuitive, but
+ since you can't go deeper than the local ambient depth anyway,
+ requesting svn_depth_infinity really means "as deep as the various
+ parts of this working copy go". Of course, the information that
+ comes back from the server will be different for svn_depth_unknown
+ than for svn_depth_infinity.)
+
    If TRAVERSAL_INFO is non-null, record this directory's
    value of svn:externals in both TRAVERSAL_INFO->externals_old and
    TRAVERSAL_INFO->externals_new, using wc_path + dir_path as the key,
@@ -323,10 +341,8 @@
                                         FALSE,
                                         current_entry->lock_token,
                                         iterpool));
- /* ... or perhaps just a differing revision or depth or
- lock token. */
+ /* ... or perhaps just a differing revision or lock token. */
           else if (current_entry->revision != dir_rev
- || current_entry->depth != depth
                    || current_entry->lock_token)
             SVN_ERR(reporter->set_path(report_baton,
                                        this_path,
@@ -339,15 +355,10 @@
       
       /*** Directories (in recursive mode) ***/
       else if (current_entry->kind == svn_node_dir
- && depth == svn_depth_infinity)
+ && (depth == svn_depth_immediates
+ || depth == svn_depth_infinity
+ || depth == svn_depth_unknown))
         {
- /* ### TODO(sd): I think it's correct to check whether
- ### 'depth == svn_depth_infinity' above. If the
- ### specified depth is not infinity, then we don't want
- ### to recurse at all. If it is, then we want recursion
- ### to be dependent on the subdirs' entries, right?
- ### That's what the code below does. */
-
           svn_wc_adm_access_t *subdir_access;
           const svn_wc_entry_t *subdir_entry;
 
@@ -413,18 +424,25 @@
                                        subdir_entry->lock_token,
                                        iterpool));
 
- /* ### TODO(sd): See TODO comment in svn_wc_crawl_revisions3()
- ### about depth treatment here. */
- if (depth == svn_depth_infinity)
- SVN_ERR(report_revisions_and_depths(adm_access, this_path,
- subdir_entry->revision,
- reporter, report_baton,
- notify_func, notify_baton,
- restore_files, depth,
- subdir_entry->incomplete,
- use_commit_times,
- traversal_info,
- iterpool));
+ /* Recurse only if requested depth could require it. */
+ if (depth != svn_depth_empty && depth != svn_depth_files)
+ {
+ svn_depth_t depth_beneath_here = depth;
+
+ if (depth == svn_depth_immediates)
+ depth_beneath_here = svn_depth_empty;
+
+ SVN_ERR(report_revisions_and_depths(adm_access, this_path,
+ subdir_entry->revision,
+ reporter, report_baton,
+ notify_func, notify_baton,
+ restore_files,
+ depth_beneath_here,
+ subdir_entry->incomplete,
+ use_commit_times,
+ traversal_info,
+ iterpool));
+ }
         } /* end directory case */
     } /* end main entries loop */
 
@@ -474,9 +492,9 @@
                                       adm_access, FALSE, pool));
 
       base_rev = parent_entry->revision;
- if (depth == svn_depth_unknown)
- depth = parent_entry->depth;
- SVN_ERR(reporter->set_path(report_baton, "", base_rev, depth,
+ /* Just use svn_depth_infinity here, because it doesn't matter. */
+ SVN_ERR(reporter->set_path(report_baton, "", base_rev,
+ svn_depth_infinity,
                                  entry ? entry->incomplete : TRUE,
                                  NULL, pool));
       SVN_ERR(reporter->delete_path(report_baton, "", pool));
@@ -497,13 +515,10 @@
       base_rev = parent_entry->revision;
     }
 
- if (depth == svn_depth_unknown)
- depth = entry->depth;
-
   /* The first call to the reporter merely informs it that the
      top-level directory being updated is at BASE_REV. Its PATH
      argument is ignored. */
- SVN_ERR(reporter->set_path(report_baton, "", base_rev, depth,
+ SVN_ERR(reporter->set_path(report_baton, "", base_rev, entry->depth,
                              entry->incomplete , /* start_empty ? */
                              NULL, pool));
 
@@ -532,14 +547,6 @@
         }
       else
         {
- /* ### TODO(sd): Just passing depth here is not enough. There
- ### can be circumstances where the root is depth 0 or 1,
- ### but some child directories are present at depth
- ### infinity. We need to detect them and recurse into
- ### them *unless* there is a passed-in depth that is not
- ### infinity. I think.
- */
-
           /* Recursively crawl ROOT_DIRECTORY and report differing
              revisions. */
           err = report_revisions_and_depths(adm_access,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat May 19 10:38:51 2007

This is an archived mail posted to the Subversion Dev mailing list.