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 2010/08/09 20:59:57 UTC
svn commit: r983775 -
/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
Author: hwright
Date: Mon Aug 9 18:59:56 2010
New Revision: 983775
URL: http://svn.apache.org/viewvc?rev=983775&view=rev
Log:
JavaHL: Add a shim class to allow updating various commity APIs in JavaHL.
This does not push those changes up to Java-land, but maintains them all
within C++. Also, this only adjusts the call for to svn_client_commit5().
The approach only captures the most recent commit if several are performed
by the API, but we currenly don't have any multi-commit APIs. Adjustments will
need to happen in Java-land to return multiple values, anyway.
* subversion/bindings/javahl/native/SVNClient.cpp
(CommitNotifier): New class.
(commit): Create a CommitNotifier, and use it in the context to capture
commit information.
Modified:
subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=983775&r1=983774&r2=983775&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Mon Aug 9 18:59:56 2010
@@ -68,6 +68,42 @@
#include <iostream>
#include <sstream>
+class CommitNotifier
+{
+ public:
+ CommitNotifier(SVN::Pool &inPool)
+ : pool(inPool), info(NULL)
+ {
+ ;
+ }
+
+ static svn_error_t *callback(const svn_commit_info_t *commit_info,
+ void *baton,
+ apr_pool_t *pool)
+ {
+ if (baton)
+ return ((CommitNotifier *)baton)->stashInfo(commit_info);
+
+ return SVN_NO_ERROR;
+ }
+
+ svn_commit_info_t *getInfo()
+ {
+ return info;
+ }
+
+ protected:
+ svn_error_t *stashInfo(const svn_commit_info_t *commit_info)
+ {
+ info = svn_commit_info_dup(commit_info, pool.pool());
+ return SVN_NO_ERROR;
+ }
+
+ private:
+ SVN::Pool &pool;
+ svn_commit_info_t *info;
+};
+
struct log_msg_baton
{
const char *message;
@@ -411,20 +447,24 @@ jlong SVNClient::commit(Targets &targets
StringArray &changelists, RevpropTable &revprops)
{
SVN::Pool requestPool;
- svn_commit_info_t *commit_info = NULL;
+ CommitNotifier commitNotifier(requestPool);
const apr_array_header_t *targets2 = targets.array(requestPool);
SVN_JNI_ERR(targets.error_occured(), -1);
svn_client_ctx_t *ctx = getContext(message);
if (ctx == NULL)
return SVN_INVALID_REVNUM;
- SVN_JNI_ERR(svn_client_commit4(&commit_info, targets2, depth,
+ ctx->commit_callback2 = CommitNotifier::callback;
+ ctx->commit_baton = &commitNotifier;
+
+ SVN_JNI_ERR(svn_client_commit5(targets2, depth,
noUnlock, keepChangelist,
changelists.array(requestPool),
revprops.hash(requestPool), ctx,
requestPool.pool()),
SVN_INVALID_REVNUM);
+ svn_commit_info_t *commit_info = commitNotifier.getInfo();
if (commit_info && SVN_IS_VALID_REVNUM(commit_info->revision))
return commit_info->revision;