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 2011/07/13 13:19:58 UTC

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

Author: rhuijben
Date: Wed Jul 13 11:19:58 2011
New Revision: 1145956

URL: http://svn.apache.org/viewvc?rev=1145956&view=rev
Log:
Avoid a few more database transactions in simple wc status scenarios by
simplifying the code.

* subversion/libsvn_wc/status.c
  (read_info): We are not interested in svn:special props on directories, so
    we can avoid checking for them in that case (which happens to be the most
    common case where this function is used).
  (svn_wc__internal_walk_status): Simplify checks that were added to work
    around access baton limitations. Whether a file or directory exists on disk
    is no longer relevant for driving status and can even be invalid on
    deleted directories.

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=1145956&r1=1145955&r2=1145956&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Wed Jul 13 11:19:58 2011
@@ -278,7 +278,8 @@ read_info(const struct svn_wc__db_info_t
   mtb->has_checksum = (checksum != NULL);
 
 #ifdef HAVE_SYMLINK
-  if (mtb->had_props || mtb->props_mod)
+  if (mtb->kind == svn_wc__db_kind_file
+      && (mtb->had_props || mtb->props_mod))
     {
       apr_hash_t *properties;
 
@@ -2300,7 +2301,8 @@ svn_wc__internal_walk_status(svn_wc__db_
   const svn_io_dirent2_t *dirent;
   const char *anchor_abspath, *target_name;
   svn_boolean_t skip_root;
-  svn_wc__db_kind_t kind;
+  const struct svn_wc__db_info_t *dir_info;
+  svn_error_t *err;
 
   wb.db = db;
   wb.target_abspath = local_abspath;
@@ -2321,35 +2323,37 @@ svn_wc__internal_walk_status(svn_wc__db_
       ignore_patterns = ignores;
     }
 
-  SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath, TRUE, scratch_pool));
-  SVN_ERR(svn_io_stat_dirent(&dirent, local_abspath, TRUE,
-                             scratch_pool, scratch_pool));
+  err = read_info(&dir_info, local_abspath, db, scratch_pool, scratch_pool);
 
-  if (kind == svn_wc__db_kind_file && dirent->kind == svn_node_file)
-    {
-      anchor_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
-      target_name = svn_dirent_basename(local_abspath, NULL);
-      skip_root = TRUE;
-    }
-  else if (kind == svn_wc__db_kind_dir && dirent->kind == svn_node_dir)
+  if (!err && dir_info->kind == svn_wc__db_kind_dir)
     {
       anchor_abspath = local_abspath;
       target_name = NULL;
       skip_root = FALSE;
     }
+  else if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+    return svn_error_trace(err);
   else
     {
+      svn_error_clear(err);
+      dir_info = NULL; /* Don't pass information of the child */
+
+      /* Walk the status of the parent of LOCAL_ABSPATH, but only report
+         status on its child LOCAL_ABSPATH. */
       anchor_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
       target_name = svn_dirent_basename(local_abspath, NULL);
-      skip_root = FALSE;
+      skip_root = TRUE;
     }
 
+  SVN_ERR(svn_io_stat_dirent(&dirent, local_abspath, TRUE,
+                             scratch_pool, scratch_pool));
+
   SVN_ERR(get_dir_status(&wb,
                          anchor_abspath,
                          target_name,
                          skip_root,
                          NULL, NULL, NULL,
-                         NULL, /* parent info */
+                         dir_info,
                          dirent,
                          ignore_patterns,
                          depth,