Author: hwright
Date: Fri Jan 13 02:41:45 2012
New Revision: 1230867

URL: http://svn.apache.org/viewvc?rev=1230867&view=rev
Log:
Ev2 shims: Handle copy-replaces in the correct manner.

Current number of Ev2 test failures: 89

* subversion/libsvn_delta/compat.c
  (process_actions): For a copy operation, make sure we don't need to do a
    delete first, and if so, use the Ev2 method of providing a replace_rev
    to do the replacement-on-copy.
  (copy_cb): If we get a replacement revision, make sure we add a delete
    action first.

Modified:
    subversion/trunk/subversion/libsvn_delta/compat.c

Modified: subversion/trunk/subversion/libsvn_delta/compat.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/compat.c?rev=1230867&r1=1230866&r2=1230867&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/compat.c (original)
+++ subversion/trunk/subversion/libsvn_delta/compat.c Fri Jan 13 02:41:45 2012
@@ -221,6 +221,9 @@ process_actions(void *edit_baton,
   apr_hash_t *props = NULL;
   svn_boolean_t need_add = FALSE;
   svn_boolean_t need_delete = FALSE;
+  svn_boolean_t need_copy = FALSE;
+  const char *copyfrom_path;
+  svn_revnum_t copyfrom_rev;
   apr_array_header_t *children;
   svn_stream_t *contents = NULL;
   svn_checksum_t *checksum = NULL;
@@ -317,9 +320,9 @@ process_actions(void *edit_baton,
             {
               struct copy_args *c_args = action->args;
 
-              SVN_ERR(svn_editor_copy(eb->editor, c_args->copyfrom_path,
-                                      c_args->copyfrom_rev, path,
-                                      SVN_INVALID_REVNUM));
+              copyfrom_path = c_args->copyfrom_path;
+              copyfrom_rev = c_args->copyfrom_rev;
+              need_copy = TRUE;
               break;
             }
 
@@ -339,7 +342,7 @@ process_actions(void *edit_baton,
   /* We've now got a wholistic view of what has happened to this node,
    * so we can call our own editor APIs on it. */
 
-  if (need_delete && !need_add)
+  if (need_delete && !need_add && !need_copy)
     {
       /* If we're only doing a delete, do it here. */
       SVN_ERR(svn_editor_delete(eb->editor, path, delete_revnum));
@@ -357,23 +360,29 @@ process_actions(void *edit_baton,
           SVN_ERR(svn_editor_add_file(eb->editor, path, checksum, contents,
                                       props, delete_revnum));
         }
+
+      return SVN_NO_ERROR;
     }
-  else
+
+  if (need_copy)
     {
-      if (props)
-        {
-          /* We fetched and modified the props in some way. Apply 'em now that
-             we have the new set.  */
-          SVN_ERR(svn_editor_set_props(eb->editor, path, props_base_revision,
-                                       props, contents == NULL));
-        }
+      SVN_ERR(svn_editor_copy(eb->editor, copyfrom_path, copyfrom_rev, path,
+                              delete_revnum));
+    }
 
-      if (contents)
-        {
-          /* If we have an content for this node, set it now. */
-          SVN_ERR(svn_editor_set_text(eb->editor, path, text_base_revision,
-                                      checksum, contents));
-        }
+  if (props)
+    {
+      /* We fetched and modified the props in some way. Apply 'em now that
+         we have the new set.  */
+      SVN_ERR(svn_editor_set_props(eb->editor, path, props_base_revision,
+                                   props, contents == NULL));
+    }
+
+  if (contents)
+    {
+      /* If we have an content for this node, set it now. */
+      SVN_ERR(svn_editor_set_text(eb->editor, path, text_base_revision,
+                                  checksum, contents));
     }
 
   return SVN_NO_ERROR;
@@ -1300,6 +1309,15 @@ copy_cb(void *baton,
 
   SVN_ERR(ensure_root_opened(eb));
 
+  if (SVN_IS_VALID_REVNUM(replaces_rev))
+    {
+      /* We need to add the delete action. */
+
+      SVN_ERR(build(eb, ACTION_DELETE, dst_relpath, svn_kind_unknown,
+                    NULL, SVN_INVALID_REVNUM,
+                    NULL, NULL, SVN_INVALID_REVNUM, scratch_pool));
+    }
+
   SVN_ERR(build(eb, ACTION_COPY, dst_relpath, svn_kind_unknown,
                 src_relpath, src_revision, NULL, NULL, SVN_INVALID_REVNUM,
                 scratch_pool));


Reply via email to