You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/02/21 21:43:36 UTC
svn commit: r1291997 - in /subversion/trunk/subversion/libsvn_client:
client.h commit.c ra.c util.c
Author: hwright
Date: Tue Feb 21 20:43:35 2012
New Revision: 1291997
URL: http://svn.apache.org/viewvc?rev=1291997&view=rev
Log:
Ev2 shims: Instead of installing callbacks generally for every ra session, do
so only for a commit. Also, implement the various client-side shim callbacks.
* subversion/libsvn_client/ra.c
(svn_client__open_ra_session_internal): Don't register the shims.
* subversion/libsvn_client/util.c
(shim_callbacks_baton): New.
(fetch_props_func, fetch_kind_func, fetch_base_func): Implement.
(svn_client__get_shim_callbacks): Add a baton, and a few params.
* subversion/libsvn_client/commit.c
(get_ra_editor): Register the callbacks prior to getting a commit editor.
* subversion/libsvn_client/client.h
(svn_client__get_shim_callbacks): Add a few params.
Modified:
subversion/trunk/subversion/libsvn_client/client.h
subversion/trunk/subversion/libsvn_client/commit.c
subversion/trunk/subversion/libsvn_client/ra.c
subversion/trunk/subversion/libsvn_client/util.c
Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1291997&r1=1291996&r2=1291997&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Tue Feb 21 20:43:35 2012
@@ -1075,7 +1075,9 @@ svn_client__get_normalized_stream(svn_st
/* Return a set of callbacks to use with the Ev2 shims. */
svn_delta_shim_callbacks_t *
-svn_client__get_shim_callbacks(apr_pool_t *result_pool);
+svn_client__get_shim_callbacks(svn_wc_context_t *wc_ctx,
+ const char *anchor_abspath,
+ apr_pool_t *result_pool);
/* Return true if KIND is a revision kind that is dependent on the working
* copy. Otherwise, return false. */
Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1291997&r1=1291996&r2=1291997&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Tue Feb 21 20:43:35 2012
@@ -49,6 +49,7 @@
#include "client.h"
#include "private/svn_wc_private.h"
+#include "private/svn_ra_private.h"
#include "private/svn_magic.h"
#include "svn_private_config.h"
@@ -645,6 +646,7 @@ get_ra_editor(svn_ra_session_t **ra_sess
apr_pool_t *pool)
{
apr_hash_t *commit_revprops;
+ const char *anchor_abspath;
/* Open an RA session to URL. */
SVN_ERR(svn_client__open_ra_session_internal(ra_session, NULL, base_url,
@@ -669,7 +671,22 @@ get_ra_editor(svn_ra_session_t **ra_sess
SVN_ERR(svn_client__ensure_revprop_table(&commit_revprops, revprop_table,
log_msg, ctx, pool));
+ /* We need this for the shims. */
+ if (base_dir_abspath)
+ {
+ const char *relpath;
+
+ SVN_ERR(svn_ra_get_path_relative_to_root(*ra_session, &relpath, base_url,
+ pool));
+ anchor_abspath = svn_dirent_join(base_dir_abspath, relpath, pool);
+ }
+ else
+ anchor_abspath = NULL;
+
/* Fetch RA commit editor. */
+ SVN_ERR(svn_ra__register_editor_shim_callbacks(*ra_session,
+ svn_client__get_shim_callbacks(ctx->wc_ctx,
+ anchor_abspath, pool)));
SVN_ERR(svn_ra_get_commit_editor3(*ra_session, editor, edit_baton,
commit_revprops, commit_callback,
commit_baton, lock_tokens, keep_locks,
Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=1291997&r1=1291996&r2=1291997&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Tue Feb 21 20:43:35 2012
@@ -40,7 +40,6 @@
#include "svn_private_config.h"
#include "private/svn_wc_private.h"
-#include "private/svn_ra_private.h"
#include "private/svn_client_private.h"
@@ -369,9 +368,6 @@ svn_client__open_ra_session_internal(svn
uuid, cbtable, cb, ctx->config, pool));
}
- SVN_ERR(svn_ra__register_editor_shim_callbacks(*ra_session,
- svn_client__get_shim_callbacks(pool)));
-
return SVN_NO_ERROR;
}
#undef SVN_CLIENT__MAX_REDIRECT_ATTEMPTS
Modified: subversion/trunk/subversion/libsvn_client/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/util.c?rev=1291997&r1=1291996&r2=1291997&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/util.c (original)
+++ subversion/trunk/subversion/libsvn_client/util.c Tue Feb 21 20:43:35 2012
@@ -241,6 +241,12 @@ svn_client__assert_homogeneous_target_ty
return SVN_NO_ERROR;
}
+struct shim_callbacks_baton
+{
+ svn_wc_context_t *wc_ctx;
+ const char *anchor_abspath;
+};
+
static svn_error_t *
fetch_props_func(apr_hash_t **props,
void *baton,
@@ -249,6 +255,13 @@ fetch_props_func(apr_hash_t **props,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
+ struct shim_callbacks_baton *scb = baton;
+ const char *local_abspath = svn_dirent_join(scb->anchor_abspath, path,
+ scratch_pool);
+
+ SVN_ERR(svn_wc_get_pristine_props(props, scb->wc_ctx, local_abspath,
+ result_pool, scratch_pool));
+
return SVN_NO_ERROR;
}
@@ -259,6 +272,15 @@ fetch_kind_func(svn_kind_t *kind,
svn_revnum_t base_revision,
apr_pool_t *scratch_pool)
{
+ struct shim_callbacks_baton *scb = baton;
+ svn_node_kind_t node_kind;
+ const char *local_abspath = svn_dirent_join(scb->anchor_abspath, path,
+ scratch_pool);
+
+ SVN_ERR(svn_wc_read_kind(&node_kind, scb->wc_ctx, local_abspath, FALSE,
+ scratch_pool));
+ *kind = svn__kind_from_node_kind(node_kind, FALSE);
+
return SVN_NO_ERROR;
}
@@ -270,18 +292,50 @@ fetch_base_func(const char **filename,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
+ struct shim_callbacks_baton *scb = baton;
+ const char *local_abspath = svn_dirent_join(scb->anchor_abspath, path,
+ scratch_pool);
+ svn_stream_t *pristine_stream;
+ svn_stream_t *temp_stream;
+ svn_error_t *err;
+
+ err = svn_wc_get_pristine_contents2(&pristine_stream, scb->wc_ctx,
+ local_abspath, scratch_pool,
+ scratch_pool);
+ if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+ {
+ svn_error_clear(err);
+ *filename = NULL;
+ return SVN_NO_ERROR;
+ }
+ else if (err)
+ return svn_error_trace(err);
+
+ SVN_ERR(svn_stream_open_unique(&temp_stream, filename, NULL,
+ svn_io_file_del_on_pool_cleanup,
+ result_pool, scratch_pool));
+ SVN_ERR(svn_stream_copy3(pristine_stream, temp_stream, NULL, NULL,
+ scratch_pool));
+
return SVN_NO_ERROR;
}
svn_delta_shim_callbacks_t *
-svn_client__get_shim_callbacks(apr_pool_t *result_pool)
+svn_client__get_shim_callbacks(svn_wc_context_t *wc_ctx,
+ const char *anchor_abspath,
+ apr_pool_t *result_pool)
{
svn_delta_shim_callbacks_t *callbacks =
svn_delta_shim_callbacks_default(result_pool);
+ struct shim_callbacks_baton *scb = apr_pcalloc(result_pool, sizeof(*scb));
+
+ scb->wc_ctx = wc_ctx;
+ scb->anchor_abspath = apr_pstrdup(result_pool, anchor_abspath);
callbacks->fetch_props_func = fetch_props_func;
callbacks->fetch_kind_func = fetch_kind_func;
callbacks->fetch_base_func = fetch_base_func;
+ callbacks->fetch_baton = scb;
return callbacks;
}