You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/01/10 17:42:48 UTC

svn commit: r1431491 - /subversion/trunk/subversion/libsvn_wc/status.c

Author: rhuijben
Date: Thu Jan 10 16:42:48 2013
New Revision: 1431491

URL: http://svn.apache.org/viewvc?rev=1431491&view=rev
Log:
In the statuswalker optimize the code that calculates the copied '*' for
deleted nodes, to not require an additional db call in many cases.

In the process combine a bit of code that was duplicated for files
and directories.

* subversion/libsvn_wc/status.c
  (assemble_status): Combine some code and extend the directory query
    optimization for deletes, which now also handles files.

Modified:
    subversion/trunk/subversion/libsvn_wc/status.c

Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=1431491&r1=1431490&r2=1431491&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Thu Jan 10 16:42:48 2013
@@ -514,52 +514,23 @@ assemble_status(svn_wc_status3_t **statu
                              != 0);
     }
 
-  /* Examine whether our target is missing or obstructed. To detect
-   * obstructions, we have to look at the on-disk status in DIRENT. */
-  if (info->kind == svn_kind_dir)
+  if (info->status == svn_wc__db_status_incomplete || info->incomplete)
     {
-      if (info->status == svn_wc__db_status_incomplete || info->incomplete)
-        {
-          /* Highest precedence.  */
-          node_status = svn_wc_status_incomplete;
-        }
-      else if (info->status == svn_wc__db_status_deleted)
-        {
-          node_status = svn_wc_status_deleted;
-
-          if (!info->have_base)
-            copied = TRUE;
-          else
-            {
-              const char *work_del_abspath;
-
-              /* Find out details of our deletion.  */
-              SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL,
-                                               &work_del_abspath, NULL,
-                                               db, local_abspath,
-                                               scratch_pool, scratch_pool));
-              if (work_del_abspath)
-                copied = TRUE; /* Working deletion */
-            }
-        }
-      else if (!dirent || dirent->kind != svn_node_dir)
-        {
-          /* A present or added directory should be on disk, so it is
-             reported missing or obstructed.  */
-          if (!dirent || dirent->kind == svn_node_none)
-            node_status = svn_wc_status_missing;
-          else
-            node_status = svn_wc_status_obstructed;
-        }
+      /* Highest precedence.  */
+      node_status = svn_wc_status_incomplete;
     }
-  else
+  else if (info->status == svn_wc__db_status_deleted)
     {
-      if (info->status == svn_wc__db_status_deleted)
+      node_status = svn_wc_status_deleted;
+
+      if (!info->have_base || info->have_more_work || info->copied)
+        copied = TRUE;
+      else if (!info->have_more_work && info->have_base)
+        copied = FALSE;
+      else
         {
           const char *work_del_abspath;
 
-          node_status = svn_wc_status_deleted;
-
           /* Find out details of our deletion.  */
           SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL,
                                            &work_del_abspath, NULL,
@@ -568,9 +539,18 @@ assemble_status(svn_wc_status3_t **statu
           if (work_del_abspath)
             copied = TRUE; /* Working deletion */
         }
-      else if (!dirent || dirent->kind != svn_node_file)
+    }
+  else 
+    {
+      /* Examine whether our target is missing or obstructed. To detect
+       * obstructions, we have to look at the on-disk status in DIRENT. */
+      svn_node_kind_t expected_kind = (info->kind == svn_kind_dir) 
+                                        ? svn_node_dir
+                                        : svn_node_file;
+
+      if (!dirent || dirent->kind != expected_kind)
         {
-          /* A present or added file should be on disk, so it is
+          /* A present or added node should be on disk, so it is
              reported missing or obstructed.  */
           if (!dirent || dirent->kind == svn_node_none)
             node_status = svn_wc_status_missing;