You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2013/04/23 16:59:02 UTC
svn commit: r1470994 -
/subversion/trunk/subversion/libsvn_client/repos_diff.c
Author: philip
Date: Tue Apr 23 14:59:02 2013
New Revision: 1470994
URL: http://svn.apache.org/r1470994
Log:
Significantly reduce the number of open files during a typical 2-URL
diff over ra_serf by using lazy-opening streams to delay opening until
the HTTP response is received.
* subversion/libsvn_wc/repos_diff.c
(lazy_open_source, lazy_open_result): New.
(apply_textdelta): Use lazy-open streams for source and result.
Modified:
subversion/trunk/subversion/libsvn_client/repos_diff.c
Modified: subversion/trunk/subversion/libsvn_client/repos_diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/repos_diff.c?rev=1470994&r1=1470993&r2=1470994&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/repos_diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/repos_diff.c Tue Apr 23 14:59:02 2013
@@ -843,6 +843,37 @@ window_handler(svn_txdelta_window_t *win
return SVN_NO_ERROR;
}
+/* Implements svn_stream_lazyopen_func_t. */
+static svn_error_t *
+lazy_open_source(svn_stream_t **stream,
+ void *baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct file_baton *fb = baton;
+
+ SVN_ERR(svn_stream_open_readonly(stream, fb->path_start_revision,
+ result_pool, scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
+/* Implements svn_stream_lazyopen_func_t. */
+static svn_error_t *
+lazy_open_result(svn_stream_t **stream,
+ void *baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct file_baton *fb = baton;
+
+ SVN_ERR(svn_stream_open_unique(stream, &fb->path_end_revision, NULL,
+ svn_io_file_del_on_pool_cleanup,
+ result_pool, scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
/* An svn_delta_editor_t function. */
static svn_error_t *
apply_textdelta(void *file_baton,
@@ -902,14 +933,13 @@ apply_textdelta(void *file_baton,
}
/* Open the file to be used as the base for second revision */
- SVN_ERR(svn_stream_open_readonly(&src_stream, fb->path_start_revision,
- scratch_pool, scratch_pool));
+ src_stream = svn_stream_lazyopen_create(lazy_open_source, fb, FALSE,
+ scratch_pool);
/* Open the file that will become the second revision after applying the
text delta, it starts empty */
- SVN_ERR(svn_stream_open_unique(&result_stream, &fb->path_end_revision, NULL,
- svn_io_file_del_on_pool_cleanup,
- scratch_pool, scratch_pool));
+ result_stream = svn_stream_lazyopen_create(lazy_open_result, fb, FALSE,
+ scratch_pool);
svn_txdelta_apply(src_stream,
result_stream,