Author: julianfoad
Date: Fri Aug 22 14:50:37 2014
New Revision: 1619825

URL: http://svn.apache.org/r1619825
Log:
On the 'move-tracking-2' branch: switch the commit editor shim callbacks to
a single callback that can fetch the whole base state instead of having
separate functions for kind, properties and text. 

Also move the shim-related declarations from svn_delta_private.h to
svn_editor3.h to keep all editor3-related declarations together.

Modified:
    
subversion/branches/move-tracking-2/subversion/include/private/svn_delta_private.h
    subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h
    subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c
    subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c
    subversion/branches/move-tracking-2/subversion/libsvn_repos/commit.c

Modified: 
subversion/branches/move-tracking-2/subversion/include/private/svn_delta_private.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_delta_private.h?rev=1619825&r1=1619824&r2=1619825&view=diff
==============================================================================
--- 
subversion/branches/move-tracking-2/subversion/include/private/svn_delta_private.h
 (original)
+++ 
subversion/branches/move-tracking-2/subversion/include/private/svn_delta_private.h
 Fri Aug 22 14:50:37 2014
@@ -102,130 +102,6 @@ svn_delta__delta_from_editor(const svn_d
                              struct svn_delta__extra_baton *exb,
                              apr_pool_t *pool);
 
-/* An object for communicating out-of-band details between an Ev1-to-Ev3
- * shim and an Ev3-to-Ev1 shim. */
-typedef struct svn_delta__shim_connector_t svn_delta__shim_connector_t;
-
-/* Return an Ev3 editor in *EDITOR_P which will drive the Ev1 delta
- * editor DEDITOR/DEDIT_BATON.
- *
- * This editor buffers all the changes and then drives the Ev1 when the
- * returned editor's "close" method is called.
- *
- * This editor converts moves into copy-and-delete. It presently makes a
- * one-way (lossy) conversion.
- *
- *   TODO: Option to pass the 'move' information through as some sort of
- *   metadata so that it can be preserved in an Ev3-Ev1-Ev3 round-trip
- *   conversion.
- *     - Use 'entry-props'?
- *     - Send copy-and-delete with copy-from-rev = -1?
- *
- * This editor implements the "incremental changes" variant of the Ev3
- * commit editor interface.
- *
- * SHIM_CONNECTOR can be used to enable a more exact round-trip conversion
- * from an Ev1 drive to Ev3 and back to Ev1. The caller should pass the
- * returned *SHIM_CONNECTOR value to svn_delta__delta_from_ev3_for_commit().
- * SHIM_CONNECTOR may be null if not wanted.
- *
- * REPOS_ROOT_URL is the repository root URL, and BASE_RELPATH is the
- * relative path within the repository of the root directory of the edit.
- * (An Ev1 edit must be rooted at a directory, not at a file.)
- *
- * FETCH_KIND_FUNC / FETCH_KIND_BATON: A callback by which the shim may
- * determine the kind of a path. This is called for a copy source or move
- * source node, passing the Ev3 relpath and the specific copy-from
- * revision.
- *
- * FETCH_PROPS_FUNC / FETCH_PROPS_BATON: A callback by which the shim may
- * determine the existing properties on a path. This is called for a copy
- * source or move source node or a modified node, but not for a simple
- * add, passing the Ev3 relpath and the specific revision.
- *
- * CANCEL_FUNC / CANCEL_BATON: The usual cancellation callback; folded
- * into the produced editor. May be NULL/NULL if not wanted.
- *
- * Allocate the new editor in RESULT_POOL, which may become large and must
- * live for the lifetime of the edit. Use SCRATCH_POOL for temporary
- * allocations.
- */
-svn_error_t *
-svn_delta__ev3_from_delta_for_commit(
-                        svn_editor3_t **editor_p,
-                        svn_delta__shim_connector_t **shim_connector,
-                        const svn_delta_editor_t *deditor,
-                        void *dedit_baton,
-                        const char *repos_root,
-                        const char *base_relpath,
-                        svn_delta_fetch_kind_func_t fetch_kind_func,
-                        void *fetch_kind_baton,
-                        svn_delta_fetch_props_func_t fetch_props_func,
-                        void *fetch_props_baton,
-                        svn_cancel_func_t cancel_func,
-                        void *cancel_baton,
-                        apr_pool_t *result_pool,
-                        apr_pool_t *scratch_pool);
-
-/* Return a delta editor in DEDITOR/DEDITOR_BATON which will drive EDITOR.
- *
- * REPOS_ROOT_URL is the repository root URL, and BASE_RELPATH is the
- * relative path within the repository of the root directory of the edit.
- * (An Ev1 edit must be rooted at a directory, not at a file.)
- *
- * FETCH_PROPS_FUNC / FETCH_PROPS_BATON: A callback / baton pair which
- * will be used by the shim handlers if they need to determine the
- * existing properties on a  path.
- *
- * FETCH_BASE_FUNC / FETCH_BASE_BATON: A callback / baton pair which will
- * be used by the shims handlers if they need to determine the base
- * text of a path.  It should only be invoked for files.
- *
- * SHIM_CONNECTOR can be used to enable a more exact round-trip conversion
- * from an Ev1 drive to Ev3 and back to Ev1. It must live for the lifetime
- * of the edit. It may be null if not wanted.
- *
- * Allocate the new editor in RESULT_POOL, which may become large and must
- * live for the lifetime of the edit. Use SCRATCH_POOL for temporary
- * allocations.
- */
-svn_error_t *
-svn_delta__delta_from_ev3_for_commit(
-                        const svn_delta_editor_t **deditor,
-                        void **dedit_baton,
-                        svn_editor3_t *editor,
-                        const char *repos_root,
-                        const char *base_relpath,
-                        svn_delta_fetch_props_func_t fetch_props_func,
-                        void *fetch_props_baton,
-                        svn_delta_fetch_base_func_t fetch_base_func,
-                        void *fetch_base_baton,
-                        const svn_delta__shim_connector_t *shim_connector,
-                        apr_pool_t *result_pool,
-                        apr_pool_t *scratch_pool);
-
-/* Return in NEW_DEDITOR/NEW_DETIT_BATON a delta editor that wraps
- * OLD_DEDITOR/OLD_DEDIT_BATON, inserting a pair of shims that convert
- * Ev1 to Ev3 and back to Ev1.
- *
- * REPOS_ROOT_URL is the repository root URL, and BASE_RELPATH is the
- * relative path within the repository of the root directory of the edit.
- *
- * SHIM_CB provides callbacks that the shims may use to fetch details of
- * the base state when needed.
- */
-svn_error_t *
-svn_editor3__insert_shims(
-                        const svn_delta_editor_t **new_deditor,
-                        void **new_dedit_baton,
-                        const svn_delta_editor_t *old_deditor,
-                        void *old_dedit_baton,
-                        const char *repos_root,
-                        const char *base_relpath,
-                        const svn_delta_shim_callbacks_t *shim_cb,
-                        apr_pool_t *result_pool,
-                        apr_pool_t *scratch_pool);
-
 /** Read the txdelta window header from @a stream and return the total
     length of the unparsed window data in @a *window_len. */
 svn_error_t *

Modified: 
subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h?rev=1619825&r1=1619824&r2=1619825&view=diff
==============================================================================
--- 
subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h 
(original)
+++ 
subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h 
Fri Aug 22 14:50:37 2014
@@ -1423,6 +1423,162 @@ svn_editor3__get_debug_editor(svn_editor
                               apr_pool_t *result_pool);
 #endif
 
+
+/** Callback to retrieve a node's kind and content.  This is
+ * needed by the various editor shims in order to effect backwards
+ * compatibility.
+ *
+ * Implementations should set @a *kind to the node kind of @a path in
+ * @a base_revision.
+ *
+ * Implementations should set @a *props to the hash of properties
+ * associated with @a path in @a base_revision, allocating that hash
+ * and its contents in @a result_pool.
+ *
+ * Implementations should set @a *filename to the name of a file
+ * suitable for use as a delta base for @a path in @a base_revision
+ * (allocating @a *filename from @a result_pool), or to @c NULL if the
+ * base stream is empty.
+ *
+ * Any output argument may be NULL if the output is not wanted.
+ *
+ * @a baton is an implementation-specific closure.
+ * @a scratch_pool is provided for temporary allocations.
+ */
+typedef svn_error_t *(*svn_editor3__shim_fetch_func_t)(
+  svn_node_kind_t *kind,
+  apr_hash_t **props,
+  const char **filename,
+  void *baton,
+  const char *path,
+  svn_revnum_t base_revision,
+  apr_pool_t *result_pool,
+  apr_pool_t *scratch_pool
+  );
+
+/* An object for communicating out-of-band details between an Ev1-to-Ev3
+ * shim and an Ev3-to-Ev1 shim. */
+typedef struct svn_editor3__shim_connector_t svn_editor3__shim_connector_t;
+
+/* Return an Ev3 editor in *EDITOR_P which will drive the Ev1 delta
+ * editor DEDITOR/DEDIT_BATON.
+ *
+ * This editor buffers all the changes and then drives the Ev1 when the
+ * returned editor's "close" method is called.
+ *
+ * This editor converts moves into copy-and-delete. It presently makes a
+ * one-way (lossy) conversion.
+ *
+ *   TODO: Option to pass the 'move' information through as some sort of
+ *   metadata so that it can be preserved in an Ev3-Ev1-Ev3 round-trip
+ *   conversion.
+ *     - Use 'entry-props'?
+ *     - Send copy-and-delete with copy-from-rev = -1?
+ *
+ * This editor implements the "incremental changes" variant of the Ev3
+ * commit editor interface.
+ *
+ * SHIM_CONNECTOR can be used to enable a more exact round-trip conversion
+ * from an Ev1 drive to Ev3 and back to Ev1. The caller should pass the
+ * returned *SHIM_CONNECTOR value to svn_delta__delta_from_ev3_for_commit().
+ * SHIM_CONNECTOR may be null if not wanted.
+ *
+ * REPOS_ROOT_URL is the repository root URL, and BASE_RELPATH is the
+ * relative path within the repository of the root directory of the edit.
+ * (An Ev1 edit must be rooted at a directory, not at a file.)
+ *
+ * FETCH_KIND_FUNC / FETCH_KIND_BATON: A callback by which the shim may
+ * determine the kind of a path. This is called for a copy source or move
+ * source node, passing the Ev3 relpath and the specific copy-from
+ * revision.
+ *
+ * FETCH_PROPS_FUNC / FETCH_PROPS_BATON: A callback by which the shim may
+ * determine the existing properties on a path. This is called for a copy
+ * source or move source node or a modified node, but not for a simple
+ * add, passing the Ev3 relpath and the specific revision.
+ *
+ * CANCEL_FUNC / CANCEL_BATON: The usual cancellation callback; folded
+ * into the produced editor. May be NULL/NULL if not wanted.
+ *
+ * Allocate the new editor in RESULT_POOL, which may become large and must
+ * live for the lifetime of the edit. Use SCRATCH_POOL for temporary
+ * allocations.
+ */
+svn_error_t *
+svn_delta__ev3_from_delta_for_commit(
+                        svn_editor3_t **editor_p,
+                        svn_editor3__shim_connector_t **shim_connector,
+                        const svn_delta_editor_t *deditor,
+                        void *dedit_baton,
+                        const char *repos_root,
+                        const char *base_relpath,
+                        svn_editor3__shim_fetch_func_t fetch_func,
+                        void *fetch_baton,
+                        svn_cancel_func_t cancel_func,
+                        void *cancel_baton,
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool);
+
+/* Return a delta editor in DEDITOR/DEDITOR_BATON which will drive EDITOR.
+ *
+ * REPOS_ROOT_URL is the repository root URL, and BASE_RELPATH is the
+ * relative path within the repository of the root directory of the edit.
+ * (An Ev1 edit must be rooted at a directory, not at a file.)
+ *
+ * FETCH_PROPS_FUNC / FETCH_PROPS_BATON: A callback / baton pair which
+ * will be used by the shim handlers if they need to determine the
+ * existing properties on a  path.
+ *
+ * FETCH_BASE_FUNC / FETCH_BASE_BATON: A callback / baton pair which will
+ * be used by the shims handlers if they need to determine the base
+ * text of a path.  It should only be invoked for files.
+ *
+ * SHIM_CONNECTOR can be used to enable a more exact round-trip conversion
+ * from an Ev1 drive to Ev3 and back to Ev1. It must live for the lifetime
+ * of the edit. It may be null if not wanted.
+ *
+ * Allocate the new editor in RESULT_POOL, which may become large and must
+ * live for the lifetime of the edit. Use SCRATCH_POOL for temporary
+ * allocations.
+ */
+svn_error_t *
+svn_delta__delta_from_ev3_for_commit(
+                        const svn_delta_editor_t **deditor,
+                        void **dedit_baton,
+                        svn_editor3_t *editor,
+                        const char *repos_root,
+                        const char *base_relpath,
+                        svn_editor3__shim_fetch_func_t fetch_func,
+                        void *fetch_baton,
+                        const svn_editor3__shim_connector_t *shim_connector,
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool);
+
+/* Return in NEW_DEDITOR/NEW_DETIT_BATON a delta editor that wraps
+ * OLD_DEDITOR/OLD_DEDIT_BATON, inserting a pair of shims that convert
+ * Ev1 to Ev3 and back to Ev1.
+ *
+ * REPOS_ROOT_URL is the repository root URL, and BASE_RELPATH is the
+ * relative path within the repository of the root directory of the edit.
+ *
+ * FETCH_FUN/FETCH_BATON is a callback that the shims may use to fetch
+ * details of the base state (that is, the initial state of the edit) when
+ * needed.
+ */
+svn_error_t *
+svn_editor3__insert_shims(
+                        const svn_delta_editor_t **new_deditor,
+                        void **new_dedit_baton,
+                        const svn_delta_editor_t *old_deditor,
+                        void *old_dedit_baton,
+                        const char *repos_root,
+                        const char *base_relpath,
+                        svn_editor3__shim_fetch_func_t fetch_func,
+                        void *fetch_baton,
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool);
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c?rev=1619825&r1=1619824&r2=1619825&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c Fri 
Aug 22 14:50:37 2014
@@ -72,7 +72,7 @@
  * The shim connector enables a more exact round-trip conversion from an
  * Ev1 drive to Ev3 and back to Ev1.
  */
-struct svn_delta__shim_connector_t
+struct svn_editor3__shim_connector_t
 {
   /* Set to true if and when an Ev1 receiving shim receives an absolute
    * path (prefixed with '/') from the delta edit, and causes the Ev1
@@ -117,12 +117,13 @@ svn_editor3__insert_shims(
                         void *old_dedit_baton,
                         const char *repos_root,
                         const char *base_relpath,
-                        const svn_delta_shim_callbacks_t *shim_cb,
+                        svn_editor3__shim_fetch_func_t fetch_func,
+                        void *fetch_baton,
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool)
 {
   svn_editor3_t *editor3;
-  svn_delta__shim_connector_t *shim_connector;
+  svn_editor3__shim_connector_t *shim_connector;
 
 #ifdef SVN_DEBUG
   /*SVN_ERR(svn_delta__get_debug_editor(&old_deditor, &old_dedit_baton,
@@ -134,8 +135,7 @@ svn_editor3__insert_shims(
                         &shim_connector,
                         old_deditor, old_dedit_baton,
                         repos_root, base_relpath,
-                        shim_cb->fetch_kind_func, shim_cb->fetch_baton,
-                        shim_cb->fetch_props_func, shim_cb->fetch_baton,
+                        fetch_func, fetch_baton,
                         NULL, NULL /*cancel*/,
                         result_pool, scratch_pool));
 #ifdef SVN_DEBUG
@@ -145,8 +145,7 @@ svn_editor3__insert_shims(
                         new_deditor, new_dedit_baton,
                         editor3,
                         repos_root, base_relpath,
-                        shim_cb->fetch_props_func, shim_cb->fetch_baton,
-                        shim_cb->fetch_base_func, shim_cb->fetch_baton,
+                        fetch_func, fetch_baton,
                         shim_connector,
                         result_pool, scratch_pool));
 #ifdef SVN_DEBUG
@@ -584,13 +583,10 @@ struct ev3_edit_baton
   /* Base directory of the edit, relative to the repository root. */
   const char *base_relpath;
 
-  const svn_delta__shim_connector_t *shim_connector;
+  const svn_editor3__shim_connector_t *shim_connector;
 
-  svn_delta_fetch_props_func_t fetch_props_func;
-  void *fetch_props_baton;
-
-  svn_delta_fetch_base_func_t fetch_base_func;
-  void *fetch_base_baton;
+  svn_editor3__shim_fetch_func_t fetch_func;
+  void *fetch_baton;
 
   svn_boolean_t closed;
 
@@ -953,10 +949,10 @@ apply_propedit(struct ev3_edit_baton *eb
          Otherwise, we get the properties from BASE.  */
       if (copyfrom_path)
         {
-          SVN_ERR(eb->fetch_props_func(&change->props,
-                                       eb->fetch_props_baton,
-                                       copyfrom_path, copyfrom_rev,
-                                       eb->edit_pool, scratch_pool));
+          SVN_ERR(eb->fetch_func(NULL, &change->props, NULL,
+                                 eb->fetch_baton,
+                                 copyfrom_path, copyfrom_rev,
+                                 eb->edit_pool, scratch_pool));
         }
       else if (change->action == RESTRUCTURE_ADD)
         {
@@ -966,10 +962,10 @@ apply_propedit(struct ev3_edit_baton *eb
         {
           if (! SVN_IS_VALID_REVNUM(base_revision))
             SVN_DBG(("apply_propedit: base_revision == -1"));
-          SVN_ERR(eb->fetch_props_func(&change->props,
-                                       eb->fetch_props_baton,
-                                       relpath, base_revision,
-                                       eb->edit_pool, scratch_pool));
+          SVN_ERR(eb->fetch_func(NULL, &change->props, NULL,
+                                 eb->fetch_baton,
+                                 relpath, base_revision,
+                                 eb->edit_pool, scratch_pool));
         }
     }
 
@@ -1162,11 +1158,11 @@ ev3_add_file(const char *path,
                                                    fb->eb->edit_pool);
       change->copyfrom_rev = copyfrom_revision;
 
-      SVN_ERR(fb->eb->fetch_base_func(&fb->delta_base_abspath,
-                                      fb->eb->fetch_base_baton,
-                                      change->copyfrom_path,
-                                      change->copyfrom_rev,
-                                      result_pool, scratch_pool));
+      SVN_ERR(fb->eb->fetch_func(NULL, NULL, &fb->delta_base_abspath,
+                                 fb->eb->fetch_baton,
+                                 change->copyfrom_path,
+                                 change->copyfrom_rev,
+                                 result_pool, scratch_pool));
       fb->copyfrom_relpath = change->copyfrom_path;
       fb->copyfrom_rev = change->copyfrom_rev;
     }
@@ -1215,17 +1211,17 @@ ev3_open_file(const char *path,
 
       fb->copyfrom_relpath = copyfrom_relpath;
       fb->copyfrom_rev = pb->copyfrom_rev;
-      SVN_ERR(fb->eb->fetch_base_func(&fb->delta_base_abspath,
-                                      fb->eb->fetch_base_baton,
-                                      copyfrom_relpath, pb->copyfrom_rev,
-                                      result_pool, scratch_pool));
+      SVN_ERR(fb->eb->fetch_func(NULL, NULL, &fb->delta_base_abspath,
+                                 fb->eb->fetch_baton,
+                                 copyfrom_relpath, pb->copyfrom_rev,
+                                 result_pool, scratch_pool));
     }
   else
     {
-      SVN_ERR(fb->eb->fetch_base_func(&fb->delta_base_abspath,
-                                      fb->eb->fetch_base_baton,
-                                      relpath, base_revision,
-                                      result_pool, scratch_pool));
+      SVN_ERR(fb->eb->fetch_func(NULL, NULL, &fb->delta_base_abspath,
+                                 fb->eb->fetch_baton,
+                                 relpath, base_revision,
+                                 result_pool, scratch_pool));
     }
 
   *file_baton = fb;
@@ -1503,11 +1499,9 @@ svn_delta__delta_from_ev3_for_commit(
                         svn_editor3_t *editor,
                         const char *repos_root,
                         const char *base_relpath,
-                        svn_delta_fetch_props_func_t fetch_props_func,
-                        void *fetch_props_baton,
-                        svn_delta_fetch_base_func_t fetch_base_func,
-                        void *fetch_base_baton,
-                        const svn_delta__shim_connector_t *shim_connector,
+                        svn_editor3__shim_fetch_func_t fetch_func,
+                        void *fetch_baton,
+                        const svn_editor3__shim_connector_t *shim_connector,
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool)
 {
@@ -1550,11 +1544,8 @@ svn_delta__delta_from_ev3_for_commit(
   eb->repos_root = apr_pstrdup(result_pool, repos_root);
   eb->base_relpath = apr_pstrdup(result_pool, base_relpath);
 
-  eb->fetch_props_func = fetch_props_func;
-  eb->fetch_props_baton = fetch_props_baton;
-
-  eb->fetch_base_func = fetch_base_func;
-  eb->fetch_base_baton = fetch_base_baton;
+  eb->fetch_func = fetch_func;
+  eb->fetch_baton = fetch_baton;
 
   *dedit_baton = eb;
   *deditor = &delta_editor;
@@ -1667,10 +1658,8 @@ typedef struct ev3_from_delta_baton_t
   void *dedit_baton;
 
   /* Callbacks */
-  svn_delta_fetch_kind_func_t fetch_kind_func;
-  void *fetch_kind_baton;
-  svn_delta_fetch_props_func_t fetch_props_func;
-  void *fetch_props_baton;
+  svn_editor3__shim_fetch_func_t fetch_func;
+  void *fetch_baton;
 
   /* The Ev1 root directory baton if we have opened the root, else null. */
   void *ev1_root_dir_baton;
@@ -1780,8 +1769,8 @@ static svn_error_t *
 fetch_base_props(apr_hash_t **base_props,
                  apr_hash_t *changes,
                  const char *repos_relpath,
-                 svn_delta_fetch_props_func_t fetch_props_func,
-                 void *fetch_props_baton,
+                 svn_editor3__shim_fetch_func_t fetch_func,
+                 void *fetch_baton,
                  apr_pool_t *result_pool,
                  apr_pool_t *scratch_pool)
 {
@@ -1830,9 +1819,9 @@ fetch_base_props(apr_hash_t **base_props
 
   if (source_path)
     {
-      SVN_ERR(fetch_props_func(base_props, fetch_props_baton,
-                               source_path, source_rev,
-                               result_pool, scratch_pool));
+      SVN_ERR(fetch_func(NULL, base_props, NULL,
+                         fetch_baton, source_path, source_rev,
+                         result_pool, scratch_pool));
     }
 
   return SVN_NO_ERROR;
@@ -1924,7 +1913,7 @@ apply_change(void **dir_baton,
   *dir_baton = NULL;
 
   SVN_ERR(fetch_base_props(&base_props, eb->changes, relpath,
-                           eb->fetch_props_func, eb->fetch_props_baton,
+                           eb->fetch_func, eb->fetch_baton,
                            scratch_pool, scratch_pool));
 
   /* Are we editing the root of the tree?  */
@@ -2228,9 +2217,10 @@ editor3_cp(void *baton,
   change->copyfrom_rev = from_peg_loc.rev;
   /* We need the source's kind to know whether to call add_directory()
      or add_file() later on.  */
-  SVN_ERR(eb->fetch_kind_func(&change->kind, eb->fetch_kind_baton,
-                              from_peg_loc.relpath, from_peg_loc.rev,
-                              scratch_pool));
+  SVN_ERR(eb->fetch_func(&change->kind, NULL, NULL,
+                         eb->fetch_baton,
+                         from_peg_loc.relpath, from_peg_loc.rev,
+                         scratch_pool, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -2266,8 +2256,9 @@ editor3_mv(void *baton,
      already recorded a change -- an earlier move, I suppose -- then the
      'kind' has already been recorded there and we could potentially
      re-use it here. But we have no need yet to optimise that case.) */
-  SVN_ERR(eb->fetch_kind_func(&change->kind, eb->fetch_kind_baton,
-                              from_loc.relpath, from_loc.rev, scratch_pool));
+  SVN_ERR(eb->fetch_func(&change->kind, NULL, NULL, eb->fetch_baton,
+                         from_loc.relpath, from_loc.rev,
+                         scratch_pool, scratch_pool));
 
   /* duplicate any child changes into the copy destination */
   SVN_ERR(duplicate_child_changes(eb->changes, from_txnpath, new_txnpath,
@@ -2442,15 +2433,13 @@ editor3_abort(void *baton,
 svn_error_t *
 svn_delta__ev3_from_delta_for_commit(
                         svn_editor3_t **editor_p,
-                        svn_delta__shim_connector_t **shim_connector,
+                        svn_editor3__shim_connector_t **shim_connector,
                         const svn_delta_editor_t *deditor,
                         void *dedit_baton,
                         const char *repos_root_url,
                         const char *base_relpath,
-                        svn_delta_fetch_kind_func_t fetch_kind_func,
-                        void *fetch_kind_baton,
-                        svn_delta_fetch_props_func_t fetch_props_func,
-                        void *fetch_props_baton,
+                        svn_editor3__shim_fetch_func_t fetch_func,
+                        void *fetch_baton,
                         svn_cancel_func_t cancel_func,
                         void *cancel_baton,
                         apr_pool_t *result_pool,
@@ -2480,10 +2469,8 @@ svn_delta__ev3_from_delta_for_commit(
   eb->changes = apr_hash_make(result_pool);
   eb->moves = apr_hash_make(result_pool);
 
-  eb->fetch_kind_func = fetch_kind_func;
-  eb->fetch_kind_baton = fetch_kind_baton;
-  eb->fetch_props_func = fetch_props_func;
-  eb->fetch_props_baton = fetch_props_baton;
+  eb->fetch_func = fetch_func;
+  eb->fetch_baton = fetch_baton;
 
   eb->edit_pool = result_pool;
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c?rev=1619825&r1=1619824&r2=1619825&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c Fri 
Aug 22 14:50:37 2014
@@ -808,44 +808,6 @@ fetch(svn_node_kind_t *kind_p,
   return SVN_NO_ERROR;
 }
 
-static svn_error_t *
-fetch_kind(svn_node_kind_t *kind,
-           void *baton,
-           const char *repos_relpath,
-           svn_revnum_t base_revision,
-           apr_pool_t *scratch_pool)
-{
-  return fetch(kind, NULL, NULL,
-               baton, repos_relpath, base_revision,
-               scratch_pool, scratch_pool);
-}
-
-static svn_error_t *
-fetch_props(apr_hash_t **props,
-            void *baton,
-            const char *repos_relpath,
-            svn_revnum_t base_revision,
-            apr_pool_t *result_pool,
-            apr_pool_t *scratch_pool)
-{
-  return fetch(NULL, props, NULL,
-               baton, repos_relpath, base_revision,
-               result_pool, scratch_pool);
-}
-
-static svn_error_t *
-fetch_base(const char **filename,
-           void *baton,
-           const char *repos_relpath,
-           svn_revnum_t base_revision,
-           apr_pool_t *result_pool,
-           apr_pool_t *scratch_pool)
-{
-  return fetch(NULL, NULL, filename,
-               baton, repos_relpath, base_revision,
-               result_pool, scratch_pool);
-}
-
 svn_error_t *svn_ra_get_commit_editor3(svn_ra_session_t *session,
                                        const svn_delta_editor_t **editor,
                                        void **edit_baton,
@@ -868,23 +830,17 @@ svn_error_t *svn_ra_get_commit_editor3(s
   /* Insert Ev3 shims */
   {
     const char *repos_root_url, *session_url, *base_relpath;
-    svn_delta_shim_callbacks_t *shim_callbacks
-      = svn_delta_shim_callbacks_default(pool);
     struct fb_baton *fbb = apr_palloc(pool, sizeof(*fbb));
 
     SVN_ERR(svn_ra_get_repos_root2(session, &repos_root_url, pool));
     SVN_ERR(svn_ra_get_session_url(session, &session_url, pool));
     base_relpath = svn_uri_skip_ancestor(repos_root_url, session_url, pool);
-    shim_callbacks->fetch_props_func = fetch_props;
-    shim_callbacks->fetch_kind_func = fetch_kind;
-    shim_callbacks->fetch_base_func = fetch_base;
-    shim_callbacks->fetch_baton = fbb;
     SVN_ERR(svn_ra_dup_session(&fbb->session, session, repos_root_url, pool, 
pool));
     fbb->session_path = base_relpath;
     fbb->repos_root_url = repos_root_url;
     SVN_ERR(svn_editor3__insert_shims(editor, edit_baton, *editor, *edit_baton,
                                       repos_root_url, base_relpath,
-                                      shim_callbacks, pool, pool));
+                                      fetch, fbb, pool, pool));
   }
 
   return SVN_NO_ERROR;

Modified: subversion/branches/move-tracking-2/subversion/libsvn_repos/commit.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_repos/commit.c?rev=1619825&r1=1619824&r2=1619825&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_repos/commit.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_repos/commit.c Fri 
Aug 22 14:50:37 2014
@@ -836,13 +836,16 @@ abort_edit(void *edit_baton,
 }
 
 
+/* Fetch kind and/or props and/or text */
 static svn_error_t *
-fetch_props_func(apr_hash_t **props,
-                 void *baton,
-                 const char *path,
-                 svn_revnum_t base_revision,
-                 apr_pool_t *result_pool,
-                 apr_pool_t *scratch_pool)
+fetch_func(svn_node_kind_t *kind,
+           apr_hash_t **props,
+           const char **filename,
+           void *baton,
+           const char *path,
+           svn_revnum_t base_revision,
+           apr_pool_t *result_pool,
+           apr_pool_t *scratch_pool)
 {
   struct edit_baton *eb = baton;
   svn_fs_root_t *fs_root;
@@ -853,74 +856,46 @@ fetch_props_func(apr_hash_t **props,
 
   SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs, base_revision, scratch_pool));
 
-  err = svn_fs_node_proplist(props, fs_root, path, result_pool);
-  if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
+  if (kind)
     {
-      svn_error_clear(err);
-      *props = apr_hash_make(result_pool);
-      return SVN_NO_ERROR;
+      SVN_ERR(svn_fs_check_path(kind, fs_root, path, scratch_pool));
     }
-  else if (err)
-    return svn_error_trace(err);
-
-  return SVN_NO_ERROR;
-}
 
-static svn_error_t *
-fetch_kind_func(svn_node_kind_t *kind,
-                void *baton,
-                const char *path,
-                svn_revnum_t base_revision,
-                apr_pool_t *scratch_pool)
-{
-  struct edit_baton *eb = baton;
-  svn_fs_root_t *fs_root;
-
-  if (!SVN_IS_VALID_REVNUM(base_revision))
-    base_revision = svn_fs_txn_base_revision(eb->txn);
-
-  SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs, base_revision, scratch_pool));
-
-  SVN_ERR(svn_fs_check_path(kind, fs_root, path, scratch_pool));
-
-  return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-fetch_base_func(const char **filename,
-                void *baton,
-                const char *path,
-                svn_revnum_t base_revision,
-                apr_pool_t *result_pool,
-                apr_pool_t *scratch_pool)
-{
-  struct edit_baton *eb = baton;
-  svn_stream_t *contents;
-  svn_stream_t *file_stream;
-  const char *tmp_filename;
-  svn_fs_root_t *fs_root;
-  svn_error_t *err;
-
-  if (!SVN_IS_VALID_REVNUM(base_revision))
-    base_revision = svn_fs_txn_base_revision(eb->txn);
-
-  SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs, base_revision, scratch_pool));
+  if (props)
+        {
+      err = svn_fs_node_proplist(props, fs_root, path, result_pool);
+      if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
+        {
+          svn_error_clear(err);
+          *props = apr_hash_make(result_pool);
+          return SVN_NO_ERROR;
+        }
+      else if (err)
+        return svn_error_trace(err);
+    }
 
-  err = svn_fs_file_contents(&contents, fs_root, path, scratch_pool);
-  if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
+  if (filename)
     {
-      svn_error_clear(err);
-      *filename = NULL;
-      return SVN_NO_ERROR;
-    }
-  else if (err)
-    return svn_error_trace(err);
-  SVN_ERR(svn_stream_open_unique(&file_stream, &tmp_filename, NULL,
-                                 svn_io_file_del_none,
-                                 scratch_pool, scratch_pool));
-  SVN_ERR(svn_stream_copy3(contents, file_stream, NULL, NULL, scratch_pool));
+      svn_stream_t *contents;
+      svn_stream_t *file_stream;
+      const char *tmp_filename;
+
+      err = svn_fs_file_contents(&contents, fs_root, path, scratch_pool);
+      if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
+        {
+          svn_error_clear(err);
+          *filename = NULL;
+          return SVN_NO_ERROR;
+        }
+      else if (err)
+        return svn_error_trace(err);
+      SVN_ERR(svn_stream_open_unique(&file_stream, &tmp_filename, NULL,
+                                     svn_io_file_del_none,
+                                     scratch_pool, scratch_pool));
+      SVN_ERR(svn_stream_copy3(contents, file_stream, NULL, NULL, 
scratch_pool));
 
-  *filename = apr_pstrdup(result_pool, tmp_filename);
+      *filename = apr_pstrdup(result_pool, tmp_filename);
+    }
 
   return SVN_NO_ERROR;
 }
@@ -946,8 +921,6 @@ svn_repos_get_commit_editor5(const svn_d
   svn_delta_editor_t *e;
   apr_pool_t *subpool = svn_pool_create(pool);
   struct edit_baton *eb;
-  svn_delta_shim_callbacks_t *shim_callbacks =
-                                    svn_delta_shim_callbacks_default(pool);
 
   /* Do a global authz access lookup.  Users with no write access
      whatsoever to the repository don't get a commit editor. */
@@ -999,15 +972,10 @@ svn_repos_get_commit_editor5(const svn_d
   *edit_baton = eb;
   *editor = e;
 
-  shim_callbacks->fetch_props_func = fetch_props_func;
-  shim_callbacks->fetch_kind_func = fetch_kind_func;
-  shim_callbacks->fetch_base_func = fetch_base_func;
-  shim_callbacks->fetch_baton = eb;
-
   SVN_ERR(svn_editor3__insert_shims(editor, edit_baton, *editor, *edit_baton,
                                     eb->repos_url,
                                     svn_relpath_canonicalize(eb->base_path, 
pool),
-                                    shim_callbacks, pool, pool));
+                                    fetch_func, eb, pool, pool));
 
   return SVN_NO_ERROR;
 }


Reply via email to