subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1682876 - in /subversion/branches/move-tracking-2/subversion: include/private/svn_editor3e.h libsvn_delta/compat3e.c libsvn_delta/editor3e.c svnmover/svnmover.c
Date Mon, 01 Jun 2015 11:36:08 GMT
Author: julianfoad
Date: Mon Jun  1 11:36:07 2015
New Revision: 1682876

URL: http://svn.apache.org/r1682876
Log:
On the 'move-tracking-2' branch: Remove an editor drive ordering
requirement.

Let the edit driver obtain the EID for a new element (that will be created
through the 'add' method) so that it can use this EID as the parent EID of
other elements before calling 'add'. Thus it is no longer necessary to add a
new directory before making any calls that refer to it as a parent.

* subversion/include/private/svn_editor3e.h
  (svn_editor3_new_eid,
   svn_editor3_cb_new_eid_t): New.
  (svn_editor3_add,
   svn_editor3_cb_add_t): Don't create a new EID here. Remove the unused 'kind'
    parameter too, while we're here.
  (svn_editor3_cb_funcs_t): Add the 'new_eid' method.

* subversion/libsvn_delta/editor3e.c
  (svn_editor3_new_eid,
   wrap_new_eid): New.
  (svn_editor3_add,
   wrap_add): Update as described above.
  (svn_editor3__get_debug_editor): Add the new method to the vtable.

* subversion/libsvn_delta/compat3e.c
  (editor3_new_eid): New.
  (editor3_add): Update as described above.
  (svn_editor3_in_memory,
   svn_editor3__ev3_from_delta_for_commit): Add the new method to the vtable.

* subversion/svnmover/svnmover.c
  (mk_branch
   execute): Call svn_editor3_new_eid() before svn_editor3_add().

Modified:
    subversion/branches/move-tracking-2/subversion/include/private/svn_editor3e.h
    subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3e.c
    subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c
    subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c

Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_editor3e.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_editor3e.h?rev=1682876&r1=1682875&r2=1682876&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/private/svn_editor3e.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/private/svn_editor3e.h Mon Jun
 1 11:36:07 2015
@@ -586,7 +586,14 @@ typedef struct svn_editor3_t svn_editor3
  *     but in that case the caller would need to specify the new eids.]
  */
 
-/** Create a new element of kind @a new_kind in branch @a branch.
+/** Allocate a new EID.
+ */
+svn_error_t *
+svn_editor3_new_eid(svn_editor3_t *editor,
+                    svn_branch_eid_t *eid_p,
+                    svn_branch_state_t *branch);
+
+/** Create a new element in branch @a branch.
  * 
  * Assign the new element a new element id; store this in @a *eid_p if
  * @a eid_p is not null.
@@ -594,16 +601,14 @@ typedef struct svn_editor3_t svn_editor3
  * Set the element's parent and name to @a new_parent_eid and @a new_name.
  *
  * Set the payload to @a new_payload. If @a new_payload is null, create a
- * subbranch-root element instead of a normal element. (@a new_kind must
- * be svn_node_unknown in this case.)
+ * subbranch-root element instead of a normal element.
  *
  * @see #svn_editor3_t
  */
 svn_error_t *
 svn_editor3_add(svn_editor3_t *editor,
-                svn_branch_eid_t *eid,
-                svn_node_kind_t new_kind,
                 svn_branch_state_t *branch,
+                svn_branch_eid_t eid,
                 svn_branch_eid_t new_parent_eid,
                 const char *new_name,
                 const svn_element_payload_t *new_payload);
@@ -823,13 +828,20 @@ svn_editor3_abort(svn_editor3_t *editor)
  * @{
  */
 
+/** @see svn_editor3_new_eid(), #svn_editor3_t
+ */
+typedef svn_error_t *(*svn_editor3_cb_new_eid_t)(
+  void *baton,
+  svn_branch_eid_t *eid_p,
+  svn_branch_state_t *branch,
+  apr_pool_t *scratch_pool);
+
 /** @see svn_editor3_add(), #svn_editor3_t
  */
 typedef svn_error_t *(*svn_editor3_cb_add_t)(
   void *baton,
-  svn_branch_eid_t *eid,
-  svn_node_kind_t new_kind,
   svn_branch_state_t *branch,
+  svn_branch_eid_t eid,
   svn_branch_eid_t new_parent_eid,
   const char *new_name,
   const svn_element_payload_t *new_payload,
@@ -922,6 +934,7 @@ typedef svn_error_t *(*svn_editor3_cb_ab
  */
 typedef struct svn_editor3_cb_funcs_t
 {
+  svn_editor3_cb_new_eid_t cb_new_eid;
   svn_editor3_cb_add_t cb_add;
   svn_editor3_cb_copy_one_t cb_copy_one;
   svn_editor3_cb_copy_tree_t cb_copy_tree;

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3e.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3e.c?rev=1682876&r1=1682875&r2=1682876&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3e.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3e.c Mon Jun  1 11:36:07
2015
@@ -1099,19 +1099,27 @@ svn_editor3_find_branch_element_by_rrpat
 
 /* An #svn_editor3_t method. */
 static svn_error_t *
+editor3_new_eid(void *baton,
+                svn_branch_eid_t *eid_p,
+                svn_branch_state_t *branch,
+                apr_pool_t *scratch_pool)
+{
+  int eid = svn_branch_allocate_new_eid(branch->rev_root);
+
+  *eid_p = eid;
+  return SVN_NO_ERROR;
+}
+
+/* An #svn_editor3_t method. */
+static svn_error_t *
 editor3_add(void *baton,
-            svn_branch_eid_t *eid_p,
-            svn_node_kind_t new_kind,
             svn_branch_state_t *branch,
+            svn_branch_eid_t eid,
             svn_branch_eid_t new_parent_eid,
             const char *new_name,
             const svn_element_payload_t *new_payload,
             apr_pool_t *scratch_pool)
 {
-  int eid;
-
-  eid = svn_branch_allocate_new_eid(branch->rev_root);
-
   if (new_payload)
     {
       SVN_DBG(("add(e%d): parent e%d, name '%s', kind %s",
@@ -1130,7 +1138,6 @@ editor3_add(void *baton,
                                                new_parent_eid, new_name);
     }
 
-  *eid_p = eid;
   return SVN_NO_ERROR;
 }
 
@@ -1764,6 +1771,7 @@ svn_editor3_in_memory(svn_editor3_t **ed
                       apr_pool_t *result_pool)
 {
   static const svn_editor3_cb_funcs_t editor_funcs = {
+    editor3_new_eid,
     editor3_add,
     editor3_copy_one,
     editor3_copy_tree,
@@ -1802,6 +1810,7 @@ svn_editor3__ev3_from_delta_for_commit(
                         apr_pool_t *scratch_pool)
 {
   static const svn_editor3_cb_funcs_t editor_funcs = {
+    editor3_new_eid,
     editor3_add,
     editor3_copy_one,
     editor3_copy_tree,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c?rev=1682876&r1=1682875&r2=1682876&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c Mon Jun  1 11:36:07
2015
@@ -189,35 +189,44 @@ check_cancel(svn_editor3_t *editor)
                              #method, #expr)
 
 svn_error_t *
+svn_editor3_new_eid(svn_editor3_t *editor,
+                    svn_branch_eid_t *eid_p,
+                    svn_branch_state_t *branch)
+{
+  int eid = -1;
+
+  DO_CALLBACK(editor, cb_new_eid,
+              2(&eid, branch));
+
+  SVN_ERR_ASSERT(VALID_EID(eid));
+
+  /* We allow the output pointer to be null, here, so that implementations
+     may assume their output pointer is non-null. */
+  if (eid_p)
+    *eid_p = eid;
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_editor3_add(svn_editor3_t *editor,
-                svn_branch_eid_t *local_eid_p,
-                svn_node_kind_t new_kind,
                 svn_branch_state_t *branch,
+                svn_branch_eid_t eid,
                 svn_branch_eid_t new_parent_eid,
                 const char *new_name,
                 const svn_element_payload_t *new_payload)
 {
-  int eid = -1;
-
-  SVN_ERR_ASSERT(new_payload ? VALID_NODE_KIND(new_kind)
-                             : new_kind == svn_node_unknown);
+  SVN_ERR_ASSERT(VALID_EID(eid));
   SVN_ERR_ASSERT(VALID_EID(new_parent_eid));
   SVN_ERR_ASSERT(VALID_NAME(new_name));
   SVN_ERR_ASSERT(!new_payload || VALID_PAYLOAD(new_payload));
-  SVN_ERR_ASSERT(!new_payload || new_payload->kind == new_kind);
+  VERIFY(alter, new_parent_eid != eid);
 
   DO_CALLBACK(editor, cb_add,
-              6(&eid, new_kind,
-                branch, new_parent_eid, new_name,
+              5(branch, eid,
+                new_parent_eid, new_name,
                 new_payload));
 
-  SVN_ERR_ASSERT(VALID_EID(eid));
-
-  /* We allow the output pointer to be null, here, so that implementations
-     may assume their output pointer is non-null. */
-  if (local_eid_p)
-    *local_eid_p = eid;
-
   return SVN_NO_ERROR;
 }
 
@@ -410,10 +419,22 @@ eid_str(svn_branch_eid_t eid,
 }
 
 static svn_error_t *
+wrap_new_eid(void *baton,
+             svn_branch_eid_t *eid_p,
+             svn_branch_state_t *branch,
+             apr_pool_t *scratch_pool)
+{
+  wrapper_baton_t *eb = baton;
+
+  SVN_ERR(svn_editor3_new_eid(eb->wrapped_editor,
+                              eid_p, branch));
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
 wrap_add(void *baton,
-         svn_branch_eid_t *local_eid,
-         svn_node_kind_t new_kind,
          svn_branch_state_t *branch,
+         svn_branch_eid_t eid,
          svn_branch_eid_t new_parent_eid,
          const char *new_name,
          const svn_element_payload_t *new_payload,
@@ -421,12 +442,11 @@ wrap_add(void *baton,
 {
   wrapper_baton_t *eb = baton;
 
-  dbg(eb, scratch_pool, "... : add(k=%s, p=%s, n=%s, c=...)",
-      svn_node_kind_to_word(new_kind),
+  dbg(eb, scratch_pool, "... : add(p=%s, n=%s, c=...)",
       eid_str(new_parent_eid, scratch_pool), new_name);
   SVN_ERR(svn_editor3_add(eb->wrapped_editor,
-                          local_eid, new_kind,
-                          branch, new_parent_eid, new_name, new_payload));
+                          branch, eid,
+                          new_parent_eid, new_name, new_payload));
   return SVN_NO_ERROR;
 }
 
@@ -545,6 +565,7 @@ svn_editor3__get_debug_editor(svn_editor
                               apr_pool_t *result_pool)
 {
   static const svn_editor3_cb_funcs_t wrapper_funcs = {
+    wrap_new_eid,
     wrap_add,
     wrap_copy_one,
     wrap_copy_tree,

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=1682876&r1=1682875&r2=1682876&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Mon Jun  1 11:36:07
2015
@@ -1891,8 +1891,10 @@ mk_branch(svn_branch_state_t **new_branc
   int new_outer_eid;
   svn_branch_state_t *new_branch;
 
-  SVN_ERR(svn_editor3_add(editor, &new_outer_eid, svn_node_unknown,
-                          outer_branch, outer_parent_eid, outer_name,
+  SVN_ERR(svn_editor3_new_eid(editor, &new_outer_eid, outer_branch));
+  SVN_ERR(svn_editor3_add(editor,
+                          outer_branch, new_outer_eid,
+                          outer_parent_eid, outer_name,
                           NULL /*new_payload*/));
   new_branch = svn_branch_add_new_branch(
                  outer_branch, new_outer_eid, -1/*new_root_eid*/,
@@ -2254,8 +2256,10 @@ execute(const apr_array_header_t *action
               = svn_element_payload_create_dir(props, iterpool);
             int new_eid;
 
-            SVN_ERR(svn_editor3_add(editor, &new_eid, svn_node_dir,
-                                    arg[0]->parent_el_rev->branch,
+            SVN_ERR(svn_editor3_new_eid(editor, &new_eid,
+                                        arg[0]->parent_el_rev->branch));
+            SVN_ERR(svn_editor3_add(editor,
+                                    arg[0]->parent_el_rev->branch, new_eid,
                                     arg[0]->parent_el_rev->eid, arg[0]->path_name,
                                     payload));
           }
@@ -2318,8 +2322,10 @@ execute(const apr_array_header_t *action
               {
                 int new_eid;
 
-                SVN_ERR(svn_editor3_add(editor, &new_eid, svn_node_file,
-                                        arg[1]->parent_el_rev->branch,
+                SVN_ERR(svn_editor3_new_eid(editor, &new_eid,
+                                            arg[1]->parent_el_rev->branch));
+                SVN_ERR(svn_editor3_add(editor,
+                                        arg[1]->parent_el_rev->branch, new_eid,
                                         parent_eid, name,
                                         payload));
               }



Mime
View raw message