subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1390017 - in /subversion/branches/10Gb: subversion/include/private/ subversion/libsvn_subr/ tools/client-side/svn-bench/
Date Tue, 25 Sep 2012 17:49:28 GMT
Author: stefan2
Date: Tue Sep 25 17:49:27 2012
New Revision: 1390017

URL: http://svn.apache.org/viewvc?rev=1390017&view=rev
Log:
On the 10Gb branch: nicer formatting of the numbers produced by svn-bench.
Also, fix "svn-bench null-log -g".

* subversion/include/private/svn_string_private.h
  (svn__ui64toa_sep,
   svn__i64toa_sep): declare new private utility API
* subversion/libsvn_subr/string.c
  (ui64toa_sep): core function
  (svn__ui64toa_sep,
   svn__i64toa_sep): implement new API

* tools/client-side/svn-bench/main.c
  (svn_cl__option): forgot to add support for the "-g" option

* tools/client-side/svn-bench/null-export-cmd.c
  (svn_cl__null_export): use nicer output formatting
* tools/client-side/svn-bench/null-list-cmd.c
  (svn_cl__null_list): ditto
* tools/client-side/svn-bench/null-log-cmd.c
  (log_entry_receiver): fix counters for merged info
  (svn_cl__null_log): use nicer and conditional output formatting

Modified:
    subversion/branches/10Gb/subversion/include/private/svn_string_private.h
    subversion/branches/10Gb/subversion/libsvn_subr/string.c
    subversion/branches/10Gb/tools/client-side/svn-bench/main.c
    subversion/branches/10Gb/tools/client-side/svn-bench/null-export-cmd.c
    subversion/branches/10Gb/tools/client-side/svn-bench/null-list-cmd.c
    subversion/branches/10Gb/tools/client-side/svn-bench/null-log-cmd.c

Modified: subversion/branches/10Gb/subversion/include/private/svn_string_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/subversion/include/private/svn_string_private.h?rev=1390017&r1=1390016&r2=1390017&view=diff
==============================================================================
--- subversion/branches/10Gb/subversion/include/private/svn_string_private.h (original)
+++ subversion/branches/10Gb/subversion/include/private/svn_string_private.h Tue Sep 25 17:49:27
2012
@@ -78,6 +78,18 @@ svn__ui64toa(char * dest, apr_uint64_t n
 apr_size_t
 svn__i64toa(char * dest, apr_int64_t number);
 
+/** Returns a decimal string for @a number allocated in @a pool.  Put in
+ * the @a seperator at each third place.
+ */
+char *
+svn__ui64toa_sep(apr_uint64_t number, char seperator, apr_pool_t *pool);
+
+/** Returns a decimal string for @a number allocated in @a pool.  Put in
+ * the @a seperator at each third place.
+ */
+char *
+svn__i64toa_sep(apr_uint64_t number, char seperator, apr_pool_t *pool);
+
 /** @} */
 
 /** @} */

Modified: subversion/branches/10Gb/subversion/libsvn_subr/string.c
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/subversion/libsvn_subr/string.c?rev=1390017&r1=1390016&r2=1390017&view=diff
==============================================================================
--- subversion/branches/10Gb/subversion/libsvn_subr/string.c (original)
+++ subversion/branches/10Gb/subversion/libsvn_subr/string.c Tue Sep 25 17:49:27 2012
@@ -1093,3 +1093,44 @@ svn__i64toa(char * dest, apr_int64_t num
   *dest = '-';
   return svn__ui64toa(dest + 1, (apr_uint64_t)(0-number)) + 1;
 }
+
+static void
+ui64toa_sep(apr_uint64_t number, char seperator, char *buffer)
+{
+  apr_size_t length = svn__ui64toa(buffer, number);
+  apr_size_t i;
+
+  for (i = length; i > 3; i -= 3)
+    {
+      memmove(&buffer[i - 2], &buffer[i - 3], length - i + 3);
+      buffer[i-3] = seperator;
+      length++;
+    }
+
+  buffer[length] = 0;
+}
+
+char *
+svn__ui64toa_sep(apr_uint64_t number, char seperator, apr_pool_t *pool)
+{
+  char buffer[2 * SVN_INT64_BUFFER_SIZE];
+  ui64toa_sep(number, seperator, buffer);
+
+  return apr_pstrdup(pool, buffer);
+}
+
+char *
+svn__i64toa_sep(apr_uint64_t number, char seperator, apr_pool_t *pool)
+{
+  char buffer[2 * SVN_INT64_BUFFER_SIZE];
+  if (number < 0)
+    {
+      buffer[0] = '-';
+      ui64toa_sep((apr_uint64_t)(-number), seperator, &buffer[1]);
+    }
+  else
+    ui64toa_sep((apr_uint64_t)(number), seperator, buffer);
+
+  return apr_pstrdup(pool, buffer);
+}
+

Modified: subversion/branches/10Gb/tools/client-side/svn-bench/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/tools/client-side/svn-bench/main.c?rev=1390017&r1=1390016&r2=1390017&view=diff
==============================================================================
--- subversion/branches/10Gb/tools/client-side/svn-bench/main.c (original)
+++ subversion/branches/10Gb/tools/client-side/svn-bench/main.c Tue Sep 25 17:49:27 2012
@@ -147,6 +147,10 @@ const apr_getopt_option_t svn_cl__option
                     N_("set revision property ARG in new revision\n"
                        "                             "
                        "using the name[=value] format")},
+  {"use-merge-history", 'g', 0,
+                    N_("use/display additional information from merge\n"
+                       "                             "
+                       "history")},
 
   /* Long-opt Aliases
    *

Modified: subversion/branches/10Gb/tools/client-side/svn-bench/null-export-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/tools/client-side/svn-bench/null-export-cmd.c?rev=1390017&r1=1390016&r2=1390017&view=diff
==============================================================================
--- subversion/branches/10Gb/tools/client-side/svn-bench/null-export-cmd.c (original)
+++ subversion/branches/10Gb/tools/client-side/svn-bench/null-export-cmd.c Tue Sep 25 17:49:27
2012
@@ -36,7 +36,7 @@
 
 #include "svn_private_config.h"
 #include "libsvn_client/client.h"
-
+#include "private/svn_string_private.h"
 
 /*** The export editor code. ***/
 
@@ -344,16 +344,16 @@ svn_cl__null_export(apr_getopt_t *os,
 
   if (!opt_state->quiet)
     SVN_ERR(svn_cmdline_printf(pool,
-                               _("%15ld directories\n"
-                                 "%15ld files\n"
-                                 "%15ld bytes in files\n"
-                                 "%15ld properties\n"
-                                 "%15ld bytes in properties\n"),
-                               eb.dir_count,
-                               eb.file_count,
-                               eb.byte_count,
-                               eb.prop_count,
-                               eb.prop_byte_count));
+                               _("%15s directories\n"
+                                 "%15s files\n"
+                                 "%15s bytes in files\n"
+                                 "%15s properties\n"
+                                 "%15s bytes in properties\n"),
+                               svn__ui64toa_sep(eb.dir_count, ',', pool),
+                               svn__ui64toa_sep(eb.file_count, ',', pool),
+                               svn__ui64toa_sep(eb.byte_count, ',', pool),
+                               svn__ui64toa_sep(eb.prop_count, ',', pool),
+                               svn__ui64toa_sep(eb.prop_byte_count, ',', pool)));
 
   return svn_error_trace(err);
 }

Modified: subversion/branches/10Gb/tools/client-side/svn-bench/null-list-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/tools/client-side/svn-bench/null-list-cmd.c?rev=1390017&r1=1390016&r2=1390017&view=diff
==============================================================================
--- subversion/branches/10Gb/tools/client-side/svn-bench/null-list-cmd.c (original)
+++ subversion/branches/10Gb/tools/client-side/svn-bench/null-list-cmd.c Tue Sep 25 17:49:27
2012
@@ -35,6 +35,7 @@
 #include "cl.h"
 
 #include "svn_private_config.h"
+#include "private/svn_string_private.h"
 
 
 
@@ -146,8 +147,12 @@ svn_cl__null_list(apr_getopt_t *os,
         }
       else if (!opt_state->quiet)
         SVN_ERR(svn_cmdline_printf(pool,
-                               _("%15ld directories\n%15ld files\n%15ld locks\n"),
-                               pb.directories, pb.files, pb.locks));
+                                   _("%15s directories\n"
+                                     "%15s files\n"
+                                     "%15s locks\n"),
+                                   svn__ui64toa_sep(pb.directories, ',', pool),
+                                   svn__ui64toa_sep(pb.files, ',', pool),
+                                   svn__ui64toa_sep(pb.locks, ',', pool)));
     }
 
   svn_pool_destroy(subpool);

Modified: subversion/branches/10Gb/tools/client-side/svn-bench/null-log-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/tools/client-side/svn-bench/null-log-cmd.c?rev=1390017&r1=1390016&r2=1390017&view=diff
==============================================================================
--- subversion/branches/10Gb/tools/client-side/svn-bench/null-log-cmd.c (original)
+++ subversion/branches/10Gb/tools/client-side/svn-bench/null-log-cmd.c Tue Sep 25 17:49:27
2012
@@ -33,6 +33,7 @@
 #include "cl.h"
 
 #include "svn_private_config.h"
+#include "private/svn_string_private.h"
 
 
 /*** Code. ***/
@@ -101,16 +102,18 @@ log_entry_receiver(void *baton,
 
   if (message != NULL)
     {
-      lb->message_lines += svn_cstring_count_newlines(message) + 1;
+      int count = svn_cstring_count_newlines(message) + 1;
+      lb->message_lines += count;
       if (lb->merge_depth)
-        lb->merged_message_lines++;
+        lb->merged_message_lines += count;
     }
 
   if (log_entry->changed_paths2)
     {
-      lb->changes += apr_hash_count(log_entry->changed_paths2);
+      unsigned count = apr_hash_count(log_entry->changed_paths2);
+      lb->changes += count;
       if (lb->merge_depth)
-        lb->merged_changes++;
+        lb->merged_changes += count;
     }
 
   if (log_entry->has_children)
@@ -212,13 +215,26 @@ svn_cl__null_log(apr_getopt_t *os,
                           pool));
 
   if (!opt_state->quiet)
-    SVN_ERR(svn_cmdline_printf(pool,
-                               _("%15ld revisions, %15ld merged in %ld merges\n"
-                                 "%15ld msg lines, %15ld in merged revision\n"
-                                 "%15ld changes,   %15ld in merged revision\n"),
-                               lb.revisions, lb.merged_revs, lb.merges,
-                               lb.message_lines, lb.merged_message_lines,
-                               lb.changes, lb.merged_changes));
+    if (opt_state->use_merge_history)
+      SVN_ERR(svn_cmdline_printf(pool,
+                                _("%15s revisions, %15s merged in %s merges\n"
+                                  "%15s msg lines, %15s in merged revisions\n"
+                                  "%15s changes,   %15s in merged revisions\n"),
+                                svn__ui64toa_sep(lb.revisions, ',', pool),
+                                svn__ui64toa_sep(lb.merged_revs, ',', pool),
+                                svn__ui64toa_sep(lb.merges, ',', pool),
+                                svn__ui64toa_sep(lb.message_lines, ',', pool),
+                                svn__ui64toa_sep(lb.merged_message_lines, ',', pool),
+                                svn__ui64toa_sep(lb.changes, ',', pool),
+                                svn__ui64toa_sep(lb.merged_changes, ',', pool)));
+    else
+      SVN_ERR(svn_cmdline_printf(pool,
+                                _("%15s revisions\n"
+                                  "%15s msg lines\n"
+                                  "%15s changes\n"),
+                                svn__ui64toa_sep(lb.revisions, ',', pool),
+                                svn__ui64toa_sep(lb.message_lines, ',', pool),
+                                svn__ui64toa_sep(lb.changes, ',', pool)));
 
   return SVN_NO_ERROR;
 }



Mime
View raw message