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/13 19:33:27 UTC

svn commit: r985295 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/ src/org/apache/subversion/javahl/callback/ src/org/tigris/subversion/javahl/ tests/org/apache/subversion/javahl/

Author: hwright
Date: Fri Aug 13 17:33:26 2010
New Revision: 985295

URL: http://svn.apache.org/viewvc?rev=985295&view=rev
Log:
JavaHL: Introduce the commit information callback for the commit() API.  This
callback will eventually spread to the other commit-y APIs.

[ in subversion/bindings/javahl/ ]
* tests/org/apache/subversion/javahl/BasicTests.java:
  Update tests calling commit().

* native/CreateJ.cpp,
* native/CreateJ.h
  (CommitInfo): New.

* native/SVNClient.h,
* native/SVNClient.cpp
  (commit): Update to use the user-provided callback.
  (CommitNotfier): Remove.
  (getContext): Don't set up the commit notifier.

* native/CommitCallback.h:
  New.

* native/CommitCallback.cpp:
  New.

* native/org_apache_subversion_javahl_SVNClient.cpp
  (Java_org_apache_subversion_javahl_SVNClient_commit): Change return type and
    params to match the Java API.

* src/org/apache/subversion/javahl/CommitInfo.java:
  New.

* src/org/apache/subversion/javahl/SVNClient.java
* src/org/apache/subversion/javahl/ISVNClient.java
  (commit): Take a callback to return the commit revision, author, date, etc.

* src/org/apache/subversion/javahl/callback/CommitCallback.java:
  New.

* src/org/tigris/subversion/javahl/SVNClient.java
  (commit): Update compat wrapper for new callback.

Added:
    subversion/trunk/subversion/bindings/javahl/native/CommitCallback.cpp   (with props)
    subversion/trunk/subversion/bindings/javahl/native/CommitCallback.h   (with props)
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitInfo.java   (with props)
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/CommitCallback.java   (with props)
Modified:
    subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
    subversion/trunk/subversion/bindings/javahl/native/CreateJ.h
    subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
    subversion/trunk/subversion/bindings/javahl/native/SVNClient.h
    subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
    subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java

Added: subversion/trunk/subversion/bindings/javahl/native/CommitCallback.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CommitCallback.cpp?rev=985295&view=auto
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CommitCallback.cpp (added)
+++ subversion/trunk/subversion/bindings/javahl/native/CommitCallback.cpp Fri Aug 13 17:33:26 2010
@@ -0,0 +1,104 @@
+/**
+ * @copyright
+ * ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one
+ *    or more contributor license agreements.  See the NOTICE file
+ *    distributed with this work for additional information
+ *    regarding copyright ownership.  The ASF licenses this file
+ *    to you under the Apache License, Version 2.0 (the
+ *    "License"); you may not use this file except in compliance
+ *    with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing,
+ *    software distributed under the License is distributed on an
+ *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *    KIND, either express or implied.  See the License for the
+ *    specific language governing permissions and limitations
+ *    under the License.
+ * ====================================================================
+ * @endcopyright
+ *
+ * @file CommitCallback.cpp
+ * @brief Implementation of the class CommitCallback
+ */
+
+#include "CommitCallback.h"
+#include "CreateJ.h"
+#include "EnumMapper.h"
+#include "JNIUtil.h"
+#include "svn_time.h"
+#include "svn_sorts.h"
+#include "svn_compat.h"
+
+/**
+ * Create a CommitCallback object
+ * @param jcallback the Java callback object.
+ */
+CommitCallback::CommitCallback(jobject jcallback)
+{
+  m_callback = jcallback;
+}
+
+/**
+ * Destroy a CommitCallback object
+ */
+CommitCallback::~CommitCallback()
+{
+  // The m_callback does not need to be destroyed because it is the
+  // passed in parameter to the Java SVNClientInterface.logMessages
+  // method.
+}
+
+svn_error_t *
+CommitCallback::callback(const svn_commit_info_t *commit_info,
+                         void *baton,
+                         apr_pool_t *pool)
+{
+  if (baton)
+    return ((CommitCallback *)baton)->commitInfo(commit_info, pool);
+
+  return SVN_NO_ERROR;
+}
+
+/**
+ * Callback called for a single log message
+ */
+svn_error_t *
+CommitCallback::commitInfo(const svn_commit_info_t *commit_info,
+                           apr_pool_t *pool)
+{
+  JNIEnv *env = JNIUtil::getEnv();
+
+  // Create a local frame for our references
+  env->PushLocalFrame(LOCAL_FRAME_SIZE);
+  if (JNIUtil::isJavaExceptionThrown())
+    return SVN_NO_ERROR;
+
+  // The method id will not change during the time this library is
+  // loaded, so it can be cached.
+  static jmethodID sm_mid = 0;
+  if (sm_mid == 0)
+    {
+      jclass clazz = env->FindClass(JAVA_PACKAGE"/callback/CommitCallback");
+      if (JNIUtil::isJavaExceptionThrown())
+        POP_AND_RETURN(SVN_NO_ERROR);
+
+      sm_mid = env->GetMethodID(clazz,
+                                "commitInfo",
+                                "(L"JAVA_PACKAGE"/CommitInfo;)V");
+      if (JNIUtil::isJavaExceptionThrown())
+        POP_AND_RETURN(SVN_NO_ERROR);
+    }
+
+  jobject jcommitInfo = CreateJ::CommitInfo(commit_info);
+  if (JNIUtil::isJavaExceptionThrown())
+    POP_AND_RETURN(SVN_NO_ERROR);
+
+  env->CallVoidMethod(m_callback, sm_mid, jcommitInfo);
+  // No need to check for an exception here, because we return anyway.
+
+  env->PopLocalFrame(NULL);
+  return SVN_NO_ERROR;
+}

Propchange: subversion/trunk/subversion/bindings/javahl/native/CommitCallback.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: subversion/trunk/subversion/bindings/javahl/native/CommitCallback.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CommitCallback.h?rev=985295&view=auto
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CommitCallback.h (added)
+++ subversion/trunk/subversion/bindings/javahl/native/CommitCallback.h Fri Aug 13 17:33:26 2010
@@ -0,0 +1,57 @@
+/**
+ * @copyright
+ * ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one
+ *    or more contributor license agreements.  See the NOTICE file
+ *    distributed with this work for additional information
+ *    regarding copyright ownership.  The ASF licenses this file
+ *    to you under the Apache License, Version 2.0 (the
+ *    "License"); you may not use this file except in compliance
+ *    with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing,
+ *    software distributed under the License is distributed on an
+ *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *    KIND, either express or implied.  See the License for the
+ *    specific language governing permissions and limitations
+ *    under the License.
+ * ====================================================================
+ * @endcopyright
+ *
+ * @file CommitCallback.h
+ * @brief Interface of the class CommitCallback
+ */
+
+#ifndef COMMITCALLBACK_H
+#define COMMITCALLBACK_H
+
+#include <jni.h>
+#include "svn_client.h"
+
+/**
+ * This class holds a Java callback object, which will receive every
+ * log message for which the callback information is requested.
+ */
+class CommitCallback
+{
+ public:
+  CommitCallback(jobject jcallback);
+  ~CommitCallback();
+
+  static svn_error_t *callback(const svn_commit_info_t *commit_info,
+                               void *baton,
+                               apr_pool_t *pool);
+ protected:
+  svn_error_t *commitInfo(const svn_commit_info_t *commit_info,
+                          apr_pool_t *pool);
+
+ private:
+  /**
+   * This a local reference to the Java object.
+   */
+  jobject m_callback;
+};
+
+#endif  // COMMITCALLBACK_H

Propchange: subversion/trunk/subversion/bindings/javahl/native/CommitCallback.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp?rev=985295&r1=985294&r2=985295&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp Fri Aug 13 17:33:26 2010
@@ -850,6 +850,47 @@ CreateJ::ReposNotifyInformation(const sv
 }
 
 jobject
+CreateJ::CommitInfo(const svn_commit_info_t *commit_info)
+{
+  JNIEnv *env = JNIUtil::getEnv();
+
+  // Create a local frame for our references
+  env->PushLocalFrame(LOCAL_FRAME_SIZE);
+  if (JNIUtil::isJavaExceptionThrown())
+    return NULL;
+
+  static jmethodID midCT = 0;
+  jclass clazz = env->FindClass(JAVA_PACKAGE"/CommitInfo");
+  if (JNIUtil::isJavaExceptionThrown())
+    POP_AND_RETURN_NULL;
+
+  if (midCT == 0)
+    {
+      midCT = env->GetMethodID(clazz, "<init>",
+                               "(JLjava/lang/String;Ljava/lang/String;)V");
+      if (JNIUtil::isJavaExceptionThrown() || midCT == 0)
+        POP_AND_RETURN_NULL;
+    }
+
+  jstring jAuthor = JNIUtil::makeJString(commit_info->author);
+  if (JNIUtil::isJavaExceptionThrown())
+    POP_AND_RETURN_NULL;
+
+  jstring jDate = JNIUtil::makeJString(commit_info->date);
+  if (JNIUtil::isJavaExceptionThrown())
+    POP_AND_RETURN_NULL;
+
+  jlong jRevision = commit_info->revision;
+
+  // call the Java method
+  jobject jInfo = env->NewObject(clazz, midCT, jRevision, jDate, jAuthor);
+  if (JNIUtil::isJavaExceptionThrown())
+    POP_AND_RETURN_NULL;
+
+  return env->PopLocalFrame(jInfo);
+}
+
+jobject
 CreateJ::RevisionRangeList(apr_array_header_t *ranges)
 {
   JNIEnv *env = JNIUtil::getEnv();

Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.h?rev=985295&r1=985294&r2=985295&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.h Fri Aug 13 17:33:26 2010
@@ -65,6 +65,9 @@ class CreateJ
   ReposNotifyInformation(const svn_repos_notify_t *notify, apr_pool_t *pool);
 
   static jobject
+  CommitInfo(const svn_commit_info_t *info);
+
+  static jobject
   RevisionRangeList(apr_array_header_t *ranges);
 
   static jobject

Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=985295&r1=985294&r2=985295&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Fri Aug 13 17:33:26 2010
@@ -41,6 +41,7 @@
 #include "LogMessageCallback.h"
 #include "InfoCallback.h"
 #include "PatchCallback.h"
+#include "CommitCallback.h"
 #include "StatusCallback.h"
 #include "ChangelistCallback.h"
 #include "ListCallback.h"
@@ -68,51 +69,6 @@
 #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;
-    }
-
-    long getRevnum()
-    {
-        if (info && SVN_IS_VALID_REVNUM(info->revision))
-            return info->revision;
-
-        return SVN_INVALID_REVNUM;
-    }
-
-    /* Special operator new to allocate this thing in a pool. */
-    void * operator new(size_t sz, SVN::Pool &pool)
-    {
-        void *ptr = apr_pcalloc(pool.pool(), sizeof(CommitNotifier));
-        return ptr;
-    }
-
-  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
 {
@@ -451,25 +407,27 @@ jlongArray SVNClient::update(Targets &ta
     return jrevs;
 }
 
-jlong SVNClient::commit(Targets &targets, const char *message,
-                        svn_depth_t depth, bool noUnlock, bool keepChangelist,
-                        StringArray &changelists, RevpropTable &revprops)
+void SVNClient::commit(Targets &targets, const char *message,
+                       svn_depth_t depth, bool noUnlock, bool keepChangelist,
+                       StringArray &changelists, RevpropTable &revprops,
+                       CommitCallback *callback)
 {
     SVN::Pool requestPool;
     const apr_array_header_t *targets2 = targets.array(requestPool);
-    SVN_JNI_ERR(targets.error_occured(), -1);
+    SVN_JNI_ERR(targets.error_occured(), );
     svn_client_ctx_t *ctx = getContext(message);
     if (ctx == NULL)
-        return SVN_INVALID_REVNUM;
+        return;
+
+    ctx->commit_callback2 = CommitCallback::callback;
+    ctx->commit_baton = callback;
 
     SVN_JNI_ERR(svn_client_commit5(targets2, depth,
                                    noUnlock, keepChangelist,
                                    changelists.array(requestPool),
                                    revprops.hash(requestPool), ctx,
                                    requestPool.pool()),
-                SVN_INVALID_REVNUM);
-
-    return ((CommitNotifier *)ctx->commit_baton)->getRevnum();
+                );
 }
 
 void SVNClient::copy(CopySources &copySources, const char *destPath,
@@ -1295,9 +1253,6 @@ svn_client_ctx_t *SVNClient::getContext(
     ctx->progress_func = ProgressListener::progress;
     ctx->progress_baton = m_progressListener;
 
-    ctx->commit_callback2 = CommitNotifier::callback;
-    ctx->commit_baton = new (*requestPool) CommitNotifier(*requestPool);
-
     if (m_conflictResolver)
     {
         ctx->conflict_func = ConflictResolverCallback::resolveConflict;

Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.h?rev=985295&r1=985294&r2=985295&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.h Fri Aug 13 17:33:26 2010
@@ -46,6 +46,7 @@ class BlameCallback;
 class ProplistCallback;
 class LogMessageCallback;
 class InfoCallback;
+class CommitCallback;
 class ListCallback;
 class StatusCallback;
 class PatchCallback;
@@ -136,9 +137,10 @@ class SVNClient :public SVNBase
   void copy(CopySources &copySources, const char *destPath,
             const char *message, bool copyAsChild, bool makeParents,
             bool ignoreExternals, RevpropTable &revprops);
-  jlong commit(Targets &targets, const char *message, svn_depth_t depth,
-               bool noUnlock, bool keepChangelist,
-               StringArray &changelists, RevpropTable &revprops);
+  void commit(Targets &targets, const char *message, svn_depth_t depth,
+              bool noUnlock, bool keepChangelist,
+              StringArray &changelists, RevpropTable &revprops,
+              CommitCallback *callback);
   jlongArray update(Targets &targets, Revision &revision, svn_depth_t depth,
                     bool depthIsSticky, bool ignoreExternals,
                     bool allowUnverObstructions);

Modified: subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=985295&r1=985294&r2=985295&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Fri Aug 13 17:33:26 2010
@@ -44,6 +44,7 @@
 #include "BlameCallback.h"
 #include "ProplistCallback.h"
 #include "PatchCallback.h"
+#include "CommitCallback.h"
 #include "LogMessageCallback.h"
 #include "InfoCallback.h"
 #include "StatusCallback.h"
@@ -516,37 +517,39 @@ Java_org_apache_subversion_javahl_SVNCli
                     jallowUnverObstructions ? true : false);
 }
 
-JNIEXPORT jlong JNICALL
+JNIEXPORT void JNICALL
 Java_org_apache_subversion_javahl_SVNClient_commit
 (JNIEnv *env, jobject jthis, jobject jtargets, jstring jmessage, jobject jdepth,
  jboolean jnoUnlock, jboolean jkeepChangelist, jobject jchangelists,
- jobject jrevpropTable)
+ jobject jrevpropTable, jobject jcallback)
 {
   JNIEntry(SVNClient, commit);
   SVNClient *cl = SVNClient::getCppObject(jthis);
   if (cl == NULL)
     {
       JNIUtil::throwError(_("bad C++ this"));
-      return -1;
+      return;
     }
   StringArray targetsArr(jtargets);
   Targets targets(targetsArr);
   JNIStringHolder message(jmessage);
   if (JNIUtil::isExceptionThrown())
-    return -1;
+    return;
 
   // Build the changelist vector from the Java array.
   StringArray changelists(jchangelists);
   if (JNIUtil::isExceptionThrown())
-    return -1;
+    return;
 
   RevpropTable revprops(jrevpropTable);
   if (JNIUtil::isExceptionThrown())
-    return -1;
+    return;
 
-  return cl->commit(targets, message, EnumMapper::toDepth(jdepth),
-                    jnoUnlock ? true : false, jkeepChangelist ? true : false,
-                    changelists, revprops);
+  CommitCallback callback(jcallback);
+  cl->commit(targets, message, EnumMapper::toDepth(jdepth),
+             jnoUnlock ? true : false, jkeepChangelist ? true : false,
+             changelists, revprops,
+             jcallback ? &callback : NULL);
 }
 
 JNIEXPORT void JNICALL

Added: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitInfo.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitInfo.java?rev=985295&view=auto
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitInfo.java (added)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitInfo.java Fri Aug 13 17:33:26 2010
@@ -0,0 +1,83 @@
+/**
+ * @copyright
+ * ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one
+ *    or more contributor license agreements.  See the NOTICE file
+ *    distributed with this work for additional information
+ *    regarding copyright ownership.  The ASF licenses this file
+ *    to you under the Apache License, Version 2.0 (the
+ *    "License"); you may not use this file except in compliance
+ *    with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing,
+ *    software distributed under the License is distributed on an
+ *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *    KIND, either express or implied.  See the License for the
+ *    specific language governing permissions and limitations
+ *    under the License.
+ * ====================================================================
+ * @endcopyright
+ */
+
+package org.apache.subversion.javahl;
+
+import java.util.Date;
+
+/**
+ * This class describes a item which will be commited.
+ */
+public class CommitInfo implements java.io.Serializable
+{
+    // Update the serialVersionUID when there is a incompatible change
+    // made to this class.  See any of the following, depending upon
+    // the Java release.
+    // http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/version.doc7.html
+    // http://java.sun.com/j2se/1.4/pdf/serial-spec.pdf
+    // http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/version.html#6678
+    // http://java.sun.com/javase/6/docs/platform/serialization/spec/version.html#6678
+    private static final long serialVersionUID = 1L;
+
+    /** the revision commited */
+    long revision;
+
+    /** the date of the revision */
+    Date date;
+
+    /** the author of the revision */
+    String author;
+
+    /** This constructor will be only called from the jni code.  */
+    public CommitInfo(long rev, String d, String a)
+            throws java.text.ParseException
+    {
+        revision = rev;
+        date = (new LogDate(d)).getDate();
+        author = a;
+    }
+
+    /**
+     * retrieve the revision of the commit
+     */
+    public long getRevision()
+    {
+        return revision;
+    }
+
+    /**
+     * return the date of the commit
+     */
+    public Date getDate()
+    {
+        return date;
+    }
+
+    /**
+     * return the author of the commit
+     */
+    public String getAuthor()
+    {
+        return author;
+    }
+}

Propchange: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=985295&r1=985294&r2=985295&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java Fri Aug 13 17:33:26 2010
@@ -284,10 +284,11 @@ public interface ISVNClient
      * @throws ClientException
      * @since 1.5
      */
-    long commit(Set<String> path, String message, Depth depth,
+    void commit(Set<String> path, String message, Depth depth,
                 boolean noUnlock, boolean keepChangelist,
                 Collection<String> changelists,
-                Map<String, String> revpropTable)
+                Map<String, String> revpropTable,
+                CommitCallback callback)
             throws ClientException;
 
     /**

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=985295&r1=985294&r2=985295&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Fri Aug 13 17:33:26 2010
@@ -225,10 +225,11 @@ public class SVNClient implements ISVNCl
     /**
      * @since 1.5
      */
-    public native long commit(Set<String> paths, String message, Depth depth,
+    public native void commit(Set<String> paths, String message, Depth depth,
                               boolean noUnlock, boolean keepChangelist,
                               Collection<String> changelists,
-                              Map<String, String> revpropTable)
+                              Map<String, String> revpropTable,
+                              CommitCallback callback)
             throws ClientException;
 
     /**

Added: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/CommitCallback.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/CommitCallback.java?rev=985295&view=auto
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/CommitCallback.java (added)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/CommitCallback.java Fri Aug 13 17:33:26 2010
@@ -0,0 +1,42 @@
+/**
+ * @copyright
+ * ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one
+ *    or more contributor license agreements.  See the NOTICE file
+ *    distributed with this work for additional information
+ *    regarding copyright ownership.  The ASF licenses this file
+ *    to you under the Apache License, Version 2.0 (the
+ *    "License"); you may not use this file except in compliance
+ *    with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing,
+ *    software distributed under the License is distributed on an
+ *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *    KIND, either express or implied.  See the License for the
+ *    specific language governing permissions and limitations
+ *    under the License.
+ * ====================================================================
+ * @endcopyright
+ */
+
+package org.apache.subversion.javahl.callback;
+
+import java.util.Date;
+
+import org.apache.subversion.javahl.CommitInfo;
+
+/**
+ * This interface is used to receive commit information from APIs which
+ * generate such.
+ */
+public interface CommitCallback
+{
+    /**
+     * The method will be called for every commit
+     *
+     * @param info           the commit info for this commit
+     */
+    public void commitInfo(CommitInfo info);
+}

Propchange: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/CommitCallback.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java?rev=985295&r1=985294&r2=985295&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java Fri Aug 13 17:33:26 2010
@@ -932,12 +932,20 @@ public class SVNClient implements SVNCli
     {
         try
         {
-            return aSVNClient.commit(new HashSet<String>(Arrays.asList(paths)),
-                                     message, Depth.toADepth(depth), noUnlock,
-                                     keepChangelist,
-                                     changelists == null ? null
-                                       : Arrays.asList(changelists),
-                                     revpropTable);
+            final long[] revList = { -1 };
+            org.apache.subversion.javahl.callback.CommitCallback callback =
+                new org.apache.subversion.javahl.callback.CommitCallback () {
+                    public void commitInfo(org.apache.subversion.javahl.CommitInfo info)
+                    { revList[0] = info.getRevision(); }
+                };
+
+            aSVNClient.commit(new HashSet<String>(Arrays.asList(paths)),
+                              message, Depth.toADepth(depth), noUnlock,
+                              keepChangelist,
+                              changelists == null ? null
+                                : Arrays.asList(changelists),
+                              revpropTable, callback);
+            return revList[0];
         }
         catch (org.apache.subversion.javahl.ClientException ex)
         {

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=985295&r1=985294&r2=985295&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java (original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java Fri Aug 13 17:33:26 2010
@@ -221,6 +221,7 @@ public class BasicTests extends SVNTests
         PrintWriter pw;
         Status status;
         MyStatusCallback statusCallback;
+        MyCommitCallback commitCallback = new MyCommitCallback();
         long rev;             // Resulting rev from co or update
         long expectedRev = 2;  // Keeps track of the latest rev committed
 
@@ -232,11 +233,10 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(),
                               thisTest.getUrl(), "A/D/G/rho", NodeKind.file,
                               CommitItemStateFlags.TextMods);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity,
-                                         false, false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().setItemWorkingCopyRevision("A/D/G/rho", rev);
         thisTest.getWc().setItemContent("A/D/G/rho",
             thisTest.getWc().getItemContent("A/D/G/rho")
@@ -256,11 +256,10 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "A/D/G/pi", NodeKind.file,
                               CommitItemStateFlags.Delete);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity,
-                                         false, false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().removeItem("A/D/G/pi");
 
         thisTest.getWc().setItemWorkingCopyRevision("A/D/G", rev);
@@ -278,11 +277,10 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "A/D/G/tau",NodeKind.file,
                               CommitItemStateFlags.TextMods);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity, false,
-                                         false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().setItemWorkingCopyRevision("A/D/G/tau", rev);
         thisTest.getWc().setItemContent("A/D/G/tau",
                 thisTest.getWc().getItemContent("A/D/G/tau")
@@ -301,11 +299,10 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "A/C", NodeKind.dir,
                               CommitItemStateFlags.Delete);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity, false,
-                                         false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().removeItem("A/C");
         long CCommitRev = rev;
 
@@ -316,11 +313,10 @@ public class BasicTests extends SVNTests
         client.add(dir.getAbsolutePath(), Depth.infinity, false, false, false);
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "A/B/I", NodeKind.dir, CommitItemStateFlags.Add);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg",  Depth.infinity, false,
-                                         false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg",  Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().addItem("A/B/I", null);
         statusCallback = new MyStatusCallback();
         client.status(thisTest.getWCPath() + "/A/B/I", Depth.immediates,
@@ -341,11 +337,10 @@ public class BasicTests extends SVNTests
         thisTest.getWc().setItemPropStatus("", Status.Kind.modified);
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(), null,
                               NodeKind.dir, CommitItemStateFlags.PropMods);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity, false,
-                                         false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().setItemWorkingCopyRevision("", rev);
         thisTest.getWc().setItemPropStatus("", Status.Kind.normal);
 
@@ -359,11 +354,10 @@ public class BasicTests extends SVNTests
                               "A/D/H/nu", NodeKind.file,
                               CommitItemStateFlags.TextMods +
                               CommitItemStateFlags.Add);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity, false,
-                                         false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().addItem("A/D/H/nu", "This is the file 'nu'.");
         statusCallback = new MyStatusCallback();
         client.status(thisTest.getWCPath() + "/A/D/H/nu", Depth.immediates,
@@ -379,11 +373,10 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "A/B/F", NodeKind.dir,
                               CommitItemStateFlags.PropMods);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity, false,
-                                         false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().setItemPropStatus("A/B/F", Status.Kind.normal);
         thisTest.getWc().setItemWorkingCopyRevision("A/B/F", rev);
         statusCallback = new MyStatusCallback();
@@ -400,11 +393,10 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "A/D/H/chi", NodeKind.file,
                               CommitItemStateFlags.Delete);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity, false,
-                                         false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().removeItem("A/D/G/pi");
 
         file = new File(thisTest.getWorkingCopy(), "A/D/H/chi");
@@ -416,11 +408,10 @@ public class BasicTests extends SVNTests
                               "A/D/H/chi", NodeKind.file,
                               CommitItemStateFlags.TextMods +
                               CommitItemStateFlags.Add);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity, false,
-                                         false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().addItem("A/D/H/chi",
                                  "This is the replacement file 'chi'.");
         statusCallback = new MyStatusCallback();
@@ -437,11 +428,10 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "A/B/E", NodeKind.dir,
                               CommitItemStateFlags.Delete);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity, false,
-                                         false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().removeItem("A/B/E/alpha");
         thisTest.getWc().removeItem("A/B/E/beta");
         thisTest.getWc().removeItem("A/B/E");
@@ -464,11 +454,10 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "A/D/H/psi", NodeKind.file,
                               CommitItemStateFlags.Delete);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity, false,
-                                         false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         thisTest.getWc().removeItem("A/D/H/psi");
         thisTest.getWc().setRevision(rev);
         assertEquals("wrong revision from update",
@@ -481,11 +470,10 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "A/D/H/psi", NodeKind.dir,
                               CommitItemStateFlags.Add);
-        assertEquals("wrong revision number from commit",
-                     rev = client.commit(thisTest.getWCPathSet(),
-                                         "log msg", Depth.infinity, false,
-                                         false, null, null),
-                     expectedRev++);
+        client.commit(thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                      false, false, null, null, commitCallback);
+        rev = commitCallback.getRevision();
+        assertEquals("wrong revision number from commit", rev, expectedRev++);
         statusCallback = new MyStatusCallback();
         client.status(thisTest.getWCPath() + "/A/D/H/psi", Depth.immediates,
                       false, true, false, false, null, statusCallback);
@@ -667,11 +655,9 @@ public class BasicTests extends SVNTests
                 CommitItemStateFlags.TextMods);
 
         // commit the changes
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null),
-                     2);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 2,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // check the status of the working copy
         thisTest.checkStatus();
@@ -765,11 +751,9 @@ public class BasicTests extends SVNTests
                 CommitItemStateFlags.TextMods);
 
         // commit the changes
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null),
-                     2);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 2,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // check the status of the working copy
         thisTest.checkStatus();
@@ -863,11 +847,10 @@ public class BasicTests extends SVNTests
                     null, true, false, false, null);
 
         // Commit the changes, and check the state of the WC.
-        assertEquals("Unexpected WC revision number after commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "Copy files", Depth.infinity, false, false,
-                                   null, null),
-                     2);
+        checkCommitRevision(thisTest,
+                            "Unexpected WC revision number after commit", 2,
+                            thisTest.getWCPathSet(), "Copy files",
+                            Depth.infinity, false, false, null, null);
         thisTest.checkStatus();
 
         assertExpectedSuggestion(thisTest.getUrl() + "/A/B/E/alpha", "A/B/F/alpha", thisTest);
@@ -927,10 +910,10 @@ public class BasicTests extends SVNTests
                     null, false, true, false, null);
 
         // Commit the changes, and check the state of the WC.
-        assertEquals("Unexpected WC revision number after commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "Move files", Depth.infinity, false, false,
-                                   null, null), 2);
+        checkCommitRevision(thisTest,
+                            "Unexpected WC revision number after commit", 2,
+                            thisTest.getWCPathSet(), "Move files",
+                            Depth.infinity, false, false, null, null);
         thisTest.checkStatus();
 
         assertExpectedSuggestion(thisTest.getUrl() + "/A/B/E/alpha", "A/B/F/alpha", thisTest);
@@ -1037,11 +1020,9 @@ public class BasicTests extends SVNTests
                               CommitItemStateFlags.TextMods);
 
         // commit the changes
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null),
-                     2);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 2,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // check the status of the first working copy
         thisTest.checkStatus();
@@ -1074,11 +1055,9 @@ public class BasicTests extends SVNTests
                               CommitItemStateFlags.TextMods);
 
         // commit these changes to the repository
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null),
-                     3);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 3,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // check the status of the first working copy
         thisTest.checkStatus();
@@ -1167,11 +1146,9 @@ public class BasicTests extends SVNTests
                               CommitItemStateFlags.TextMods);
 
         // commit the changes in the first working copy
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null),
-                     2);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 2,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // test the status of the working copy after the commit
         thisTest.checkStatus();
@@ -1730,9 +1707,9 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(),
                 thisTest.getUrl(), "A/D", NodeKind.dir,
                 CommitItemStateFlags.Delete);
-        assertEquals("wrong revision from commit",
-                client.commit(thisTest.getWCPathSet(), "log message",
-                              Depth.infinity, false, false, null, null),2);
+        checkCommitRevision(thisTest, "wrong revision from commit", 2,
+                            thisTest.getWCPathSet(), "log message",
+                            Depth.infinity, false, false, null, null);
         thisTest.getWc().removeItem("A/D");
         thisTest.getWc().removeItem("A/D/G");
         thisTest.getWc().removeItem("A/D/G/rho");
@@ -1791,9 +1768,9 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(),
                 thisTest.getUrl(), "A/D/gamma", NodeKind.file,
                 CommitItemStateFlags.Delete);
-        assertEquals("wrong revision number from commit",
-                client.commit(thisTest.getWCPathSet(), "log message",
-                              Depth.infinity, false, false, null, null), 2);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 2,
+                            thisTest.getWCPathSet(), "log message",
+                            Depth.infinity, false, false, null, null);
         thisTest.getWc().removeItem("A/D/gamma");
 
         // check the working copy status
@@ -2128,10 +2105,9 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(),
                               thisTest.getUrl(), "A/mu",NodeKind.file,
                               CommitItemStateFlags.PropMods);
-        assertEquals("bad revision number on commit", 2,
-                     client.commit(thisTest.getWCPathSet(),
-                                   "message", Depth.infinity, false, false,
-                                   null, null));
+        checkCommitRevision(thisTest, "bad revision number on commit", 2,
+                            thisTest.getWCPathSet(), "message", Depth.infinity,
+                            false, false, null, null);
         File f = new File(thisTest.getWCPath()+"/A/mu");
         assertEquals("file should be read only now", false, f.canWrite());
         client.lock(muPathSet, "comment", false);
@@ -2143,10 +2119,9 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(),
                               thisTest.getUrl(), "A/mu",NodeKind.file,
                               0);
-        assertEquals("rev number from commit", -1,
-                     client.commit(thisTest.getWCPathSet(),
-                                   "message", Depth.infinity, false, false,
-                                   null, null));
+        checkCommitRevision(thisTest, "rev number from commit", -1,
+                            thisTest.getWCPathSet(), "message", Depth.infinity,
+                            false, false, null, null);
         assertEquals("file should be read write now", true, f.canWrite());
 
         try
@@ -2388,11 +2363,9 @@ public class BasicTests extends SVNTests
         // Merge and commit some changes (r4).
         appendText(thisTest, "A/mu", "xxx", 4);
         appendText(thisTest, "A/D/G/rho", "yyy", 4);
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null),
-                     4);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 4,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // Add a "begin merge" notification handler.
         final Revision[] actualRange = new Revision[2];
@@ -2439,19 +2412,16 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "branches/A/D/G/rho", NodeKind.file,
                               CommitItemStateFlags.TextMods);
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null), 5);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 5,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // Merge and commit some more changes (r6).
         appendText(thisTest, "A/mu", "xxxr6", 6);
         appendText(thisTest, "A/D/G/rho", "yyyr6", 6);
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null),
-                     6);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 6,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // Test retrieval of mergeinfo from a WC path.
         String targetPath =
@@ -2480,11 +2450,9 @@ public class BasicTests extends SVNTests
 
         // Merge and commit some changes (r4).
         appendText(thisTest, "A/mu", "xxx", 4);
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null),
-                     4);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 4,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         String branchPath = thisTest.getWCPath() + "/branches/A";
         String modUrl = thisTest.getUrl() + "/A";
@@ -2501,10 +2469,9 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "branches/A/mu", NodeKind.file,
                               CommitItemStateFlags.TextMods);
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null), 5);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 5,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
     }
 
     /**
@@ -2523,18 +2490,16 @@ public class BasicTests extends SVNTests
 
         // Merge and commit some changes to main (r4).
         appendText(thisTest, "A/mu", "xxx", 4);
-        assertEquals("wrong revision number from main commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null),
-                     4);
+        checkCommitRevision(thisTest,
+                            "wrong revision number from main commit", 4,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
         // Merge and commit some changes to branch (r5).
         appendText(thisTest, "branches/A/D/G/rho", "yyy", -1);
-        assertEquals("wrong revision number from branch commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null),
-                     5);
+        checkCommitRevision(thisTest,
+                            "wrong revision number from branch commit", 5,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // update the branch WC (to r5) before merge
         client.update(thisTest.getWCPathSet("/branches"), Revision.HEAD,
@@ -2555,10 +2520,9 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "branches/A/mu", NodeKind.file,
                               CommitItemStateFlags.TextMods);
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null), 6);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 6,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // now we --reintegrate the branch with main
         String branchUrl = thisTest.getUrl() + "/branches/A";
@@ -2583,10 +2547,9 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "A/D/G/rho", NodeKind.file,
                               CommitItemStateFlags.TextMods);
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null), 7);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 7,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
     }
 
@@ -2614,10 +2577,9 @@ public class BasicTests extends SVNTests
 
         // Merge and commit a change (r2).
         File mu = appendText(thisTest, "A/mu", "xxx", 2);
-        assertEquals("wrong revision number from commit", 2,
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null));
+        checkCommitRevision(thisTest, "wrong revision number from commit", 2,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // Backdate the WC to the previous revision (r1).
         client.update(thisTest.getWCPathSet(), Revision.getInstance(1),
@@ -2662,11 +2624,9 @@ public class BasicTests extends SVNTests
         // Merge and commit some changes (r4).
         appendText(thisTest, "A/mu", "xxx", 4);
         appendText(thisTest, "A/D/G/rho", "yyy", 4);
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null),
-                     4);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 4,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // --record-only merge changes in A to branches/A
         String branchPath = thisTest.getWCPath() + "/branches/A";
@@ -2682,10 +2642,9 @@ public class BasicTests extends SVNTests
         addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(),
                               "branches/A", NodeKind.dir,
                               CommitItemStateFlags.PropMods);
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, false, false,
-                                   null, null), 5);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 5,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
 
         // Test retrieval of mergeinfo from a WC path.
         String targetPath =
@@ -2920,7 +2879,7 @@ public class BasicTests extends SVNTests
                             thisTest.getUrl(), "iota",NodeKind.file,
                             CommitItemStateFlags.PropMods);
                     client.commit(paths, "Set svn:eol-style to native",
-                            Depth.empty, false, false, null, null);
+                            Depth.empty, false, false, null, null, null);
                 }
 
                 // make edits to iota and set expected output.
@@ -3193,10 +3152,11 @@ public class BasicTests extends SVNTests
                     null, false, true, false, null);
 
         // Commit the changes, and check the state of the WC.
-        assertEquals("Unexpected WC revision number after commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "Move files", Depth.infinity, false, false,
-                                   null, null), 2);
+        checkCommitRevision(thisTest,
+                            "Unexpected WC revision number after commit", 2,
+                            thisTest.getWCPathSet(),
+                            "Move files", Depth.infinity, false, false,
+                            null, null);
         thisTest.checkStatus();
 
         // modify A/B/E/alpha in second working copy
@@ -3472,11 +3432,9 @@ public class BasicTests extends SVNTests
         Map<String, String> revprops = new HashMap<String, String>();
         revprops.put("kfogel", "rockstar");
         revprops.put("cmpilato", "theman");
-        assertEquals("wrong revision number from commit",
-                     client.commit(thisTest.getWCPathSet(),
-                                   "log msg", Depth.infinity, true, true,
-                                   null, revprops),
-                     2);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 2,
+                            thisTest.getWCPathSet(), "log msg",
+                            Depth.infinity, true, true, null, revprops);
 
         // check the status of the working copy
         thisTest.checkStatus();
@@ -3598,6 +3556,38 @@ public class BasicTests extends SVNTests
         }
     }
 
+    private void checkCommitRevision(OneTest thisTest, String failureMsg,
+                                     long expectedRevision,
+                                     Set<String> path, String message,
+                                     Depth depth, boolean noUnlock,
+                                     boolean keepChangelist,
+                                     Collection<String> changelists,
+                                     Map<String, String> revpropTable)
+            throws ClientException
+    {
+        MyCommitCallback callback = new MyCommitCallback();
+
+        client.commit(path, message, depth, noUnlock, keepChangelist,
+                      changelists, revpropTable, callback);
+        assertEquals(failureMsg, callback.getRevision(), expectedRevision);
+    }
+
+    private class MyCommitCallback implements CommitCallback
+    {
+        private CommitInfo info = null;
+
+        public void commitInfo(CommitInfo info) {
+            this.info = info;
+        }
+
+        public long getRevision() {
+            if (info != null)
+                return info.getRevision();
+            else
+                return -1;
+        }
+    }
+
     private class MyStatusCallback implements StatusCallback
     {
         private List<Status> statuses = new ArrayList<Status>();