subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1345764 - in /subversion/trunk/subversion/libsvn_client: merge.c mergeinfo.c
Date Sun, 03 Jun 2012 20:19:32 GMT
Author: rhuijben
Date: Sun Jun  3 20:19:30 2012
New Revision: 1345764

URL: http://svn.apache.org/viewvc?rev=1345764&view=rev
Log:
On my 'avoid unneeded svn_wc_read_kind()' calls list: Remove two unneeded calls
in the merge code.

* subversion/libsvn_client/merge.c
  (merge_file_added): Extend the lifetime of a kind variable to avoid
    retrieving it again for creating a tree conflict.

* subversion/libsvn_client/mergeinfo.c
  (svn_client__get_wc_mergeinfo_catalog): Don't read the kind of node to avoid
    reading properties as this is as costly as just asking the properties.
    Don't parse properties on the node itself again if we already stored them.
    Make some calls into libsvn_wc more obvious.

Modified:
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1345764&r1=1345763&r2=1345764&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Sun Jun  3 20:19:30 2012
@@ -1776,6 +1776,7 @@ merge_file_added(svn_wc_notify_state_t *
   merge_cmd_baton_t *merge_b = baton;
   const char *mine_abspath = svn_dirent_join(merge_b->target->abspath,
                                              mine_relpath, scratch_pool);
+  svn_node_kind_t wc_kind;
   svn_node_kind_t kind;
   int i;
   apr_hash_t *file_props;
@@ -1834,7 +1835,7 @@ merge_file_added(svn_wc_notify_state_t *
     svn_wc_notify_state_t obstr_state;
 
     SVN_ERR(perform_obstruction_check(&obstr_state, NULL, NULL,
-                                      &kind,
+                                      &wc_kind,
                                       merge_b, mine_abspath, svn_node_unknown,
                                       scratch_pool));
 
@@ -1967,10 +1968,6 @@ merge_file_added(svn_wc_notify_state_t *
       if (content_state)
         {
           /* directory already exists, is it under version control? */
-          svn_node_kind_t wc_kind;
-          SVN_ERR(svn_wc_read_kind(&wc_kind, merge_b->ctx->wc_ctx,
-                                   mine_abspath, FALSE, scratch_pool));
-
           if ((wc_kind != svn_node_none)
               && dry_run_deleted_p(merge_b, mine_abspath))
             *content_state = svn_wc_notify_state_changed;

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1345764&r1=1345763&r2=1345764&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Sun Jun  3 20:19:30 2012
@@ -414,38 +414,37 @@ svn_client__get_wc_mergeinfo_catalog(svn
     }
 
   /* If LOCAL_ABSPATH is a directory and we want the subtree mergeinfo too,
-     then get it. */
-  SVN_ERR(svn_wc_read_kind(&kind, ctx->wc_ctx, local_abspath, FALSE,
-                           scratch_pool));
-  if (kind == svn_node_dir && include_descendants)
+     then get it.
+
+     With WC-NG it is cheaper to do a single db transaction, than first
+     looking if we really have a directory. */
+  if (include_descendants)
     {
       apr_hash_t *mergeinfo_props;
       apr_hash_index_t *hi;
-      svn_opt_revision_t opt;
-
-      opt.kind = svn_opt_revision_unspecified;
 
-      SVN_ERR(svn_client_propget4(&mergeinfo_props,
-                                  SVN_PROP_MERGEINFO,
-                                  local_abspath,
-                                  &opt, &opt,
-                                  NULL, svn_depth_infinity, NULL,
-                                  ctx, scratch_pool, scratch_pool));
+      SVN_ERR(svn_wc__prop_retrieve_recursive(&mergeinfo_props,
+                                              ctx->wc_ctx, local_abspath,
+                                              SVN_PROP_MERGEINFO,
+                                              scratch_pool, scratch_pool));
 
       /* Convert *mergeinfo_props into a proper svn_mergeinfo_catalog_t */
       for (hi = apr_hash_first(scratch_pool, mergeinfo_props);
            hi;
            hi = apr_hash_next(hi))
         {
-          const char *key_path = svn__apr_hash_index_key(hi);
+          const char *node_abspath = svn__apr_hash_index_key(hi);
           svn_string_t *propval = svn__apr_hash_index_val(hi);
           svn_mergeinfo_t subtree_mergeinfo;
+          const char *repos_relpath;
+
+          if (strcmp(node_abspath, local_abspath) == 0)
+            continue; /* Already parsed in svn_client__get_wc_mergeinfo */
+
+          SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath,
+                                                 ctx->wc_ctx, node_abspath,
+                                                 result_pool, scratch_pool));
 
-          SVN_ERR(svn_client__path_relative_to_root(&key_path, ctx->wc_ctx,
-                                                    key_path,
-                                                    NULL, FALSE,
-                                                    NULL, result_pool,
-                                                    scratch_pool));
           SVN_ERR(svn_mergeinfo_parse(&subtree_mergeinfo, propval->data,
                                       result_pool));
 
@@ -455,7 +454,7 @@ svn_client__get_wc_mergeinfo_catalog(svn
           if (*mergeinfo_cat == NULL)
             *mergeinfo_cat = apr_hash_make(result_pool);
 
-          apr_hash_set(*mergeinfo_cat, key_path,
+          apr_hash_set(*mergeinfo_cat, repos_relpath,
                        APR_HASH_KEY_STRING, subtree_mergeinfo);
         }
     }



Mime
View raw message