subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1310085 - in /subversion/branches/ev2-export/subversion: include/svn_ra.h libsvn_client/add.c libsvn_ra/ra_loader.c
Date Thu, 05 Apr 2012 21:45:42 GMT
Author: hwright
Date: Thu Apr  5 21:45:42 2012
New Revision: 1310085

URL: http://svn.apache.org/viewvc?rev=1310085&view=rev
Log:
On the ev2-export branch:
(this branch is going way beyond export, perhaps it should be renamed)

Add svn_ra_get_commit_editor4(), which returns an Ev2 commit editor.  We
don't currently marshall Ev2 actions across the wire, this just wraps the
Ev1 editor within the RA layer.

* subversion/include/svn_ra.h
  (svn_ra_get_commit_editor4): New.
  (svn_ra_get_commit_editor3): Deprecate.

* subversion/libsvn_client/add.c
  (drive_editor): Take an Ev2 editor, and drive it directly, rather than
    wrapping an Ev1 editor.
  (mkdir_urls): Request an Ev2 editor from the RA layer.
 
* subversion/libsvn_ra/ra_loader.c
  (svn_ra_get_commit_editor4): New.

Modified:
    subversion/branches/ev2-export/subversion/include/svn_ra.h
    subversion/branches/ev2-export/subversion/libsvn_client/add.c
    subversion/branches/ev2-export/subversion/libsvn_ra/ra_loader.c

Modified: subversion/branches/ev2-export/subversion/include/svn_ra.h
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/include/svn_ra.h?rev=1310085&r1=1310084&r2=1310085&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/include/svn_ra.h (original)
+++ subversion/branches/ev2-export/subversion/include/svn_ra.h Thu Apr  5 21:45:42 2012
@@ -865,8 +865,28 @@ svn_ra_rev_prop(svn_ra_session_t *sessio
  *
  * Use @a pool for memory allocation.
  *
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_ra_get_commit_editor4(svn_ra_session_t *session,
+                          svn_editor_t **editor,
+                          apr_hash_t *revprop_table,
+                          svn_commit_callback2_t callback,
+                          void *callback_baton,
+                          apr_hash_t *lock_tokens,
+                          svn_boolean_t keep_locks,
+                          svn_cancel_func_t cancel_func,
+                          void *cancel_baton,
+                          apr_pool_t *scratch_pool,
+                          apr_pool_t *result_pool);
+
+/**
+ * Same as svn_ra_get_commit_editor4(), but returns a #svn_delta_editor_t.
+ *
  * @since New in 1.5.
+ * @deprecated Provided for backward compatibility with the 1.7 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_ra_get_commit_editor3(svn_ra_session_t *session,
                           const svn_delta_editor_t **editor,

Modified: subversion/branches/ev2-export/subversion/libsvn_client/add.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/add.c?rev=1310085&r1=1310084&r2=1310085&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/add.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/add.c Thu Apr  5 21:45:42 2012
@@ -740,35 +740,16 @@ add_url_parents(svn_ra_session_t *ra_ses
 }
 
 static svn_error_t *
-drive_editor(const svn_delta_editor_t *deditor,
-             void *dedit_baton,
+drive_editor(svn_editor_t *editor,
              apr_array_header_t *targets,
              apr_hash_t *children_hash,
-             svn_cancel_func_t cancel_func,
-             void *cancel_baton,
              apr_pool_t *scratch_pool)
 {
-  svn_editor_t *editor;
-  struct svn_delta__extra_baton *exb;
-  svn_delta_unlock_func_t unlock_func;
-  void *unlock_baton;
-  svn_boolean_t send_abs_paths;
   apr_hash_t *empty_props = apr_hash_make(scratch_pool);
   apr_pool_t *iterpool;
   svn_error_t *err;
   int i;
 
-  /* Create the Ev2 editor from the Ev1 editor provided by the RA layer. */
-  SVN_ERR(svn_delta__editor_from_delta(&editor, &exb,
-                                       &unlock_func, &unlock_baton,
-                                       deditor, dedit_baton, &send_abs_paths,
-                                       cancel_func, cancel_baton,
-                                       NULL, NULL, NULL, NULL,
-                                       scratch_pool, scratch_pool));
-
-  if (exb->start_edit)
-    SVN_ERR(exb->start_edit(exb->baton, SVN_INVALID_REVNUM));
-
   iterpool = svn_pool_create(scratch_pool);
   for (i = 0; i < targets->nelts; i++)
     {
@@ -811,8 +792,7 @@ mkdir_urls(const apr_array_header_t *url
            apr_pool_t *pool)
 {
   svn_ra_session_t *ra_session = NULL;
-  const svn_delta_editor_t *editor;
-  void *edit_baton;
+  svn_editor_t *editor;
   const char *log_msg;
   apr_array_header_t *targets;
   apr_hash_t *targets_hash;
@@ -969,16 +949,15 @@ mkdir_urls(const apr_array_header_t *url
   SVN_ERR(svn_ra__register_editor_shim_callbacks(ra_session,
                         svn_client__get_shim_callbacks(ctx->wc_ctx,
                                                        NULL, pool)));
-  SVN_ERR(svn_ra_get_commit_editor3(ra_session, &editor, &edit_baton,
+  SVN_ERR(svn_ra_get_commit_editor4(ra_session, &editor,
                                     commit_revprops,
                                     commit_callback,
                                     commit_baton,
                                     NULL, TRUE, /* No lock tokens */
-                                    pool));
+                                    ctx->cancel_func, ctx->cancel_baton,
+                                    pool, pool));
 
-  return svn_error_trace(drive_editor(editor, edit_baton, targets,
-                                      children_hash,
-                                      ctx->cancel_func, ctx->cancel_baton,
+  return svn_error_trace(drive_editor(editor, targets, children_hash,
                                       pool));
 }
 

Modified: subversion/branches/ev2-export/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra/ra_loader.c?rev=1310085&r1=1310084&r2=1310085&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra/ra_loader.c Thu Apr  5 21:45:42 2012
@@ -733,6 +733,63 @@ svn_error_t *svn_ra_get_commit_editor3(s
                                             lock_tokens, keep_locks, pool);
 }
 
+svn_error_t *
+svn_ra_get_commit_editor4(svn_ra_session_t *session,
+                          svn_editor_t **editor,
+                          apr_hash_t *revprop_table,
+                          svn_commit_callback2_t callback,
+                          void *callback_baton,
+                          apr_hash_t *lock_tokens,
+                          svn_boolean_t keep_locks,
+                          svn_cancel_func_t cancel_func,
+                          void *cancel_baton,
+                          apr_pool_t *scratch_pool,
+                          apr_pool_t *result_pool)
+{
+  const svn_delta_editor_t *deditor;
+  void *dedit_baton;
+  /* Allocate this in a pool, since the callback will be called long after
+     this function as returned. */
+  struct ccw_baton *ccwb = apr_palloc(result_pool, sizeof(*ccwb));
+  struct svn_delta__extra_baton *exb;
+  svn_delta_unlock_func_t unlock_func;
+  void *unlock_baton;
+  svn_boolean_t send_abs_paths;
+
+  ccwb->original_callback = callback;
+  ccwb->original_baton = callback_baton;
+  ccwb->session = session;
+
+  SVN_ERR(session->vtable->get_commit_editor(session, &deditor, &dedit_baton,
+                                             revprop_table,
+                                             callback
+                                                 ? commit_callback_wrapper
+                                                 : NULL,
+                                             callback ? ccwb : NULL,
+                                             lock_tokens, keep_locks,
+                                             result_pool));
+
+  /* Create the Ev2 editor from the Ev1 editor provided by the RA layer. */
+  SVN_ERR(svn_delta__editor_from_delta(editor, &exb,
+                                       &unlock_func, &unlock_baton,
+                                       deditor, dedit_baton, &send_abs_paths,
+                                       cancel_func, cancel_baton,
+                                       NULL, NULL, NULL, NULL,
+                                       scratch_pool, result_pool));
+
+  /* Since we're (currently) just wrapping an existing Ev1 editor, we have
+     to call any start_edit handler it may provide.  We've got a couple of
+     options to do so: Implement a wrapper editor and call the start_edit
+     callback upon the first invocation of any of the underlying editor's
+     functions; or, just assume our consumer is going to eventually use the
+     editor it is asking for, and call the start edit callback now.  For
+     simplicity's sake, we do the latter. */
+  if (exb->start_edit)
+    SVN_ERR(exb->start_edit(exb->baton, SVN_INVALID_REVNUM));
+
+  return SVN_NO_ERROR;
+}
+
 svn_error_t *svn_ra_get_file(svn_ra_session_t *session,
                              const char *path,
                              svn_revnum_t revision,



Mime
View raw message