subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Sperling <s...@elego.de>
Subject Re: Improving svn commit progress notification
Date Tue, 17 Jun 2014 16:10:16 GMT
On Tue, Jun 17, 2014 at 06:40:43PM +0400, Ivan Zhakov wrote:
> Anyone have any ideas on the UI in svn command line. I've prepared
> several versions:1.
> 
> [[[
> $ svn ci wc -m "log msg"
> Sending        wc\foo
> Transmitting file data .
> Finalizing commit ...
> Committed revision 5.
> ]]]
> 
> 
> [[[
> $ svn ci wc -m "log msg"
> Sending        wc\foo
> Transmitting file data .
> Finalizing commit: Committed revision 5.
> ]]]
> 
> 
> [[[
> $ svn ci wc -m "log msg"
> Sending        wc\foo
> Transmitting file data .
> Committing: Committed revision 5.
> ]]]
> 
> [[[
> $ svn ci wc -m "log msg"
> Sending        wc\foo
> Transmitting file data .
> Finalizing: Committed revision 5.
> ]]]
> 
> Any other ideas?

[[[
$ svn ci wc -m "log msg"
Sending        wc\foo
Transmitting file data ............done
Committing transaction...
Committed revision 5.
]]]

Also consider the out-of-date case:

[[[
$ svn ci wc -m "log msg"
Sending        wc\foo
Transmitting file data ............done
Committing transaction...
subversion/svn/commit-cmd.c:183,
subversion/libsvn_client/commit.c:987,
subversion/libsvn_client/commit.c:156: (apr_err=SVN_ERR_WC_NOT_UP_TO_DATE)
svn: E155011: Commit failed (details follow):
subversion/libsvn_client/commit.c:902,
subversion/libsvn_client/commit_util.c:1883,
subversion/libsvn_delta/path_driver.c:263,
subversion/libsvn_client/commit_util.c:1833,
subversion/libsvn_client/commit_util.c:94: (apr_err=SVN_ERR_WC_NOT_UP_TO_DATE)
svn: E155011: File 'wc\foo' is out of date
subversion/libsvn_repos/commit.c:586,
subversion/libsvn_repos/commit.c:165: (apr_err=SVN_ERR_FS_TXN_OUT_OF_DATE)
svn: E160028: File 'wc\foo' is out of date
]]]

While here, it might be nice to print the amount of data transmitted
to the server:

[[[
$ svn ci wc -m "log msg"
Sending        wc\foo
Transmitting file data ............done (1024 bytes transferred)
Committing transaction...
Committed revision 5.
]]]

Here's a starting point for that.

Index: subversion/svn/svn.c
===================================================================
--- subversion/svn/svn.c	(revision 1543401)
+++ subversion/svn/svn.c	(working copy)
@@ -1738,6 +1738,32 @@ add_search_pattern_to_latest_group(svn_cl__opt_sta
   APR_ARRAY_PUSH(group, const char *) = pattern;
 }
 
+
+/*** Progress information. ***/
+
+/* Baton type for progress_func(). */
+struct progress_func_baton_t {
+  apr_off_t progress;
+  apr_off_t total;
+} progress_func_baton_t;
+
+/* An implementation of svn_ra_progress_notify_func_t */
+static void
+progress_func(apr_off_t progress,
+              apr_off_t total,
+              void *baton,
+              apr_pool_t *pool)
+{
+  struct progress_func_baton_t *b = baton;
+
+  b->progress = progress;
+  if (total != -1)
+    b->total = total;
+
+  SVN_DBG(("progress: %" APR_OFF_T_FMT ", total: %" APR_OFF_T_FMT,
+      progress, total));
+}
+
 
 /*** Main. ***/
 
@@ -1780,6 +1806,7 @@ sub_main(int argc, const char *argv[], apr_pool_t
   svn_boolean_t reading_file_from_stdin = FALSE;
   apr_hash_t *changelists;
   apr_hash_t *cfg_hash;
+  struct progress_func_baton_t progress_baton = { 0 };
 
   received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
 
@@ -2829,6 +2856,10 @@ sub_main(int argc, const char *argv[], apr_pool_t
      subcommands will populate the ctx->log_msg_baton3. */
   ctx->log_msg_func3 = svn_cl__get_log_message;
 
+  /* Setup progress information callback. */
+  ctx->progress_func = progress_func;
+  ctx->progress_baton = &progress_baton;
+
   /* Set up the notifier.
 
      In general, we use it any time we aren't in --quiet mode.  'svn


Mime
View raw message