subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1188357 - /subversion/trunk/subversion/libsvn_delta/compat.c
Date Mon, 24 Oct 2011 20:24:33 GMT
Author: hwright
Date: Mon Oct 24 20:24:32 2011
New Revision: 1188357

URL: http://svn.apache.org/viewvc?rev=1188357&view=rev
Log:
Ev2 shims: opprotunistically open the delta editor root.  Some of the other
callback functions may depend on state initialized by the underlying editor
as part of its open_root() function.

* subversion/libsvn_delta/compat.c
  (editor_baton): Add root_opened member.
  (add_directory_cb, add_file_cb, add_symlink_cb, add_absent_cb, set_props_cb,
   set_text_cb, set_text_cb, set_target_cb, delete_cb, copy_cb, move_cb):
    Open the underlying editor root here, if not already done so.
  (complete_cb, abort_cb): Don't open the root here.
  (svn_editor_from_delta): Initialize a flag.

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=1188357&r1=1188356&r2=1188357&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/compat.c (original)
+++ subversion/trunk/subversion/libsvn_delta/compat.c Mon Oct 24 20:24:32 2011
@@ -591,6 +591,7 @@ struct editor_baton
   void *fetch_kind_baton;
 
   struct operation root;
+  svn_boolean_t root_opened;
 
   apr_hash_t *paths;
   apr_pool_t *edit_pool;
@@ -753,6 +754,13 @@ add_directory_cb(void *baton,
 {
   struct editor_baton *eb = baton;
 
+  if (!eb->root_opened)
+    {
+      SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
+                                     eb->edit_pool, &eb->root.baton));
+      eb->root_opened = TRUE;
+    }
+
   SVN_ERR(build(eb, ACTION_MKDIR, relpath, svn_kind_dir,
                 NULL, SVN_INVALID_REVNUM,
                 NULL, NULL, SVN_INVALID_REVNUM, scratch_pool));
@@ -774,6 +782,13 @@ add_file_cb(void *baton,
   const char *tmp_filename;
   svn_stream_t *tmp_stream;
 
+  if (!eb->root_opened)
+    {
+      SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
+                                     eb->edit_pool, &eb->root.baton));
+      eb->root_opened = TRUE;
+    }
+
   /* Spool the contents to a tempfile, and provide that to the driver. */
   SVN_ERR(svn_stream_open_unique(&tmp_stream, &tmp_filename, NULL,
                                  svn_io_file_del_on_pool_cleanup,
@@ -797,6 +812,15 @@ add_symlink_cb(void *baton,
                svn_revnum_t replaces_rev,
                apr_pool_t *scratch_pool)
 {
+  struct editor_baton *eb = baton;
+
+  if (!eb->root_opened)
+    {
+      SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
+                                     eb->edit_pool, &eb->root.baton));
+      eb->root_opened = TRUE;
+    }
+
   return SVN_NO_ERROR;
 }
 
@@ -808,6 +832,15 @@ add_absent_cb(void *baton,
               svn_revnum_t replaces_rev,
               apr_pool_t *scratch_pool)
 {
+  struct editor_baton *eb = baton;
+
+  if (!eb->root_opened)
+    {
+      SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
+                                     eb->edit_pool, &eb->root.baton));
+      eb->root_opened = TRUE;
+    }
+
   return SVN_NO_ERROR;
 }
 
@@ -822,6 +855,13 @@ set_props_cb(void *baton,
 {
   struct editor_baton *eb = baton;
 
+  if (!eb->root_opened)
+    {
+      SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
+                                     eb->edit_pool, &eb->root.baton));
+      eb->root_opened = TRUE;
+    }
+
   SVN_ERR(build(eb, ACTION_PROPSET, relpath, svn_kind_none,
                 NULL, SVN_INVALID_REVNUM,
                 props, NULL, SVN_INVALID_REVNUM, scratch_pool));
@@ -842,6 +882,13 @@ set_text_cb(void *baton,
   const char *tmp_filename;
   svn_stream_t *tmp_stream;
 
+  if (!eb->root_opened)
+    {
+      SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
+                                     eb->edit_pool, &eb->root.baton));
+      eb->root_opened = TRUE;
+    }
+
   /* Spool the contents to a tempfile, and provide that to the driver. */
   SVN_ERR(svn_stream_open_unique(&tmp_stream, &tmp_filename, NULL,
                                  svn_io_file_del_on_pool_cleanup,
@@ -864,6 +911,15 @@ set_target_cb(void *baton,
               const char *target,
               apr_pool_t *scratch_pool)
 {
+  struct editor_baton *eb = baton;
+
+  if (!eb->root_opened)
+    {
+      SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
+                                     eb->edit_pool, &eb->root.baton));
+      eb->root_opened = TRUE;
+    }
+
   return SVN_NO_ERROR;
 }
 
@@ -874,6 +930,15 @@ delete_cb(void *baton,
           svn_revnum_t revision,
           apr_pool_t *scratch_pool)
 {
+  struct editor_baton *eb = baton;
+
+  if (!eb->root_opened)
+    {
+      SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
+                                     eb->edit_pool, &eb->root.baton));
+      eb->root_opened = TRUE;
+    }
+
   return SVN_NO_ERROR;
 }
 
@@ -886,6 +951,15 @@ copy_cb(void *baton,
         svn_revnum_t replaces_rev,
         apr_pool_t *scratch_pool)
 {
+  struct editor_baton *eb = baton;
+
+  if (!eb->root_opened)
+    {
+      SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
+                                     eb->edit_pool, &eb->root.baton));
+      eb->root_opened = TRUE;
+    }
+
   return SVN_NO_ERROR;
 }
 
@@ -898,6 +972,15 @@ move_cb(void *baton,
         svn_revnum_t replaces_rev,
         apr_pool_t *scratch_pool)
 {
+  struct editor_baton *eb = baton;
+
+  if (!eb->root_opened)
+    {
+      SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
+                                     eb->edit_pool, &eb->root.baton));
+      eb->root_opened = TRUE;
+    }
+
   return SVN_NO_ERROR;
 }
 
@@ -966,9 +1049,6 @@ complete_cb(void *baton,
   struct editor_baton *eb = baton;
   svn_error_t *err;
 
-  SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
-                                 eb->edit_pool, &eb->root.baton));
-
   /* Drive the tree we've created. */
   err = drive(&eb->root, eb->deditor, scratch_pool);
   if (!err)
@@ -990,8 +1070,6 @@ abort_cb(void *baton,
 
   /* We still need to drive anything we collected in the editor to this
      point. */
-  SVN_ERR(eb->deditor->open_root(eb->dedit_baton, SVN_INVALID_REVNUM,
-                                 eb->edit_pool, &eb->root.baton));
 
   /* Drive the tree we've created. */
   err = drive(&eb->root, eb->deditor, scratch_pool);
@@ -1051,6 +1129,8 @@ svn_editor_from_delta(svn_editor_t **edi
   eb->root.props = NULL;
   eb->root.copyfrom_revision = SVN_INVALID_REVNUM;
 
+  eb->root_opened = FALSE;
+
   SVN_ERR(svn_editor_create(&editor, eb, cancel_func, cancel_baton,
                             result_pool, scratch_pool));
   SVN_ERR(svn_editor_setcb_many(editor, &editor_cbs, scratch_pool));



Mime
View raw message