subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1499159 - in /subversion/branches/javahl-1.8-extensions: ./ subversion/bindings/javahl/ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversion/javahl/ subversion/bindings/javahl/src/org/apache/subversion/ja...
Date Wed, 03 Jul 2013 00:14:43 GMT
Author: brane
Date: Wed Jul  3 00:14:42 2013
New Revision: 1499159

URL: http://svn.apache.org/r1499159
Log:
On the javahl-1.8-extensions branch: Sync JavaHL with trunk up to r1499152.
Also cherry-pick r1498885 from trunk to make the shims needed by the Ev2 editor proxy work.

Added:
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/EditorProxy.cpp
      - copied, changed from r1499152, subversion/trunk/subversion/bindings/javahl/native/EditorProxy.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/EditorProxy.h
      - copied, changed from r1499152, subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/StateReporter.cpp
      - copied unchanged from r1499152, subversion/trunk/subversion/bindings/javahl/native/StateReporter.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/StateReporter.h
      - copied unchanged from r1499152, subversion/trunk/subversion/bindings/javahl/native/StateReporter.h
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_StateReporter.cpp
      - copied unchanged from r1499152, subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_StateReporter.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/RemoteStatus.java
      - copied unchanged from r1499152, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/RemoteStatus.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
      - copied unchanged from r1499152, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java
      - copied unchanged from r1499152, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StatusEditor.java
Removed:
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/UpdateReporter.java
Modified:
    subversion/branches/javahl-1.8-extensions/   (props changed)
    subversion/branches/javahl-1.8-extensions/build.conf
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/   (props changed)
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.h
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.h
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.h
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.h
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
    subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
    subversion/branches/javahl-1.8-extensions/subversion/libsvn_delta/compat.c

Propchange: subversion/branches/javahl-1.8-extensions/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1498885

Modified: subversion/branches/javahl-1.8-extensions/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/build.conf?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/build.conf (original)
+++ subversion/branches/javahl-1.8-extensions/build.conf Wed Jul  3 00:14:42 2013
@@ -67,6 +67,7 @@ private-built-includes =
         subversion/bindings/javahl/include/org_apache_subversion_javahl_remote_RemoteSession.h
         subversion/bindings/javahl/include/org_apache_subversion_javahl_remote_RemoteFactory.h
         subversion/bindings/javahl/include/org_apache_subversion_javahl_remote_CommitEditor.h
+        subversion/bindings/javahl/include/org_apache_subversion_javahl_remote_StateReporter.h
         subversion/bindings/javahl/include/org_apache_subversion_javahl_ConfigImpl_Category.h
 
 test-scripts =

Propchange: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/
------------------------------------------------------------------------------
  Merged /subversion/trunk/subversion/bindings/javahl:r1497791-1499152

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.cpp?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.cpp Wed Jul  3 00:14:42 2013
@@ -126,36 +126,10 @@ void CommitEditor::dispose(jobject jthis
 }
 
 namespace {
-void throw_illegal_state(const char* msg)
-{
-  JNIEnv *env = JNIUtil::getEnv();
-
-  jclass clazz = env->FindClass("java/lang/IllegalStateException");
-  if (JNIUtil::isJavaExceptionThrown())
-    return;
-
-  static jmethodID ctor_mid = 0;
-  if (0 == ctor_mid)
-    {
-      ctor_mid = env->GetMethodID(clazz, "<init>", "(Ljava/lang/String;)V");
-      if (JNIUtil::isJavaExceptionThrown())
-        return;
-    }
-
-  jstring jmsg = JNIUtil::makeJString(msg);
-  if (JNIUtil::isJavaExceptionThrown())
-    return;
-
-  jobject jexception = env->NewObject(clazz, ctor_mid, jmsg);
-  if (JNIUtil::isJavaExceptionThrown())
-    return;
-
-  env->Throw((jthrowable)jexception);
-}
-
 void throw_editor_inactive()
 {
-  throw_illegal_state(_("The editor is not active"));
+  JNIUtil::raiseThrowable("java/lang/IllegalStateException",
+                          _("The editor is not active"));
 }
 
 void throw_not_implemented(const char* fname)
@@ -163,7 +137,7 @@ void throw_not_implemented(const char* f
   std::string msg = _("Not implemented: ");
   msg += "CommitEditor.";
   msg += fname;
-  throw_illegal_state(msg.c_str());
+  JNIUtil::raiseThrowable("java/lang/RuntimeException", msg.c_str());
 }
 
 const apr_array_header_t*
@@ -285,11 +259,7 @@ void CommitEditor::addDirectory(jstring 
                                 jobject jchildren, jobject jproperties,
                                 jlong jreplaces_revision)
 {
-  if (!m_valid)
-    {
-      throw_editor_inactive();
-      return;
-    }
+  if (!m_valid) { throw_editor_inactive(); return; }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   Iterator children(jchildren);
@@ -316,11 +286,7 @@ void CommitEditor::addFile(jstring jrelp
                            jobject jproperties,
                            jlong jreplaces_revision)
 {
-  if (!m_valid)
-    {
-      throw_editor_inactive();
-      return;
-    }
+  if (!m_valid) { throw_editor_inactive(); return; }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   InputStream contents(jcontents);
@@ -353,11 +319,7 @@ void CommitEditor::addSymlink(jstring jr
 void CommitEditor::addAbsent(jstring jrelpath, jobject jkind,
                              jlong jreplaces_revision)
 {
-  if (!m_valid)
-    {
-      throw_editor_inactive();
-      return;
-    }
+  if (!m_valid) { throw_editor_inactive(); return; }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   SVN::Pool subPool(pool);
@@ -374,11 +336,7 @@ void CommitEditor::addAbsent(jstring jre
 void CommitEditor::alterDirectory(jstring jrelpath, jlong jrevision,
                                   jobject jchildren, jobject jproperties)
 {
-  if (!m_valid)
-    {
-      throw_editor_inactive();
-      return;
-    }
+  if (!m_valid) { throw_editor_inactive(); return; }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   Iterator children(jchildren);
@@ -404,11 +362,7 @@ void CommitEditor::alterFile(jstring jre
                              jobject jchecksum, jobject jcontents,
                              jobject jproperties)
 {
-  if (!m_valid)
-    {
-      throw_editor_inactive();
-      return;
-    }
+  if (!m_valid) { throw_editor_inactive(); return; }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   InputStream contents(jcontents);
@@ -440,11 +394,7 @@ void CommitEditor::alterSymlink(jstring 
 
 void CommitEditor::remove(jstring jrelpath, jlong jrevision)
 {
-  if (!m_valid)
-    {
-      throw_editor_inactive();
-      return;
-    }
+  if (!m_valid) { throw_editor_inactive(); return; }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   SVN::Pool subPool(pool);
@@ -460,11 +410,7 @@ void CommitEditor::remove(jstring jrelpa
 void CommitEditor::copy(jstring jsrc_relpath, jlong jsrc_revision,
                         jstring jdst_relpath, jlong jreplaces_revision)
 {
-  if (!m_valid)
-    {
-      throw_editor_inactive();
-      return;
-    }
+  if (!m_valid) { throw_editor_inactive(); return; }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   SVN::Pool subPool(pool);
@@ -487,11 +433,7 @@ void CommitEditor::copy(jstring jsrc_rel
 void CommitEditor::move(jstring jsrc_relpath, jlong jsrc_revision,
                         jstring jdst_relpath, jlong jreplaces_revision)
 {
-  if (!m_valid)
-    {
-      throw_editor_inactive();
-      return;
-    }
+  if (!m_valid) { throw_editor_inactive(); return; }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   SVN::Pool subPool(pool);
@@ -511,13 +453,9 @@ void CommitEditor::move(jstring jsrc_rel
                               svn_revnum_t(jreplaces_revision)),);
 }
 
-void CommitEditor::rotate(jobject jelements)
-{
-//   if (!m_valid)
-//     {
-//       throw_editor_inactive();
-//       return;
-//     }
+// void CommitEditor::rotate(jobject jelements)
+// {
+//   if (!m_valid) { throw_editor_inactive(); return; }
 //   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 //
 //   SVN::Pool subPool(pool);
@@ -528,16 +466,11 @@ void CommitEditor::rotate(jobject jeleme
 //     return;
 //
 //   SVN_JNI_ERR(svn_editor_rotate(m_editor, relpaths, revisions),);
-  throw_not_implemented("rotate");
-}
+// }
 
 void CommitEditor::complete()
 {
-  if (!m_valid)
-    {
-      throw_editor_inactive();
-      return;
-    }
+  if (!m_valid) { throw_editor_inactive(); return; }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   SVN_JNI_ERR(svn_editor_complete(m_editor),);
@@ -546,11 +479,7 @@ void CommitEditor::complete()
 
 void CommitEditor::abort()
 {
-  if (!m_valid)
-    {
-      throw_editor_inactive();
-      return;
-    }
+  if (!m_valid) { throw_editor_inactive(); return; }
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   SVN_JNI_ERR(svn_editor_abort(m_editor),);

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.h?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.h (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.h Wed Jul  3 00:14:42 2013
@@ -81,7 +81,7 @@ public:
             jstring jdst_relpath, jlong jreplaces_revision);
   void move(jstring jsrc_relpath, jlong jsrc_revision,
             jstring jdst_relpath, jlong jreplaces_revision);
-  void rotate(jobject jelements);
+  // void rotate(jobject jelements);
   void complete();
   void abort();
 

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.cpp?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.cpp Wed Jul  3 00:14:42 2013
@@ -1124,7 +1124,7 @@ CreateJ::RevisionRangeList(svn_rangelist
 }
 
 jobject
-CreateJ::StringSet(apr_array_header_t *strings)
+CreateJ::StringSet(const apr_array_header_t *strings)
 {
   std::vector<jobject> jstrs;
 

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.h?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.h (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CreateJ.h Wed Jul  3 00:14:42 2013
@@ -84,7 +84,7 @@ class CreateJ
   RevisionRangeList(svn_rangelist_t *ranges);
 
   static jobject
-  StringSet(apr_array_header_t *strings);
+  StringSet(const apr_array_header_t *strings);
 
   static jobject
   PropertyMap(apr_hash_t *prop_hash);

Copied: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/EditorProxy.cpp (from r1499152, subversion/trunk/subversion/bindings/javahl/native/EditorProxy.cpp)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/EditorProxy.cpp?p2=subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/EditorProxy.cpp&p1=subversion/trunk/subversion/bindings/javahl/native/EditorProxy.cpp&r1=1499152&r2=1499159&rev=1499159&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EditorProxy.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/EditorProxy.cpp Wed Jul  3 00:14:42 2013
@@ -308,9 +308,9 @@ svn_error_t*
 EditorProxy::cb_alter_file(void *baton,
                            const char *relpath,
                            svn_revnum_t revision,
+                           apr_hash_t *props,
                            const svn_checksum_t *checksum,
                            svn_stream_t *contents,
-                           apr_hash_t *props,
                            apr_pool_t *scratch_pool)
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_alter_file('%s', r%lld)\n",
@@ -348,8 +348,8 @@ svn_error_t*
 EditorProxy::cb_alter_symlink(void *baton,
                               const char *relpath,
                               svn_revnum_t revision,
-                              const char *target,
                               apr_hash_t *props,
+                              const char *target,
                               apr_pool_t *scratch_pool)
 {
   //DEBUG:fprintf(stderr, "  (n) EditorProxy::cb_alter_symlink('%s', r%lld)\n",

Copied: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/EditorProxy.h (from r1499152, subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/EditorProxy.h?p2=subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/EditorProxy.h&p1=subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h&r1=1499152&r2=1499159&rev=1499159&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/EditorProxy.h Wed Jul  3 00:14:42 2013
@@ -103,15 +103,15 @@ private:
   static svn_error_t* cb_alter_file(void *baton,
                                     const char *relpath,
                                     svn_revnum_t revision,
+                                    apr_hash_t *props,
                                     const svn_checksum_t *checksum,
                                     svn_stream_t *contents,
-                                    apr_hash_t *props,
                                     apr_pool_t *scratch_pool);
   static svn_error_t* cb_alter_symlink(void *baton,
                                        const char *relpath,
                                        svn_revnum_t revision,
-                                       const char *target,
                                        apr_hash_t *props,
+                                       const char *target,
                                        apr_pool_t *scratch_pool);
   static svn_error_t* cb_delete(void *baton,
                                 const char *relpath,

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.cpp Wed Jul  3 00:14:42 2013
@@ -705,11 +705,11 @@ bool JNIUtil::isJavaExceptionThrown()
   return false;
 }
 
-const char *
-JNIUtil::thrownExceptionToCString(SVN::Pool &in_pool)
+namespace {
+const char* exception_to_cstring(apr_pool_t* pool)
 {
   const char *msg;
-  JNIEnv *env = getEnv();
+  JNIEnv *env = JNIUtil::getEnv();
   if (env->ExceptionCheck())
     {
       jthrowable t = env->ExceptionOccurred();
@@ -718,12 +718,12 @@ JNIUtil::thrownExceptionToCString(SVN::P
         {
           jclass clazz = env->FindClass("java/lang/Throwable");
           getMessage = env->GetMethodID(clazz, "getMessage",
-                                        "(V)Ljava/lang/String;");
+                                        "()Ljava/lang/String;");
           env->DeleteLocalRef(clazz);
         }
       jstring jmsg = (jstring) env->CallObjectMethod(t, getMessage);
       JNIStringHolder tmp(jmsg);
-      msg = tmp.pstrdup(in_pool.getPool());
+      msg = tmp.pstrdup(pool);
       // ### Conditionally add t.printStackTrace() to msg?
     }
   else
@@ -732,6 +732,24 @@ JNIUtil::thrownExceptionToCString(SVN::P
     }
   return msg;
 }
+} // anonymous namespace
+
+const char *
+JNIUtil::thrownExceptionToCString(SVN::Pool &in_pool)
+{
+  return exception_to_cstring(in_pool.getPool());
+}
+
+svn_error_t*
+JNIUtil::checkJavaException(apr_status_t errorcode)
+{
+  if (!getEnv()->ExceptionCheck())
+    return SVN_NO_ERROR;
+  svn_error_t* err = svn_error_create(errorcode, NULL, NULL);
+  err->message = apr_psprintf(err->pool, _("Java exception: %s"),
+                              exception_to_cstring(err->pool));
+  return err;
+}
 
 /**
  * Create a Java string from a native UTF-8 string.

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.h?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.h (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/JNIUtil.h Wed Jul  3 00:14:42 2013
@@ -40,6 +40,8 @@ class SVNBase;
 #include <vector>
 struct svn_error_t;
 
+#include "svn_error.h"
+
 #define JAVA_PACKAGE "org/apache/subversion/javahl"
 
 struct svn_string_t;
@@ -109,6 +111,12 @@ class JNIUtil
   static const char *thrownExceptionToCString(SVN::Pool &in_pool);
 
   /**
+   * Check if a Java exception was thrown and convert it to a
+   * Subversion error, using @a errorcode as the generic error code.
+   */
+  static svn_error_t* checkJavaException(apr_status_t errorcode);
+
+  /**
    * Throw a Java exception corresponding to err, and run
    * svn_error_clear() on err.
    */
@@ -301,4 +309,10 @@ class JNIUtil
     }                                                   \
   } while (0)
 
+#define SVN_JNI_CATCH(statement, errorcode)             \
+  do {                                                  \
+    do { statement; } while(0);                         \
+    SVN_ERR(JNIUtil::checkJavaException((errorcode)));  \
+  } while(0)
+
 #endif  // JNIUTIL_H

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.cpp?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.cpp Wed Jul  3 00:14:42 2013
@@ -25,6 +25,7 @@
  */
 
 #include <cstring>
+#include <memory>
 #include <set>
 
 #include "JNIByteArray.h"
@@ -44,6 +45,8 @@
 #include "Prompter.h"
 #include "Revision.h"
 #include "RemoteSession.h"
+#include "EditorProxy.h"
+#include "StateReporter.h"
 
 #include <apr_strings.h>
 #include "svn_private_config.h"
@@ -639,12 +642,112 @@ RemoteSession::getDirectory(jlong jrevis
 // TODO: update
 // TODO: switch
 
-jobject
-RemoteSession::status(jstring jstatus_target,
+namespace {
+svn_error_t*
+status_unlock_func(void* baton, const char* path, apr_pool_t* scratch_pool)
+{
+  //DEBUG:fprintf(stderr, "  (n) status_unlock_func('%s')\n", path);
+  return SVN_NO_ERROR;
+}
+
+svn_error_t*
+status_fetch_props_func(apr_hash_t **props, void *baton,
+                        const char *path, svn_revnum_t base_revision,
+                        apr_pool_t *result_pool, apr_pool_t *scratch_pool)
+{
+  //DEBUG:fprintf(stderr, "  (n) status_fetch_props_func('%s', r%lld)\n",
+  //DEBUG:        path, static_cast<long long>(base_revision));
+  *props = apr_hash_make(scratch_pool);
+  return SVN_NO_ERROR;
+}
+
+svn_error_t*
+status_fetch_base_func(const char **filename, void *baton,
+                       const char *path, svn_revnum_t base_revision,
+                       apr_pool_t *result_pool, apr_pool_t *scratch_pool)
+{
+  //DEBUG:fprintf(stderr, "  (n) status_fetch_base_func('%s', r%lld)\n",
+  //DEBUG:        path, static_cast<long long>(base_revision));
+  *filename = NULL;
+  return SVN_NO_ERROR;
+}
+
+svn_error_t*
+status_start_edit_func(void* baton, svn_revnum_t start_revision)
+{
+  //DEBUG:fprintf(stderr, "  (n) status_start_edit_func(r%lld)\n",
+  //DEBUG:        static_cast<long long>(start_revision));
+  return SVN_NO_ERROR;
+}
+
+svn_error_t*
+status_target_revision_func(void* baton, svn_revnum_t target_revision,
+                            apr_pool_t* scratch_pool)
+{
+  //DEBUG:fprintf(stderr, "  (n) status_target_revision_func(r%lld)\n",
+  //DEBUG:        static_cast<long long>(target_revision));
+  *static_cast<svn_revnum_t*>(baton) = target_revision;
+  return SVN_NO_ERROR;
+}
+
+const EditorProxyCallbacks template_status_editor_callbacks = {
+  status_unlock_func,
+  status_fetch_props_func,
+  status_fetch_base_func,
+  { status_start_edit_func, status_target_revision_func, NULL },
+  NULL
+};
+} // anonymous namespace
+
+void
+RemoteSession::status(jobject jthis, jstring jstatus_target,
                       jlong jrevision, jobject jdepth,
-                      jobject jstatus_editor)
+                      jobject jstatus_editor, jobject jreporter)
 {
-  return NULL;
+  StateReporter *rp = StateReporter::getCppObject(jreporter);
+  CPPADDR_NULL_PTR(rp,);
+
+  SVN::Pool scratchPool(rp->get_report_pool());
+  Relpath status_target(jstatus_target, scratchPool);
+  if (JNIUtil::isExceptionThrown())
+    return;
+
+  apr_pool_t* scratch_pool = scratchPool.getPool();
+  const char* repos_root_url;
+  SVN_JNI_ERR(svn_ra_get_repos_root2(m_session, &repos_root_url,
+                                     scratch_pool),);
+  const char* session_root_url;
+  SVN_JNI_ERR(svn_ra_get_session_url(m_session, &session_root_url,
+                                     scratch_pool),);
+  const char* base_relpath;
+  SVN_JNI_ERR(svn_ra_get_path_relative_to_root(m_session, &base_relpath,
+                                               session_root_url,
+                                               scratch_pool),);
+
+  EditorProxyCallbacks proxy_callbacks =
+    template_status_editor_callbacks;
+  proxy_callbacks.m_extra_baton.baton = &rp->m_target_revision;
+
+  apr_pool_t* report_pool = rp->get_report_pool();
+  std::auto_ptr<EditorProxy> editor(
+      new EditorProxy(jstatus_editor, report_pool,
+                      repos_root_url, base_relpath,
+                      m_context->checkCancel, m_context,
+                      proxy_callbacks));
+  if (JNIUtil::isExceptionThrown())
+    return;
+
+  const svn_ra_reporter3_t* raw_reporter;
+  void* report_baton;
+  SVN_JNI_ERR(svn_ra_do_status2(m_session,
+                                &raw_reporter, &report_baton,
+                                status_target.c_str(),
+                                svn_revnum_t(jrevision),
+                                EnumMapper::toDepth(jdepth),
+                                editor->delta_editor(),
+                                editor->delta_baton(),
+                                report_pool),);
+  rp->set_reporter_data(raw_reporter, report_baton, editor.release());
 }
 
 // TODO: diff

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.h?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.h (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/RemoteSession.h Wed Jul  3 00:14:42 2013
@@ -82,9 +82,9 @@ class RemoteSession : public SVNBase
     // TODO: getMergeinfo
     // TODO: update
     // TODO: switch
-    jobject status(jstring jstatus_target,
-                   jlong jrevision, jobject jdepth,
-                   jobject jstatus_editor);
+    void status(jobject jthis, jstring jstatus_target,
+                jlong jrevision, jobject jdepth,
+                jobject jstatus_editor, jobject jreporter);
     // TODO: diff
     void getLog(jobject jpaths, jlong jstartrev, jlong jendrev, jint jlimit,
                 jboolean jstrict_node_history, jboolean jdiscover_changed_paths,

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp Wed Jul  3 00:14:42 2013
@@ -182,15 +182,15 @@ Java_org_apache_subversion_javahl_remote
   editor->move(jsrc_relpath, jsrc_revision, jdst_relpath, jreplaces_revision);
 }
 
-JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_rotate(
-    JNIEnv* env, jobject jthis, jobject jelements)
-{
-  JNIEntry(CommitEditor, rotate);
-  CommitEditor *editor = CommitEditor::getCppObject(jthis);
-  CPPADDR_NULL_PTR(editor,);
-  editor->rotate(jelements);
-}
+//JNIEXPORT void JNICALL
+//Java_org_apache_subversion_javahl_remote_CommitEditor_rotate(
+//    JNIEnv* env, jobject jthis, jobject jelements)
+//{
+//  JNIEntry(CommitEditor, rotate);
+//  CommitEditor *editor = CommitEditor::getCppObject(jthis);
+//  CPPADDR_NULL_PTR(editor,);
+//  editor->rotate(jelements);
+//}
 
 JNIEXPORT void JNICALL
 Java_org_apache_subversion_javahl_remote_CommitEditor_complete(

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp Wed Jul  3 00:14:42 2013
@@ -217,16 +217,17 @@ Java_org_apache_subversion_javahl_remote
 // TODO: update
 // TODO: switch
 
-JNIEXPORT jobject JNICALL
-Java_org_apache_subversion_javahl_remote_RemoteSession_status(
-    JNIEnv *env, jobject jthis, jstring jstatus_target,
-    jlong jrevision, jobject jdepth, jobject jstatus_editor)
+JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_remote_RemoteSession_nativeStatus(
+    JNIEnv *env, jobject jthis, jstring jstatus_target, jlong jrevision,
+    jobject jdepth, jobject jstatus_editor, jobject jreporter)
 {
-  JNIEntry(SVNReposAccess, doStatus);
+  JNIEntry(SVNReposAccess, nativeStatus);
   RemoteSession *ras = RemoteSession::getCppObject(jthis);
-  CPPADDR_NULL_PTR(ras, NULL);
+  CPPADDR_NULL_PTR(ras,);
 
-  return ras->status(jstatus_target, jrevision, jdepth, jstatus_editor);
+  ras->status(jthis, jstatus_target, jrevision, jdepth,
+              jstatus_editor, jreporter);
 }
 
 // TODO: diff

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java Wed Jul  3 00:14:42 2013
@@ -273,40 +273,42 @@ public interface ISVNEditor
               String destinationRelativePath,
               long replacesRevision)
             throws ClientException;
-    /**
-     * Perform a rotation among multiple nodes in the target tree.
-     * <p>
-     * The <code>elements</code> list specifies the nodes in the tree
-     * which are located at a path and expected to be at a specific
-     * revision. These nodes are simultaneously moved in a rotation
-     * pattern.  For example, the node at index 0
-     * <code>elements</code> will be moved to the relative path
-     * specified at index 1 of <code>elements</code>. The node at
-     * index 1 will be moved to the location at index 2. The node at
-     * index N-1 will be moved to the relative path specified at index 0.
-     * <p>
-     * The simplest form of this operation is to swap nodes A and
-     * B. One may think to move A to a temporary location T, then move
-     * B to A, then move T to B. However, this last move violations
-     * the Once Rule by moving T (which had already by edited by the
-     * move from A). In order to keep the restrictions against
-     * multiple moves of a single node, the rotation operation is
-     * needed for certain types of tree edits.
-     *
-     * @throws ClientException
-     */
-    void rotate(Iterable<RotatePair> elements) throws ClientException;
 
-    public static final class RotatePair
-    {
-        public RotatePair(String relativePath, long revision)
-        {
-            this.relativePath = relativePath;
-            this.revision = revision;
-        }
-        public final String relativePath;
-        public final long revision;
-    }
+// Not implemented in the native API
+//    /**
+//     * Perform a rotation among multiple nodes in the target tree.
+//     * <p>
+//     * The <code>elements</code> list specifies the nodes in the tree
+//     * which are located at a path and expected to be at a specific
+//     * revision. These nodes are simultaneously moved in a rotation
+//     * pattern.  For example, the node at index 0
+//     * <code>elements</code> will be moved to the relative path
+//     * specified at index 1 of <code>elements</code>. The node at
+//     * index 1 will be moved to the location at index 2. The node at
+//     * index N-1 will be moved to the relative path specified at index 0.
+//     * <p>
+//     * The simplest form of this operation is to swap nodes A and
+//     * B. One may think to move A to a temporary location T, then move
+//     * B to A, then move T to B. However, this last move violations
+//     * the Once Rule by moving T (which had already by edited by the
+//     * move from A). In order to keep the restrictions against
+//     * multiple moves of a single node, the rotation operation is
+//     * needed for certain types of tree edits.
+//     *
+//     * @throws ClientException
+//     */
+//    void rotate(Iterable<RotatePair> elements) throws ClientException;
+//
+//    public static final class RotatePair
+//    {
+//        public RotatePair(String relativePath, long revision)
+//        {
+//            this.relativePath = relativePath;
+//            this.revision = revision;
+//        }
+//        public final String relativePath;
+//        public final long revision;
+//    }
 
     /**
      * Signal that the edit has been completed successfully.

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java Wed Jul  3 00:14:42 2013
@@ -289,8 +289,8 @@ public interface ISVNRemote
      * or the HEAD revision if <code>revision</code> is
      * {@link org.apache.subversion.javahl.types.Revision#SVN_INVALID_REVNUM}.
      * <p>
-     * The client begins by providing a <code>statusEditor</code> to
-     * the remote session; this editor must contain knowledge of where
+     * The client begins by providing a <code>receiver</code> to
+     * the remote session; this object must contain knowledge of where
      * the change will begin in the working copy.
      * <p>
      * In return, the client receives an {@link ISVNReporter}
@@ -298,14 +298,12 @@ public interface ISVNRemote
      * calls to its methods.
      * <p>
      * When finished, the client calls {@link ISVNReporter#finishReport}.
-     * This results in a complete drive of <code>statusEditor</code>,
-     * ending with {@link ISVNEditor#complete()}, to report,
-     * essentially, what would be modified in the working copy were
-     * the client to perform an update.  <code>statusTarget</code> is
-     * an optional single path component that restricts the scope of
-     * the status report to an entry in the directory represented by
-     * the session's URL, or empty if the entire directory is meant to
-     * be examined.
+     * This results in <code>receiver</code> being called once for
+     * every path in the working copy that is different from the
+     * repository. <code>statusTarget</code> is an optional single
+     * path component that restricts the scope of the status report to
+     * an entry in the directory represented by the session's URL, or
+     * empty if the entire directory is meant to be examined.
      * <p>
      * Get status as deeply as <code>depth</code> indicates.  If
      * <code>depth</code> is
@@ -317,8 +315,8 @@ public interface ISVNRemote
      * <p>
      * The caller may not perform any operations using this session
      * before finishing the report, and may not perform any operations
-     * using this session from within the editing operations of
-     * <code>statusEditor</code>.
+     * using this session from within the implementation of
+     * <code>receiver</code>.
      * <p>
      * <b>Note:</b> The reporter provided by this function does
      * <em>not</em> supply copy-from information to the editor
@@ -332,7 +330,7 @@ public interface ISVNRemote
      */
     ISVNReporter status(String statusTarget,
                         long revision, Depth depth,
-                        ISVNEditor statusEditor)
+                        RemoteStatus receiver)
             throws ClientException;
 
     // TODO: diff

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java Wed Jul  3 00:14:42 2013
@@ -134,16 +134,22 @@ public interface ISVNReporter
                   String lockToken)
             throws ClientException;
 
-
     /**
      * The report driver calls this when the state report is finished.
      * Any directories or files not explicitly "set" are assumed to be
      * at the baseline revision originally passed into do_update(). No
      * other reporting functions, including {@link abortReport()},
      * should be called after calling this function.
+     *
+     * @return The target revision of the resulting editor drive. In
+     *         the case of {@link ISVNRemote#status}, this is the
+     *         revision against which the status call was performed;
+     *         in the case of {@link ISVNRemote#update}, it is the
+     *         revision updated to.
+     *
      * @throws ClientException
      */
-    void finishReport() throws ClientException;
+    long finishReport() throws ClientException;
 
     /**
      * If an error occurs during a report, this routine should cause

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java Wed Jul  3 00:14:42 2013
@@ -94,7 +94,7 @@ public class CommitEditor extends JNIObj
                                     String target,
                                     Map<String, byte[]> properties)
             throws ClientException;
-   
+
     public native void delete(String relativePath,
                               long revision)
             throws ClientException;
@@ -111,11 +111,8 @@ public class CommitEditor extends JNIObj
                             long replacesRevision)
             throws ClientException;
 
-    /**
-     * <b>Note:</b> Not implemented.
-     */
-    public native void rotate(Iterable<RotatePair> elements)
-            throws ClientException;
+//    public native void rotate(Iterable<RotatePair> elements)
+//            throws ClientException;
 
     public native void complete() throws ClientException;
 

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java Wed Jul  3 00:14:42 2013
@@ -57,6 +57,17 @@ public class RemoteSession extends JNIOb
             }
             editorReference = null;
         }
+        if (reporterReference != null)
+        {
+            // Deactivate the open reporter
+            ISVNReporter rp = reporterReference.get();
+            if (rp != null)
+            {
+                rp.dispose();
+                reporterReference.clear();
+            }
+            reporterReference = null;
+        }
         nativeDispose();
     }
 
@@ -114,13 +125,10 @@ public class RemoteSession extends JNIOb
                                       boolean keepLocks)
             throws ClientException
     {
-        if (editorReference != null && editorReference.get() != null)
-            throw new IllegalStateException("An editor is already active");
-
+        check_inactive(editorReference, reporterReference);
         ISVNEditor ed =
             CommitEditor.createInstance(this, revisionProperties,
                                         commitCallback, lockTokens, keepLocks);
-
         if (editorReference != null)
             editorReference.clear();
         editorReference = new WeakReference<ISVNEditor>(ed);
@@ -155,10 +163,24 @@ public class RemoteSession extends JNIOb
     // TODO: update
     // TODO: switch
 
-    public native ISVNReporter status(String statusTarget,
-                                      long revision, Depth depth,
-                                      ISVNEditor statusEditor)
-            throws ClientException;
+    public ISVNReporter status(String statusTarget,
+                               long revision, Depth depth,
+                               RemoteStatus receiver)
+            throws ClientException
+    {
+        check_inactive(editorReference, reporterReference);
+        StateReporter rp = StateReporter.createInstance(this);
+
+        // At this point, the reporter is not active/valid.
+        StatusEditor editor = new StatusEditor(receiver);
+        nativeStatus(statusTarget, revision, depth, editor, rp);
+        // Now it should be valid.
+
+        if (reporterReference != null)
+            reporterReference.clear();
+        reporterReference = new WeakReference<ISVNReporter>(rp);
+        return rp;
+    }
 
     // TODO: diff
 
@@ -219,12 +241,16 @@ public class RemoteSession extends JNIOb
                                       OutputStream contents,
                                       Map<String, byte[]> properties)
             throws ClientException;
-
     private native long nativeGetDirectory(long revision, String path,
                                            int direntFields,
                                            Map<String, DirEntry> dirents,
                                            Map<String, byte[]> properties)
             throws ClientException;
+    private native void nativeStatus(String statusTarget,
+                                     long revision, Depth depth,
+                                     ISVNEditor statusEditor,
+                                     ISVNReporter reporter)
+            throws ClientException;
     private native boolean nativeHasCapability(String capability)
             throws ClientException;
 
@@ -235,18 +261,19 @@ public class RemoteSession extends JNIOb
     private class RemoteSessionContext extends OperationContext {}
 
     /*
-     * A reference to the current open editor. We need this in order
+     * A reference to the current active editor. We need this in order
      * to dispose/abort the editor when the session is disposed. And
-     * furthermore, there can be only one editor active at any time.
+     * furthermore, there can be only one editor or reporter active at
+     * any time.
      */
     private WeakReference<ISVNEditor> editorReference;
 
     /*
-     * The commit editor callse this when disposed to clear the
+     * The commit editor calls this when disposed to clear the
      * reference. Note that this function will be called during our
      * dispose, so make sure they don't step on each others' toes.
      */
-    void disposeEditor(CommitEditor editor)
+    void disposeEditor(ISVNEditor editor)
     {
         if (editorReference == null)
             return;
@@ -259,6 +286,31 @@ public class RemoteSession extends JNIOb
     }
 
     /*
+     * A reference to the current active reporter. We need this in
+     * order to dispose/abort the report when the session is
+     * disposed. And furthermore, there can be only one reporter or
+     * editor active at any time.
+     */
+    private WeakReference<ISVNReporter> reporterReference;
+
+    /*
+     * The update reporter calls this when disposed to clear the
+     * reference. Note that this function will be called during our
+     * dispose, so make sure they don't step on each others' toes.
+     */
+    void disposeReporter(ISVNReporter reporter)
+    {
+        if (reporterReference == null)
+            return;
+        ISVNReporter rp = reporterReference.get();
+        if (rp == null)
+            return;
+        if (rp != reporter)
+            throw new IllegalStateException("Disposing unknown reporter");
+        reporterReference.clear();
+    }
+
+    /*
      * Private helper methods.
      */
     private final static void maybe_clear(Map clearable)
@@ -270,4 +322,14 @@ public class RemoteSession extends JNIOb
                 // ignored
             }
     }
+
+    private final static
+        void check_inactive(WeakReference<ISVNEditor> editorReference,
+                            WeakReference<ISVNReporter> reporterReference)
+    {
+        if (editorReference != null && editorReference.get() != null)
+            throw new IllegalStateException("An editor is already active");
+        if (reporterReference != null && reporterReference.get() != null)
+            throw new IllegalStateException("A reporter is already active");
+    }
 }

Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java Wed Jul  3 00:14:42 2013
@@ -649,8 +649,8 @@ public class SVNRemoteTests extends SVNT
         ISVNRemote session = getSession();
 
         HashMap<String, byte[]> props = new HashMap<String, byte[]>();
-        ArrayList<ISVNEditor.RotatePair> rotation =
-            new ArrayList<ISVNEditor.RotatePair>();
+        // ArrayList<ISVNEditor.RotatePair> rotation =
+        //     new ArrayList<ISVNEditor.RotatePair>();
 
         CommitContext cc = new CommitContext(session, "not implemented");
         try {
@@ -659,7 +659,7 @@ public class SVNRemoteTests extends SVNT
             try {
                 exmsg = "";
                 cc.editor.addSymlink("", "", props, 1);
-            } catch (IllegalStateException ex) {
+            } catch (RuntimeException ex) {
                 exmsg = ex.getMessage();
             }
             assertEquals("Not implemented: CommitEditor.addSymlink", exmsg);
@@ -667,18 +667,18 @@ public class SVNRemoteTests extends SVNT
             try {
                 exmsg = "";
                 cc.editor.alterSymlink("", 1, "", null);
-            } catch (IllegalStateException ex) {
+            } catch (RuntimeException ex) {
                 exmsg = ex.getMessage();
             }
             assertEquals("Not implemented: CommitEditor.alterSymlink", exmsg);
 
-            try {
-                exmsg = "";
-                cc.editor.rotate(rotation);
-            } catch (IllegalStateException ex) {
-                exmsg = ex.getMessage();
-            }
-            assertEquals("Not implemented: CommitEditor.rotate", exmsg);
+            // try {
+            //     exmsg = "";
+            //     cc.editor.rotate(rotation);
+            // } catch (RuntimeException ex) {
+            //     exmsg = ex.getMessage();
+            // }
+            // assertEquals("Not implemented: CommitEditor.rotate", exmsg);
         } finally {
             cc.editor.dispose();
         }
@@ -783,4 +783,121 @@ public class SVNRemoteTests extends SVNT
                                         handler);
         session.getLatestRevision(); // Make sure the configuration gets loaded
     }
+
+    private static class RemoteStatusReceiver implements RemoteStatus
+    {
+        static class StatInfo
+        {
+            public String relpath = null;
+            public char kind = ' '; // F, D, L
+            public boolean textChanged = false;
+            public boolean propsChanged = false;
+            public boolean deleted = false;
+
+            StatInfo(String relpath, char kind, boolean added)
+            {
+                this.relpath = relpath;
+                this.kind = kind;
+                this.deleted = !added;
+            }
+
+            StatInfo(String relpath, char kind,
+                     boolean textChanged, boolean propsChanged)
+            {
+                this.relpath = relpath;
+                this.kind = kind;
+                this.textChanged = textChanged;
+                this.propsChanged = propsChanged;
+            }
+        }
+
+        public ArrayList<StatInfo> status = new ArrayList<StatInfo>();
+
+        public void addedDirectory(String relativePath)
+        {
+            status.add(new StatInfo(relativePath, 'D', true));
+        }
+
+        public void addedFile(String relativePath)
+        {
+            status.add(new StatInfo(relativePath, 'F', true));
+        }
+
+        public void addedSymlink(String relativePath)
+        {
+            status.add(new StatInfo(relativePath, 'L', true));
+        }
+
+        public void modifiedDirectory(String relativePath,
+                                      boolean childrenModified, boolean propsModified)
+        {
+            status.add(new StatInfo(relativePath, 'D',
+                                    childrenModified, propsModified));
+        }
+
+        public void modifiedFile(String relativePath,
+                                 boolean textModified, boolean propsModified)
+        {
+            status.add(new StatInfo(relativePath, 'F',
+                                    textModified, propsModified));
+        }
+
+        public void modifiedSymlink(String relativePath,
+                                    boolean targetModified, boolean propsModified)
+        {
+            status.add(new StatInfo(relativePath, 'L',
+                                    targetModified, propsModified));
+        }
+
+        public void deleted(String relativePath)
+        {
+            status.add(new StatInfo(relativePath, ' ', false));
+        }
+    }
+
+    public void testSimpleStatus() throws Exception
+    {
+        ISVNRemote session = getSession();
+
+        RemoteStatusReceiver receiver = new RemoteStatusReceiver();
+        ISVNReporter rp = session.status(null, Revision.SVN_INVALID_REVNUM,
+                                         Depth.infinity, receiver);
+        try {
+            rp.setPath("", 0, Depth.infinity, true, null);
+            assertEquals(1, rp.finishReport());
+        } finally {
+            rp.dispose();
+        }
+        assertEquals(21, receiver.status.size());
+    }
+
+    public void testPropchangeStatus() throws Exception
+    {
+        ISVNRemote session = getSession();
+
+        CommitMessageCallback cmcb = new CommitMessageCallback() {
+                public String getLogMessage(Set<CommitItem> x) {
+                    return "Property change on A/D/gamma";
+                }
+            };
+        client.propertySetRemote(getTestRepoUrl() + "/A/D/gamma",
+                                 1L, "foo", "bar".getBytes(), cmcb,
+                                 false, null, null);
+
+        RemoteStatusReceiver receiver = new RemoteStatusReceiver();
+        ISVNReporter rp = session.status(null, Revision.SVN_INVALID_REVNUM,
+                                         Depth.infinity, receiver);
+        try {
+            rp.setPath("", 1, Depth.infinity, false, null);
+            assertEquals(2, rp.finishReport());
+        } finally {
+            rp.dispose();
+        }
+        assertEquals(4, receiver.status.size());
+        RemoteStatusReceiver.StatInfo mod = receiver.status.get(3);
+        assertEquals("A/D/gamma", mod.relpath);
+        assertEquals('F', mod.kind);
+        assertEquals(false, mod.textChanged);
+        assertEquals(true, mod.propsChanged);
+    }
 }

Modified: subversion/branches/javahl-1.8-extensions/subversion/libsvn_delta/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/libsvn_delta/compat.c?rev=1499159&r1=1499158&r2=1499159&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/libsvn_delta/compat.c (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/libsvn_delta/compat.c Wed Jul  3 00:14:42 2013
@@ -218,6 +218,7 @@ locate_change(struct ev2_edit_baton *eb,
   change = apr_pcalloc(eb->edit_pool, sizeof(*change));
   change->changing = SVN_INVALID_REVNUM;
   change->deleting = SVN_INVALID_REVNUM;
+  change->kind = svn_node_unknown;
 
   svn_hash_sets(eb->changes, relpath, change);
 



Mime
View raw message