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

[PATCH] Update progress while ra-neon spools text delta

From: Eric Gillespie <epg_at_pretzelnet.org>
Date: 2007-08-17 02:47:39 CEST

[[[
When committing a new gigantic file, ra-neon spends a long time
calculating a text delta and spooling it to disk, during which time
application progress meters are left hanging. Unless we call the
progress callback here, too, so let's do that.

* subversion/libsvn_ra_neon/ra_neon.h
  (svn_ra_neon__session_t): Add fields for progress_func and baton.

* subversion/libsvn_ra_neon/session.c
  (svn_ra_neon__open): Save progress_func and baton in ras.

* subversion/libsvn_ra_neon/commit.c
  (put_baton_t): Add fields for progress bytes, session baton, and pool.
  (commit_stream_write): Add bytes written to pb->progress and pass it
    to the progress callback.
  (commit_apply_txdelta): Set session baton and pool in put_baton.
]]]

Index: subversion/libsvn_ra_neon/session.c
===================================================================
--- subversion/libsvn_ra_neon/session.c (revision 26021)
+++ subversion/libsvn_ra_neon/session.c (working copy)
@@ -782,6 +782,8 @@
   ras->callbacks = callbacks;
   ras->callback_baton = callback_baton;
   ras->compression = compression;
+ ras->progress_baton = callbacks->progress_baton;
+ ras->progress_func = callbacks->progress_func;
   /* save config and server group in the auth parameter hash */
   svn_auth_set_parameter(ras->callbacks->auth_baton,
                          SVN_AUTH_PARAM_CONFIG, cfg);
Index: subversion/libsvn_ra_neon/ra_neon.h
===================================================================
--- subversion/libsvn_ra_neon/ra_neon.h (revision 26021)
+++ subversion/libsvn_ra_neon/ra_neon.h (working copy)
@@ -95,6 +95,9 @@
 
   svn_boolean_t compression; /* should we use http compression? */
   const char *uuid; /* repository UUID */
+
+ svn_ra_progress_notify_func_t progress_func;
+ void *progress_baton;
 } svn_ra_neon__session_t;
 
 
Index: subversion/libsvn_ra_neon/commit.c
===================================================================
--- subversion/libsvn_ra_neon/commit.c (revision 26021)
+++ subversion/libsvn_ra_neon/commit.c (working copy)
@@ -105,6 +105,9 @@
   apr_file_t *tmpfile; /* may be NULL for content-less file */
   svn_stringbuf_t *fname; /* may be NULL for content-less file */
   const char *base_checksum; /* hex md5 of base text; may be null */
+ apr_off_t progress;
+ svn_ra_neon__session_t *ras;
+ apr_pool_t *pool;
 } put_baton_t;
 
 typedef struct
@@ -1122,6 +1125,8 @@
   if (status)
     return svn_error_wrap_apr(status,
                               _("Could not write svndiff to temp file"));
+ pb->progress += *len;
+ pb->ras->progress_func(pb->progress, -1, pb->ras->progress_baton, pb->pool);
 
   return SVN_NO_ERROR;
 }
@@ -1138,6 +1143,8 @@
   svn_stream_t *stream;
 
   baton = apr_pcalloc(file->pool, sizeof(*baton));
+ baton->ras = file->cc->ras;
+ baton->pool = pool;
   file->put_baton = baton;
 
   if (base_checksum)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Aug 17 02:45:22 2007

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.