You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/03/23 14:43:52 UTC

svn commit: r1736320 - /subversion/trunk/subversion/libsvn_client/conflicts.c

Author: stsp
Date: Wed Mar 23 13:43:52 2016
New Revision: 1736320

URL: http://svn.apache.org/viewvc?rev=1736320&view=rev
Log:
Eliminate an unnecessary RA API call in the conflict resolver.

* subversion/libsvn_client/conflicts.c
  (find_deleted_rev_baton): New fields deleted_rev_author and result_pool.
  (find_deleted_rev): Fetch the revision author while scanning the log.
  (describe_local_none_node_change): Ask svn_ra_get_log2() for revprops
   and look up the author in find_deleted_rev_baton, rather than calling
   svn_ra_rev_prop() to obtain the author.

Modified:
    subversion/trunk/subversion/libsvn_client/conflicts.c

Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1736320&r1=1736319&r2=1736320&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Wed Mar 23 13:43:52 2016
@@ -237,11 +237,13 @@ struct find_deleted_rev_baton
   svn_revnum_t related_repos_peg_rev;
 
   svn_revnum_t deleted_rev;
+  const char *deleted_rev_author;
   svn_node_kind_t replacing_node_kind;
 
   const char *repos_root_url;
   const char *repos_uuid;
   svn_client_ctx_t *ctx;
+  apr_pool_t *result_pool;
 };
 
 /* Implements svn_log_entry_receiver_t.
@@ -316,8 +318,14 @@ find_deleted_rev(void *baton,
                                                            iterpool));
           if (yca_loc != NULL)
             {
+              svn_string_t *author;
               /* Found the correct node, we are done. */
               b->deleted_rev = log_entry->revision;
+
+              author = svn_hash_gets(log_entry->revprops,
+                                     SVN_PROP_REVISION_AUTHOR);
+              b->deleted_rev_author = apr_pstrdup(b->result_pool, author->data);
+                  
               if (log_item->action == 'R')
                 b->replacing_node_kind = log_item->node_kind;
               else
@@ -795,6 +803,7 @@ describe_local_none_node_change(const ch
           const char *url;
           const char *corrected_url;
           apr_array_header_t *paths;
+          apr_array_header_t *revprops;
           const char *old_repos_relpath;
           const char *new_repos_relpath;
           const char *repos_root_url;
@@ -803,7 +812,6 @@ describe_local_none_node_change(const ch
           svn_revnum_t old_rev;
           svn_revnum_t new_rev;
           struct find_deleted_rev_baton b;
-          svn_string_t *author_revprop;
           svn_error_t *err;
 
           SVN_ERR(svn_client_conflict_get_repos_info(&repos_root_url,
@@ -844,6 +852,9 @@ describe_local_none_node_change(const ch
           paths = apr_array_make(scratch_pool, 1, sizeof(const char *));
           APR_ARRAY_PUSH(paths, const char *) = "";
 
+          revprops = apr_array_make(scratch_pool, 1, sizeof(const char *));
+          APR_ARRAY_PUSH(revprops, const char *) = SVN_PROP_REVISION_AUTHOR;
+
           b.deleted_repos_relpath = svn_relpath_join(
                                       parent_repos_relpath,
                                       svn_dirent_basename(
@@ -865,15 +876,14 @@ describe_local_none_node_change(const ch
           b.repos_root_url = repos_root_url;
           b.repos_uuid = repos_uuid;
           b.ctx = conflict->ctx;
+          b.result_pool = scratch_pool;
 
           err = svn_ra_get_log2(ra_session, paths, new_rev, 0,
                                 0, /* no limit */
                                 TRUE, /* need the changed paths list */
                                 FALSE, /* need to traverse copies */
                                 FALSE, /* no need for merged revisions */
-                                /* no need for revprops: */
-                                apr_array_make(scratch_pool, 0,
-                                               sizeof(const char *)),
+                                revprops,
                                 find_deleted_rev, &b,
                                 scratch_pool);
           if (err)
@@ -899,16 +909,12 @@ describe_local_none_node_change(const ch
               return SVN_NO_ERROR;
             }
 
-          /* ### gather this while scanning the log? */
-          SVN_ERR(svn_ra_rev_prop(ra_session, b.deleted_rev,
-                                  SVN_PROP_REVISION_AUTHOR,
-                                  &author_revprop, scratch_pool));
           *description = apr_psprintf(
                            result_pool,
                            _("No such file or directory was found in the "
                              "merge target working copy.\nThe item was "
                              "deleted or moved away in r%ld by %s."),
-                           b.deleted_rev, author_revprop->data);
+                           b.deleted_rev, b.deleted_rev_author);
         }
       break;
     case svn_wc_conflict_reason_unversioned: