Author: rhuijben
Date: Thu Mar 31 15:12:39 2011
New Revision: 1087335
URL: http://svn.apache.org/viewvc?rev=1087335&view=rev
Log:
Avoid a db operation in the commit harvester for every root of an add/copy.
Move the commit as copy logic in its own scope.
* subversion/libsvn_client/commit_util.c
(harvest_committables): Use the original revision and relpath from the main
information query to process most of the addition/copy processing.
Modified:
subversion/trunk/subversion/libsvn_client/commit_util.c
Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1087335&r1=1087334&r2=1087335&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Thu Mar 31 15:12:39
2011
@@ -368,8 +368,8 @@ harvest_committables(svn_wc_context_t *w
svn_boolean_t conflicted;
const char *node_changelist;
svn_boolean_t is_update_root;
- const char *node_copyfrom_relpath;
- svn_revnum_t node_copyfrom_rev;
+ svn_revnum_t original_rev;
+ const char *original_relpath;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -393,7 +393,7 @@ harvest_committables(svn_wc_context_t *w
&is_not_present, &is_excluded,
&is_op_root, &is_symlink,
&entry_rev, &entry_relpath,
- NULL, NULL,
+ &original_rev, &original_relpath,
&conflicted,
&node_changelist,
&prop_mod, &is_update_root,
@@ -505,33 +505,55 @@ harvest_committables(svn_wc_context_t *w
{
svn_boolean_t is_copy_target;
- SVN_ERR(svn_wc__node_get_copyfrom_info(NULL, &node_copyfrom_relpath,
- NULL, &node_copyfrom_rev,
- &is_copy_target,
- wc_ctx, local_abspath,
- scratch_pool, scratch_pool));
- if (is_copy_target)
- {
- state_flags |= SVN_CLIENT_COMMIT_ITEM_ADD;
- state_flags |= SVN_CLIENT_COMMIT_ITEM_IS_COPY;
- cf_relpath = node_copyfrom_relpath;
- cf_rev = node_copyfrom_rev;
- }
- else if (!node_copyfrom_relpath)
+ if (is_op_root)
{
+ /* Root of local add or copy */
state_flags |= SVN_CLIENT_COMMIT_ITEM_ADD;
+ if (original_relpath)
+ {
+ /* Root of copy */
+ state_flags |= SVN_CLIENT_COMMIT_ITEM_ADD;
+ state_flags |= SVN_CLIENT_COMMIT_ITEM_IS_COPY;
+ cf_relpath = original_relpath;
+ cf_rev = original_rev;
+ }
}
else
{
- /* ### svn_wc__node_get_copyfrom_info has pre-wc-ng
- behaviour for is_copy_target. In this case we really
- want all the copy targets, even those where just the
- copfrom revision is different. */
+ /* While we still have some pre-WC-NG like processing we have
+ to check if the child has the same revision as the parent.
+
+ ### Should we also check for switched?
+
+ ### This could be handled inside WC-NG, by recording a new
+ ### op-depth for this condition.
+
+ ### !!! Removing this entire block currently only triggers
+ ### !!! a single failure in our test suite, but this problem
+ ### !!! is far more likely to occur in real user working copies.
+ */
const char *parent_copyfrom_relpath;
svn_revnum_t parent_copyfrom_rev;
const char *parent_abspath = svn_dirent_dirname(local_abspath,
scratch_pool);
+ const char *node_copyfrom_relpath;
+ svn_revnum_t node_copyfrom_rev;
+
+ if (original_relpath)
+ {
+ node_copyfrom_relpath = original_relpath;
+ node_copyfrom_rev = original_rev;
+ }
+ else
+ SVN_ERR(svn_wc__node_get_copyfrom_info(NULL,
+ &node_copyfrom_relpath,
+ NULL, &node_copyfrom_rev,
+ &is_copy_target,
+ wc_ctx, local_abspath,
+ scratch_pool,
+ scratch_pool));
+
SVN_ERR(svn_wc__node_get_copyfrom_info(NULL,
&parent_copyfrom_relpath,
NULL,
@@ -548,16 +570,28 @@ harvest_committables(svn_wc_context_t *w
}
}
}
- else
- {
- node_copyfrom_relpath = NULL;
- node_copyfrom_rev = SVN_INVALID_REVNUM;
- }
/* Further additions occur in copy mode. */
if (copy_mode && !(state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE))
{
svn_revnum_t dir_rev;
+ const char *node_copyfrom_relpath;
+ svn_revnum_t node_copyfrom_rev;
+
+ if (is_added)
+ {
+ SVN_ERR(svn_wc__node_get_copyfrom_info(NULL,
+ &node_copyfrom_relpath,
+ NULL, &node_copyfrom_rev,
+ NULL,
+ wc_ctx, local_abspath,
+ scratch_pool, scratch_pool));
+ }
+ else
+ {
+ node_copyfrom_relpath = NULL;
+ node_copyfrom_rev = SVN_INVALID_REVNUM;
+ }
if (!copy_mode_root)
SVN_ERR(svn_wc__node_get_base_rev(&dir_rev, wc_ctx,
@@ -704,8 +738,6 @@ harvest_committables(svn_wc_context_t *w
const apr_array_header_t *children;
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
int i;
- svn_boolean_t skip_files;
- svn_boolean_t skip_dirs;
svn_depth_t depth_below_here = depth;
if (depth < svn_depth_infinity)