You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2010/05/12 00:54:43 UTC

svn commit: r943323 - in /subversion/trunk/subversion/libsvn_wc: adm_crawler.c adm_ops.c

Author: gstein
Date: Tue May 11 22:54:43 2010
New Revision: 943323

URL: http://svn.apache.org/viewvc?rev=943323&view=rev
Log:
Remove a redundant call to svn_wc__db_temp_is_dir_deleted, and add a bunch
of clarifying comments. Other small cleanups.

* subversion/libsvn_wc/adm_crawler.c:
  (restore_node): remove spurious cut/paste comment
  (report_revisions_and_depths): after the base_get_info call, explain why
    an error may have been raised, and adjust the resulting state. if it
    succeeds, explain how we do NOT have to test for a parent stub in the
    not-present condition. shift the depth/rev tweak/assert lower in the
    file to just before use. remove a status_excluded check from a block,
    since the prior block did that already; adjust comments to explain the
    absent/not-present operation. clarify a comment about on-disk testing.

* subversion/libsvn_wc/adm_ops.c:
  (svn_wc_delete4): rename localvar to indicate it will not be used

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_crawler.c
    subversion/trunk/subversion/libsvn_wc/adm_ops.c

Modified: subversion/trunk/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_crawler.c?rev=943323&r1=943322&r2=943323&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_crawler.c Tue May 11 22:54:43 2010
@@ -134,8 +134,6 @@ restore_node(svn_boolean_t *restored,
           notify->kind = svn_node_file;
           (*notify_func)(notify_baton, notify, scratch_pool);
         }
-
-      /* Keep missing = FALSE */
     }
 
   return SVN_NO_ERROR;
@@ -307,31 +305,40 @@ report_revisions_and_depths(svn_wc__db_t
                                      NULL, NULL, NULL, NULL, NULL, &this_depth,
                                      NULL, NULL, NULL, &this_lock,
                                      db, this_abspath, iterpool, iterpool);
+      if (err)
+        {
+          if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+            return svn_error_return(err);
 
-      if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
-        svn_error_clear(err);
-      else
-        SVN_ERR(err);
+          /* THIS_ABSPATH was listed as a BASE child of DIR_ABSPATH. Yet,
+             we just got an error trying to read it. What gives? :-P
 
-      /* ### While still using parent stubs: Fetch info from the stub.
-             Handles the error case above */
-      {
-        svn_boolean_t not_present;
+             This happens when THIS_ABSPATH is a subdirectory that is
+             marked in the parent stub as "not-present". The subdir is
+             then removed. Later, an addition is scheduled, putting the
+             subdirectory back, but ONLY containing WORKING nodes.
 
-        SVN_ERR(svn_wc__db_temp_is_dir_deleted(&not_present, &this_rev, db,
-                                               this_abspath, iterpool));
+             Thus, the BASE fetch comes out of the subdir, and fails.
 
-        if (not_present || err)
-          this_status = svn_wc__db_status_not_present;
+             For this case, we go ahead and treat this as a simple
+             not-present, and ignore whatever is in the subdirectory.  */
+          svn_error_clear(err);
 
-        if (!SVN_IS_VALID_REVNUM(this_rev))
-          this_rev = dir_rev; /* Obstructed node */
-      } /* /Stub handling */
+          this_status = svn_wc__db_status_not_present;
 
-      if (this_depth == svn_depth_unknown)
-        this_depth = svn_depth_infinity;
+          /* Note: the other THIS_* local variables pass to base_get_info
+             are NOT set at this point. But we don't need them...  */
+        }
 
-      SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(this_rev));
+      /* Note: some older code would attempt to check the parent stub
+         of subdirectories for the not-present state. That check was
+         redundant since a not-present directory has no BASE nodes
+         within it which may report another status.
+
+         There might be NO BASE node (per the condition above), but the
+         typical case is that base_get_info() reads the parent stub
+         because there is no subdir (with administrative data). Thus, we
+         already have all the information we need. No further testing.  */
 
       /* First check for exclusion */
       if (this_status == svn_wc__db_status_excluded)
@@ -367,20 +374,23 @@ report_revisions_and_depths(svn_wc__db_t
         }
 
       /*** The Big Tests: ***/
-      if (this_status == svn_wc__db_status_absent ||
-          this_status == svn_wc__db_status_excluded ||
-          this_status == svn_wc__db_status_not_present)
+      if (this_status == svn_wc__db_status_absent
+          || this_status == svn_wc__db_status_not_present)
         {
-          /* If the entry is 'deleted' or 'absent', make sure the server
+          /* If the entry is 'absent' or 'not-present', make sure the server
              knows it's gone...
              ...unless we're reporting everything, in which case we're
-             going to report it missing later anyway. */
+             going to report it missing later anyway.
+
+             This instructs the server to send it back to us, if it is
+             now available (an addition after a not-present state), or if
+             it is now authorized (change in authz for the absent item).  */
           if (! report_everything)
             SVN_ERR(reporter->delete_path(report_baton, this_path, iterpool));
           continue;
         }
 
-      /* Is the entry on disk? */
+      /* Is the entry NOT on the disk? We may be able to restore it.  */
       if (apr_hash_get(dirents, child, APR_HASH_KEY_STRING) == NULL)
         {
           svn_boolean_t missing = FALSE;
@@ -410,10 +420,10 @@ report_revisions_and_depths(svn_wc__db_t
               if (dirent_kind == svn_node_none)
                 {
                   svn_boolean_t restored;
+
                   SVN_ERR(restore_node(&restored, db, this_abspath, wrk_kind,
                                        use_commit_times, notify_func,
                                        notify_baton, iterpool));
-
                   if (!restored)
                     missing = TRUE;
                 }
@@ -454,6 +464,13 @@ report_revisions_and_depths(svn_wc__db_t
             this_switched = FALSE;
         }
 
+      /* Tweak THIS_DEPTH to a useful value.  */
+      if (this_depth == svn_depth_unknown)
+        this_depth = svn_depth_infinity;
+
+      /* We better have a revision.  */
+      SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(this_rev));
+
       /*** Files ***/
       if (this_kind == svn_wc__db_kind_file ||
           this_kind == svn_wc__db_kind_symlink)

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=943323&r1=943322&r2=943323&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue May 11 22:54:43 2010
@@ -1092,8 +1092,9 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
 
   if (kind == svn_wc__db_kind_dir)
     {
-      svn_revnum_t base_rev;
-      SVN_ERR(svn_wc__db_temp_is_dir_deleted(&was_deleted, &base_rev,
+      svn_revnum_t unused_base_rev;
+
+      SVN_ERR(svn_wc__db_temp_is_dir_deleted(&was_deleted, &unused_base_rev,
                                              db, local_abspath, pool));
 
       if (was_add && !was_deleted)