You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/12/07 03:31:18 UTC

svn commit: r1042892 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/merge.c libsvn_wc/node.c

Author: hwright
Date: Tue Dec  7 02:31:18 2010
New Revision: 1042892

URL: http://svn.apache.org/viewvc?rev=1042892&view=rev
Log:
Consolidate four database reads into one when running merge.

* subversion/include/private/svn_wc_private.h
  (svn_wc__get_mergeinfo_walk_info): New.

* subversion/libsvn_wc/node.c
  (svn_wc__get_mergeinfo_walk_info): New.

* subversion/libsvn_client/merge.c
  (get_mergeinfo_walk_cb): Use the new API, and eliminate calls to four others.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_wc/node.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1042892&r1=1042891&r2=1042892&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Tue Dec  7 02:31:18 2010
@@ -706,6 +706,21 @@ svn_wc__node_get_schedule(svn_wc_schedul
                           const char *local_abspath,
                           apr_pool_t *scratch_pool);
 
+/**
+ * Helper function which fetches all the relevant information for
+ * libsvn_client/merge.c:get_mergeinfo_walk_cb().  This combines several
+ * svn_wc__db_read_info() calls into one, limiting the number of database
+ * accesses, and, more importantly, system calls.
+ */
+svn_error_t *
+svn_wc__get_mergeinfo_walk_info(svn_boolean_t *is_present,
+                                svn_boolean_t *is_deleted,
+                                svn_boolean_t *is_absent,
+                                svn_depth_t *depth,
+                                svn_wc_context_t *wc_ctx,
+                                const char *local_abspath,
+                                apr_pool_t *scratch_pool);
+
 
 #ifdef __cplusplus
 }

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1042892&r1=1042891&r2=1042892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Tue Dec  7 02:31:18 2010
@@ -5592,18 +5592,16 @@ get_mergeinfo_walk_cb(const char *local_
 
   /* TODO(#2843) How to deal with a excluded item on merge? */
 
+  SVN_ERR(svn_wc__get_mergeinfo_walk_info(&is_present, &deleted, &absent,
+                                          &depth,
+                                          wb->ctx->wc_ctx, local_abspath,
+                                          scratch_pool));
+
   /* Ignore LOCAL_ABSPATH if its parent thinks it exists, but it is not
      actually present. */
-  SVN_ERR(svn_wc__node_is_status_present(&is_present, wb->ctx->wc_ctx,
-                                         local_abspath, scratch_pool));
   if (!is_present)
     return SVN_NO_ERROR;
 
-  SVN_ERR(svn_wc__node_is_status_deleted(&deleted, wb->ctx->wc_ctx,
-                                         local_abspath, scratch_pool));
-  SVN_ERR(svn_wc__node_is_status_absent(&absent, wb->ctx->wc_ctx,
-                                        local_abspath, scratch_pool));
-
    if (deleted || absent)
     {
       propval = NULL;
@@ -5627,8 +5625,6 @@ get_mergeinfo_walk_cb(const char *local_
 
   SVN_ERR(svn_wc_read_kind(&kind, wb->ctx->wc_ctx, local_abspath, TRUE,
                            scratch_pool));
-  SVN_ERR(svn_wc__node_get_depth(&depth, wb->ctx->wc_ctx, local_abspath,
-                                 scratch_pool));
 
   immediate_child_dir = ((wb->depth == svn_depth_immediates)
                          &&(kind == svn_node_dir)

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1042892&r1=1042891&r2=1042892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Tue Dec  7 02:31:18 2010
@@ -1472,3 +1472,29 @@ svn_wc__node_get_info_bits(apr_time_t *t
 
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_wc__get_mergeinfo_walk_info(svn_boolean_t *is_present,
+                                svn_boolean_t *is_deleted,
+                                svn_boolean_t *is_absent,
+                                svn_depth_t *depth,
+                                svn_wc_context_t *wc_ctx,
+                                const char *local_abspath,
+                                apr_pool_t *scratch_pool)
+{
+  svn_wc__db_status_t status;
+
+  SVN_ERR(svn_wc__db_read_info(&status,
+                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL, NULL, depth, NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL, NULL,
+                               wc_ctx->db, local_abspath,
+                               scratch_pool, scratch_pool));
+
+  *is_present = (status != svn_wc__db_status_not_present);
+  *is_deleted = (status == svn_wc__db_status_deleted);
+  *is_absent = (status == svn_wc__db_status_absent);
+
+  return SVN_NO_ERROR;
+}