Hi,
The attached patch implements a notification callback UI clients can use
to show progress information during long network transfers (e.g. import
of a file which is some megs in size). It only does this for DAV
connections for now, svn:// and file:// don't use this callback yet.
Log message is in the patch.
(See also Issue 901)
Stefan
P.S. Please comment only on what the patch does and ignore style issues
for now. We can deal with those later.
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.tigris.org
[[[
Implement a reduced version of issue #901 for DAV connections.
* subversion/include/svn_progress.h
(new file): typedefs for the notification callback function.
* subversion/include/svn_client.h
(svn_client_ctx_t): extend the client context structure with the
callback function and baton.
* subversion/include/svn_ra.h
(svn_ra_callbacks_t): add the progress notification callback to the
ra callbacks structure.
* subversion/libsvn_client/ra.c
(svn_client__open_ra_session_internal): set the progress notification
callback and baton.
* subversion/libsvn_ra_dav/session.c
(svn_ra_dav__neonprogress): new function. The callback function neon
calls during network data transfers.
(svn_ra_dav__open): set the neon callback function for the session.
]]]
Index: subversion/include/svn_progress.h
===================================================================
--- subversion/include/svn_progress.h (Revision 0)
+++ subversion/include/svn_progress.h (Revision 0)
@@ -0,0 +1,38 @@
+/**
+ * @copyright
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ * @endcopyright
+ */
+#ifndef SVN_PROGRESS_H
+#define SVN_PROGRESS_H
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+
+typedef void (*svn_progress_notify_func_t) (apr_off_t progress, apr_off_t total,
+ void * baton);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* SVN_PROGRESS_H */
+
Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h (Revision 15819)
+++ subversion/include/svn_client.h (Arbeitskopie)
@@ -40,6 +40,7 @@
#include "svn_error.h"
#include "svn_opt.h"
#include "svn_version.h"
+#include "svn_progress.h"
#ifdef __cplusplus
@@ -451,6 +452,11 @@
/** notification baton for notify_func2().
* @since New in 1.2. */
void *notify_baton2;
+
+ /** notification callback and baton for network progress information.
+ * @since New in 1.3. */
+ svn_progress_notify_func_t progress_func;
+ void *progress_baton;
} svn_client_ctx_t;
Index: subversion/include/svn_ra.h
===================================================================
--- subversion/include/svn_ra.h (Revision 15819)
+++ subversion/include/svn_ra.h (Arbeitskopie)
@@ -31,6 +31,7 @@
#include "svn_error.h"
#include "svn_delta.h"
#include "svn_auth.h"
+#include "svn_progress.h"
#ifdef __cplusplus
extern "C" {
@@ -347,6 +348,8 @@
/** Invalidate working copy properties. */
svn_ra_invalidate_wc_props_func_t invalidate_wc_props;
+ svn_progress_notify_func_t progress_func;
+ void *progress_baton;
} svn_ra_callbacks_t;
Index: subversion/libsvn_client/ra.c
===================================================================
--- subversion/libsvn_client/ra.c (Revision 15819)
+++ subversion/libsvn_client/ra.c (Arbeitskopie)
@@ -278,6 +278,8 @@
cbtable->push_wc_prop = commit_items ? push_wc_prop : NULL;
cbtable->invalidate_wc_props = read_only_wc ? NULL : invalidate_wc_props;
cbtable->auth_baton = ctx->auth_baton; /* new-style */
+ cbtable->progress_func = ctx->progress_func;
+ cbtable->progress_baton = ctx->progress_baton;
cb->base_dir = base_dir;
cb->base_access = base_access;
Index: subversion/libsvn_ra_dav/session.c
===================================================================
--- subversion/libsvn_ra_dav/session.c (Revision 15819)
+++ subversion/libsvn_ra_dav/session.c (Arbeitskopie)
@@ -561,8 +561,16 @@
#endif /* if/else SVN_NEON_0_25_0 */
}
+static void
+svn_ra_dav__neonprogress(void * baton, off_t progress, off_t total)
+{
+ const svn_ra_callbacks_t * callbacks = (svn_ra_callbacks_t *)baton;
+ if (callbacks->progress_func)
+ {
+ callbacks->progress_func(progress, total, callbacks->progress_baton);
+ }
+}
-
/* ### need an ne_session_dup to avoid the second gethostbyname
* call and make this halfway sane. */
@@ -793,6 +801,9 @@
}
}
+ /* set the neon callback to make it call the svn_progress_notify_func_t */
+ ne_set_progress(sess, svn_ra_dav__neonprogress, callbacks);
+ ne_set_progress(sess2, svn_ra_dav__neonprogress, callbacks);
session->priv = ras;
return SVN_NO_ERROR;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Aug 19 18:35:02 2005