[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Make svnadmin less verbose by default and add a --verbose flag

From: Tobias Ringström <tobias_at_ringstrom.mine.nu>
Date: 2004-06-24 22:20:12 CEST

Any objections to the attached patch? It makes "svnadmin load" print
one line per commit by default. You can still get the old behaviour by
using the --verbose (or -v) flag.

/Tobias

[[[
Make svnadmin load less verbose by default and add a --verbose flag.

* subversion/svnadmin/main.c
  (options_table): Add a verbose option.
  (cmd_table): Make load accept the verbose option.
  (svnadmin_opt_state): Add a verbose member.
  (subcommand_load): Use svn_repos_load_fs2 and the verbose flag.
  (main): Accept the verbose option.

* subversion/include/svn_repos.h
  (svn_repos_load_fs2): Like svn_repos_load_fs but with a verbose argument.
  (svn_repos_load_fs): Depricate.
  (svn_repos_get_fs_build_parser2): Add a verbose argument.

* subversion/libsvn_repos/load.c
  (parse_baton): Add a verbose member.
  (maybe_add_with_history, new_node_record, close_node, close_revision):
  Only print progress when verbose.
  (svn_repos_get_fs_build_parser2): Set the verbose member in the baton.
  (svn_repos_get_fs_build_parser): Set the verbose member the baton to TRUE.
  (svn_repos_load_fs2): Like svn_repos_load_fs but with a verbose argument.
  (svn_repos_load_fs): Call svn_repos_load_fs2 with verbose set to TRUE.
]]]

Index: subversion/svnadmin/main.c
===================================================================
--- subversion/svnadmin/main.c (revision 10069)
+++ subversion/svnadmin/main.c (working copy)
@@ -224,6 +224,9 @@
     {"clean-logs", svnadmin__clean_logs, 0,
      N_("remove redundant log files from source repository")},
 
+ {"verbose", 'v', 0,
+ N_("print extra information")},
+
     {NULL}
   };
 
@@ -288,7 +291,7 @@
         "was previously empty, its UUID will, by default, be changed to the\n"
         "one specified in the stream. Progress feedback is sent to"
         " stdout.\n"),
- {'q', svnadmin__ignore_uuid, svnadmin__force_uuid,
+ {'q', 'v', svnadmin__ignore_uuid, svnadmin__force_uuid,
       svnadmin__parent_dir} },
 
     {"lstxns", subcommand_lstxns, {0},
@@ -351,6 +354,7 @@
   svn_boolean_t bypass_hooks; /* --bypass-hooks */
   enum svn_repos_load_uuid uuid_action; /* --ignore-uuid,
                                                        --force-uuid */
+ svn_boolean_t verbose; /* --verbose */
   const char *parent_dir;
 
   const char *config_dir; /* Overriding Configuration Directory */
@@ -565,9 +569,10 @@
     SVN_ERR (create_stdio_stream (&stdout_stream,
                                   apr_file_open_stdout, pool));
   
- SVN_ERR (svn_repos_load_fs (repos, stdin_stream, stdout_stream,
- opt_state->uuid_action, opt_state->parent_dir,
- check_cancel, NULL, pool));
+ SVN_ERR (svn_repos_load_fs2 (repos, stdin_stream, stdout_stream,
+ opt_state->verbose, opt_state->uuid_action,
+ opt_state->parent_dir, check_cancel, NULL,
+ pool));
 
   return SVN_NO_ERROR;
 }
@@ -938,6 +943,9 @@
       case 'q':
         opt_state.quiet = TRUE;
         break;
+ case 'v':
+ opt_state.verbose = TRUE;
+ break;
       case 'h':
       case '?':
         opt_state.help = TRUE;
Index: subversion/include/svn_repos.h
===================================================================
--- subversion/include/svn_repos.h (revision 10069)
+++ subversion/include/svn_repos.h (working copy)
@@ -940,13 +940,17 @@
                                 apr_pool_t *pool);
 
 
-/** Read and parse dumpfile-formatted @a dumpstream, reconstructing
+/**
+ * @since New in 1.1.
+ *
+ * Read and parse dumpfile-formatted @a dumpstream, reconstructing
  * filesystem revisions in already-open @a repos, handling uuids
  * in accordance with @a uuid_action.
  *
  * Read and parse dumpfile-formatted @a dumpstream, reconstructing
  * filesystem revisions in already-open @a repos. Use @a pool for all
  * allocation. If non-@c NULL, send feedback to @a feedback_stream.
+ * The feedback is verbose if @a verbose is TRUE.
  *
  * If the dumpstream contains copy history that is unavailable in the
  * repository, an error will be thrown.
@@ -968,6 +972,22 @@
  * @a cancel_baton as argument to see if the client wishes to cancel
  * the load.
  */
+svn_error_t *svn_repos_load_fs2 (svn_repos_t *repos,
+ svn_stream_t *dumpstream,
+ svn_stream_t *feedback_stream,
+ svn_boolean_t verbose,
+ enum svn_repos_load_uuid uuid_action,
+ const char *parent_dir,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool);
+
+/**
+ * @deprecated Provided for backward compatibility with the 1.0.0 API.
+ *
+ * Similar to svn_repos_load_fs2(), but with the @a verbose parameter
+ * always set to @c TRUE.
+ */
 svn_error_t *svn_repos_load_fs (svn_repos_t *repos,
                                 svn_stream_t *dumpstream,
                                 svn_stream_t *feedback_stream,
@@ -1120,7 +1140,8 @@
  * loaded nodes, from root to @a parent_dir. The directory @a parent_dir
  * must be an existing directory in the repository.
  *
- * Print all parsing feedback to @a outstream (if non-@c NULL).
+ * Print all parsing feedback to @a outstream (if non-@c NULL). If @a
+ * verbose is TRUE, the output will be verbose.
  *
  */
 svn_error_t *
@@ -1130,6 +1151,7 @@
                                 svn_boolean_t use_history,
                                 enum svn_repos_load_uuid uuid_action,
                                 svn_stream_t *outstream,
+ svn_boolean_t verbose,
                                 const char *parent_dir,
                                 apr_pool_t *pool);
 
Index: subversion/libsvn_repos/load.c
===================================================================
--- subversion/libsvn_repos/load.c (revision 10069)
+++ subversion/libsvn_repos/load.c (working copy)
@@ -42,6 +42,7 @@
   svn_stream_t *outstream;
   enum svn_repos_load_uuid uuid_action;
   const char *parent_dir;
+ svn_boolean_t verbose;
 };
 
 struct revision_baton
@@ -836,7 +837,7 @@
       SVN_ERR (svn_fs_copy (copy_root, nb->copyfrom_path,
                             rb->txn_root, nb->path, pool));
 
- if (pb->outstream)
+ if (pb->outstream && pb->verbose)
         {
           apr_size_t len = 9;
           SVN_ERR (svn_stream_write (pb->outstream, "COPIED...", &len));
@@ -882,7 +883,7 @@
     {
     case svn_node_action_change:
       {
- if (pb->outstream)
+ if (pb->outstream && pb->verbose)
           SVN_ERR (svn_stream_printf (pb->outstream, pool,
                                       " * editing path : %s ...",
                                       nb->path));
@@ -890,7 +891,7 @@
       }
     case svn_node_action_delete:
       {
- if (pb->outstream)
+ if (pb->outstream && pb->verbose)
           SVN_ERR (svn_stream_printf (pb->outstream, pool,
                                       " * deleting path : %s ...",
                                       nb->path));
@@ -899,7 +900,7 @@
       }
     case svn_node_action_add:
       {
- if (pb->outstream)
+ if (pb->outstream && pb->verbose)
           SVN_ERR (svn_stream_printf (pb->outstream, pool,
                                       " * adding path : %s ...",
                                       nb->path));
@@ -909,7 +910,7 @@
       }
     case svn_node_action_replace:
       {
- if (pb->outstream)
+ if (pb->outstream && pb->verbose)
           SVN_ERR (svn_stream_printf (pb->outstream, pool,
                                       " * replacing path : %s ...",
                                       nb->path));
@@ -1056,7 +1057,7 @@
   struct revision_baton *rb = nb->rb;
   struct parse_baton *pb = rb->pb;
 
- if (pb->outstream)
+ if (pb->outstream && pb->verbose)
     {
       apr_size_t len = 7;
       SVN_ERR (svn_stream_write (pb->outstream, " done.\n", &len));
@@ -1100,7 +1101,7 @@
                                      SVN_PROP_REVISION_DATE, rb->datestamp,
                                      rb->pool));
 
- if (pb->outstream)
+ if (pb->outstream && pb->verbose)
     {
       if (new_rev == rb->rev)
         {
@@ -1133,17 +1134,21 @@
                                 svn_boolean_t use_history,
                                 enum svn_repos_load_uuid uuid_action,
                                 svn_stream_t *outstream,
+ svn_boolean_t verbose,
                                 const char *parent_dir,
                                 apr_pool_t *pool)
 {
   const svn_repos_parser_fns_t *fns;
   svn_repos_parser_fns2_t *parser;
+ struct parse_baton *pb;
 
   /* Fetch the old-style vtable and baton, convert the vtable to a
    * new-style vtable, and set the new callbacks. */
   SVN_ERR (svn_repos_get_fs_build_parser (&fns, parse_baton, repos,
                                           use_history, uuid_action, outstream,
                                           parent_dir, pool));
+ pb = *(struct parse_baton**)parse_baton;
+ pb->verbose = verbose;
   parser = fns2_from_fns (fns, pool);
   parser->delete_node_property = delete_node_property;
   parser->apply_textdelta = apply_textdelta;
@@ -1182,6 +1187,7 @@
   pb->outstream = outstream;
   pb->uuid_action = uuid_action;
   pb->parent_dir = parent_dir;
+ pb->verbose = TRUE;
 
   *parser_callbacks = parser;
   *parse_baton = pb;
@@ -1191,14 +1197,15 @@
 
 
 svn_error_t *
-svn_repos_load_fs (svn_repos_t *repos,
- svn_stream_t *dumpstream,
- svn_stream_t *feedback_stream,
- enum svn_repos_load_uuid uuid_action,
- const char *parent_dir,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
- apr_pool_t *pool)
+svn_repos_load_fs2 (svn_repos_t *repos,
+ svn_stream_t *dumpstream,
+ svn_stream_t *feedback_stream,
+ svn_boolean_t verbose,
+ enum svn_repos_load_uuid uuid_action,
+ const char *parent_dir,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool)
 {
   const svn_repos_parser_fns2_t *parser;
   void *parse_baton;
@@ -1210,6 +1217,7 @@
                                            TRUE, /* look for copyfrom revs */
                                            uuid_action,
                                            feedback_stream,
+ verbose,
                                            parent_dir,
                                            pool));
 
@@ -1218,3 +1226,25 @@
 
   return SVN_NO_ERROR;
 }
+
+
+svn_error_t *
+svn_repos_load_fs (svn_repos_t *repos,
+ svn_stream_t *dumpstream,
+ svn_stream_t *feedback_stream,
+ enum svn_repos_load_uuid uuid_action,
+ const char *parent_dir,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool)
+{
+ return svn_repos_load_fs2 (repos,
+ dumpstream,
+ feedback_stream,
+ TRUE,
+ uuid_action,
+ parent_dir,
+ cancel_func,
+ cancel_baton,
+ pool);
+}

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jun 24 22:21:03 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.