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/05/31 21:04:08 UTC

svn commit: r1344864 - /subversion/trunk/subversion/libsvn_repos/dump.c

Author: stsp
Date: Thu May 31 19:04:08 2012
New Revision: 1344864

URL: http://svn.apache.org/viewvc?rev=1344864&view=rev
Log:
Issue #4134: svnadmin dump files are not reproducible, due to APR 1.4.6
             hash order changes

This patch sorts deleted path names before dumping them.

* subversion/libsvn_repos/dump.c
   (close_directory): sort hash deleted_entries before dumping.

Patch by: Dustin Lang <ds...@gmail.com>
Review by: stsp
(Stefan suggested several stylistic changes and using 
svn_sort_compare_items_lexically.)

Modified:
    subversion/trunk/subversion/libsvn_repos/dump.c

Modified: subversion/trunk/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/dump.c?rev=1344864&r1=1344863&r2=1344864&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/dump.c (original)
+++ subversion/trunk/subversion/libsvn_repos/dump.c Thu May 31 19:04:08 2012
@@ -34,6 +34,7 @@
 #include "svn_time.h"
 #include "svn_checksum.h"
 #include "svn_props.h"
+#include "svn_sorts.h"
 
 #include "private/svn_mergeinfo_private.h"
 #include "private/svn_fs_private.h"
@@ -736,12 +737,15 @@ close_directory(void *dir_baton,
   struct edit_baton *eb = db->edit_baton;
   apr_hash_index_t *hi;
   apr_pool_t *subpool = svn_pool_create(pool);
+  unsigned int i;
+  apr_array_header_t *sorted_entries;
 
-  for (hi = apr_hash_first(pool, db->deleted_entries);
-       hi;
-       hi = apr_hash_next(hi))
+  sorted_entries = svn_sort__hash(db->deleted_entries,
+                                  svn_sort_compare_items_lexically, pool);
+  for (i = 0; i < sorted_entries->nelts; i++)
     {
-      const char *path = svn__apr_hash_index_key(hi);
+      const char *path = APR_ARRAY_IDX(sorted_entries, i,
+                                       svn_sort__item_t).key;
 
       svn_pool_clear(subpool);