You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2014/10/30 10:09:07 UTC

svn commit: r1635437 - in /subversion/branches/move-tracking-2/subversion: include/private/svn_editor3.h libsvn_delta/compat3.c libsvn_delta/editor3.c svnmover/svnmover.c

Author: julianfoad
Date: Thu Oct 30 09:09:06 2014
New Revision: 1635437

URL: http://svn.apache.org/r1635437
Log:
On the 'move-tracking-2' branch: More pool usage fixes etc.

* subversion/include/private/svn_editor3.h
  (svn_branch_el_rev_content_create): Add a doc string.
  (svn_branch_el_rev_content_dup): New.
  (svn_branch_el_rev_content_equal): Add a doc string. Remove a redundant
    parameter.

* subversion/libsvn_delta/compat3.c
  (svn_branch_el_rev_content_dup): New.
  (svn_branch_el_rev_content_equal): Remove a redundant parameter.
  (branch_map_copy_children,
   branch_map_branch_children): Duplicate the new data.
  (svn_branch_subtree_differences): Update the call to
    svn_branch_el_rev_content_equal().

* subversion/libsvn_delta/editor3.c
  (svn_editor3_node_content_create_ref,
   svn_editor3_node_content_create_dir,
   svn_editor3_node_content_create_file,
   svn_editor3_node_content_create_symlink): Duplicate everything into the
    result pool.

* subversion/svnmover/svnmover.c
  (element_merge): Update the calls to svn_branch_el_rev_content_equal().

Modified:
    subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h
    subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c
    subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c
    subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c

Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h?rev=1635437&r1=1635436&r2=1635437&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h Thu Oct 30 09:09:06 2014
@@ -1689,17 +1689,25 @@ typedef struct svn_branch_el_rev_content
 
 } svn_branch_el_rev_content_t;
 
-/*  */
+/* Return a new content object constructed with deep copies of PARENT_EID,
+ * NAME and NODE_CONTENT, allocated in RESULT_POOL.
+ */
 svn_branch_el_rev_content_t *
 svn_branch_el_rev_content_create(svn_editor3_nbid_t parent_eid,
                                  const char *name,
                                  const svn_editor3_node_content_t *node_content,
                                  apr_pool_t *result_pool);
 
-/*  */
+/* Return a new content object constructed with a deep copy of OLD,
+ * allocated in RESULT_POOL.
+ */
+svn_branch_el_rev_content_t *
+svn_branch_el_rev_content_dup(const svn_branch_el_rev_content_t *old,
+                              apr_pool_t *result_pool);
+
+/* Return TRUE iff CONTENT_LEFT is the same as CONTENT_RIGHT. */
 svn_boolean_t
-svn_branch_el_rev_content_equal(int eid,
-                                const svn_branch_el_rev_content_t *content_left,
+svn_branch_el_rev_content_equal(const svn_branch_el_rev_content_t *content_left,
                                 const svn_branch_el_rev_content_t *content_right,
                                 apr_pool_t *scratch_pool);
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c?rev=1635437&r1=1635436&r2=1635437&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c Thu Oct 30 09:09:06 2014
@@ -1873,9 +1873,20 @@ svn_branch_el_rev_content_create(svn_edi
   return content;
 }
 
+svn_branch_el_rev_content_t *
+svn_branch_el_rev_content_dup(const svn_branch_el_rev_content_t *old,
+                              apr_pool_t *result_pool)
+{
+  svn_branch_el_rev_content_t *content
+     = apr_pmemdup(result_pool, old, sizeof(*content));
+
+  content->name = apr_pstrdup(result_pool, old->name);
+  content->content = svn_editor3_node_content_dup(old->content, result_pool);
+  return content;
+}
+
 svn_boolean_t
-svn_branch_el_rev_content_equal(int eid,
-                                const svn_branch_el_rev_content_t *content_left,
+svn_branch_el_rev_content_equal(const svn_branch_el_rev_content_t *content_left,
                                 const svn_branch_el_rev_content_t *content_right,
                                 apr_pool_t *scratch_pool)
 {
@@ -2266,7 +2277,6 @@ branch_map_copy_children(svn_branch_inst
                          int to_parent_eid,
                          apr_pool_t *scratch_pool)
 {
-  apr_pool_t *map_pool = apr_hash_pool_get(to_branch->e_map);
   apr_hash_index_t *hi;
 
   /* The 'from' and 'to' nodes must exist. */
@@ -2283,11 +2293,10 @@ branch_map_copy_children(svn_branch_inst
       if (from_node->parent_eid == from_parent_eid)
         {
           int new_eid = family_add_new_element(to_branch->sibling_defn->family);
-          svn_branch_el_rev_content_t *new_node
-            = svn_branch_el_rev_content_create(to_parent_eid, from_node->name,
-                                               from_node->content, map_pool);
 
-          branch_map_set(to_branch, new_eid, new_node);
+          branch_map_update(to_branch, new_eid,
+                            to_parent_eid, from_node->name,
+                            from_node->content);
 
           /* Recurse. (We don't try to check whether it's a directory node,
              as we might not have the node kind in the map.) */
@@ -2346,8 +2355,9 @@ branch_map_branch_children(svn_branch_in
 
           SVN_ERR(copy_content_from(&this_content, from_branch, this_eid,
                                     scratch_pool, scratch_pool));
-          from_node->content = this_content;
-          branch_map_set(to_branch, this_eid, from_node);
+          branch_map_update(to_branch, this_eid,
+                            from_node->parent_eid, from_node->name,
+                            this_content);
 
           /* Recurse. (We don't try to check whether it's a directory node,
              as we might not have the node kind in the map.) */
@@ -3117,7 +3127,7 @@ svn_branch_subtree_differences(apr_hash_
                                         result_pool, scratch_pool));
         }
 
-      if (! svn_branch_el_rev_content_equal(e, content_left, content_right, scratch_pool))
+      if (! svn_branch_el_rev_content_equal(content_left, content_right, scratch_pool))
         {
           int *eid_stored = apr_pmemdup(result_pool, &e, sizeof(e));
           svn_branch_el_rev_content_t **contents

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c?rev=1635437&r1=1635436&r2=1635437&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c Thu Oct 30 09:09:06 2014
@@ -509,7 +509,7 @@ svn_editor3_node_content_create_ref(svn_
     = apr_pcalloc(result_pool, sizeof(*new_content));
 
   new_content->kind = svn_node_unknown;
-  new_content->ref = ref;
+  new_content->ref = svn_editor3_peg_path_dup(ref, result_pool);
   return new_content;
 }
 
@@ -521,7 +521,7 @@ svn_editor3_node_content_create_dir(apr_
     = apr_pcalloc(result_pool, sizeof(*new_content));
 
   new_content->kind = svn_node_dir;
-  new_content->props = props;
+  new_content->props = svn_prop_hash_dup(props, result_pool);
   return new_content;
 }
 
@@ -536,8 +536,8 @@ svn_editor3_node_content_create_file(apr
   SVN_ERR_ASSERT_NO_RETURN(text);
 
   new_content->kind = svn_node_file;
-  new_content->props = props;
-  new_content->text = text;
+  new_content->props = svn_prop_hash_dup(props, result_pool);
+  new_content->text = svn_stringbuf_dup(text, result_pool);
   return new_content;
 }
 
@@ -552,8 +552,8 @@ svn_editor3_node_content_create_symlink(
   SVN_ERR_ASSERT_NO_RETURN(target);
 
   new_content->kind = svn_node_symlink;
-  new_content->props = props;
-  new_content->target = target;
+  new_content->props = svn_prop_hash_dup(props, result_pool);
+  new_content->target = apr_pstrdup(result_pool, target);
   return new_content;
 }
 

Modified: subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c?rev=1635437&r1=1635436&r2=1635437&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Thu Oct 30 09:09:06 2014
@@ -374,9 +374,9 @@ element_merge(svn_branch_el_rev_content_
               apr_pool_t *result_pool,
               apr_pool_t *scratch_pool)
 {
-  svn_boolean_t same1 = svn_branch_el_rev_content_equal(eid, yca, side1,
+  svn_boolean_t same1 = svn_branch_el_rev_content_equal(yca, side1,
                                                         scratch_pool);
-  svn_boolean_t same2 = svn_branch_el_rev_content_equal(eid, yca, side2,
+  svn_boolean_t same2 = svn_branch_el_rev_content_equal(yca, side2,
                                                         scratch_pool);
   svn_boolean_t conflict = FALSE;
   svn_branch_el_rev_content_t *result = NULL;
@@ -488,7 +488,7 @@ element_merge(svn_branch_el_rev_content_
     {
       /* Double add (as we already handled the case where YCA also exists) */
       if (policy->merge_double_add
-          && svn_branch_el_rev_content_equal(eid, side1, side2, scratch_pool))
+          && svn_branch_el_rev_content_equal(side1, side2, scratch_pool))
         {
           SVN_DBG(("e%d double add",
                    eid));
@@ -498,7 +498,7 @@ element_merge(svn_branch_el_rev_content_
         {
           SVN_DBG(("e%d conflict: add vs. add (%s)",
                    eid,
-                   svn_branch_el_rev_content_equal(eid, side1, side2,
+                   svn_branch_el_rev_content_equal(side1, side2,
                                                    scratch_pool)
                      ? "same content" : "different content"));
           conflict = TRUE;