You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/06/26 07:01:54 UTC
svn commit: r1496733 - in /subversion/trunk/subversion/bindings/javahl:
native/ src/org/apache/subversion/javahl/remote/
tests/org/apache/subversion/javahl/
Author: brane
Date: Wed Jun 26 05:01:53 2013
New Revision: 1496733
URL: http://svn.apache.org/r1496733
Log:
Refactor the JavaHL commit editor and implement EV2 copy.
[in subversion/bindings/javahl/src/org/apache/subversion/javahl]
* remote/CommitEditor.java: Remove native implementaiton methods;
make the ISVNRemote interface implementation native instead.
[in subversion/bindings/javahl/native]
* CommitEditor.h (CommitEditor): Remove session parameter from the
editor API methods ...
(CommitEditor::m_session): ... and remember the session here instead.
(CommitEditor::m_callback): Change type to PersistentCommitCallback.
(CommitEditor::m_extra_baton): Remove.
(CommitEditor::get_copysrc_kind_cb,
CommitEditor::m_callback_session,
CommitEditor::m_callback_session_url,
CommitEditor::m_callback_session_uuid): Helpers for EV2/EV1 shims.
* CommitEditor.cpp:
(CommitEditor::CommitEditor): Use private RA function to create editor.
(CommitEditor::copy, CommitEditor::complete, CommitEditor::abort):
Implement EV2 edit operations.
Rework boilerplate code for other EV2 operations.
* org_apache_subversion_javahl_remote_CommitEditor.cpp: Remove "native" from
the names of wrapper functions that changed in CommitEditor.java.
Modified:
subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp
subversion/trunk/subversion/bindings/javahl/native/CommitEditor.h
subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java
subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
Modified: subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp?rev=1496733&r1=1496732&r2=1496733&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp Wed Jun 26 05:01:53 2013
@@ -29,8 +29,8 @@
#include "RevpropTable.h"
#include "RemoteSession.h"
-#include "svn_delta.h"
#include "private/svn_editor.h"
+#include "private/svn_ra_private.h"
#include "svn_private_config.h"
CommitEditor*
@@ -52,9 +52,9 @@ CommitEditor::createInstance(jobject jse
RemoteSession* session = RemoteSession::getCppObject(jsession);
CPPADDR_NULL_PTR(session, 0);
- CommitEditor* editor = new CommitEditor(session->m_session,
+ CommitEditor* editor = new CommitEditor(session,
jrevprops, jcommit_callback,
- jlock_tokens, bool(jkeep_locks));
+ jlock_tokens, jkeep_locks);
if (JNIUtil::isJavaExceptionThrown())
{
delete editor;
@@ -64,50 +64,47 @@ CommitEditor::createInstance(jobject jse
}
-CommitEditor::CommitEditor(svn_ra_session_t* session,
+CommitEditor::CommitEditor(RemoteSession* session,
jobject jrevprops, jobject jcommit_callback,
- jobject jlock_tokens, bool keep_locks)
+ jobject jlock_tokens, jboolean jkeep_locks)
: m_valid(false),
m_callback(jcommit_callback),
+ m_session(session),
m_editor(NULL),
- m_extra_baton(NULL)
-{
+ m_callback_session(NULL),
+ m_callback_session_url(NULL),
+ m_callback_session_uuid(NULL)
+{
+ // Store the repository root identity from the current session as we
+ // may need it to open another session in get_copysrc_kind_cb.
+ SVN_JNI_ERR(svn_ra_get_repos_root2(session->m_session,
+ &m_callback_session_url,
+ pool.getPool()),);
+ SVN_JNI_ERR(svn_ra_get_uuid2(session->m_session,
+ &m_callback_session_uuid,
+ pool.getPool()),);
+
RevpropTable revprops(jrevprops, true);
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
LockTokenTable lock_tokens(jlock_tokens);
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
SVN::Pool subPool(pool);
- const svn_delta_editor_t* delta_editor = NULL;
- void* delta_edit_baton = NULL;
- SVN_JNI_ERR(svn_ra_get_commit_editor3(
- session, &delta_editor, &delta_edit_baton,
+ SVN_JNI_ERR(svn_ra__get_commit_ev2(
+ &m_editor,
+ session->m_session,
revprops.hash(subPool, false),
m_callback.callback, &m_callback,
lock_tokens.hash(subPool, true),
- keep_locks, pool.getPool()),
+ bool(jkeep_locks),
+ NULL, // svn_ra__provide_base_cb_t
+ NULL, // svn_ra__provide_props_cb_t
+ this->get_copysrc_kind_cb, this,
+ pool.getPool(), // result pool
+ subPool.getPool()), // scratch pool
);
-
-// SVN_JNI_ERR(svn_delta__editor_from_delta(
-// &m_editor, &m_extra_baton,
-//
-// svn_delta__unlock_func_t *unlock_func,
-// void **unlock_baton,
-//
-// delta_editor, delta_edit_baton,
-//
-// svn_boolean_t *send_abs_paths,
-// const char *repos_root,
-// const char *base_relpath,
-// svn_cancel_func_t cancel_func,
-// void *cancel_baton,
-// svn_delta_fetch_kind_func_t fetch_kind_func,
-// void *fetch_kind_baton,
-// svn_delta_fetch_props_func_t fetch_props_func,
-// void *fetch_props_baton,
-//
-// pool.getPool(), // result_pool
-// subpool.getPool()) // scratch_pool
-// );
-
m_valid = true;
}
@@ -115,15 +112,15 @@ CommitEditor::~CommitEditor() {}
void CommitEditor::dispose(jobject jthis)
{
- //if (m_valid)
- // abort();
+ if (m_valid)
+ abort();
static jfieldID fid = 0;
SVNBase::dispose(jthis, &fid, JAVA_PACKAGE"/remote/CommitEditor");
}
namespace {
-void throw_editor_inactive()
+void throw_illegal_state(const char* msg)
{
JNIEnv *env = JNIUtil::getEnv();
@@ -139,7 +136,7 @@ void throw_editor_inactive()
return;
}
- jstring jmsg = JNIUtil::makeJString(_("The editor is not active"));
+ jstring jmsg = JNIUtil::makeJString(msg);
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -149,201 +146,217 @@ void throw_editor_inactive()
env->Throw((jthrowable)jexception);
}
+
+void throw_editor_inactive()
+{
+ throw_illegal_state(_("The editor is not active"));
+}
+
+void throw_not_implemented(const char* fname)
+{
+ std::string msg = _("Not implemented: ");
+ msg += "CommitEditor.";
+ msg += fname;
+ throw_illegal_state(msg.c_str());
+}
} // anonymous namespace
-void CommitEditor::addDirectory(jobject jsession, jstring jrelpath,
+void CommitEditor::addDirectory(jstring jrelpath,
jobject jchildren, jobject jproperties,
jlong jreplaces_revision)
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
+ if (!m_valid)
{
throw_editor_inactive();
return;
}
+ SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
+ throw_not_implemented("addDirectory");
}
-void CommitEditor::addFile(jobject jsession, jstring jrelpath,
+void CommitEditor::addFile(jstring jrelpath,
jobject jchecksum, jobject jcontents,
jobject jproperties,
jlong jreplaces_revision)
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
+ if (!m_valid)
{
throw_editor_inactive();
return;
}
+ SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
+ throw_not_implemented("addFile");
}
-void CommitEditor::addSymlink(jobject jsession, jstring jrelpath,
+void CommitEditor::addSymlink(jstring jrelpath,
jstring jtarget, jobject jproperties,
jlong jreplaces_revision)
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
+ if (!m_valid)
{
throw_editor_inactive();
return;
}
+ SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
+ throw_not_implemented("addSymlink");
}
-void CommitEditor::addAbsent(jobject jsession, jstring jrelpath,
- jobject jkind, jlong jreplaces_revision)
+void CommitEditor::addAbsent(jstring jrelpath, jobject jkind,
+ jlong jreplaces_revision)
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
+ if (!m_valid)
{
throw_editor_inactive();
return;
}
+ SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
+ throw_not_implemented("addAbsent");
}
-void CommitEditor::alterDirectory(jobject jsession,
- jstring jrelpath, jlong jrevision,
+void CommitEditor::alterDirectory(jstring jrelpath, jlong jrevision,
jobject jchildren, jobject jproperties)
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
+ if (!m_valid)
{
throw_editor_inactive();
return;
}
+ SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
+ throw_not_implemented("alterDirectory");
}
-void CommitEditor::alterFile(jobject jsession,
- jstring jrelpath, jlong jrevision,
+void CommitEditor::alterFile(jstring jrelpath, jlong jrevision,
jobject jchecksum, jobject jcontents,
jobject jproperties)
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
+ if (!m_valid)
{
throw_editor_inactive();
return;
}
+ SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
+ throw_not_implemented("alterFile");
}
-void CommitEditor::alterSymlink(jobject jsession,
- jstring jrelpath, jlong jrevision,
+void CommitEditor::alterSymlink(jstring jrelpath, jlong jrevision,
jstring jtarget, jobject jproperties)
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
+ if (!m_valid)
{
throw_editor_inactive();
return;
}
+ SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
+ throw_not_implemented("alterSymlink");
}
-void CommitEditor::remove(jobject jsession, jstring jrelpath, jlong jrevision)
+void CommitEditor::remove(jstring jrelpath, jlong jrevision)
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
+ if (!m_valid)
{
throw_editor_inactive();
return;
}
+ SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
+ throw_not_implemented("delete");
}
-void CommitEditor::copy(jobject jsession,
- jstring jsrc_relpath, jlong jsrc_revision,
+void CommitEditor::copy(jstring jsrc_relpath, jlong jsrc_revision,
jstring jdst_relpath, jlong jreplaces_revision)
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
+ if (!m_valid)
{
throw_editor_inactive();
return;
}
+ SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
+
+ JNIStringHolder src_relpath(jsrc_relpath);
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+ JNIStringHolder dst_relpath(jdst_relpath);
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+
+ SVN_JNI_ERR(svn_editor_copy(m_editor,
+ src_relpath, svn_revnum_t(jsrc_revision),
+ dst_relpath, svn_revnum_t(jreplaces_revision)),
+ );
}
-void CommitEditor::move(jobject jsession,
- jstring jsrc_relpath, jlong jsrc_revision,
+void CommitEditor::move(jstring jsrc_relpath, jlong jsrc_revision,
jstring jdst_relpath, jlong jreplaces_revision)
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
- {
- throw_editor_inactive();
- return;
- }
+ throw_not_implemented("move");
}
-void CommitEditor::rotate(jobject jsession, jobject jelements)
+void CommitEditor::rotate(jobject jelements)
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
- {
- throw_editor_inactive();
- return;
- }
+ throw_not_implemented("rotate");
}
-void CommitEditor::complete(jobject jsession)
+void CommitEditor::complete()
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
+ if (!m_valid)
{
throw_editor_inactive();
return;
}
+ SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
- // do stuff
-
+ SVN_JNI_ERR(svn_editor_complete(m_editor),);
m_valid = false;
}
-void CommitEditor::abort(jobject jsession)
+void CommitEditor::abort()
{
- RemoteSession* session = RemoteSession::getCppObject(jsession);
- CPPADDR_NULL_PTR(session,);
- SVN_JNI_ERR(session->m_context->checkCancel(session->m_context),);
-
- if (!m_valid || 1/*FIXME:*/)
+ if (!m_valid)
{
throw_editor_inactive();
return;
}
+ SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
- // do stuff
-
+ SVN_JNI_ERR(svn_editor_abort(m_editor),);
m_valid = false;
}
+
+
+svn_error_t*
+CommitEditor::get_copysrc_kind_cb(svn_node_kind_t* kind, void* baton,
+ const char* repos_relpath,
+ svn_revnum_t src_revision,
+ apr_pool_t *scratch_pool)
+{
+ CommitEditor* editor = static_cast<CommitEditor*>(baton);
+ if (!editor->m_callback_session)
+ {
+ const char* corrected_url;
+ SVN_ERR(svn_ra_open4(&editor->m_callback_session, &corrected_url,
+ editor->m_callback_session_url,
+ editor->m_callback_session_uuid,
+ editor->m_session->m_context->getCallbacks(),
+ editor->m_session->m_context->getCallbackBaton(),
+ editor->m_session->m_context->getConfigData(),
+ editor->pool.getPool()));
+
+ if (corrected_url)
+ {
+ // This shouldn't happen -- the open session will give us
+ // the final redirected repository URL. There's an edge case
+ // where redirects might change while the session is open;
+ // but we'll just punt handling that to the caller.
+ return svn_error_createf(
+ SVN_ERR_RA_ILLEGAL_URL, NULL,
+ _("Repository URL changed while session was open.\n"
+ "Expected URL: %s\nApparent URL: %s"),
+ editor->m_callback_session_url, corrected_url);
+ }
+ }
+
+ SVN::Pool subPool(editor->pool);
+ return svn_ra_check_path(editor->m_callback_session,
+ repos_relpath, src_revision, kind,
+ subPool.getPool());
+}
Modified: subversion/trunk/subversion/bindings/javahl/native/CommitEditor.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CommitEditor.h?rev=1496733&r1=1496732&r2=1496733&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CommitEditor.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CommitEditor.h Wed Jun 26 05:01:53 2013
@@ -27,6 +27,7 @@
#ifndef JAVAHL_COMMIT_EDITOR_H
#define JAVAHL_COMMIT_EDITOR_H
+#include <string>
#include <jni.h>
#include "svn_ra.h"
@@ -35,9 +36,10 @@
#include "SVNBase.h"
#include "CommitCallback.h"
-// Forward-declare the currently private EV2 editor structs.
+class RemoteSession;
+
+// Forward-declare the currently private EV2 editor struct.
struct svn_editor_t;
-struct svn_delta__extra_baton;
/*
* This class wraps an EV2 commit editor.
@@ -55,48 +57,54 @@ public:
virtual void dispose(jobject jthis);
- void addDirectory(jobject jsession, jstring jrelpath,
+ void addDirectory(jstring jrelpath,
jobject jchildren, jobject jproperties,
jlong jreplaces_revision);
- void addFile(jobject jsession, jstring jrelpath,
+ void addFile(jstring jrelpath,
jobject jchecksum, jobject jcontents,
jobject jproperties,
jlong jreplaces_revision);
- void addSymlink(jobject jsession, jstring jrelpath,
+ void addSymlink(jstring jrelpath,
jstring jtarget, jobject jproperties,
jlong jreplaces_revision);
- void addAbsent(jobject jsession, jstring jrelpath,
+ void addAbsent(jstring jrelpath,
jobject jkind, jlong jreplaces_revision);
- void alterDirectory(jobject jsession,
- jstring jrelpath, jlong jrevision,
+ void alterDirectory(jstring jrelpath, jlong jrevision,
jobject jchildren, jobject jproperties);
- void alterFile(jobject jsession,
- jstring jrelpath, jlong jrevision,
+ void alterFile(jstring jrelpath, jlong jrevision,
jobject jchecksum, jobject jcontents,
jobject jproperties);
- void alterSymlink(jobject jsession,
- jstring jrelpath, jlong jrevision,
+ void alterSymlink(jstring jrelpath, jlong jrevision,
jstring jtarget, jobject jproperties);
- void remove(jobject jsession, jstring jrelpath, jlong jrevision);
- void copy(jobject jsession,
- jstring jsrc_relpath, jlong jsrc_revision,
+ void remove(jstring jrelpath, jlong jrevision);
+ void copy(jstring jsrc_relpath, jlong jsrc_revision,
jstring jdst_relpath, jlong jreplaces_revision);
- void move(jobject jsession,
- jstring jsrc_relpath, jlong jsrc_revision,
+ void move(jstring jsrc_relpath, jlong jsrc_revision,
jstring jdst_relpath, jlong jreplaces_revision);
- void rotate(jobject jsession, jobject jelements);
- void complete(jobject jsession);
- void abort(jobject jsession);
+ void rotate(jobject jelements);
+ void complete();
+ void abort();
private:
- CommitEditor(svn_ra_session_t* session,
+ CommitEditor(RemoteSession* session,
jobject jrevprops, jobject jcommit_callback,
- jobject jlock_tokens, bool keep_locks);
+ jobject jlock_tokens, jboolean jkeep_locks);
+
+ // This is our svn_ra__get_copysrc_kind_cb_t for the commit editor.
+ static svn_error_t* get_copysrc_kind_cb(svn_node_kind_t* kind, void* baton,
+ const char* repos_relpath,
+ svn_revnum_t src_revision,
+ apr_pool_t *scratch_pool);
bool m_valid;
- CommitCallback m_callback;
+ PersistentCommitCallback m_callback;
+ RemoteSession* m_session;
svn_editor_t* m_editor;
- svn_delta__extra_baton* m_extra_baton;
+
+ // Temporary, while EV2 shims are in place
+ svn_ra_session_t* m_callback_session;
+ const char* m_callback_session_url;
+ const char* m_callback_session_uuid;
};
#endif // JAVAHL_COMMIT_EDITOR_H
Modified: subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp?rev=1496733&r1=1496732&r2=1496733&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp Wed Jun 26 05:01:53 2013
@@ -66,157 +66,148 @@ Java_org_apache_subversion_javahl_remote
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeAddDirectory(
- JNIEnv* env, jobject jthis, jobject jsession,
+Java_org_apache_subversion_javahl_remote_CommitEditor_addDirectory(
+ JNIEnv* env, jobject jthis,
jstring jrelpath, jobject jchildren, jobject jproperties,
jlong jreplaces_revision)
{
- JNIEntry(CommitEditor, nativeAddDirectory);
+ JNIEntry(CommitEditor, addDirectory);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->addDirectory(jsession,
- jrelpath, jchildren, jproperties, jreplaces_revision);
+ editor->addDirectory(jrelpath, jchildren, jproperties, jreplaces_revision);
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeAddFile(
- JNIEnv* env, jobject jthis, jobject jsession,
+Java_org_apache_subversion_javahl_remote_CommitEditor_addFile(
+ JNIEnv* env, jobject jthis,
jstring jrelpath, jobject jchecksum, jobject jcontents,
jobject jproperties, jlong jreplaces_revision)
{
- JNIEntry(CommitEditor, nativeAddFile);
+ JNIEntry(CommitEditor, addFile);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->addFile(jsession,
- jrelpath, jchecksum, jcontents, jproperties,
+ editor->addFile(jrelpath, jchecksum, jcontents, jproperties,
jreplaces_revision);
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeAddSymlink(
- JNIEnv* env, jobject jthis, jobject jsession,
+Java_org_apache_subversion_javahl_remote_CommitEditor_addSymlink(
+ JNIEnv* env, jobject jthis,
jstring jrelpath, jstring jtarget, jobject jproperties,
jlong jreplaces_revision)
{
- JNIEntry(CommitEditor, nativeAddSymlink);
+ JNIEntry(CommitEditor, addSymlink);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->addSymlink(jsession,
- jrelpath, jtarget, jproperties, jreplaces_revision);
+ editor->addSymlink(jrelpath, jtarget, jproperties, jreplaces_revision);
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeAddAbsent(
- JNIEnv* env, jobject jthis, jobject jsession,
+Java_org_apache_subversion_javahl_remote_CommitEditor_addAbsent(
+ JNIEnv* env, jobject jthis,
jstring jrelpath, jobject jkind, jlong jreplaces_revision)
{
- JNIEntry(CommitEditor, nativeAddAbsent);
+ JNIEntry(CommitEditor, addAbsent);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->addAbsent(jsession,
- jrelpath, jkind, jreplaces_revision);
+ editor->addAbsent(jrelpath, jkind, jreplaces_revision);
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeAlterDirectory(
- JNIEnv* env, jobject jthis, jobject jsession,
+Java_org_apache_subversion_javahl_remote_CommitEditor_alterDirectory(
+ JNIEnv* env, jobject jthis,
jstring jrelpath, jlong jrevision, jobject jchildren, jobject jproperties)
{
- JNIEntry(CommitEditor, nativeAlterDirectory);
+ JNIEntry(CommitEditor, alterDirectory);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->alterDirectory(jsession,
- jrelpath, jrevision, jchildren, jproperties);
+ editor->alterDirectory(jrelpath, jrevision, jchildren, jproperties);
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeAlterFile(
- JNIEnv* env, jobject jthis, jobject jsession,
+Java_org_apache_subversion_javahl_remote_CommitEditor_alterFile(
+ JNIEnv* env, jobject jthis,
jstring jrelpath, jlong jrevision, jobject jchecksum, jobject jcontents,
jobject jproperties)
{
- JNIEntry(CommitEditor, nativeAlterFile);
+ JNIEntry(CommitEditor, alterFile);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->alterFile(jsession,
- jrelpath, jrevision, jchecksum, jcontents, jproperties);
+ editor->alterFile(jrelpath, jrevision, jchecksum, jcontents, jproperties);
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeAlterSymlink(
- JNIEnv* env, jobject jthis, jobject jsession,
+Java_org_apache_subversion_javahl_remote_CommitEditor_alterSymlink(
+ JNIEnv* env, jobject jthis,
jstring jrelpath, jlong jrevision, jstring jtarget, jobject jproperties)
{
- JNIEntry(CommitEditor, nativeAlterSymlink);
+ JNIEntry(CommitEditor, alterSymlink);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->alterSymlink(jsession,
- jrelpath, jrevision, jtarget, jproperties);
+ editor->alterSymlink(jrelpath, jrevision, jtarget, jproperties);
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeDelete(
- JNIEnv* env, jobject jthis, jobject jsession,
+Java_org_apache_subversion_javahl_remote_CommitEditor_delete(
+ JNIEnv* env, jobject jthis,
jstring jrelpath, jlong jrevision)
{
- JNIEntry(CommitEditor, nativeDelete);
+ JNIEntry(CommitEditor, delete);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->remove(jsession, jrelpath, jrevision);
+ editor->remove(jrelpath, jrevision);
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeCopy(
- JNIEnv* env, jobject jthis, jobject jsession,
+Java_org_apache_subversion_javahl_remote_CommitEditor_copy(
+ JNIEnv* env, jobject jthis,
jstring jsrc_relpath, jlong jsrc_revision, jstring jdst_relpath,
jlong jreplaces_revision)
{
- JNIEntry(CommitEditor, nativeCopy);
+ JNIEntry(CommitEditor, copy);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->copy(jsession,
- jsrc_relpath, jsrc_revision, jdst_relpath, jreplaces_revision);
+ editor->copy(jsrc_relpath, jsrc_revision, jdst_relpath, jreplaces_revision);
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeMove(
- JNIEnv* env, jobject jthis, jobject jsession,
+Java_org_apache_subversion_javahl_remote_CommitEditor_move(
+ JNIEnv* env, jobject jthis,
jstring jsrc_relpath, jlong jsrc_revision, jstring jdst_relpath,
jlong jreplaces_revision)
{
- JNIEntry(CommitEditor, nativeMove);
+ JNIEntry(CommitEditor, move);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->move(jsession,
- jsrc_relpath, jsrc_revision, jdst_relpath, jreplaces_revision);
+ editor->move(jsrc_relpath, jsrc_revision, jdst_relpath, jreplaces_revision);
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeRotate(
- JNIEnv* env, jobject jthis, jobject jsession, jobject jelements)
+Java_org_apache_subversion_javahl_remote_CommitEditor_rotate(
+ JNIEnv* env, jobject jthis, jobject jelements)
{
- JNIEntry(CommitEditor, nativeRotate);
+ JNIEntry(CommitEditor, rotate);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->rotate(jsession, jelements);
+ editor->rotate(jelements);
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeComplete(
- JNIEnv* env, jobject jthis, jobject jsession)
+Java_org_apache_subversion_javahl_remote_CommitEditor_complete(
+ JNIEnv* env, jobject jthis)
{
- JNIEntry(CommitEditor, nativeComplete);
+ JNIEntry(CommitEditor, complete);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->complete(jsession);
+ editor->complete();
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_remote_CommitEditor_nativeAbort(
+Java_org_apache_subversion_javahl_remote_CommitEditor_abort(
JNIEnv* env, jobject jthis, jobject jsession)
{
- JNIEntry(CommitEditor, nativeAbort);
+ JNIEntry(CommitEditor, abort);
CommitEditor *editor = CommitEditor::getCppObject(jthis);
CPPADDR_NULL_PTR(editor,);
- editor->abort(jsession);
+ editor->abort();
}
Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java?rev=1496733&r1=1496732&r2=1496733&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java Wed Jun 26 05:01:53 2013
@@ -47,118 +47,71 @@ public class CommitEditor extends JNIObj
nativeDispose();
}
- public void addDirectory(String relativePath,
- Iterable<String> children,
- Map<String, byte[]> properties,
- long replacesRevision)
- throws ClientException
- {
- nativeAddDirectory(session, relativePath, children, properties,
- replacesRevision);
- }
-
- public void addFile(String relativePath,
- Checksum checksum,
- InputStream contents,
- Map<String, byte[]> properties,
- long replacesRevision)
- throws ClientException
- {
- nativeAddFile(session, relativePath,
- checksum, contents, properties,
- replacesRevision);
- }
+ public native void addDirectory(String relativePath,
+ Iterable<String> children,
+ Map<String, byte[]> properties,
+ long replacesRevision)
+ throws ClientException;
- public void addSymlink(String relativePath,
- String target,
- Map<String, byte[]> properties,
- long replacesRevision)
- throws ClientException
- {
- nativeAddSymlink(session, relativePath, target, properties,
- replacesRevision);
- }
+ public native void addFile(String relativePath,
+ Checksum checksum,
+ InputStream contents,
+ Map<String, byte[]> properties,
+ long replacesRevision)
+ throws ClientException;
- public void addAbsent(String relativePath,
- NodeKind kind,
- long replacesRevision)
- throws ClientException
- {
- nativeAddAbsent(session, relativePath, kind, replacesRevision);
- }
+ public native void addSymlink(String relativePath,
+ String target,
+ Map<String, byte[]> properties,
+ long replacesRevision)
+ throws ClientException;
- public void alterDirectory(String relativePath,
- long revision,
- Iterable<String> children,
- Map<String, byte[]> properties)
- throws ClientException
- {
- nativeAlterDirectory(session, relativePath, revision,
- children, properties);
- }
+ public native void addAbsent(String relativePath,
+ NodeKind kind,
+ long replacesRevision)
+ throws ClientException;
- public void alterFile(String relativePath,
- long revision,
- Checksum checksum,
- InputStream contents,
- Map<String, byte[]> properties)
- throws ClientException
- {
- nativeAlterFile(session, relativePath, revision,
- checksum, contents, properties);
- }
+ public native void alterDirectory(String relativePath,
+ long revision,
+ Iterable<String> children,
+ Map<String, byte[]> properties)
+ throws ClientException;
- public void alterSymlink(String relativePath,
- long revision,
- String target,
- Map<String, byte[]> properties)
- throws ClientException
- {
- nativeAlterSymlink(session, relativePath, revision,
- target, properties);
- }
+ public native void alterFile(String relativePath,
+ long revision,
+ Checksum checksum,
+ InputStream contents,
+ Map<String, byte[]> properties)
+ throws ClientException;
- public void delete(String relativePath,
- long revision)
- throws ClientException
- {
- nativeDelete(session, relativePath, revision);
- }
+ public native void alterSymlink(String relativePath,
+ long revision,
+ String target,
+ Map<String, byte[]> properties)
+ throws ClientException;
+
+ public native void delete(String relativePath,
+ long revision)
+ throws ClientException;
- public void copy(String sourceRelativePath,
- long sourceRevision,
- String destinationRelativePath,
- long replacesRevision)
- throws ClientException
- {
- nativeCopy(session, sourceRelativePath, sourceRevision,
- destinationRelativePath, replacesRevision);
- }
+ public native void copy(String sourceRelativePath,
+ long sourceRevision,
+ String destinationRelativePath,
+ long replacesRevision)
+ throws ClientException;
- public void move(String sourceRelativePath,
- long sourceRevision,
- String destinationRelativePath,
- long replacesRevision)
- throws ClientException
- {
- nativeMove(session, sourceRelativePath, sourceRevision,
- destinationRelativePath, replacesRevision);
- }
+ public native void move(String sourceRelativePath,
+ long sourceRevision,
+ String destinationRelativePath,
+ long replacesRevision)
+ throws ClientException;
- public void rotate(List<RotatePair> elements) throws ClientException
- {
- nativeRotate(session, elements);
- }
+ public native void rotate(List<RotatePair> elements)
+ throws ClientException;
- public void complete() throws ClientException
- {
- nativeComplete(session);
- }
+ public native void complete() throws ClientException;
- public void abort() throws ClientException
- {
- nativeAbort(session);
- }
+ public native void abort() throws ClientException;
/**
* This factory method called from RemoteSession.getCommitEditor.
@@ -171,9 +124,8 @@ public class CommitEditor extends JNIObj
boolean keepLocks)
throws ClientException
{
- long cppAddr = nativeCreateInstance(session,
- revisionProperties, commitCallback,
- lockTokens, keepLocks);
+ long cppAddr = nativeCreateInstance(session, revisionProperties,
+ commitCallback, lockTokens, keepLocks);
return new CommitEditor(cppAddr, session);
}
@@ -196,72 +148,6 @@ public class CommitEditor extends JNIObj
* Wrapped private native implementation declarations.
*/
private native void nativeDispose();
- private native void nativeAddDirectory(RemoteSession session,
- String relativePath,
- Iterable<String> children,
- Map<String, byte[]> properties,
- long replacesRevision)
- throws ClientException;
- private native void nativeAddFile(RemoteSession session,
- String relativePath,
- Checksum checksum,
- InputStream contents,
- Map<String, byte[]> properties,
- long replacesRevision)
- throws ClientException;
- private native void nativeAddSymlink(RemoteSession session,
- String relativePath,
- String target,
- Map<String, byte[]> properties,
- long replacesRevision)
- throws ClientException;
- private native void nativeAddAbsent(RemoteSession session,
- String relativePath,
- NodeKind kind,
- long replacesRevision)
- throws ClientException;
- private native void nativeAlterDirectory(RemoteSession session,
- String relativePath,
- long revision,
- Iterable<String> children,
- Map<String, byte[]> properties)
- throws ClientException;
- private native void nativeAlterFile(RemoteSession session,
- String relativePath,
- long revision,
- Checksum checksum,
- InputStream contents,
- Map<String, byte[]> properties)
- throws ClientException;
- private native void nativeAlterSymlink(RemoteSession session,
- String relativePath,
- long revision,
- String target,
- Map<String, byte[]> properties)
- throws ClientException;
- private native void nativeDelete(RemoteSession session,
- String relativePath,
- long revision)
- throws ClientException;
- private native void nativeCopy(RemoteSession session,
- String sourceRelativePath,
- long sourceRevision,
- String destinationRelativePath,
- long replacesRevision)
- throws ClientException;
- private native void nativeMove(RemoteSession session,
- String sourceRelativePath,
- long sourceRevision,
- String destinationRelativePath,
- long replacesRevision)
- throws ClientException;
- private native void nativeRotate(RemoteSession session,
- List<RotatePair> elements)
- throws ClientException;
- private native void nativeComplete(RemoteSession session)
- throws ClientException;
- private native void nativeAbort(RemoteSession session)
- throws ClientException;
private static final native
long nativeCreateInstance(RemoteSession session,
Map<String, byte[]> revisionProperties,
Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java?rev=1496733&r1=1496732&r2=1496733&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java (original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java Wed Jun 26 05:01:53 2013
@@ -24,6 +24,7 @@ package org.apache.subversion.javahl;
import org.apache.subversion.javahl.*;
import org.apache.subversion.javahl.remote.*;
+import org.apache.subversion.javahl.callback.*;
import org.apache.subversion.javahl.types.*;
import java.util.Arrays;
@@ -368,4 +369,47 @@ public class SVNRemoteTests extends SVNT
for (Map.Entry<String, byte[]> e : properties.entrySet())
assertTrue(e.getKey().startsWith("svn:entry:"));
}
+
+ 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 Revision.SVN_INVALID_REVNUM;
+ }
+ }
+
+ public void testRemoteCopy() throws Exception
+ {
+ ISVNRemote session = getSession();
+
+ HashMap<String, byte[]> revprops = new HashMap<String, byte[]>();
+ revprops.put("svn:log", new byte[0]);
+
+ MyCommitCallback commitcb = new MyCommitCallback();
+
+ ISVNEditor editor =
+ session.getCommitEditor(revprops, commitcb, null, false);
+
+ try {
+ editor.copy("A/B/lambda", 1, "A/B/omega",
+ Revision.SVN_INVALID_REVNUM);
+ editor.complete();
+ } finally {
+ editor.dispose();
+ }
+
+ assertEquals(2, commitcb.getRevision());
+ assertEquals(2, session.getLatestRevision());
+ assertEquals(NodeKind.file,
+ session.checkPath("A/B/omega",
+ Revision.SVN_INVALID_REVNUM));
+ }
}