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 2015/04/07 12:22:57 UTC
svn commit: r1671788 - in /subversion/branches/move-tracking-2/subversion:
include/private/svn_branch.h libsvn_delta/branch.c
Author: julianfoad
Date: Tue Apr 7 10:22:56 2015
New Revision: 1671788
URL: http://svn.apache.org/r1671788
Log:
On the 'move-tracking-2' branch: Make a function slightly easier to use.
* subversion/include/private/svn_branch.h,
subversion/libsvn_delta/branch.c
(svn_branch_map_add_subtree): Allow calling with TO_EID=-1 to generate a
new EID for the subtree root.
(svn_branch_copy_subtree_r): Simplify by using that feature.
Modified:
subversion/branches/move-tracking-2/subversion/include/private/svn_branch.h
subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c
Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_branch.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_branch.h?rev=1671788&r1=1671787&r2=1671788&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/private/svn_branch.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/private/svn_branch.h Tue Apr 7 10:22:56 2015
@@ -555,11 +555,14 @@ svn_branch_branch_subtree_r2(svn_branch_
svn_branch_sibling_t *new_branch_def,
apr_pool_t *scratch_pool);
-/* Create a copy of NEW_SUBTREE at TO_BRANCH:TO_EID, generating new elements
- * for all elements in NEW_SUBTREE except the root. Set the root element's
- * parent to NEW_PARENT_EID and name to NEW_NAME.
+/* Create a copy of NEW_SUBTREE in TO_BRANCH, generating a new element
+ * for each non-root element in NEW_SUBTREE.
*
- * Alter the 'to' element if it already exists, otherwise instantiate it.
+ * For the new subtree root element, if TO_EID is -1, generate a new EID,
+ * otherwise alter (if it exists) or instantiate the element TO_EID.
+ *
+ * Set the new subtree root element's parent to NEW_PARENT_EID and name to
+ * NEW_NAME.
*/
svn_error_t *
svn_branch_map_add_subtree(svn_branch_instance_t *to_branch,
Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c?rev=1671788&r1=1671787&r2=1671788&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c Tue Apr 7 10:22:56 2015
@@ -746,6 +746,13 @@ svn_branch_map_add_subtree(svn_branch_in
apr_hash_index_t *hi;
svn_branch_el_rev_content_t *new_root_content;
+ /* Get a new EID for the root element, if not given. */
+ if (to_eid == -1)
+ {
+ /* Assign a new EID for the new subtree's root element */
+ to_eid = svn_branch_family_add_new_element(to_branch->sibling_defn->family);
+ }
+
/* Create the new subtree root element */
new_root_content = svn_int_hash_get(new_subtree.e_map, new_subtree.root_eid);
if (new_root_content->content)
@@ -764,15 +771,13 @@ svn_branch_map_add_subtree(svn_branch_in
if (from_node->parent_eid == new_subtree.root_eid)
{
- int new_eid
- = svn_branch_family_add_new_element(to_branch->sibling_defn->family);
svn_branch_subtree_t this_subtree;
/* Recurse. (We don't try to check whether it's a directory node,
as we might not have the node kind in the map.) */
this_subtree.e_map = new_subtree.e_map;
this_subtree.root_eid = this_from_eid;
- SVN_ERR(svn_branch_map_add_subtree(to_branch, new_eid,
+ SVN_ERR(svn_branch_map_add_subtree(to_branch, -1 /*to_eid*/,
to_eid, from_node->name,
this_subtree, scratch_pool));
}
@@ -1581,13 +1586,11 @@ svn_branch_copy_subtree_r(const svn_bran
const char *to_name,
apr_pool_t *scratch_pool)
{
- int to_eid;
-
- /* Assign a new EID for the new subtree's root element */
- to_eid = svn_branch_family_add_new_element(to_branch->sibling_defn->family);
+ SVN_DBG(("cp subtree from e%d to e%d/%s",
+ from_el_rev->eid, to_parent_eid, to_name));
/* copy the subtree, assigning new EIDs */
- SVN_ERR(svn_branch_map_add_subtree(to_branch, to_eid,
+ SVN_ERR(svn_branch_map_add_subtree(to_branch, -1 /*to_eid*/,
to_parent_eid, to_name,
svn_branch_map_get_subtree(
from_el_rev->branch, from_el_rev->eid,
@@ -1597,9 +1600,6 @@ svn_branch_copy_subtree_r(const svn_bran
/* handle any subbranches under FROM_BRANCH:FROM_EID */
/* ### Later. */
- SVN_DBG(("cp subtree from e%d to e%d (%d/%s)",
- from_el_rev->eid,
- to_eid, to_parent_eid, to_name));
return SVN_NO_ERROR;
}