subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1341031 - /subversion/trunk/subversion/svn/props.c
Date Mon, 21 May 2012 14:03:46 GMT
Author: stsp
Date: Mon May 21 14:03:46 2012
New Revision: 1341031

URL: http://svn.apache.org/viewvc?rev=1341031&view=rev
Log:
Make 'svn proplist' print property lists in sorted order.
Avoids random output ordering with APR-1.4.6.

* subversion/svn/props.c
  (svn_cl__print_prop_hash, svn_cl__print_xml_prop_hash): Iterate over a sorted
   hash key array rather than iterating over the property hash table itself.

Modified:
    subversion/trunk/subversion/svn/props.c

Modified: subversion/trunk/subversion/svn/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/props.c?rev=1341031&r1=1341030&r2=1341031&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/props.c (original)
+++ subversion/trunk/subversion/svn/props.c Mon May 21 14:03:46 2012
@@ -31,6 +31,7 @@
 #include "svn_cmdline.h"
 #include "svn_string.h"
 #include "svn_error.h"
+#include "svn_sorts.h"
 #include "svn_subst.h"
 #include "svn_props.h"
 #include "svn_string.h"
@@ -87,12 +88,16 @@ svn_cl__print_prop_hash(svn_stream_t *ou
                         svn_boolean_t names_only,
                         apr_pool_t *pool)
 {
-  apr_hash_index_t *hi;
+  apr_array_header_t *sorted_props;
+  int i;
 
-  for (hi = apr_hash_first(pool, prop_hash); hi; hi = apr_hash_next(hi))
+  sorted_props = svn_sort__hash(prop_hash, svn_sort_compare_items_lexically,
+                                pool);
+  for (i = 0; i < sorted_props->nelts; i++)
     {
-      const char *pname = svn__apr_hash_index_key(hi);
-      svn_string_t *propval = svn__apr_hash_index_val(hi);
+      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
+      const char *pname = item.key;
+      svn_string_t *propval = item.value;
       const char *pname_stdout;
 
       if (svn_prop_needs_translation(pname))
@@ -150,15 +155,19 @@ svn_cl__print_xml_prop_hash(svn_stringbu
                             svn_boolean_t names_only,
                             apr_pool_t *pool)
 {
-  apr_hash_index_t *hi;
+  apr_array_header_t *sorted_props;
+  int i;
 
   if (*outstr == NULL)
     *outstr = svn_stringbuf_create_empty(pool);
 
-  for (hi = apr_hash_first(pool, prop_hash); hi; hi = apr_hash_next(hi))
+  sorted_props = svn_sort__hash(prop_hash, svn_sort_compare_items_lexically,
+                                pool);
+  for (i = 0; i < sorted_props->nelts; i++)
     {
-      const char *pname = svn__apr_hash_index_key(hi);
-      svn_string_t *propval = svn__apr_hash_index_val(hi);
+      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
+      const char *pname = item.key;
+      svn_string_t *propval = item.value;
 
       if (names_only)
         {



Mime
View raw message