You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/10/27 23:53:03 UTC

svn commit: r1402894 - in /subversion/trunk/subversion: include/ libsvn_client/ libsvn_delta/ libsvn_repos/

Author: stefan2
Date: Sat Oct 27 21:53:02 2012
New Revision: 1402894

URL: http://svn.apache.org/viewvc?rev=1402894&view=rev
Log:
Extend the svn_delta_path_driver2 (rev'ed for 1.8) API such that
it becomes more suitable for existing callers of the deprecated
svn_delta_path_driver. Making the rev'ed API optionally sort the
path list will be enough. Update all callers to not use the
deprecated API.

* subversion/include/svn_delta.h
  (svn_delta_path_driver2): add sort_paths parameter
* subversion/libsvn_delta/path_driver.c
  (svn_delta_path_driver2): adapt implementation
* subversion/libsvn_delta/deprecated.c
  (svn_delta_path_driver): simplify

* subversion/libsvn_client/add.c
  (mkdir_urls): use rev'ed API
* subversion/libsvn_client/commit_util.c
  (svn_client__do_commit): ditto
* subversion/libsvn_client/copy.c
  (repos_to_repos_copy): same here ...
* subversion/libsvn_client/delete.c
  (single_repos_delete): and here ...
* subversion/libsvn_delta/compat.c
  (drive_changes): here ...
* subversion/libsvn_repos/replay.c
  (svn_repos_replay2): and finally here

Modified:
    subversion/trunk/subversion/include/svn_delta.h
    subversion/trunk/subversion/libsvn_client/add.c
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/libsvn_client/delete.c
    subversion/trunk/subversion/libsvn_delta/compat.c
    subversion/trunk/subversion/libsvn_delta/deprecated.c
    subversion/trunk/subversion/libsvn_delta/path_driver.c
    subversion/trunk/subversion/libsvn_repos/replay.c

Modified: subversion/trunk/subversion/include/svn_delta.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_delta.h?rev=1402894&r1=1402893&r2=1402894&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_delta.h (original)
+++ subversion/trunk/subversion/include/svn_delta.h Sat Oct 27 21:53:02 2012
@@ -1324,8 +1324,9 @@ typedef svn_error_t *(*svn_delta_path_dr
  * Each path in @a paths is a const char *. The editor drive will be
  * performed in the same order as @a paths. The paths should be sorted
  * using something like svn_sort_compare_paths to ensure that a depth-first
- * pattern is observed for directory/file baton creation. Some callers may
- * need further customization of the order (ie. libsvn_delta/compat.c).
+ * pattern is observed for directory/file baton creation. If @a sort_paths
+ * is set, the function will sort the paths for you. Some callers may need
+ * further customization of the order (ie. libsvn_delta/compat.c).
  *
  * Use @a scratch_pool for all necessary allocations.
  *
@@ -1335,6 +1336,7 @@ svn_error_t *
 svn_delta_path_driver2(const svn_delta_editor_t *editor,
                        void *edit_baton,
                        const apr_array_header_t *paths,
+                       svn_boolean_t sort_paths,
                        svn_delta_path_driver_cb_func_t callback_func,
                        void *callback_baton,
                        apr_pool_t *scratch_pool);

Modified: subversion/trunk/subversion/libsvn_client/add.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/add.c?rev=1402894&r1=1402893&r2=1402894&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/add.c (original)
+++ subversion/trunk/subversion/libsvn_client/add.c Sat Oct 27 21:53:02 2012
@@ -1365,9 +1365,8 @@ mkdir_urls(const apr_array_header_t *url
                                     pool));
 
   /* Call the path-based editor driver. */
-  err = svn_delta_path_driver(editor, edit_baton, SVN_INVALID_REVNUM,
-                              targets, path_driver_cb_func,
-                              (void *)editor, pool);
+  err = svn_delta_path_driver2(editor, edit_baton, targets, TRUE,
+                               path_driver_cb_func, (void *)editor, pool);
   if (err)
     {
       /* At least try to abort the edit (and fs txn) before throwing err. */

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1402894&r1=1402893&r2=1402894&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Sat Oct 27 21:53:02 2012
@@ -1793,9 +1793,8 @@ svn_client__do_commit(const char *base_u
   cb_baton.base_url = base_url;
 
   /* Drive the commit editor! */
-  SVN_ERR(svn_delta_path_driver(editor, edit_baton, SVN_INVALID_REVNUM,
-                                paths, do_item_commit, &cb_baton,
-                                scratch_pool));
+  SVN_ERR(svn_delta_path_driver2(editor, edit_baton, paths, TRUE,
+                                 do_item_commit, &cb_baton, scratch_pool));
 
   /* Transmit outstanding text deltas. */
   for (hi = apr_hash_first(scratch_pool, file_mods);

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1402894&r1=1402893&r2=1402894&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Sat Oct 27 21:53:02 2012
@@ -1147,8 +1147,8 @@ repos_to_repos_copy(const apr_array_head
   cb_baton.is_move = is_move;
 
   /* Call the path-based editor driver. */
-  err = svn_delta_path_driver(editor, edit_baton, SVN_INVALID_REVNUM, paths,
-                              path_driver_cb_func, &cb_baton, pool);
+  err = svn_delta_path_driver2(editor, edit_baton, paths, TRUE,
+                               path_driver_cb_func, &cb_baton, pool);
   if (err)
     {
       /* At least try to abort the edit (and fs txn) before throwing err. */

Modified: subversion/trunk/subversion/libsvn_client/delete.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/delete.c?rev=1402894&r1=1402893&r2=1402894&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/delete.c (original)
+++ subversion/trunk/subversion/libsvn_client/delete.c Sat Oct 27 21:53:02 2012
@@ -206,9 +206,8 @@ single_repos_delete(svn_ra_session_t *ra
                                     pool));
 
   /* Call the path-based editor driver. */
-  err = svn_delta_path_driver(editor, edit_baton, SVN_INVALID_REVNUM,
-                              relpaths, path_driver_cb_func,
-                              (void *)editor, pool);
+  err = svn_delta_path_driver2(editor, edit_baton, relpaths, TRUE,
+                               path_driver_cb_func, (void *)editor, pool);
 
   if (err)
     {

Modified: subversion/trunk/subversion/libsvn_delta/compat.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/compat.c?rev=1402894&r1=1402893&r2=1402894&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/compat.c (original)
+++ subversion/trunk/subversion/libsvn_delta/compat.c Sat Oct 27 21:53:02 2012
@@ -1726,7 +1726,7 @@ drive_changes(const struct editor_baton 
   /* Get a sorted list of Ev1-relative paths.  */
   paths = get_sorted_paths(eb->changes, eb->base_relpath, scratch_pool);
   SVN_ERR(svn_delta_path_driver2(eb->deditor, eb->dedit_baton, paths,
-                                 apply_change, (void *)eb,
+                                 FALSE, apply_change, (void *)eb,
                                  scratch_pool));
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_delta/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/deprecated.c?rev=1402894&r1=1402893&r2=1402894&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_delta/deprecated.c Sat Oct 27 21:53:02 2012
@@ -39,15 +39,10 @@ svn_delta_path_driver(const svn_delta_ed
                       void *callback_baton,
                       apr_pool_t *scratch_pool)
 {
-  apr_array_header_t *sorted;
-
   /* REVISION is dropped on the floor.  */
 
-  /* Construct a copy of PATHS, then sort them in a depth-first order.  */
-  sorted = apr_array_copy(scratch_pool, paths);
-  qsort(sorted->elts, sorted->nelts, sorted->elt_size, svn_sort_compare_paths);
-
-  return svn_error_trace(svn_delta_path_driver2(editor, edit_baton, sorted,
+  return svn_error_trace(svn_delta_path_driver2(editor, edit_baton, paths,
+                                                TRUE,
                                                 callback_func, callback_baton,
                                                 scratch_pool));
 }

Modified: subversion/trunk/subversion/libsvn_delta/path_driver.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/path_driver.c?rev=1402894&r1=1402893&r2=1402894&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/path_driver.c (original)
+++ subversion/trunk/subversion/libsvn_delta/path_driver.c Sat Oct 27 21:53:02 2012
@@ -133,6 +133,7 @@ svn_error_t *
 svn_delta_path_driver2(const svn_delta_editor_t *editor,
                        void *edit_baton,
                        const apr_array_header_t *paths,
+                       svn_boolean_t sort_paths,
                        svn_delta_path_driver_cb_func_t callback_func,
                        void *callback_baton,
                        apr_pool_t *pool)
@@ -151,6 +152,16 @@ svn_delta_path_driver2(const svn_delta_e
 
   subpool = svn_pool_create(pool);
   iterpool = svn_pool_create(pool);
+
+  /* sort paths if necessary */
+  if (sort_paths && paths->nelts > 1)
+    {
+      apr_array_header_t *sorted = apr_array_copy(subpool, paths);
+      qsort(sorted->elts, sorted->nelts, sorted->elt_size,
+            svn_sort_compare_paths);
+      paths = sorted;
+    }
+
   item = apr_pcalloc(subpool, sizeof(*item));
 
   /* If the root of the edit is also a target path, we want to call

Modified: subversion/trunk/subversion/libsvn_repos/replay.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/replay.c?rev=1402894&r1=1402893&r2=1402894&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/replay.c (original)
+++ subversion/trunk/subversion/libsvn_repos/replay.c Sat Oct 27 21:53:02 2012
@@ -946,9 +946,9 @@ svn_repos_replay2(svn_fs_root_t *root,
     }
 
   /* Call the path-based editor driver. */
-  return svn_delta_path_driver(editor, edit_baton,
-                               SVN_INVALID_REVNUM, paths,
-                               path_driver_cb_func, &cb_baton, pool);
+  return svn_delta_path_driver2(editor, edit_baton,
+                                paths, TRUE,
+                                path_driver_cb_func, &cb_baton, pool);
 #else
   svn_editor_t *editorv2;
   struct svn_delta__extra_baton *exb;