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/05/28 19:55:12 UTC

svn commit: r1682292 - in /subversion/branches/move-tracking-2: BRANCH-README subversion/include/private/svn_editor3e.h subversion/libsvn_delta/compat3e.c subversion/libsvn_delta/editor3e.c subversion/svnmover/svnmover.c

Author: julianfoad
Date: Thu May 28 17:55:11 2015
New Revision: 1682292

URL: http://svn.apache.org/r1682292
Log:
On the 'move-tracking-2' branch: Combine the 'instantiate' and 'alter' methods
into one, which is called 'alter' for now.

(I think it still makes sense to combine these with the 'add' method too.)

* BRANCH-README
  Mention the 'add' method in the 'to do' note about this topic.

* subversion/include/private/svn_editor3e.h
  (svn_editor3_instantiate): Delete.
  (svn_editor3_alter): Update and improve the doc string.
  (svn_editor3_cb_funcs_t): Delete the 'instantiate' member.

* subversion/libsvn_delta/compat3e.c
  (editor3_instantiate): Delete.
  (editor3_alter): Cope with the case where the element doesn't already
    exist in this branch.
  (svn_editor3_in_memory
   svn_editor3__ev3_from_delta_for_commit): Remove the 'instantiate' method
    from the vtable.

* subversion/libsvn_delta/editor3e.c
  (svn_editor3_instantiate): Delete.
  (svn_editor3_alter): Remove a now-obsolete comment.
  (wrap_instantiate): Delete.
  (svn_editor3__get_debug_editor): Remove the 'instantiate' method
    from the vtable.

* subversion/svnmover/svnmover.c
  (subtree_replay,
   branch_merge_subtree_r): s/svn_editor3_instantiate/svn_editor3_alter/.

Modified:
    subversion/branches/move-tracking-2/BRANCH-README
    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/BRANCH-README
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/BRANCH-README?rev=1682292&r1=1682291&r2=1682292&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/BRANCH-README (original)
+++ subversion/branches/move-tracking-2/BRANCH-README Thu May 28 17:55:11 2015
@@ -113,8 +113,8 @@ Work on this branch:
 
     Tidying things to do:
 
-      Combine editor3 methods 'instantiate' and 'alter' into a single
-      method.
+      Combine editor3 methods 'instantiate' and 'alter' and probably 'add'
+      as well into a single method.
 
         They have basically the same meaning apart from the precondition
         (does or does not already exist) and the pre-existence should

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=1682292&r1=1682291&r2=1682292&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 Thu May 28 17:55:11 2015
@@ -608,28 +608,6 @@ svn_editor3_add(svn_editor3_t *editor,
                 const char *new_name,
                 const svn_element_payload_t *new_payload);
 
-/* Make the existing element @a eid exist in branch @a branch, assuming it was
- * previously not existing in this branch.
- *
- * This can be used to "branch" the element from another branch during a
- * merge, or to resurrect it.
- *
- * Set the element's parent and name to @a new_parent_eid and @a new_name.
- *
- * Set the payload to @a new_payload.
- *
- * @see #svn_editor3_t
- *
- * ### Need to specify where the underlying FS node is to be "copied" from?
- */
-svn_error_t *
-svn_editor3_instantiate(svn_editor3_t *editor,
-                        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);
-
 /** Create a new element that is copied from a pre-existing
  * <SVN_EDITOR3_WITH_COPY_FROM_THIS_REV> or newly created </>
  * element, with the same or different content (parent, name, payload).
@@ -747,9 +725,8 @@ svn_editor3_delete(svn_editor3_t *editor
                    svn_branch_state_t *branch,
                    svn_branch_eid_t eid);
 
-/** Alter the tree position and/or payload of the element identified
- * by @a eid.
- * <SVN_EDITOR3_WITH_RESURRECTION> ### or resurrect it? </>
+/** Specify the tree position and payload of the element of @a branch
+ * identified by @a eid.
  *
  * Set the element's parent and name to @a new_parent_eid and @a new_name.
  *
@@ -760,6 +737,21 @@ svn_editor3_delete(svn_editor3_t *editor
  * SHOULD NOT be sent.
  *
  * @see #svn_editor3_t
+ *
+ * If the element ...                   we can describe the effect as ...
+ *
+ *   exists in the branch               =>  altering it;
+ *   previously existed in the branch   =>  resurrecting it;
+ *   only existed in other branches     =>  branching it;
+ *   never existed anywhere             =>  creating it.
+ *
+ * However, these are imprecise descriptions and not mutually exclusive.
+ * For example, if it existed previously in this branch and another, then
+ * we may describe the result as 'resurrecting' and/or as 'branching'.
+ *
+ * ### When converting this edit to an Ev1 edit, do we need a way to specify
+ *     where the Ev1 node is to be "copied" from, when this is branching the
+ *     element?
  */
 svn_error_t *
 svn_editor3_alter(svn_editor3_t *editor,
@@ -931,7 +923,6 @@ typedef svn_error_t *(*svn_editor3_cb_ab
 typedef struct svn_editor3_cb_funcs_t
 {
   svn_editor3_cb_add_t cb_add;
-  svn_editor3_cb_instantiate_t cb_instantiate;
   svn_editor3_cb_copy_one_t cb_copy_one;
   svn_editor3_cb_copy_tree_t cb_copy_tree;
   svn_editor3_cb_delete_t cb_delete;

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=1682292&r1=1682291&r2=1682292&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3e.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3e.c Thu May 28 17:55:11 2015
@@ -1136,36 +1136,6 @@ editor3_add(void *baton,
 
 /* An #svn_editor3_t method. */
 static svn_error_t *
-editor3_instantiate(void *baton,
-                    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)
-{
-  if (new_payload)
-    {
-      SVN_DBG(("instantiate(e%d): parent e%d, name '%s', kind %s",
-               eid, new_parent_eid, new_name,
-               svn_node_kind_to_word(new_payload->kind)));
-
-      svn_branch_update_element(branch, eid, new_parent_eid, new_name,
-                                new_payload);
-    }
-  else
-    {
-      SVN_DBG(("instantiate subbranch-root(e%d): parent e%d, name '%s'",
-               eid, new_parent_eid, new_name));
-
-      svn_branch_update_subbranch_root_element(branch, eid,
-                                               new_parent_eid, new_name);
-    }
-  return SVN_NO_ERROR;
-}
-
-/* An #svn_editor3_t method. */
-static svn_error_t *
 editor3_copy_one(void *baton,
                  const svn_branch_el_rev_id_t *src_el_rev,
                  svn_branch_state_t *branch,
@@ -1238,7 +1208,11 @@ editor3_alter(void *baton,
   /* New payload shall be the same as before if NEW_PAYLOAD is null. */
   if (! new_payload)
     {
-      new_payload = svn_branch_get_element(branch, eid)->payload;
+      svn_branch_el_rev_content_t *existing_element
+        = svn_branch_get_element(branch, eid);
+
+      if (existing_element)
+        new_payload = existing_element->payload;
     }
 
   if (new_payload)
@@ -1801,7 +1775,6 @@ svn_editor3_in_memory(svn_editor3_t **ed
 {
   static const svn_editor3_cb_funcs_t editor_funcs = {
     editor3_add,
-    editor3_instantiate,
     editor3_copy_one,
     editor3_copy_tree,
     editor3_delete,
@@ -1840,7 +1813,6 @@ svn_editor3__ev3_from_delta_for_commit(
 {
   static const svn_editor3_cb_funcs_t editor_funcs = {
     editor3_add,
-    editor3_instantiate,
     editor3_copy_one,
     editor3_copy_tree,
     editor3_delete,

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=1682292&r1=1682291&r2=1682292&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c Thu May 28 17:55:11 2015
@@ -217,37 +217,6 @@ svn_editor3_add(svn_editor3_t *editor,
 }
 
 svn_error_t *
-svn_editor3_instantiate(svn_editor3_t *editor,
-                        svn_branch_state_t *branch,
-                        svn_branch_eid_t local_eid,
-                        svn_branch_eid_t new_parent_eid,
-                        const char *new_name,
-                        const svn_element_payload_t *new_payload)
-{
-  SVN_ERR_ASSERT(VALID_EID(local_eid));
-  SVN_ERR_ASSERT(local_eid == branch->root_eid ? new_parent_eid == -1
-                                               : VALID_EID(new_parent_eid));
-  SVN_ERR_ASSERT(local_eid == branch->root_eid ? *new_name == '\0'
-                                               : VALID_NAME(new_name));
-  SVN_ERR_ASSERT(!new_payload || VALID_PAYLOAD(new_payload));
-  VERIFY(instantiate, new_parent_eid != local_eid);
-  /* TODO: verify this element does not exist (in initial state) */
-
-  /* ### Ensure the requested EIDs are allocated... This is not the
-         right way to do it. Should instead map 'to be created' EIDs
-         to new EIDs? See BRANCH-README. */
-  while (local_eid >= branch->rev_root->next_eid
-         || new_parent_eid >= branch->rev_root->next_eid)
-    svn_branch_allocate_new_eid(branch->rev_root);
-
-  DO_CALLBACK(editor, cb_instantiate,
-              5(branch, local_eid,
-                new_parent_eid, new_name,
-                new_payload));
-  return SVN_NO_ERROR;
-}
-
-svn_error_t *
 svn_editor3_copy_one(svn_editor3_t *editor,
                      const svn_branch_el_rev_id_t *src_el_rev,
                      svn_branch_state_t *branch,
@@ -321,7 +290,6 @@ svn_editor3_alter(svn_editor3_t *editor,
                                          : VALID_NAME(new_name));
   SVN_ERR_ASSERT(! new_payload || VALID_PAYLOAD(new_payload));
   VERIFY(alter, new_parent_eid != eid);
-  /* TODO: verify this element exists (in initial state) */
 
   /* ### Ensure the requested EIDs are allocated... This is not the
          right way to do it. Should instead map 'to be created' EIDs
@@ -458,26 +426,6 @@ wrap_add(void *baton,
 }
 
 static svn_error_t *
-wrap_instantiate(void *baton,
-                 svn_branch_state_t *branch,
-                 svn_branch_eid_t local_eid,
-                 svn_branch_eid_t new_parent_eid,
-                 const char *new_name,
-                 const svn_element_payload_t *new_payload,
-                 apr_pool_t *scratch_pool)
-{
-  wrapper_baton_t *eb = baton;
-
-  dbg(eb, scratch_pool, "%s : instantiate(p=%s, n=%s, c=...)",
-      eid_str(local_eid, scratch_pool),
-      eid_str(new_parent_eid, scratch_pool), new_name);
-  SVN_ERR(svn_editor3_instantiate(eb->wrapped_editor,
-                                  branch, local_eid,
-                                  new_parent_eid, new_name, new_payload));
-  return SVN_NO_ERROR;
-}
-
-static svn_error_t *
 wrap_copy_one(void *baton,
               const svn_branch_el_rev_id_t *src_el_rev,
               svn_branch_state_t *branch,
@@ -593,7 +541,6 @@ svn_editor3__get_debug_editor(svn_editor
 {
   static const svn_editor3_cb_funcs_t wrapper_funcs = {
     wrap_add,
-    wrap_instantiate,
     wrap_copy_one,
     wrap_copy_tree,
     wrap_delete,

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=1682292&r1=1682291&r2=1682292&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Thu May 28 17:55:11 2015
@@ -245,10 +245,10 @@ subtree_replay(svn_editor3_t *editor,
           else
             {
               printf("replay: instan. e%d\n", eid);
-              SVN_ERR(svn_editor3_instantiate(editor,
-                                              edit_branch, eid,
-                                              e1->parent_eid, e1->name,
-                                              e1->payload));
+              SVN_ERR(svn_editor3_alter(editor,
+                                        edit_branch, eid,
+                                        e1->parent_eid, e1->name,
+                                        e1->payload));
             }
         }
     }
@@ -1343,9 +1343,9 @@ branch_merge_subtree_r(svn_editor3_t *ed
            * (which is not specified here, but will need to be),
            * which may be in this branch or in another branch.
            */
-          SVN_ERR(svn_editor3_instantiate(editor, tgt->branch, eid,
-                                          result->parent_eid, result->name,
-                                          result->payload));
+          SVN_ERR(svn_editor3_alter(editor, tgt->branch, eid,
+                                    result->parent_eid, result->name,
+                                    result->payload));
 
           SVN_ERR(merge_subbranch(editor, src, tgt, yca, eid, scratch_pool));
         }