All pastes #732545 Raw Edit

Someone

public text v1 · immutable
·published 2007-10-11 02:21 UTC
rendered paste body
[[[
Fix Issue #2959: depth upgrade against old servers was broken.

        ### Still in progress, do not commit. ###

* subversion/libsvn_wc/adm_crawler.c
  (svn_wc_crawl_revisions3, report_revisions_and_depths): Send TRUE
    for start_empty depending on entry depths and on whether or not
    this is a depth upgrade.
]]]

Index: subversion/libsvn_wc/adm_crawler.c
===================================================================
--- subversion/libsvn_wc/adm_crawler.c	(revision 27102)
+++ subversion/libsvn_wc/adm_crawler.c	(working copy)
@@ -368,6 +368,7 @@
         {
           svn_wc_adm_access_t *subdir_access;
           const svn_wc_entry_t *subdir_entry;
+          svn_boolean_t start_empty;
 
           /* If a directory is missing from disk, we have no way to
              recreate it locally, so report as missing and move
@@ -390,6 +391,18 @@
           SVN_ERR(svn_wc_entry(&subdir_entry, this_full_path, subdir_access,
                                TRUE, iterpool));
 
+          start_empty = subdir_entry->incomplete;
+          if (subdir_entry->depth <= svn_depth_files
+              && depth > subdir_entry->depth)
+            {
+              /* For a depth-aware server, this is harmless, as it
+                 knows the client's depth and won't send unnecessary
+                 information anyway.  But it enables a depth-unaware
+                 server to upgrade a working copy directory that has
+                 ambient depth svn_depth_empty or svn_depth_files. */
+              start_empty = TRUE;
+            }
+
           if (report_everything)
             {
               /* Report the dir unconditionally, one way or another. */
@@ -398,14 +411,14 @@
                                             subdir_entry->url,
                                             subdir_entry->revision,
                                             subdir_entry->depth,
-                                            subdir_entry->incomplete,
+                                            start_empty,
                                             subdir_entry->lock_token,
                                             iterpool));
               else
                 SVN_ERR(reporter->set_path(report_baton, this_path,
                                            subdir_entry->revision,
                                            subdir_entry->depth,
-                                           subdir_entry->incomplete,
+                                           start_empty,
                                            subdir_entry->lock_token,
                                            iterpool));
             }
@@ -417,7 +430,7 @@
                                         subdir_entry->url,
                                         subdir_entry->revision,
                                         subdir_entry->depth,
-                                        subdir_entry->incomplete,
+                                        start_empty,
                                         subdir_entry->lock_token,
                                         iterpool));
           /* ... or perhaps just a differing revision, lock token, incomplete
@@ -435,7 +448,7 @@
                                        this_path,
                                        subdir_entry->revision,
                                        subdir_entry->depth,
-                                       subdir_entry->incomplete,
+                                       start_empty,
                                        subdir_entry->lock_token,
                                        iterpool));
 
@@ -445,7 +458,7 @@
                                                 reporter, report_baton,
                                                 notify_func, notify_baton,
                                                 restore_files, depth,
-                                                subdir_entry->incomplete,
+                                                start_empty,
                                                 use_commit_times,
                                                 traversal_info,
                                                 iterpool));
@@ -482,6 +495,7 @@
   svn_boolean_t missing = FALSE;
   const svn_wc_entry_t *parent_entry = NULL;
   svn_wc_notify_t *notify;
+  svn_boolean_t start_empty;
 
   /* The first thing we do is get the base_rev from the working copy's
      ROOT_DIRECTORY.  This is the first revnum that entries will be
@@ -518,6 +532,11 @@
     }
 
   base_rev = entry->revision;
+
+  start_empty = entry->incomplete;
+  if (entry->depth <= svn_depth_files && depth > entry->depth)
+    start_empty = TRUE;
+
   if (base_rev == SVN_INVALID_REVNUM)
     {
       const char *dirname = svn_path_dirname(path, pool);
@@ -530,8 +549,7 @@
      top-level directory being updated is at BASE_REV.  Its PATH
      argument is ignored. */
   SVN_ERR(reporter->set_path(report_baton, "", base_rev, entry->depth,
-                             entry->incomplete , /* start_empty ? */
-                             NULL, pool));
+                             start_empty, NULL, pool));
 
   if (entry->schedule != svn_wc_schedule_delete)
     {
@@ -566,7 +584,7 @@
                                             reporter, report_baton,
                                             notify_func, notify_baton,
                                             restore_files, depth,
-                                            entry->incomplete,
+                                            start_empty,
                                             use_commit_times,
                                             traversal_info,
                                             pool);