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/28 16:31:11 UTC
svn commit: r1497790 - in /subversion/branches/javahl-1.7-extensions: ./
subversion/bindings/javahl/ subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversion/javahl/
subversion/bindings/javahl/src/org/apache/subversion/ja...
Author: brane
Date: Fri Jun 28 14:31:10 2013
New Revision: 1497790
URL: http://svn.apache.org/r1497790
Log:
On the javahl-1.7-extensions branch: Sync JavaHL with trunk up to r1497785.
Added:
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_ConfigImpl_Category.cpp
- copied, changed from r1497785, subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_ConfigImpl_Category.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConfigImpl.java
- copied, changed from r1497785, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConfigImpl.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNConfig.java
- copied unchanged from r1497785, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNConfig.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ConfigEvent.java
- copied unchanged from r1497785, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ConfigEvent.java
Modified:
subversion/branches/javahl-1.7-extensions/build.conf
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/ (props changed)
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/EnumMapper.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/EnumMapper.h
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIStringHolder.h
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.h
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/SVNClient.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
Modified: subversion/branches/javahl-1.7-extensions/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/build.conf?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/build.conf (original)
+++ subversion/branches/javahl-1.7-extensions/build.conf Fri Jun 28 14:31:10 2013
@@ -59,7 +59,7 @@ private-built-includes =
subversion/bindings/javahl/include/org_apache_subversion_javahl_callback_UserPasswordCallback.h
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_ConfigImpl_Category.h
test-scripts =
subversion/tests/cmdline/*_tests.py
Propchange: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/
------------------------------------------------------------------------------
Merged /subversion/trunk/subversion/bindings/javahl:r1497371-1497785
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/EnumMapper.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/EnumMapper.cpp?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/EnumMapper.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/EnumMapper.cpp Fri Jun 28 14:31:10 2013
@@ -191,6 +191,16 @@ svn_checksum_kind_t EnumMapper::toChecks
getOrdinal(JAVA_PACKAGE"/types/Checksum$Kind", jChecksumKind));
}
+svn_tristate_t EnumMapper::toTristate(jobject jTristate)
+{
+ switch (getOrdinal(JAVA_PACKAGE"/types/Tristate", jTristate))
+ {
+ case 1: return svn_tristate_false;
+ case 2: return svn_tristate_true;
+ default: return svn_tristate_unknown;
+ }
+}
+
svn_depth_t EnumMapper::toDepth(jobject jdepth)
{
// The offset for depths is -2
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/EnumMapper.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/EnumMapper.h?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/EnumMapper.h (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/EnumMapper.h Fri Jun 28 14:31:10 2013
@@ -50,6 +50,7 @@ class EnumMapper
static int toLogLevel(jobject jLogLevel);
static svn_node_kind_t toNodeKind(jobject jNodeKind);
static svn_checksum_kind_t toChecksumKind(jobject jChecksumKind);
+ static svn_tristate_t toTristate(jobject jTristate);
/* Converting from C enum's */
static jint mapCommitMessageStateFlags(apr_byte_t flags);
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIStringHolder.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIStringHolder.h?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIStringHolder.h (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIStringHolder.h Fri Jun 28 14:31:10 2013
@@ -36,6 +36,7 @@ class JNIStringHolder
JNIStringHolder(jstring jtext);
~JNIStringHolder();
operator const char *() { return m_str; }
+ const char* c_str() const { return m_str; }
const char *pstrdup(apr_pool_t *pool);
protected:
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.cpp?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.cpp Fri Jun 28 14:31:10 2013
@@ -42,7 +42,8 @@ OperationContext::OperationContext(SVN::
m_prompter(NULL),
m_cancelOperation(0),
m_pool(&pool),
- m_jctx(NULL)
+ m_jctx(NULL),
+ m_jcfgcb(NULL)
{}
void
@@ -84,6 +85,8 @@ OperationContext::~OperationContext()
JNIEnv *env = JNIUtil::getEnv();
env->DeleteGlobalRef(m_jctx);
+ if (m_jcfgcb)
+ env->DeleteGlobalRef(m_jcfgcb);
}
apr_hash_t *
@@ -101,6 +104,7 @@ OperationContext::getConfigData()
configDir = NULL;
SVN_JNI_ERR(
svn_config_get_config(&m_config, configDir, m_pool->getPool()), NULL);
+ notifyConfigLoad();
}
return m_config;
@@ -250,12 +254,34 @@ OperationContext::setConfigDirectory(con
m_config = NULL;
}
+void
+OperationContext::setConfigCallback(jobject configCallback)
+{
+ JNIEnv* env = JNIUtil::getEnv();
+
+ if (m_jcfgcb)
+ {
+ env->DeleteGlobalRef(m_jcfgcb);
+ m_jcfgcb = NULL;
+ }
+ if (configCallback)
+ {
+ m_jcfgcb = env->NewGlobalRef(configCallback);
+ env->DeleteLocalRef(configCallback);
+ }
+}
+
const char *
OperationContext::getConfigDirectory() const
{
return (m_configDir.empty() ? NULL : m_configDir.c_str());
}
+jobject OperationContext::getConfigCallback() const
+{
+ return m_jcfgcb;
+}
+
const char *
OperationContext::getUsername() const
{
@@ -364,3 +390,54 @@ OperationContext::clientName(void *baton
return SVN_NO_ERROR;
}
+
+void
+OperationContext::notifyConfigLoad()
+{
+ if (!m_jcfgcb)
+ return;
+
+ JNIEnv *env = JNIUtil::getEnv();
+
+ static jmethodID onload_mid = 0;
+ if (0 == onload_mid)
+ {
+ jclass cls = env->FindClass(JAVA_PACKAGE"/callback/ConfigEvent");
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+ onload_mid = env->GetMethodID(cls, "onLoad",
+ "(L"JAVA_PACKAGE"/ISVNConfig;)V");
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+ }
+
+ jclass cfg_cls = env->FindClass(JAVA_PACKAGE"/ConfigImpl");
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+
+ static jmethodID ctor_mid = 0;
+ if (0 == ctor_mid)
+ {
+ ctor_mid = env->GetMethodID(cfg_cls, "<init>", "(J)V");
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+ }
+
+ static jmethodID dispose_mid = 0;
+ if (0 == dispose_mid)
+ {
+ dispose_mid = env->GetMethodID(cfg_cls, "dispose", "()V");
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+ }
+
+ jobject jcbimpl = env->NewObject(cfg_cls, ctor_mid,
+ reinterpret_cast<jlong>(this));
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+ env->CallVoidMethod(m_jcfgcb, onload_mid, jcbimpl);
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+ env->CallVoidMethod(jcbimpl, dispose_mid);
+ env->DeleteLocalRef(jcbimpl);
+}
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.h?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.h (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.h Fri Jun 28 14:31:10 2013
@@ -58,8 +58,10 @@ class OperationContext
SVN::Pool *m_pool;
jobject m_jctx;
+ jobject m_jcfgcb;
static void progress(apr_off_t progressVal, apr_off_t total,
void *baton, apr_pool_t *pool);
+ void notifyConfigLoad();
public:
OperationContext(SVN::Pool &pool);
void attachJavaObject(jobject contextHolder, const char *contextClassType, const char *contextFieldName, jfieldID * ctxFieldID);
@@ -77,6 +79,7 @@ class OperationContext
virtual bool isCancelledOperation();
jobject getSelf() const;
const char *getConfigDirectory() const;
+ jobject getConfigCallback() const;
const char *getUsername() const;
const char *getPassword() const;
const Prompter& getPrompter() const;
@@ -89,6 +92,12 @@ class OperationContext
void setConfigDirectory(const char *configDir);
/**
+ * Set the config ConfigCallback instance to call when configuration
+ * is loaded..
+ */
+ void setConfigCallback(jobject configCallback);
+
+ /**
* Return configuration data for the context.
* Read it from config directory if necessary
*/
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp Fri Jun 28 14:31:10 2013
@@ -63,6 +63,7 @@ jobject
RemoteSession::open(jint jretryAttempts,
jstring jurl, jstring juuid,
jstring jconfigDirectory,
+ jobject jconfigHandler,
jstring jusername, jstring jpassword,
jobject jprompter, jobject jprogress)
{
@@ -80,9 +81,10 @@ RemoteSession::open(jint jretryAttempts,
return NULL;
env->DeleteLocalRef(juuid);
- JNIStringHolder configDirectory(jconfigDirectory);
+ Path configDirectory(jconfigDirectory, requestPool);
if (JNIUtil::isExceptionThrown())
return NULL;
+ SVN_JNI_ERR(configDirectory.error_occurred(), NULL);
env->DeleteLocalRef(jconfigDirectory);
JNIStringHolder usernameStr(jusername);
@@ -104,7 +106,8 @@ RemoteSession::open(jint jretryAttempts,
}
jobject jremoteSession = open(
- jretryAttempts, url.c_str(), uuid, configDirectory,
+ jretryAttempts, url.c_str(), uuid,
+ configDirectory.c_str(), jconfigHandler,
usernameStr, passwordStr, prompter, jprogress);
if (JNIUtil::isExceptionThrown() || !jremoteSession)
{
@@ -117,7 +120,7 @@ RemoteSession::open(jint jretryAttempts,
jobject
RemoteSession::open(jint jretryAttempts,
const char* url, const char* uuid,
- const char* configDirectory,
+ const char* configDirectory, jobject jconfigHandler,
const char* usernameStr, const char* passwordStr,
Prompter* prompter, jobject jprogress)
{
@@ -133,7 +136,8 @@ RemoteSession::open(jint jretryAttempts,
jobject jthis_out = NULL;
RemoteSession* session = new RemoteSession(
- &jthis_out, jretryAttempts, url, uuid, configDirectory,
+ &jthis_out, jretryAttempts, url, uuid,
+ configDirectory, jconfigHandler,
usernameStr, passwordStr, prompter, jprogress);
if (JNIUtil::isJavaExceptionThrown() || !session)
{
@@ -159,6 +163,7 @@ namespace{
RemoteSession::RemoteSession(jobject* jthis_out, int retryAttempts,
const char* url, const char* uuid,
const char* configDirectory,
+ jobject jconfigHandler,
const char* username, const char* password,
Prompter* prompter, jobject jprogress)
: m_session(NULL), m_context(NULL)
@@ -185,7 +190,7 @@ RemoteSession::RemoteSession(jobject* jt
return;
m_context = new RemoteSessionContext(
- jremoteSession, pool, configDirectory,
+ jremoteSession, pool, configDirectory, jconfigHandler,
username, password, prompter, jprogress);
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -681,7 +686,8 @@ build_string_array(const Iterator& iter,
void
RemoteSession::getLog(jobject jpaths,
jlong jstartrev, jlong jendrev, jint jlimit,
- jboolean jstop_on_copy, jboolean jdiscover_changed_paths,
+ jboolean jstrict_node_history,
+ jboolean jdiscover_changed_paths,
jboolean jinclude_merged_revisions,
jobject jrevprops, jobject jlog_callback)
{
@@ -707,7 +713,7 @@ RemoteSession::getLog(jobject jpaths,
svn_revnum_t(jstartrev), svn_revnum_t(jendrev),
int(jlimit),
bool(jdiscover_changed_paths),
- bool(jstop_on_copy),
+ bool(jstrict_node_history),
bool(jinclude_merged_revisions),
revprops,
receiver.callback, &receiver,
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h Fri Jun 28 14:31:10 2013
@@ -47,11 +47,13 @@ class RemoteSession : public SVNBase
static jobject open(jint jretryAttempts,
jstring jurl, jstring juuid,
jstring jconfigDirectory,
+ jobject jconfigHandler,
jstring jusername, jstring jpassword,
jobject jprompter, jobject jprogress);
static jobject open(jint jretryAttempts,
const char* url, const char* uuid,
const char* configDirectory,
+ jobject jconfigHandler,
const char* username, const char* password,
Prompter* prompter, jobject jprogress);
~RemoteSession();
@@ -85,7 +87,7 @@ class RemoteSession : public SVNBase
jobject jstatus_editor);
// TODO: diff
void getLog(jobject jpaths, jlong jstartrev, jlong jendrev, jint jlimit,
- jboolean jstop_on_copy, jboolean jdiscover_changed_paths,
+ jboolean jstrict_node_history, jboolean jdiscover_changed_paths,
jboolean jinclude_merged_revisions,
jobject jrevprops, jobject jlog_callback);
jobject checkPath(jstring jpath, jlong jrevision);
@@ -108,6 +110,7 @@ class RemoteSession : public SVNBase
RemoteSession(jobject*, int retryAttempts,
const char* url, const char* uuid,
const char* configDirectory,
+ jobject jconfigHandler,
const char* username, const char* password,
Prompter* prompter, jobject jprogress);
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp Fri Jun 28 14:31:10 2013
@@ -32,12 +32,14 @@
#define STRING_RETURN_SIGNATURE "()Ljava/lang/String;"
RemoteSessionContext::RemoteSessionContext(
- jobject contextHolder, SVN::Pool &pool, const char* configDirectory,
+ jobject contextHolder, SVN::Pool &pool,
+ const char* configDirectory, jobject jconfigHandler,
const char* usernameStr, const char* passwordStr,
Prompter* prompter, jobject jprogress)
: OperationContext(pool), m_raCallbacks(NULL)
{
setConfigDirectory(configDirectory);
+ setConfigCallback(jconfigHandler);
if (usernameStr != NULL)
username(usernameStr);
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h Fri Jun 28 14:31:10 2013
@@ -36,6 +36,7 @@ class RemoteSessionContext : public Oper
public:
RemoteSessionContext(jobject contextHolder, SVN::Pool &pool,
const char* jconfigDirectory,
+ jobject jconfigHandler,
const char* jusername, const char* jpassword,
Prompter* prompter, jobject jprogress);
virtual ~RemoteSessionContext();
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/SVNClient.cpp?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/SVNClient.cpp Fri Jun 28 14:31:10 2013
@@ -1553,6 +1553,7 @@ SVNClient::openRemoteSession(const char*
jobject jremoteSession = RemoteSession::open(
retryAttempts, path_info.url.c_str(), path_info.uuid.c_str(),
context.getConfigDirectory(),
+ context.getConfigCallback(),
context.getUsername(), context.getPassword(),
prompter, jctx);
if (JNIUtil::isJavaExceptionThrown())
Copied: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_ConfigImpl_Category.cpp (from r1497785, subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_ConfigImpl_Category.cpp)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_ConfigImpl_Category.cpp?p2=subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_ConfigImpl_Category.cpp&p1=subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_ConfigImpl_Category.cpp&r1=1497785&r2=1497790&rev=1497790&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_ConfigImpl_Category.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_ConfigImpl_Category.cpp Fri Jun 28 14:31:10 2013
@@ -40,6 +40,8 @@
#include <string>
#include <vector>
+#define svn_hash_gets(ht, key) apr_hash_get(ht, key, strlen(key))
+
namespace {
struct ImplContext
{
@@ -126,45 +128,6 @@ Java_org_apache_subversion_javahl_Config
return jboolean(value);
}
-JNIEXPORT jlong JNICALL
-Java_org_apache_subversion_javahl_ConfigImpl_00024Category_get_1long(
- JNIEnv* env, jobject jthis, jstring jcategory, jlong jcontext,
- jstring jsection, jstring joption, jlong jdefault_value)
-{
- JNIEntry(ConfigImpl$Category, get_long);
- const ImplContext ctx(env, jthis, jcategory, jcontext, jsection, joption);
-
- apr_int64_t value;
- SVN_JNI_ERR(svn_config_get_int64(ctx.m_config, &value,
- ctx.m_section.c_str(), ctx.m_option.c_str(),
- apr_int64_t(jdefault_value)),
- jdefault_value);
- return jlong(value);
-}
-
-JNIEXPORT jobject JNICALL
-Java_org_apache_subversion_javahl_ConfigImpl_00024Category_get_1tri(
- JNIEnv* env, jobject jthis, jstring jcategory, jlong jcontext,
- jstring jsection, jstring joption,
- jstring junknown, jobject jdefault_value)
-{
- JNIEntry(ConfigImpl$Category, get_tri);
- const ImplContext ctx(env, jthis, jcategory, jcontext, jsection, joption);
-
- JNIStringHolder unknown(junknown);
- if (JNIUtil::isJavaExceptionThrown())
- return NULL;
-
- svn_tristate_t value;
- SVN_JNI_ERR(svn_config_get_tristate(ctx.m_config, &value,
- ctx.m_section.c_str(),
- ctx.m_option.c_str(),
- unknown.c_str(),
- EnumMapper::toTristate(jdefault_value)),
- NULL);
- return EnumMapper::mapTristate(value);
-}
-
JNIEXPORT jstring JNICALL
Java_org_apache_subversion_javahl_ConfigImpl_00024Category_get_1yna(
JNIEnv* env, jobject jthis, jstring jcategory, jlong jcontext,
@@ -182,7 +145,7 @@ Java_org_apache_subversion_javahl_Config
ctx.m_config, &value,
ctx.m_section.c_str(), ctx.m_option.c_str(),
default_value.c_str()),
- NULL);
+ NULL);
return JNIUtil::makeJString(value);
}
@@ -216,19 +179,6 @@ Java_org_apache_subversion_javahl_Config
bool(jvalue));
}
-JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_ConfigImpl_00024Category_set_1long(
- JNIEnv* env, jobject jthis, jstring jcategory, jlong jcontext,
- jstring jsection, jstring joption, jlong jvalue)
-{
- JNIEntry(ConfigImpl$Category, set_long);
- const ImplContext ctx(env, jthis, jcategory, jcontext, jsection, joption);
-
- svn_config_set_int64(ctx.m_config,
- ctx.m_section.c_str(), ctx.m_option.c_str(),
- apr_int64_t(jvalue));
-}
-
JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_ConfigImpl_00024Category_sections(
JNIEnv* env, jobject jthis, jstring jcategory, jlong jcontext)
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Fri Jun 28 14:31:10 2013
@@ -1548,6 +1548,21 @@ Java_org_apache_subversion_javahl_SVNCli
cl->getClientContext().setConfigDirectory(configDir);
}
+JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_SVNClient_setConfigEventHandler
+(JNIEnv *env, jobject jthis, jobject jconfigHandler)
+{
+ JNIEntry(SVNClient, setConfigDirectory);
+ SVNClient *cl = SVNClient::getCppObject(jthis);
+ if (cl == NULL)
+ {
+ JNIUtil::throwError(_("bad C++ this"));
+ return;
+ }
+
+ cl->getClientContext().setConfigCallback(jconfigHandler);
+}
+
JNIEXPORT jstring JNICALL
Java_org_apache_subversion_javahl_SVNClient_getConfigDirectory
(JNIEnv *env, jobject jthis)
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp Fri Jun 28 14:31:10 2013
@@ -38,7 +38,8 @@ JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_remote_RemoteFactory_open(
JNIEnv *env, jclass jclass, jint jretryAttempts,
jstring jurl, jstring juuid,
- jstring jconfigDirectory, jstring jusername, jstring jpassword,
+ jstring jconfigDirectory, jobject jconfigHandler,
+ jstring jusername, jstring jpassword,
jobject jprompter, jobject jprogress)
{
//JNI macros need jthis but this is a static call
@@ -49,7 +50,8 @@ Java_org_apache_subversion_javahl_remote
* Create RemoteSession C++ object and return its java wrapper to the caller
*/
jobject jremoteSession = RemoteSession::open(
- jretryAttempts, jurl, juuid, jconfigDirectory,
+ jretryAttempts, jurl, juuid,
+ jconfigDirectory, jconfigHandler,
jusername, jpassword, jprompter, jprogress);
if (JNIUtil::isJavaExceptionThrown())
return NULL;
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp Fri Jun 28 14:31:10 2013
@@ -235,7 +235,7 @@ JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_remote_RemoteSession_getLog(
JNIEnv *env, jobject jthis, jobject jpaths,
jlong jstartrev, jlong jendrev, jint jlimit,
- jboolean jstop_on_copy, jboolean jdiscover_changed_paths,
+ jboolean jstrict_node_history, jboolean jdiscover_changed_paths,
jboolean jinclude_merged_revisions,
jobject jrevprops, jobject jlog_callback)
{
@@ -244,7 +244,7 @@ Java_org_apache_subversion_javahl_remote
CPPADDR_NULL_PTR(ras,);
ras->getLog(jpaths, jstartrev, jendrev, jlimit,
- jstop_on_copy, jdiscover_changed_paths,
+ jstrict_node_history, jdiscover_changed_paths,
jinclude_merged_revisions,
jrevprops, jlog_callback);
}
Copied: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConfigImpl.java (from r1497785, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConfigImpl.java)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConfigImpl.java?p2=subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConfigImpl.java&p1=subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConfigImpl.java&r1=1497785&r2=1497790&rev=1497790&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConfigImpl.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConfigImpl.java Fri Jun 28 14:31:10 2013
@@ -67,15 +67,24 @@ class ConfigImpl implements ISVNConfig
public long get(String section, String option, long defaultValue)
throws ClientException
{
- return get_long(category, context, section, option, defaultValue);
+ String dflt = Long.toString(defaultValue, 10);
+ String val = get_str(category, context, section, option, dflt);
+ return Long.valueOf(val, 10).longValue();
}
public Tristate get(String section, String option,
String unknown, Tristate defaultValue)
throws ClientException
{
- return get_tri(category, context, section, option,
- unknown, defaultValue);
+ String str = get_str(category, context, section, option, null);
+ if (str == null)
+ return defaultValue;
+ if (str.equalsIgnoreCase(unknown))
+ return Tristate.Unknown;
+
+ boolean val = get_bool(category, context,
+ section, option, false);
+ return (val ? Tristate.True : Tristate.False);
}
public String getYesNoAsk(String section, String option,
@@ -97,7 +106,8 @@ class ConfigImpl implements ISVNConfig
public void set(String section, String option, long value)
{
- set_long(category, context, section, option, value);
+ set_str(category, context, section, option,
+ Long.toString(value, 10));
}
public Iterable<String> sections()
@@ -132,14 +142,6 @@ class ConfigImpl implements ISVNConfig
String secton, String option,
boolean defaultValue)
throws ClientException;
- private native long get_long(String category, long context,
- String secton, String option,
- long defaultValue)
- throws ClientException;
- private native Tristate get_tri(String category, long context,
- String secton, String option,
- String unknown, Tristate defaultValue)
- throws ClientException;
private native String get_yna(String category, long context,
String secton, String option,
String defaultValue)
@@ -150,9 +152,6 @@ class ConfigImpl implements ISVNConfig
private native void set_bool(String category, long context,
String section, String option,
boolean value);
- private native void set_long(String category, long context,
- String section, String option,
- long value);
private native Iterable<String> sections(String category,
long context);
private native void enumerate(String category, long context,
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java Fri Jun 28 14:31:10 2013
@@ -803,6 +803,12 @@ public interface ISVNClient
void setConfigDirectory(String configDir) throws ClientException;
/**
+ * Set an event handler that will be called every time the
+ * configuration is loaded.
+ */
+ void setConfigEventHandler(ConfigEvent configHandler);
+
+ /**
* Get the configuration directory
* @return the directory
* @throws ClientException
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java Fri Jun 28 14:31:10 2013
@@ -361,7 +361,7 @@ public interface ISVNRemote
* <code>callback</code> the list of changed paths in that
* revision.
* <p>
- * If <code>stopOnCopy</code> is set, copy history will not be
+ * If <code>strictNodeHistory</code> is set, copy history will not be
* traversed (if any exists) when harvesting the revision logs for
* each path.
* <p>
@@ -395,7 +395,7 @@ public interface ISVNRemote
*/
void getLog(Iterable<String> paths,
long startRevision, long endRevision, int limit,
- boolean stopOnCopy, boolean discoverPath,
+ boolean strictNodeHistory, boolean discoverPath,
boolean includeMergedRevisions,
Iterable<String> revisionProperties,
LogMessageCallback callback)
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Fri Jun 28 14:31:10 2013
@@ -370,6 +370,8 @@ public class SVNClient implements ISVNCl
public native void setConfigDirectory(String configDir)
throws ClientException;
+ public native void setConfigEventHandler(ConfigEvent configHandler);
+
public native String getConfigDirectory()
throws ClientException;
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java Fri Jun 28 14:31:10 2013
@@ -49,11 +49,13 @@ public class RemoteFactory
* Initializing constructor. Any or all of its arguments may be null.
*/
public RemoteFactory(String configDirectory,
+ ConfigEvent configHandler,
String username, String password,
UserPasswordCallback prompt,
ProgressCallback progress)
{
setConfigDirectory(configDirectory);
+ setConfigEventHandler(configHandler);
setUsername(username);
setPassword(password);
setPrompt(prompt);
@@ -116,6 +118,15 @@ public class RemoteFactory
this.configDirectory = configDirectory;
}
+ /**
+ * Set an event handler that will be called every time the
+ * configuration is loaded.
+ */
+ public void setConfigEventHandler(ConfigEvent configHandler)
+ {
+ this.configHandler = configHandler;
+ }
+
/**
* Open a persistent session to a repository.
@@ -134,7 +145,8 @@ public class RemoteFactory
throws ClientException, SubversionException
{
return open(1, url, null,
- configDirectory, username, password, prompt, progress);
+ configDirectory, configHandler,
+ username, password, prompt, progress);
}
/**
@@ -161,7 +173,8 @@ public class RemoteFactory
throw new IllegalArgumentException(
"retryAttempts must be positive");
return open(retryAttempts, url, null,
- configDirectory, username, password, prompt, progress);
+ configDirectory, configHandler,
+ username, password, prompt, progress);
}
/**
@@ -188,7 +201,8 @@ public class RemoteFactory
if (reposUUID == null)
throw new IllegalArgumentException("reposUUID may not be null");
return open(1, url, reposUUID,
- configDirectory, username, password, prompt, progress);
+ configDirectory, configHandler,
+ username, password, prompt, progress);
}
/**
@@ -222,10 +236,12 @@ public class RemoteFactory
throw new IllegalArgumentException(
"retryAttempts must be positive");
return open(retryAttempts, url, reposUUID,
- configDirectory, username, password, prompt, progress);
+ configDirectory, configHandler,
+ username, password, prompt, progress);
}
private String configDirectory;
+ private ConfigEvent configHandler;
private String username;
private String password;
private UserPasswordCallback prompt;
@@ -235,6 +251,7 @@ public class RemoteFactory
private static native ISVNRemote open(int retryAttempts,
String url, String reposUUID,
String configDirectory,
+ ConfigEvent configHandler,
String username, String password,
UserPasswordCallback prompt,
ProgressCallback progress)
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java Fri Jun 28 14:31:10 2013
@@ -164,7 +164,7 @@ public class RemoteSession extends JNIOb
public native void getLog(Iterable<String> paths,
long startRevision, long endRevision, int limit,
- boolean stopOnCopy, boolean discoverPath,
+ boolean strictNodeHistory, boolean discoverPath,
boolean includeMergedRevisions,
Iterable<String> revisionProperties,
LogMessageCallback callback)
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java?rev=1497790&r1=1497789&r2=1497790&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java Fri Jun 28 14:31:10 2013
@@ -66,12 +66,14 @@ public class SVNRemoteTests extends SVNT
thisTest = new OneTest();
}
- public static ISVNRemote getSession(String url, String configDirectory)
+ public static ISVNRemote getSession(String url, String configDirectory,
+ ConfigEvent configHandler)
{
try
{
RemoteFactory factory = new RemoteFactory();
factory.setConfigDirectory(configDirectory);
+ factory.setConfigEventHandler(configHandler);
factory.setUsername(USERNAME);
factory.setPassword(PASSWORD);
factory.setPrompt(new DefaultPromptUserPassword());
@@ -88,7 +90,7 @@ public class SVNRemoteTests extends SVNT
private ISVNRemote getSession()
{
- return getSession(getTestRepoUrl(), super.conf.getAbsolutePath());
+ return getSession(getTestRepoUrl(), super.conf.getAbsolutePath(), null);
}
/**
@@ -107,7 +109,7 @@ public class SVNRemoteTests extends SVNT
try
{
session = new RemoteFactory(
- super.conf.getAbsolutePath(),
+ super.conf.getAbsolutePath(), null,
USERNAME, PASSWORD,
new DefaultPromptUserPassword(), null)
.openRemoteSession(getTestRepoUrl());
@@ -459,4 +461,39 @@ public class SVNRemoteTests extends SVNT
assertEquals(0, receiver.logs.size());
assertTrue(exception);
}
+
+ public void testConfigHandler() throws Exception
+ {
+ ConfigEvent handler = new ConfigEvent()
+ {
+ public void onLoad(ISVNConfig cfg)
+ {
+ //System.out.println("config:");
+ onecat(cfg.config());
+ //System.out.println("servers:");
+ onecat(cfg.servers());
+ }
+
+ private void onecat(ISVNConfig.Category cat)
+ {
+ for (String sec : cat.sections()) {
+ //System.out.println(" [" + sec + "]");
+ ISVNConfig.Enumerator en = new ISVNConfig.Enumerator()
+ {
+ public void option(String name, String value)
+ {
+ //System.out.println(" " + name
+ // + " = " + value);
+ }
+ };
+ cat.enumerate(sec, en);
+ }
+ }
+ };
+
+ ISVNRemote session = getSession(getTestRepoUrl(),
+ super.conf.getAbsolutePath(),
+ handler);
+ session.getLatestRevision(); // Make sure the configuration gets loaded
+ }
}