You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/10/27 21:28:51 UTC

svn commit: r1189956 - /subversion/trunk/subversion/libsvn_delta/compat.c

Author: hwright
Date: Thu Oct 27 19:28:51 2011
New Revision: 1189956

URL: http://svn.apache.org/viewvc?rev=1189956&view=rev
Log:
Add a callback to the Ev2 shims which allows a caller to perform some pre-run
initialization.  This is similar to the open_root() function but for Ev2, and
is required so that other shim callbacks can potentially initialize state.

Current test failures: 1168

* subversion/libsvn_delta/compat.c
  (start_edit_func_t): New type.
  (ev2_edit_baton): Hold the new start edit func.
  (ev2_open_root): Run the start edit handler.
  (start_edit_baton, start_edit_func): New.
  (delta_from_editor): Take the start edit func, and shove it in the baton.
  (svn_editor__insert_shims): Update caller to delta_from_editor().

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=1189956&r1=1189955&r2=1189956&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/compat.c (original)
+++ subversion/trunk/subversion/libsvn_delta/compat.c Thu Oct 27 19:28:51 2011
@@ -92,12 +92,24 @@ svn_compat_wrap_file_rev_handler(svn_fil
  * large amount of information in the dir batons, and then process it in the
  * close_directory() handler. */
 
+typedef svn_error_t *(*start_edit_func_t)(
+    void *baton,
+    svn_revnum_t base_revision,
+    apr_pool_t *result_pool,
+    void **root_baton);
+
 struct ev2_edit_baton
 {
   svn_editor_t *editor;
   apr_hash_t *paths;
   svn_revnum_t target_revision;
   apr_pool_t *edit_pool;
+
+  void *root_baton;
+
+  start_edit_func_t start_edit;
+  void *start_edit_baton;
+
   svn_delta_fetch_props_func_t fetch_props_func;
   void *fetch_props_baton;
 };
@@ -307,6 +319,11 @@ ev2_open_root(void *edit_baton,
   db->path = "";
 
   *root_baton = db;
+
+  if (eb->start_edit)
+    SVN_ERR(eb->start_edit(eb->start_edit_baton, base_revision, result_pool,
+                           &eb->root_baton));
+
   return SVN_NO_ERROR;
 }
 
@@ -507,12 +524,34 @@ ev2_abort_edit(void *edit_baton,
   return svn_error_trace(svn_editor_abort(eb->editor));
 }
 
+struct start_edit_baton
+{
+  const svn_delta_editor_t *deditor;
+  void *dedit_baton;
+};
+
+static svn_error_t *
+start_edit_func(void *baton,
+                svn_revnum_t base_revision,
+                apr_pool_t *result_pool,
+                void **root_baton)
+{
+  struct start_edit_baton *seb = baton;
+
+  SVN_ERR(seb->deditor->open_root(seb->dedit_baton, base_revision, result_pool,
+                                  root_baton));
+
+  return SVN_NO_ERROR;
+}
+
 static svn_error_t *
 delta_from_editor(const svn_delta_editor_t **deditor,
                   void **dedit_baton,
                   svn_editor_t *editor,
                   svn_delta_fetch_props_func_t fetch_props_func,
                   void *fetch_props_baton,
+                  start_edit_func_t start_edit,
+                  void *start_edit_baton,
                   apr_pool_t *pool)
 {
   /* Static 'cause we don't want it to be on the stack. */
@@ -534,7 +573,7 @@ delta_from_editor(const svn_delta_editor
       ev2_close_edit,
       ev2_abort_edit
     };
-  struct ev2_edit_baton *eb = apr_palloc(pool, sizeof(*eb));
+  struct ev2_edit_baton *eb = apr_pcalloc(pool, sizeof(*eb));
 
   eb->editor = editor;
   eb->paths = apr_hash_make(pool);
@@ -543,6 +582,9 @@ delta_from_editor(const svn_delta_editor
   eb->fetch_props_func = fetch_props_func;
   eb->fetch_props_baton = fetch_props_baton;
 
+  eb->start_edit = start_edit;
+  eb->start_edit_baton = start_edit_baton;
+
   *dedit_baton = eb;
   *deditor = &delta_editor;
 
@@ -1133,6 +1175,10 @@ svn_editor__insert_shims(const svn_delta
      wrap that again back into a svn_delta_editor_t.  This introduces
      a lot of overhead. */
   svn_editor_t *editor;
+  struct start_edit_baton *seb = apr_palloc(result_pool, sizeof(*seb));
+
+  seb->deditor = deditor_in;
+  seb->dedit_baton = dedit_baton_in;
 
   SVN_ERR(editor_from_delta(&editor, deditor_in, dedit_baton_in,
                             NULL, NULL, shim_callbacks->fetch_kind_func,
@@ -1141,6 +1187,7 @@ svn_editor__insert_shims(const svn_delta
   SVN_ERR(delta_from_editor(deditor_out, dedit_baton_out, editor,
                             shim_callbacks->fetch_props_func,
                             shim_callbacks->fetch_props_baton,
+                            start_edit_func, seb,
                             result_pool));
 
 #endif



RE: svn commit: r1189956 - /subversion/trunk/subversion/libsvn_delta/compat.c

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: hwright@apache.org [mailto:hwright@apache.org]
> Sent: donderdag 27 oktober 2011 21:29
> To: commits@subversion.apache.org
> Subject: svn commit: r1189956 -
> /subversion/trunk/subversion/libsvn_delta/compat.c
> 
> Author: hwright
> Date: Thu Oct 27 19:28:51 2011
> New Revision: 1189956
> 
> URL: http://svn.apache.org/viewvc?rev=1189956&view=rev
> Log:
> Add a callback to the Ev2 shims which allows a caller to perform some pre-run
> initialization.  This is similar to the open_root() function but for Ev2, and
> is required so that other shim callbacks can potentially initialize state.
> 
> Current test failures: 1168

This patch causes build failures on all platforms.

On Windows the error message is:
..\..\..\subversion\tests\libsvn_delta\editor-test.c(278): error C4047: 'function' : 'start_edit_func_t' differs in levels of indirection from 'apr_pool_t *'
  ..\..\..\subversion\tests\libsvn_delta\editor-test.c(278): error C4024: 'delta_from_editor' : different types for formal and actual parameter 6
  ..\..\..\subversion\tests\libsvn_delta\editor-test.c(278): error C2198: 'delta_from_editor' : too few arguments for call


	Bert