[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Redundant creation of svn_client_commit_item3_t's in WC -> repos copy/move operations?

From: Daniel Rall <dlr_at_collab.net>
Date: 2007-02-17 00:45:41 CET

Hyrum, I think we can remove the apparent redundant creation of
svn_client_commit_item3_t's in WC -> repos copy/move operations that
we discussed on IRC.

If for some reason the list of commit items gathered by way of
harvest_commitables() was different than those inferred from the copy
pairs (though I don't think it would be), we'd want to use the
harvested list when prompting the user for a change log message
anyways.

I think the trade-off here is that we'll end up doing more WC I/O
before prompting the user for a change log message, meaning that in
the failure case -- no log message provided -- we've performed some
extra work. This seems like a very reasonable trade-off for
simplifying the code.

- Dan

Index: subversion/libsvn_client/copy.c
===================================================================
--- subversion/libsvn_client/copy.c (revision 23421)
+++ subversion/libsvn_client/copy.c (working copy)
@@ -869,34 +869,6 @@
         }
     }
 
- /* Create a new commit item and add it to the array. */
- if (SVN_CLIENT__HAS_LOG_MSG_FUNC(ctx))
- {
- svn_client_commit_item3_t *item;
- const char *tmp_file;
- commit_items = apr_array_make(pool, copy_pairs->nelts, sizeof(item));
-
- for (i = 0; i < copy_pairs->nelts; i++ )
- {
- svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
- svn_client__copy_pair_t *);
-
- SVN_ERR(svn_client_commit_item_create
- ((const svn_client_commit_item3_t **) &item, pool));
-
- item->url = pair->dst;
- item->state_flags = SVN_CLIENT_COMMIT_ITEM_ADD;
- APR_ARRAY_PUSH(commit_items, svn_client_commit_item3_t *) = item;
- }
-
- SVN_ERR(svn_client__get_log_msg(&message, &tmp_file, commit_items,
- ctx, pool));
- if (! message)
- return SVN_NO_ERROR;
- }
- else
- message = "";
-
   /* Crawl the working copy for commit items. */
   SVN_ERR(svn_io_check_path(top_src_path, &base_kind, pool));
   if (base_kind == svn_node_dir)
@@ -916,11 +888,23 @@
      canonical repository URLs. Then, the hacked name can go away and
      be replaced with a entry->repos (or whereever the entry's
      canonical repos URL is stored). */
- if (! ((commit_items = apr_hash_get(committables,
- SVN_CLIENT__SINGLE_REPOS_NAME,
- APR_HASH_KEY_STRING))))
+ if (! (commit_items = apr_hash_get(committables,
+ SVN_CLIENT__SINGLE_REPOS_NAME,
+ APR_HASH_KEY_STRING)))
     goto cleanup;
 
+ /* Create a new commit item and add it to the array. */
+ if (SVN_CLIENT__HAS_LOG_MSG_FUNC(ctx))
+ {
+ const char *tmp_file;
+ SVN_ERR(svn_client__get_log_msg(&message, &tmp_file, commit_items,
+ ctx, pool));
+ if (! message)
+ return SVN_NO_ERROR;
+ }
+ else
+ message = "";
+
   /* Sort and condense our COMMIT_ITEMS. */
   if ((cmt_err = svn_client__condense_commit_items(&top_dst_url,
                                                    commit_items,

  • application/pgp-signature attachment: stored
Received on Sat Feb 17 02:51:02 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.