New patch which uses Branko's comments to fix what was broken.
Branko ÄŒibej wrote:
> O.K. :)
>
> Looks good in principle, but I think there's an API compatibility problem.
Right. Haven't thought of that.
>
>> 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;
>>
>>
> You can't do that. This is a public struct that gets allocated
> elsewhere, so you can't change it in a minor release.
>
> I think you'll have to rev svn_ra_open and svn_ra_plugin_t::open and add
> the progress_func and progress_baton parameters there. Should be fairly
> easy to do.
Done in the corrected patch for svn_ra_open(). svn_ra_plugin_t::open is
marked as deprecated - I think we don't have to rev that one.
>> +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;
>>
>>
> You don't need the cast here. Sorry, couldn't resist the style nit. :)
I know the cast is not needed. But the VS.NET compiler throws out a
warning if there's no cast (but only with /W4) and there's no harm to
have the cast (?), so I thought I leave it there.
Feel free to remove it though.
Stefan
--
___
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): deprecate the structure
(svn_ra_callbacks2_t): same as svn_ra_callbacks_t, but with new
progress notification callback and baton.
* subversion/libsvn_ra/ra_loader.c
(svn_ra_open): deprecate function, calls svn_ra_open2()
(svn_ra_open2): new function which takes an svn_ra_callbacks2_t
instead of an svn_ra_callback_t.
* 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.
* subversion/libsvn_client/copy.c
(repos_to_repos_copy): correct comment
]]]
Index: subversion/libsvn_ra/ra_loader.c
===================================================================
--- subversion/libsvn_ra/ra_loader.c (Revision 15819)
+++ subversion/libsvn_ra/ra_loader.c (Arbeitskopie)
@@ -230,12 +230,12 @@
return SVN_NO_ERROR;
}
-svn_error_t *svn_ra_open (svn_ra_session_t **session_p,
- const char *repos_URL,
- const svn_ra_callbacks_t *callbacks,
- void *callback_baton,
- apr_hash_t *config,
- apr_pool_t *pool)
+svn_error_t *svn_ra_open2 (svn_ra_session_t **session_p,
+ const char *repos_URL,
+ const svn_ra_callbacks2_t *callbacks,
+ void *callback_baton,
+ apr_hash_t *config,
+ apr_pool_t *pool)
{
svn_ra_session_t *session;
const struct ra_lib_defn *defn;
@@ -281,6 +281,27 @@
return SVN_NO_ERROR;
}
+svn_error_t *svn_ra_open (svn_ra_session_t **session_p,
+ const char *repos_URL,
+ const svn_ra_callbacks_t *callbacks,
+ void *callback_baton,
+ apr_hash_t *config,
+ apr_pool_t *pool)
+{
+ /* deprecated function. Copy the contents of the svn_ra_callbacks_t
+ to a new svn_ra_callbacks2_t and call svn_ra_open2() */
+ svn_ra_callbacks2_t callbacks2;
+ callbacks2.open_tmp_file = callbacks->open_tmp_file;
+ callbacks2.auth_baton = callbacks->auth_baton;
+ callbacks2.get_wc_prop = callbacks->get_wc_prop;
+ callbacks2.set_wc_prop = callbacks->set_wc_prop;
+ callbacks2.push_wc_prop = callbacks->push_wc_prop;
+ callbacks2.invalidate_wc_props = callbacks->invalidate_wc_props;
+ callbacks2.progress_func = NULL;
+ callbacks2.progress_baton = NULL;
+ svn_ra_open2 (session_p, repos_URL, &callbacks2, callback_baton, config, pool);
+}
+
svn_error_t *svn_ra_get_latest_revnum (svn_ra_session_t *session,
svn_revnum_t *latest_revnum,
apr_pool_t *pool)
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 */
+
Eigenschaftsänderungen: subversion\include\svn_progress.h
___________________________________________________________________
Name: svn:eol-style
+ native
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;
@@ -2292,7 +2298,7 @@
*
* @since New in 1.3.
*
- * @note This function is similar to svn_ra_open(), but the caller avoids
+ * @note This function is similar to svn_ra_open2(), but the caller avoids
* having to providing its own callback functions.
*/
svn_error_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" {
@@ -308,7 +309,59 @@
*
* Each routine takes a @a callback_baton originally provided with the
* vtable.
+ *
+ * @since New in 1.3.
*/
+typedef struct svn_ra_callbacks2_t
+{
+ /** Open a unique temporary file for writing in the working copy.
+ * This file will be automatically deleted when @a fp is closed.
+ */
+ svn_error_t *(*open_tmp_file) (apr_file_t **fp,
+ void *callback_baton,
+ apr_pool_t *pool);
+
+ /** An authentication baton, created by the application, which is
+ * capable of retrieving all known types of credentials.
+ */
+ svn_auth_baton_t *auth_baton;
+
+ /*** The following items may be set to NULL to disallow the RA layer
+ to perform the respective operations of the vtable functions.
+ Perhaps WC props are not defined or are in invalid for this
+ session, or perhaps the commit operation this RA session will
+ perform is a server-side only one that shouldn't do post-commit
+ processing on a working copy path. ***/
+
+ /** Fetch working copy properties.
+ *
+ *<pre> ### we might have a problem if the RA layer ever wants a property
+ * ### that corresponds to a different revision of the file than
+ * ### what is in the WC. we'll cross that bridge one day...</pre>
+ */
+ svn_ra_get_wc_prop_func_t get_wc_prop;
+
+ /** Immediately set new values for working copy properties. */
+ svn_ra_set_wc_prop_func_t set_wc_prop;
+
+ /** Schedule new values for working copy properties. */
+ svn_ra_push_wc_prop_func_t push_wc_prop;
+
+ /** 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_callbacks2_t;
+
+/** A collection of callbacks implemented by libsvn_client which allows
+ * an RA layer to "pull" information from the client application, or
+ * possibly store information. libsvn_client passes this vtable to
+ * @c RA->open().
+ *
+ * Each routine takes a @a callback_baton originally provided with the
+ * vtable.
+ */
typedef struct svn_ra_callbacks_t
{
/** Open a unique temporary file for writing in the working copy.
@@ -391,8 +442,33 @@
*
* @see svn_client_open_ra_session().
*
- * @since New in 1.2.
+ * @since New in 1.3.
*/
+svn_error_t *svn_ra_open2 (svn_ra_session_t **session_p,
+ const char *repos_URL,
+ const svn_ra_callbacks2_t *callbacks,
+ void *callback_baton,
+ apr_hash_t *config,
+ apr_pool_t *pool);
+
+/**
+ * Open a repository session to @a repos_URL. Return an opaque object
+ * representing this session in @a *session_p, allocated in @a pool.
+ *
+ * @a callbacks/@a callback_baton is a table of callbacks provided by the
+ * client; see @c svn_ra_callbacks_t.
+ *
+ * @a config is a hash mapping <tt>const char *</tt> keys to
+ * @c svn_config_t * values. For example, the @c svn_config_t for the
+ * "~/.subversion/config" file is under the key "config".
+ *
+ * All RA requests require a session; they will continue to
+ * use @a pool for memory allocation.
+ *
+ * @see svn_client_open_ra_session().
+ *
+ * @deprecated Provided for backward compatibility with the 1.2 API.
+ */
svn_error_t *svn_ra_open (svn_ra_session_t **session_p,
const char *repos_URL,
const svn_ra_callbacks_t *callbacks,
@@ -400,6 +476,7 @@
apr_hash_t *config,
apr_pool_t *pool);
+
/**
* Get the latest revision number from the repository of @a session.
*
Index: subversion/libsvn_client/ra.c
===================================================================
--- subversion/libsvn_client/ra.c (Revision 15819)
+++ subversion/libsvn_client/ra.c (Arbeitskopie)
@@ -269,7 +269,7 @@
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
- svn_ra_callbacks_t *cbtable = apr_pcalloc (pool, sizeof(*cbtable));
+ svn_ra_callbacks2_t *cbtable = apr_pcalloc (pool, sizeof(*cbtable));
svn_client__callback_baton_t *cb = apr_pcalloc (pool, sizeof(*cb));
cbtable->open_tmp_file = use_admin ? open_admin_tmp_file : open_tmp_file;
@@ -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;
@@ -285,7 +287,7 @@
cb->commit_items = commit_items;
cb->ctx = ctx;
- SVN_ERR (svn_ra_open (ra_session, base_url, cbtable, cb, ctx->config, pool));
+ SVN_ERR (svn_ra_open2 (ra_session, base_url, cbtable, cb, ctx->config, pool));
return SVN_NO_ERROR;
}
Index: subversion/libsvn_client/copy.c
===================================================================
--- subversion/libsvn_client/copy.c (Revision 15819)
+++ subversion/libsvn_client/copy.c (Arbeitskopie)
@@ -334,7 +334,7 @@
ctx, pool);
/* If the two URLs appear not to be in the same repository, then
- top_url will be empty and the call to svn_ra_open()
+ top_url will be empty and the call to svn_ra_open2()
above will have failed. Below we check for that, and propagate a
descriptive error back to the user.
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 20:53:37 2005