subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1170924 - /subversion/trunk/subversion/libsvn_delta/compat.c
Date Thu, 15 Sep 2011 01:59:11 GMT
Author: hwright
Date: Thu Sep 15 01:59:11 2011
New Revision: 1170924

URL: http://svn.apache.org/viewvc?rev=1170924&view=rev
Log:
Add some skeleton code to facilitate Ev2 shim post-processing.

(Note: this code doesn't actually run yet, since we segfault calling the
NULL fetch_props_func in the delta editor part of the shim.)

* subversion/libsvn_delta/compat.c
  (editor_baton): Add a paths hash and edit_pool.
  (set_props_cb): Add our path to the hash.
  (complete_cb): Sort the paths and iterate over them.
  (svn_editor_from_delta): Initialize a few baton members.

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=1170924&r1=1170923&r2=1170924&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/compat.c (original)
+++ subversion/trunk/subversion/libsvn_delta/compat.c Thu Sep 15 01:59:11 2011
@@ -561,6 +561,9 @@ struct editor_baton
 {
   const svn_delta_editor_t *deditor;
   void *dedit_baton;
+
+  apr_hash_t *paths;
+  apr_pool_t *edit_pool;
 };
 
 /* This implements svn_editor_cb_add_directory_t */
@@ -618,6 +621,10 @@ set_props_cb(void *baton,
              svn_boolean_t complete,
              apr_pool_t *scratch_pool)
 {
+  struct editor_baton *eb = baton;
+  apr_hash_set(eb->paths, apr_pstrdup(eb->edit_pool, relpath),
+               APR_HASH_KEY_STRING, (void *)0xdeadbeef);
+
   return SVN_NO_ERROR;
 }
 
@@ -684,6 +691,24 @@ complete_cb(void *baton,
             apr_pool_t *scratch_pool)
 {
   struct editor_baton *eb = baton;
+  apr_array_header_t *sorted_hash;
+  int i;
+
+  /* Sort the paths touched by this edit.
+   * Ev2 doesn't really have any particular need for depth-first-ness, but
+   * we want to ensure all parent directories are handled before children in
+   * the case of adds (which does introduce an element of depth-first-ness). */
+  sorted_hash = svn_sort__hash(eb->paths, svn_sort_compare_items_as_paths,
+                               scratch_pool);
+
+  for (i = 0; i < sorted_hash->nelts; i++)
+    {
+      svn_sort__item_t *item = &APR_ARRAY_IDX(sorted_hash, i, svn_sort__item_t);
+      const char *path = item->key;
+
+      /* ### We should actually do something here, but for now... */
+    }
+
   return svn_error_trace(eb->deditor->close_edit(eb->dedit_baton,
                                                  scratch_pool));
 }
@@ -726,6 +751,8 @@ svn_editor_from_delta(svn_editor_t **edi
 
   eb->deditor = deditor;
   eb->dedit_baton = dedit_baton;
+  eb->edit_pool = result_pool;
+  eb->paths = apr_hash_make(result_pool);
 
   SVN_ERR(svn_editor_create(&editor, eb, cancel_func, cancel_baton,
                             result_pool, scratch_pool));



Mime
View raw message