subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1338299 - /subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c
Date Mon, 14 May 2012 17:25:56 GMT
Author: hwright
Date: Mon May 14 17:25:56 2012
New Revision: 1338299

URL: http://svn.apache.org/viewvc?rev=1338299&view=rev
Log:
On the ev2-export branch:
Do a more thorough collection of children pending commit, which both improves
performance (we don't have to run to the working copy) and correctness (we
don't include children not being committed).

* subversion/libsvn_client/commit_util.c
  (do_item_commit): For added directories, fetch children from the new_children
    hash.
  (svn_client__do_commit): Populate the new_children hash for all nodes.

Modified:
    subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c

Modified: subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c?rev=1338299&r1=1338298&r2=1338299&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c Mon May 14 17:25:56
2012
@@ -1640,40 +1640,14 @@ do_item_commit(svn_client_commit_item3_t
         }
       else /* May be svn_node_none when adding parent dirs for a copy. */
         {
-          apr_array_header_t *children = NULL;
-          const apr_array_header_t *children_abspaths;
-          int i;
+          apr_array_header_t *children;
 
           SVN_ERR_ASSERT(props != NULL);
 
-          if (item->path)
-            {
-              SVN_ERR(svn_wc__node_get_children_of_working_node(
-                                                &children_abspaths,
-                                                ctx->wc_ctx, item->path, FALSE,
-                                                scratch_pool, scratch_pool));
-
-              /* We have to strip out the basenames returned from the above
-                 function. */
-              children = apr_array_make(scratch_pool, children_abspaths->nelts,
-                                        sizeof(const char *));
-              for (i = 0; i < children_abspaths->nelts; i++)
-                {
-                  const char *child_abspath = APR_ARRAY_IDX(children_abspaths,
-                                                            i, const char *);
-                  APR_ARRAY_PUSH(children, const char *) =
-                            svn_dirent_basename(child_abspath, scratch_pool);
-                }
-            }
-          else
-            {
-              /* Goofy special case: When doing 'cp --parents', we are adding
-                 directories which don't have a path on disk, but still have
-                 children.  We need to populate the children list
-                 appropriately. */
-              children = apr_hash_get(new_children, item->session_relpath,
-                                      APR_HASH_KEY_STRING);
-            }
+          children = apr_hash_get(new_children, item->session_relpath,
+                                  APR_HASH_KEY_STRING);
+          if (!children)
+            children = apr_array_make(scratch_pool, 0, sizeof(const char *));
 
           SVN_ERR(svn_editor_add_directory(editor, repos_relpath,
                                            children, props,
@@ -1760,8 +1734,7 @@ svn_client__do_commit(const char *repos_
   apr_hash_t *new_children = apr_hash_make(scratch_pool);
   int i;
 
-  /* Special loop to look for children of newly-added directories which
-     don't exist on the client, as in the case of 'cp --parents'.
+  /* Loop to look for children of newly-added directories.
      
      ### This information is probably available earlier in the commit
      ### process, but we just don't capture it.  If/when we rework
@@ -1771,23 +1744,20 @@ svn_client__do_commit(const char *repos_
       svn_client_commit_item3_t *item =
         APR_ARRAY_IDX(commit_items, i, svn_client_commit_item3_t *);
       apr_array_header_t *children;
-      svn_client_commit_item3_t *next_item;
+      const char *parent_relpath = svn_relpath_dirname(item->session_relpath,
+                                                       scratch_pool);
 
-      svn_pool_clear(iterpool);
-
-      /* If we have a path, we aren't newly added, nor will any of the
-         rest of our paths, since COMMIT_ITEMS is depth-first sorted. */
-      if (item->path)
-        break;
-
-      children = apr_array_make(scratch_pool, 1, sizeof(const char *));
-      next_item = APR_ARRAY_IDX(commit_items, i+1,
-                                            svn_client_commit_item3_t *);
+      children = apr_hash_get(new_children, parent_relpath,
+                              APR_HASH_KEY_STRING);
+      if (!children)
+        {
+          children = apr_array_make(scratch_pool, 1, sizeof(const char *));
+          apr_hash_set(new_children, parent_relpath, APR_HASH_KEY_STRING,
+                       children);
+        }
+    
       APR_ARRAY_PUSH(children, const char *) =
-            svn_relpath_basename(next_item->session_relpath, scratch_pool);
-                        
-      apr_hash_set(new_children, item->session_relpath, APR_HASH_KEY_STRING,
-                   children);
+            svn_relpath_basename(item->session_relpath, scratch_pool);
     }
 
   /* Build a hash from our COMMIT_ITEMS array, keyed on the



Mime
View raw message