subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1696374 - in /subversion/branches/move-tracking-2/subversion: include/private/svn_branch.h libsvn_delta/branch.c svnmover/svnmover.c
Date Tue, 18 Aug 2015 09:05:05 GMT
Author: julianfoad
Date: Tue Aug 18 09:05:05 2015
New Revision: 1696374

URL: http://svn.apache.org/r1696374
Log:
On the 'move-tracking-2' branch: Remove 'svn_branch_branch' from the public
API, because 'svn_branch_branch_subtree' is a better, more general form of
the same operation.

* subversion/include/private/svn_branch.h,
  subversion/libsvn_delta/branch.c
  (svn_branch_branch): Move and rename...

* subversion/svnmover/svnmover.c
  (do_branch): ... to here.
  (execute): Track the rename.

Modified:
    subversion/branches/move-tracking-2/subversion/include/private/svn_branch.h
    subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c
    subversion/branches/move-tracking-2/subversion/svnmover/svnmover.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=1696374&r1=1696373&r2=1696374&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 Aug 18
09:05:05 2015
@@ -765,29 +765,6 @@ svn_error_t *
 svn_branch_state_serialize(svn_stream_t *stream,
                            svn_branch_state_t *branch,
                            apr_pool_t *scratch_pool);
-  
-/* Branch all or part of an existing branch, making a new branch.
- *
- * Branch the subtree of FROM_BRANCH found at FROM_EID, to create
- * a new branch at TO_OUTER_BRANCH:TO_OUTER_PARENT_EID:NEW_NAME.
- *
- * FROM_BRANCH must be an immediate sub-branch of TO_OUTER_BRANCH.
- *
- * FROM_BRANCH:FROM_EID must be an existing element. It may be the
- * root of FROM_BRANCH. It must not be the root of a subbranch of
- * FROM_BRANCH.
- *
- * TO_OUTER_BRANCH:TO_OUTER_PARENT_EID must be an existing directory
- * and NEW_NAME must be nonexistent in that directory.
- */
-svn_error_t *
-svn_branch_branch(svn_branch_state_t **new_branch_p,
-                  svn_branch_state_t *from_branch,
-                  int from_eid,
-                  svn_branch_state_t *to_outer_branch,
-                  svn_branch_eid_t to_outer_parent_eid,
-                  const char *new_name,
-                  apr_pool_t *scratch_pool);
 
 
 #ifdef __cplusplus

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=1696374&r1=1696373&r2=1696374&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c Tue Aug 18 09:05:05
2015
@@ -1349,47 +1349,6 @@ svn_branch_branch_subtree(svn_branch_sta
 }
 
 svn_error_t *
-svn_branch_branch(svn_branch_state_t **new_branch_p,
-                  svn_branch_state_t *from_branch,
-                  int from_eid,
-                  svn_branch_state_t *to_outer_branch,
-                  svn_branch_eid_t to_outer_parent_eid,
-                  const char *new_name,
-                  apr_pool_t *scratch_pool)
-{
-  svn_branch_subtree_t *from_subtree;
-  int to_outer_eid;
-
-  /* Source element must exist */
-  if (! svn_branch_get_path_by_eid(from_branch, from_eid, scratch_pool))
-    {
-      return svn_error_createf(SVN_ERR_BRANCHING, NULL,
-                               _("cannot branch from b%s e%d: "
-                                 "does not exist"),
-                               svn_branch_get_id(
-                                 from_branch, scratch_pool), from_eid);
-    }
-
-  /* Fetch the subtree to be branched before creating the new subbranch root
-     element, as we don't want to recurse (endlessly) into that in the case
-     where it is an immediate subbranch of FROM_BRANCH. */
-  from_subtree = svn_branch_get_subtree(from_branch, from_eid, scratch_pool);
-
-  /* assign new eid to root element (outer branch) */
-  to_outer_eid
-    = svn_branch_allocate_new_eid(to_outer_branch->rev_root);
-  svn_branch_update_subbranch_root_element(to_outer_branch, to_outer_eid,
-                                           to_outer_parent_eid, new_name);
-
-  SVN_ERR(svn_branch_branch_subtree(new_branch_p,
-                                    *from_subtree,
-                                    to_outer_branch, to_outer_eid,
-                                    scratch_pool));
-
-  return SVN_NO_ERROR;
-}
-
-svn_error_t *
 svn_branch_copy_subtree(const svn_branch_el_rev_id_t *from_el_rev,
                         svn_branch_state_t *to_branch,
                         svn_branch_eid_t to_parent_eid,

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=1696374&r1=1696373&r2=1696374&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Tue Aug 18 09:05:05
2015
@@ -2132,6 +2132,61 @@ mk_branch(svn_branch_state_t **new_branc
   return SVN_NO_ERROR;
 }
 
+/* Branch all or part of an existing branch, making a new branch.
+ *
+ * Branch the subtree of FROM_BRANCH found at FROM_EID, to create
+ * a new branch at TO_OUTER_BRANCH:TO_OUTER_PARENT_EID:NEW_NAME.
+ *
+ * FROM_BRANCH must be an immediate sub-branch of TO_OUTER_BRANCH.
+ *
+ * FROM_BRANCH:FROM_EID must be an existing element. It may be the
+ * root of FROM_BRANCH. It must not be the root of a subbranch of
+ * FROM_BRANCH.
+ *
+ * TO_OUTER_BRANCH:TO_OUTER_PARENT_EID must be an existing directory
+ * and NEW_NAME must be nonexistent in that directory.
+ */
+static svn_error_t *
+do_branch(svn_branch_state_t **new_branch_p,
+          svn_branch_state_t *from_branch,
+          int from_eid,
+          svn_branch_state_t *to_outer_branch,
+          svn_branch_eid_t to_outer_parent_eid,
+          const char *new_name,
+          apr_pool_t *scratch_pool)
+{
+  svn_branch_subtree_t *from_subtree;
+  int to_outer_eid;
+
+  /* Source element must exist */
+  if (! svn_branch_get_path_by_eid(from_branch, from_eid, scratch_pool))
+    {
+      return svn_error_createf(SVN_ERR_BRANCHING, NULL,
+                               _("cannot branch from b%s e%d: "
+                                 "does not exist"),
+                               svn_branch_get_id(
+                                 from_branch, scratch_pool), from_eid);
+    }
+
+  /* Fetch the subtree to be branched before creating the new subbranch root
+     element, as we don't want to recurse (endlessly) into that in the case
+     where it is an immediate subbranch of FROM_BRANCH. */
+  from_subtree = svn_branch_get_subtree(from_branch, from_eid, scratch_pool);
+
+  /* assign new eid to root element (outer branch) */
+  to_outer_eid
+    = svn_branch_allocate_new_eid(to_outer_branch->rev_root);
+  svn_branch_update_subbranch_root_element(to_outer_branch, to_outer_eid,
+                                           to_outer_parent_eid, new_name);
+
+  SVN_ERR(svn_branch_branch_subtree(new_branch_p,
+                                    *from_subtree,
+                                    to_outer_branch, to_outer_eid,
+                                    scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
 /* Branch the subtree of FROM_BRANCH found at FROM_EID, to appear
  * in the existing branch TO_BRANCH at TO_PARENT_EID:NEW_NAME.
  *
@@ -2644,11 +2699,11 @@ execute(svnmover_wc_t *wc,
           {
             svn_branch_state_t *new_branch;
 
-            SVN_ERR(svn_branch_branch(&new_branch,
-                                      arg[0]->el_rev->branch, arg[0]->el_rev->eid,
-                                      arg[1]->el_rev->branch, arg[1]->parent_el_rev->eid,
-                                      arg[1]->path_name,
-                                      iterpool));
+            SVN_ERR(do_branch(&new_branch,
+                              arg[0]->el_rev->branch, arg[0]->el_rev->eid,
+                              arg[1]->el_rev->branch, arg[1]->parent_el_rev->eid,
+                              arg[1]->path_name,
+                              iterpool));
             notify_v("A+   %s%s", action->relpath[1],
                      branch_str(new_branch, iterpool));
           }



Mime
View raw message