You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/12/10 22:23:13 UTC
svn commit: r1044516 [2/22] - in /subversion/branches/ignore-mergeinfo: ./
build/ac-macros/ build/generator/ contrib/server-side/ notes/ notes/wc-ng/
subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversion/javahl/ subver...
Modified: subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNClient.cpp?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNClient.cpp Fri Dec 10 21:23:03 2010
@@ -26,21 +26,21 @@
#include "SVNClient.h"
#include "JNIUtil.h"
-#include "ClientNotifyCallback.h"
#include "CopySources.h"
#include "DiffSummaryReceiver.h"
-#include "ConflictResolverCallback.h"
-#include "ProgressListener.h"
+#include "ClientContext.h"
#include "Prompter.h"
#include "Pool.h"
#include "Targets.h"
#include "Revision.h"
+#include "OutputStream.h"
#include "RevisionRange.h"
#include "BlameCallback.h"
#include "ProplistCallback.h"
#include "LogMessageCallback.h"
#include "InfoCallback.h"
#include "PatchCallback.h"
+#include "CommitCallback.h"
#include "StatusCallback.h"
#include "ChangelistCallback.h"
#include "ListCallback.h"
@@ -68,73 +68,14 @@
#include <iostream>
#include <sstream>
-class CommitNotifier
-{
- public:
- CommitNotifier(SVN::Pool &inPool)
- : pool(inPool), info(NULL)
- {
- ;
- }
-
- static svn_error_t *callback(const svn_commit_info_t *commit_info,
- void *baton,
- apr_pool_t *pool)
- {
- if (baton)
- return ((CommitNotifier *)baton)->stashInfo(commit_info);
-
- return SVN_NO_ERROR;
- }
-
- long getRevnum()
- {
- if (info && SVN_IS_VALID_REVNUM(info->revision))
- return info->revision;
- return SVN_INVALID_REVNUM;
- }
-
- /* Special operator new to allocate this thing in a pool. */
- void * operator new(size_t sz, SVN::Pool &pool)
- {
- void *ptr = apr_pcalloc(pool.pool(), sizeof(CommitNotifier));
- return ptr;
- }
-
- protected:
- svn_error_t *stashInfo(const svn_commit_info_t *commit_info)
- {
- info = svn_commit_info_dup(commit_info, pool.pool());
- return SVN_NO_ERROR;
- }
-
- private:
- SVN::Pool &pool;
- svn_commit_info_t *info;
-};
-
-struct log_msg_baton
+SVNClient::SVNClient(jobject jthis_in)
+ : context(jthis_in)
{
- const char *message;
- CommitMessage *messageHandler;
-};
-
-SVNClient::SVNClient()
-{
- m_notify2 = NULL;
- m_progressListener = NULL;
- m_prompter = NULL;
- m_commitMessage = NULL;
- m_conflictResolver = NULL;
}
SVNClient::~SVNClient()
{
- delete m_notify2;
- delete m_progressListener;
- delete m_prompter;
- delete m_conflictResolver;
}
SVNClient *SVNClient::getCppObject(jobject jthis)
@@ -145,10 +86,10 @@ SVNClient *SVNClient::getCppObject(jobje
return (cppAddr == 0 ? NULL : reinterpret_cast<SVNClient *>(cppAddr));
}
-void SVNClient::dispose(jobject jthis)
+void SVNClient::dispose()
{
static jfieldID fid = 0;
- SVNBase::dispose(jthis, &fid, JAVA_PACKAGE"/SVNClient");
+ SVNBase::dispose(&fid, JAVA_PACKAGE"/SVNClient");
}
jstring SVNClient::getAdminDirectoryName()
@@ -182,7 +123,7 @@ void SVNClient::list(const char *url, Re
ListCallback *callback)
{
SVN::Pool requestPool;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -214,7 +155,7 @@ SVNClient::status(const char *path, svn_
SVN_JNI_NULL_PTR_EX(path, "path", );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
callback->setWcCtx(ctx->wc_ctx);
@@ -227,29 +168,13 @@ SVNClient::status(const char *path, svn_
SVN_JNI_ERR(svn_client_status5(&youngest, ctx, checkedPath.c_str(),
&rev,
depth,
- getAll, onServer, noIgnore,
+ getAll, onServer, noIgnore, FALSE,
ignoreExternals,
changelists.array(requestPool),
StatusCallback::callback, callback,
requestPool.pool()), );
}
-void SVNClient::username(const char *pi_username)
-{
- m_userName = (pi_username == NULL ? "" : pi_username);
-}
-
-void SVNClient::password(const char *pi_password)
-{
- m_passWord = (pi_password == NULL ? "" : pi_password);
-}
-
-void SVNClient::setPrompt(Prompter *prompter)
-{
- delete m_prompter;
- m_prompter = prompter;
-}
-
void SVNClient::logMessages(const char *path, Revision &pegRevision,
std::vector<RevisionRange> &logRanges,
bool stopOnCopy, bool discoverPaths,
@@ -260,7 +185,7 @@ void SVNClient::logMessages(const char *
SVN_JNI_NULL_PTR_EX(path, "path", );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -321,7 +246,7 @@ jlong SVNClient::checkout(const char *mo
SVN_JNI_ERR(path.error_occured(), -1);
svn_revnum_t rev;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return -1;
@@ -339,29 +264,12 @@ jlong SVNClient::checkout(const char *mo
return rev;
}
-void SVNClient::notification2(ClientNotifyCallback *notify2)
-{
- delete m_notify2;
- m_notify2 = notify2;
-}
-
-void SVNClient::setConflictResolver(ConflictResolverCallback *conflictResolver)
-{
- delete m_conflictResolver;
- m_conflictResolver = conflictResolver;
-}
-
-void SVNClient::setProgressListener(ProgressListener *listener)
-{
- delete m_progressListener;
- m_progressListener = listener;
-}
-
-void SVNClient::remove(Targets &targets, const char *message, bool force,
- bool keep_local, RevpropTable &revprops)
+void SVNClient::remove(Targets &targets, CommitMessage *message, bool force,
+ bool keep_local, RevpropTable &revprops,
+ CommitCallback *callback)
{
SVN::Pool requestPool;
- svn_client_ctx_t *ctx = getContext(message);
+ svn_client_ctx_t *ctx = context.getContext(message);
if (ctx == NULL)
return;
@@ -369,8 +277,9 @@ void SVNClient::remove(Targets &targets,
SVN_JNI_ERR(targets.error_occured(), );
SVN_JNI_ERR(svn_client_delete4(targets2, force, keep_local,
- revprops.hash(requestPool), ctx,
- requestPool.pool()), );
+ revprops.hash(requestPool),
+ CommitCallback::callback, callback,
+ ctx, requestPool.pool()), );
}
void SVNClient::revert(const char *path, svn_depth_t depth,
@@ -380,7 +289,7 @@ void SVNClient::revert(const char *path,
SVN_JNI_NULL_PTR_EX(path, "path", );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -402,7 +311,7 @@ void SVNClient::add(const char *path,
Path intPath(path);
SVN_JNI_ERR(intPath.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -418,7 +327,7 @@ jlongArray SVNClient::update(Targets &ta
{
SVN::Pool requestPool;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
apr_array_header_t *revs;
if (ctx == NULL)
return NULL;
@@ -451,30 +360,31 @@ jlongArray SVNClient::update(Targets &ta
return jrevs;
}
-jlong SVNClient::commit(Targets &targets, const char *message,
- svn_depth_t depth, bool noUnlock, bool keepChangelist,
- StringArray &changelists, RevpropTable &revprops)
+void SVNClient::commit(Targets &targets, CommitMessage *message,
+ svn_depth_t depth, bool noUnlock, bool keepChangelist,
+ StringArray &changelists, RevpropTable &revprops,
+ CommitCallback *callback)
{
SVN::Pool requestPool;
const apr_array_header_t *targets2 = targets.array(requestPool);
- SVN_JNI_ERR(targets.error_occured(), -1);
- svn_client_ctx_t *ctx = getContext(message);
+ SVN_JNI_ERR(targets.error_occured(), );
+ svn_client_ctx_t *ctx = context.getContext(message);
if (ctx == NULL)
- return SVN_INVALID_REVNUM;
+ return;
SVN_JNI_ERR(svn_client_commit5(targets2, depth,
noUnlock, keepChangelist,
changelists.array(requestPool),
- revprops.hash(requestPool), ctx,
- requestPool.pool()),
- SVN_INVALID_REVNUM);
-
- return ((CommitNotifier *)ctx->commit_baton)->getRevnum();
+ revprops.hash(requestPool),
+ CommitCallback::callback, callback,
+ ctx, requestPool.pool()),
+ );
}
void SVNClient::copy(CopySources ©Sources, const char *destPath,
- const char *message, bool copyAsChild, bool makeParents,
- bool ignoreExternals, RevpropTable &revprops)
+ CommitMessage *message, bool copyAsChild,
+ bool makeParents, bool ignoreExternals,
+ RevpropTable &revprops, CommitCallback *callback)
{
SVN::Pool requestPool;
@@ -489,19 +399,21 @@ void SVNClient::copy(CopySources ©So
Path destinationPath(destPath);
SVN_JNI_ERR(destinationPath.error_occured(), );
- svn_client_ctx_t *ctx = getContext(message);
+ svn_client_ctx_t *ctx = context.getContext(message);
if (ctx == NULL)
return;
SVN_JNI_ERR(svn_client_copy6(srcs, destinationPath.c_str(),
copyAsChild, makeParents, ignoreExternals,
- revprops.hash(requestPool), ctx,
- requestPool.pool()), );
+ revprops.hash(requestPool),
+ CommitCallback::callback, callback,
+ ctx, requestPool.pool()), );
}
void SVNClient::move(Targets &srcPaths, const char *destPath,
- const char *message, bool force, bool moveAsChild,
- bool makeParents, RevpropTable &revprops)
+ CommitMessage *message, bool force, bool moveAsChild,
+ bool makeParents, RevpropTable &revprops,
+ CommitCallback *callback)
{
SVN::Pool requestPool;
@@ -511,21 +423,23 @@ void SVNClient::move(Targets &srcPaths,
Path destinationPath(destPath);
SVN_JNI_ERR(destinationPath.error_occured(), );
- svn_client_ctx_t *ctx = getContext(message);
+ svn_client_ctx_t *ctx = context.getContext(message);
if (ctx == NULL)
return;
SVN_JNI_ERR(svn_client_move6((apr_array_header_t *) srcs,
destinationPath.c_str(), force, moveAsChild,
- makeParents, revprops.hash(requestPool), ctx,
+ makeParents, revprops.hash(requestPool),
+ CommitCallback::callback, callback, ctx,
requestPool.pool()), );
}
-void SVNClient::mkdir(Targets &targets, const char *message, bool makeParents,
- RevpropTable &revprops)
+void SVNClient::mkdir(Targets &targets, CommitMessage *message,
+ bool makeParents, RevpropTable &revprops,
+ CommitCallback *callback)
{
SVN::Pool requestPool;
- svn_client_ctx_t *ctx = getContext(message);
+ svn_client_ctx_t *ctx = context.getContext(message);
if (ctx == NULL)
return;
@@ -533,8 +447,9 @@ void SVNClient::mkdir(Targets &targets,
SVN_JNI_ERR(targets.error_occured(), );
SVN_JNI_ERR(svn_client_mkdir4(targets2, makeParents,
- revprops.hash(requestPool), ctx,
- requestPool.pool()), );
+ revprops.hash(requestPool),
+ CommitCallback::callback, callback,
+ ctx, requestPool.pool()), );
}
void SVNClient::cleanup(const char *path)
@@ -544,7 +459,7 @@ void SVNClient::cleanup(const char *path
Path intPath(path);
SVN_JNI_ERR(intPath.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -558,7 +473,7 @@ void SVNClient::resolve(const char *path
SVN_JNI_NULL_PTR_EX(path, "path", );
Path intPath(path);
SVN_JNI_ERR(intPath.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -579,7 +494,7 @@ jlong SVNClient::doExport(const char *sr
Path destinationPath(destPath);
SVN_JNI_ERR(destinationPath.error_occured(), -1);
svn_revnum_t rev;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return -1;
@@ -612,7 +527,7 @@ jlong SVNClient::doSwitch(const char *pa
SVN_JNI_ERR(intPath.error_occured(), -1);
svn_revnum_t rev;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return -1;
@@ -632,9 +547,9 @@ jlong SVNClient::doSwitch(const char *pa
}
void SVNClient::doImport(const char *path, const char *url,
- const char *message, svn_depth_t depth,
+ CommitMessage *message, svn_depth_t depth,
bool noIgnore, bool ignoreUnknownNodeTypes,
- RevpropTable &revprops)
+ RevpropTable &revprops, CommitCallback *callback)
{
SVN::Pool requestPool;
SVN_JNI_NULL_PTR_EX(path, "path", );
@@ -644,21 +559,22 @@ void SVNClient::doImport(const char *pat
Path intUrl(url);
SVN_JNI_ERR(intUrl.error_occured(), );
- svn_client_ctx_t *ctx = getContext(message);
+ svn_client_ctx_t *ctx = context.getContext(message);
if (ctx == NULL)
return;
SVN_JNI_ERR(svn_client_import4(intPath.c_str(), intUrl.c_str(), depth,
noIgnore, ignoreUnknownNodeTypes,
- revprops.hash(requestPool), ctx,
- requestPool.pool()), );
+ revprops.hash(requestPool),
+ CommitCallback::callback, callback,
+ ctx, requestPool.pool()), );
}
jobject
SVNClient::suggestMergeSources(const char *path, Revision &pegRevision)
{
SVN::Pool requestPool;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return NULL;
@@ -689,7 +605,7 @@ void SVNClient::merge(const char *path1,
Path srcPath2 = path2;
SVN_JNI_ERR(srcPath2.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -715,7 +631,7 @@ void SVNClient::merge(const char *path,
Path srcPath(path);
SVN_JNI_ERR(srcPath.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -770,7 +686,7 @@ void SVNClient::mergeReintegrate(const c
Path srcPath(path);
SVN_JNI_ERR(srcPath.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -787,7 +703,7 @@ SVNClient::getMergeinfo(const char *targ
SVN::Pool requestPool;
JNIEnv *env = JNIUtil::getEnv();
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return NULL;
@@ -864,7 +780,7 @@ void SVNClient::getMergeinfoLog(int type
{
SVN::Pool requestPool;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -904,7 +820,7 @@ jbyteArray SVNClient::propertyGet(const
Path intPath(path);
SVN_JNI_ERR(intPath.error_occured(), NULL);
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return NULL;
@@ -940,7 +856,7 @@ void SVNClient::properties(const char *p
Path intPath(path);
SVN_JNI_ERR(intPath.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -956,7 +872,7 @@ void SVNClient::properties(const char *p
void SVNClient::propertySet(const char *path, const char *name,
const char *value, svn_depth_t depth,
StringArray &changelists, bool force,
- RevpropTable &revprops)
+ RevpropTable &revprops, CommitCallback *callback)
{
SVN::Pool requestPool;
SVN_JNI_NULL_PTR_EX(path, "path", );
@@ -971,7 +887,7 @@ void SVNClient::propertySet(const char *
Path intPath(path);
SVN_JNI_ERR(intPath.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -979,6 +895,7 @@ void SVNClient::propertySet(const char *
depth, force, SVN_INVALID_REVNUM,
changelists.array(requestPool),
revprops.hash(requestPool),
+ CommitCallback::callback, callback,
ctx, requestPool.pool()), );
}
@@ -1002,7 +919,7 @@ void SVNClient::diff(const char *target1
SVN_JNI_NULL_PTR_EX(target2, "target2", );
SVN_JNI_NULL_PTR_EX(outfileName, "outfileName", );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -1129,7 +1046,7 @@ SVNClient::diffSummarize(const char *tar
SVN_JNI_NULL_PTR_EX(target1, "target1", );
SVN_JNI_NULL_PTR_EX(target2, "target2", );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -1158,7 +1075,7 @@ SVNClient::diffSummarize(const char *tar
SVN_JNI_NULL_PTR_EX(target, "target", );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -1177,199 +1094,9 @@ SVNClient::diffSummarize(const char *tar
requestPool.pool()), );
}
-svn_client_ctx_t *SVNClient::getContext(const char *message)
-{
- SVN::Pool *requestPool = JNIUtil::getRequestPool();
- apr_pool_t *pool = requestPool->pool();
- svn_auth_baton_t *ab;
- svn_client_ctx_t *ctx;
- SVN_JNI_ERR(svn_client_create_context(&ctx, pool), NULL);
-
- const char *configDir = m_configDir.c_str();
- if (m_configDir.length() == 0)
- configDir = NULL;
- SVN_JNI_ERR(svn_config_get_config(&(ctx->config), configDir, pool), NULL);
- svn_config_t *config = (svn_config_t *) apr_hash_get(ctx->config,
- SVN_CONFIG_CATEGORY_CONFIG,
- APR_HASH_KEY_STRING);
-
- /* The whole list of registered providers */
- apr_array_header_t *providers;
-
- /* Populate the registered providers with the platform-specific providers */
- SVN_JNI_ERR(svn_auth_get_platform_specific_client_providers(&providers,
- config,
- pool),
- NULL);
-
- /* The main disk-caching auth providers, for both
- * 'username/password' creds and 'username' creds. */
- svn_auth_provider_object_t *provider;
-
- svn_auth_get_simple_provider(&provider, pool);
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
- svn_auth_get_username_provider(&provider, pool);
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
-
- /* The server-cert, client-cert, and client-cert-password providers. */
- SVN_JNI_ERR(svn_auth_get_platform_specific_provider(&provider,
- "windows",
- "ssl_server_trust",
- pool),
- NULL);
-
- if (provider)
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
-
- svn_auth_get_ssl_server_trust_file_provider(&provider, pool);
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
- svn_auth_get_ssl_client_cert_file_provider(&provider, pool);
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
- svn_auth_get_ssl_client_cert_pw_file_provider(&provider, pool);
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
-
- if (m_prompter != NULL)
- {
- /* Two basic prompt providers: username/password, and just username.*/
- provider = m_prompter->getProviderSimple();
-
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
-
- provider = m_prompter->getProviderUsername();
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
-
- /* Three ssl prompt providers, for server-certs, client-certs,
- * and client-cert-passphrases. */
- provider = m_prompter->getProviderServerSSLTrust();
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
-
- provider = m_prompter->getProviderClientSSL();
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
-
- provider = m_prompter->getProviderClientSSLPassword();
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
- }
-
- /* Build an authentication baton to give to libsvn_client. */
- svn_auth_open(&ab, providers, pool);
-
- /* Place any default --username or --password credentials into the
- * auth_baton's run-time parameter hash. ### Same with --no-auth-cache? */
- if (!m_userName.empty())
- svn_auth_set_parameter(ab, SVN_AUTH_PARAM_DEFAULT_USERNAME,
- m_userName.c_str());
- if (!m_passWord.empty())
- svn_auth_set_parameter(ab, SVN_AUTH_PARAM_DEFAULT_PASSWORD,
- m_passWord.c_str());
-
- ctx->auth_baton = ab;
- ctx->notify_func = NULL;
- ctx->notify_baton = NULL;
- ctx->log_msg_func3 = getCommitMessage;
- ctx->log_msg_baton3 = getCommitMessageBaton(message);
- ctx->cancel_func = checkCancel;
- m_cancelOperation = false;
- ctx->cancel_baton = this;
- ctx->notify_func2= ClientNotifyCallback::notify;
- ctx->notify_baton2 = m_notify2;
-
- ctx->progress_func = ProgressListener::progress;
- ctx->progress_baton = m_progressListener;
-
- ctx->commit_callback2 = CommitNotifier::callback;
- ctx->commit_baton = new (*requestPool) CommitNotifier(*requestPool);
-
- if (m_conflictResolver)
- {
- ctx->conflict_func = ConflictResolverCallback::resolveConflict;
- ctx->conflict_baton = m_conflictResolver;
- }
-
- return ctx;
-}
-
-svn_error_t *
-SVNClient::getCommitMessage(const char **log_msg,
- const char **tmp_file,
- const apr_array_header_t *commit_items,
- void *baton,
- apr_pool_t *pool)
-{
- *log_msg = NULL;
- *tmp_file = NULL;
- log_msg_baton *lmb = (log_msg_baton *) baton;
-
- if (lmb && lmb->messageHandler)
- {
- jstring jmsg = lmb->messageHandler->getCommitMessage(commit_items);
- if (jmsg != NULL)
- {
- JNIStringHolder msg(jmsg);
- *log_msg = apr_pstrdup(pool, msg);
- }
- return SVN_NO_ERROR;
- }
- else if (lmb && lmb->message)
- {
- *log_msg = apr_pstrdup(pool, lmb->message);
- return SVN_NO_ERROR;
- }
-
- return SVN_NO_ERROR;
-}
-
-void *SVNClient::getCommitMessageBaton(const char *message)
-{
- if (message != NULL || m_commitMessage)
- {
- log_msg_baton *baton = (log_msg_baton *)
- apr_palloc(JNIUtil::getRequestPool()->pool(), sizeof(*baton));
-
- baton->message = message;
- baton->messageHandler = m_commitMessage;
-
- return baton;
- }
- return NULL;
-}
-
-jbyteArray SVNClient::fileContent(const char *path, Revision &revision,
- Revision &pegRevision)
-{
- SVN::Pool requestPool;
- SVN_JNI_NULL_PTR_EX(path, "path", NULL);
- Path intPath(path);
- SVN_JNI_ERR(intPath.error_occured(), NULL);
-
- size_t size = 0;
- svn_stream_t *read_stream = createReadStream(requestPool.pool(),
- intPath.c_str(), revision,
- pegRevision, size);
- if (read_stream == NULL)
- return NULL;
-
- JNIEnv *env = JNIUtil::getEnv();
- // size will be set to the number of bytes available.
- jbyteArray jcontent = env->NewByteArray(size);
- if (JNIUtil::isJavaExceptionThrown())
- return NULL;
-
- jbyte *jbytes = env->GetByteArrayElements(jcontent, NULL);
- if (JNIUtil::isJavaExceptionThrown())
- return NULL;
-
- svn_error_t *err = svn_stream_read(read_stream, (char *) jbytes, &size);
- env->ReleaseByteArrayElements(jcontent, jbytes, 0);
- SVN_JNI_ERR(err, NULL);
- if (JNIUtil::isJavaExceptionThrown())
- return NULL;
-
- return jcontent;
-}
-
void SVNClient::streamFileContent(const char *path, Revision &revision,
- Revision &pegRevision, jobject outputStream,
- size_t bufSize)
+ Revision &pegRevision,
+ OutputStream &outputStream)
{
SVN::Pool requestPool;
SVN_JNI_NULL_PTR_EX(path, "path", );
@@ -1377,101 +1104,14 @@ void SVNClient::streamFileContent(const
SVN_JNI_ERR(intPath.error_occured(), );
JNIEnv *env = JNIUtil::getEnv();
- jclass outputStreamClass = env->FindClass("java/io/OutputStream");
- if (outputStreamClass == NULL)
- return;
-
- jmethodID writeMethod = env->GetMethodID(outputStreamClass, "write",
- "([BII)V");
- if (writeMethod == NULL)
- return;
-
- // Create the buffer.
- jbyteArray buffer = env->NewByteArray(bufSize);
- if (JNIUtil::isJavaExceptionThrown())
- return;
-
- jbyte *bufData = env->GetByteArrayElements(buffer, NULL);
- if (JNIUtil::isJavaExceptionThrown())
- return;
-
- size_t contentSize = 0;
- svn_stream_t *read_stream = createReadStream(requestPool.pool(), path,
- revision, pegRevision,
- contentSize);
- if (read_stream == NULL)
+ svn_client_ctx_t *ctx = context.getContext(NULL);
+ if (ctx == NULL)
return;
- while (contentSize > 0)
- {
- size_t readSize = bufSize > contentSize ? contentSize : bufSize;
- svn_error_t *err;
-
- err = svn_stream_read(read_stream, (char *)bufData, &readSize);
- if (err != NULL)
- {
- env->ReleaseByteArrayElements(buffer, bufData, 0);
- svn_stream_close(read_stream);
- SVN_JNI_ERR(err, );
- }
-
- env->ReleaseByteArrayElements(buffer, bufData, JNI_COMMIT);
- env->CallVoidMethod(outputStream, writeMethod, buffer, 0, readSize);
- if (JNIUtil::isJavaExceptionThrown())
- {
- env->ReleaseByteArrayElements(buffer, bufData, 0);
- svn_stream_close(read_stream);
- return;
- }
- contentSize -= readSize;
- }
-
- env->ReleaseByteArrayElements(buffer, bufData, 0);
- return;
-}
-
-svn_stream_t *SVNClient::createReadStream(apr_pool_t *pool, const char *path,
- Revision &revision,
- Revision &pegRevision, size_t &size)
-{
- svn_stream_t *read_stream = NULL;
-
- if (revision.revision()->kind == svn_opt_revision_working)
- {
- // We want the working copy. Going back to the server returns
- // base instead (which is not what we want).
- apr_file_t *file = NULL;
- apr_finfo_t finfo;
- apr_status_t apr_err = apr_stat(&finfo, path, APR_FINFO_MIN, pool);
- if (apr_err)
- {
- JNIUtil::handleAPRError(apr_err, _("open file"));
- return NULL;
- }
- apr_err = apr_file_open(&file, path, APR_READ, 0, pool);
- if (apr_err)
- {
- JNIUtil::handleAPRError(apr_err, _("open file"));
- return NULL;
- }
- read_stream = svn_stream_from_aprfile2(file, TRUE, pool);
- size = finfo.size;
- }
- else
- {
- svn_client_ctx_t *ctx = getContext(NULL);
- if (ctx == NULL)
- return NULL;
-
- svn_stringbuf_t *buf = svn_stringbuf_create("", pool);
- read_stream = svn_stream_from_stringbuf(buf, pool);
- SVN_JNI_ERR(svn_client_cat2(read_stream, path, pegRevision.revision(),
- revision.revision(), ctx, pool),
- NULL);
- size = buf->len;
- }
-
- return read_stream;
+ SVN_JNI_ERR(svn_client_cat2(outputStream.getStream(requestPool),
+ path, pegRevision.revision(),
+ revision.revision(), ctx, requestPool.pool()),
+ );
}
jbyteArray SVNClient::revProperty(const char *path,
@@ -1483,7 +1123,7 @@ jbyteArray SVNClient::revProperty(const
Path intPath(path);
SVN_JNI_ERR(intPath.error_occured(), NULL);
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return NULL;
@@ -1528,7 +1168,7 @@ void SVNClient::relocate(const char *fro
Path intTo(to);
SVN_JNI_ERR(intTo.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -1548,7 +1188,7 @@ void SVNClient::blame(const char *path,
Path intPath(path);
SVN_JNI_ERR(intPath.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -1562,47 +1202,11 @@ void SVNClient::blame(const char *path,
);
}
-void SVNClient::setConfigDirectory(const char *configDir)
-{
- // A change to the config directory may necessitate creation of
- // the config templates.
- SVN::Pool requestPool;
- SVN_JNI_ERR(svn_config_ensure(configDir, requestPool.pool()), );
-
- m_configDir = (configDir == NULL ? "" : configDir);
-}
-
-const char *SVNClient::getConfigDirectory()
-{
- return m_configDir.c_str();
-}
-
-void SVNClient::commitMessageHandler(CommitMessage *commitMessage)
-{
- delete m_commitMessage;
- m_commitMessage = commitMessage;
-}
-
-void SVNClient::cancelOperation()
-{
- m_cancelOperation = true;
-}
-
-svn_error_t *SVNClient::checkCancel(void *cancelBaton)
-{
- SVNClient *that = (SVNClient*)cancelBaton;
- if (that->m_cancelOperation)
- return svn_error_create(SVN_ERR_CANCELLED, NULL,
- _("Operation canceled"));
- else
- return SVN_NO_ERROR;
-}
-
void SVNClient::addToChangelist(Targets &srcPaths, const char *changelist,
svn_depth_t depth, StringArray &changelists)
{
SVN::Pool requestPool;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
const apr_array_header_t *srcs = srcPaths.array(requestPool);
SVN_JNI_ERR(srcPaths.error_occured(), );
@@ -1616,7 +1220,7 @@ void SVNClient::removeFromChangelists(Ta
StringArray &changelists)
{
SVN::Pool requestPool;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
const apr_array_header_t *srcs = srcPaths.array(requestPool);
SVN_JNI_ERR(srcPaths.error_occured(), );
@@ -1632,7 +1236,7 @@ void SVNClient::getChangelists(const cha
ChangelistCallback *callback)
{
SVN::Pool requestPool;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
SVN_JNI_ERR(svn_client_get_changelists(rootPath,
changelists.array(requestPool),
@@ -1646,7 +1250,7 @@ void SVNClient::lock(Targets &targets, c
SVN::Pool requestPool;
const apr_array_header_t *targetsApr = targets.array(requestPool);
SVN_JNI_ERR(targets.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
SVN_JNI_ERR(svn_client_lock(targetsApr, comment, force, ctx,
requestPool.pool()), );
@@ -1658,7 +1262,7 @@ void SVNClient::unlock(Targets &targets,
const apr_array_header_t *targetsApr = targets.array(requestPool);
SVN_JNI_ERR(targets.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
SVN_JNI_ERR(svn_client_unlock((apr_array_header_t*)targetsApr, force,
ctx, requestPool.pool()), );
}
@@ -1673,7 +1277,7 @@ void SVNClient::setRevProperty(const cha
Path intPath(path);
SVN_JNI_ERR(intPath.error_occured(), );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -1712,7 +1316,7 @@ jstring SVNClient::getVersionInfo(const
SVN_JNI_ERR(intPath.error_occured(), NULL);
int wc_format;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return NULL;
SVN_JNI_ERR(svn_wc_check_wc2(&wc_format, ctx->wc_ctx, intPath.c_str(),
@@ -1771,7 +1375,7 @@ void SVNClient::upgrade(const char *path
SVN::Pool requestPool;
SVN_JNI_NULL_PTR_EX(path, "path", );
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -1789,7 +1393,7 @@ jobject SVNClient::revProperties(const c
Path intPath(path);
SVN_JNI_ERR(intPath.error_occured(), NULL);
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
const char *URL;
svn_revnum_t set_rev;
SVN_JNI_ERR(svn_client_url_from_path2(&URL, intPath.c_str(), ctx,
@@ -1822,7 +1426,7 @@ SVNClient::info2(const char *path, Revis
SVN_JNI_NULL_PTR_EX(path, "path", );
SVN::Pool requestPool;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -1847,7 +1451,7 @@ SVNClient::patch(const char *patchPath,
SVN_JNI_NULL_PTR_EX(targetPath, "targetPath", );
SVN::Pool requestPool;
- svn_client_ctx_t *ctx = getContext(NULL);
+ svn_client_ctx_t *ctx = context.getContext(NULL);
if (ctx == NULL)
return;
@@ -1856,11 +1460,18 @@ SVNClient::patch(const char *patchPath,
Path checkedTargetPath(targetPath);
SVN_JNI_ERR(checkedTargetPath.error_occured(), );
+ // Should parameterize the following, instead of defaulting to FALSE
SVN_JNI_ERR(svn_client_patch(checkedPatchPath.c_str(),
checkedTargetPath.c_str(),
- dryRun, stripCount, reverse, ignoreWhitespace,
- removeTempfiles,
+ dryRun, stripCount, FALSE, reverse,
+ ignoreWhitespace, removeTempfiles,
PatchCallback::callback, callback,
ctx, requestPool.pool(),
requestPool.pool()), );
}
+
+ClientContext &
+SVNClient::getClientContext()
+{
+ return context;
+}
Modified: subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNClient.h
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNClient.h?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNClient.h (original)
+++ subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNClient.h Fri Dec 10 21:23:03 2010
@@ -31,12 +31,10 @@
#include <string>
#include <jni.h>
#include "Path.h"
+#include "ClientContext.h"
class Revision;
class RevisionRange;
-class ClientNotifyCallback;
-class ConflictResolverCallback;
-class ProgressListener;
class Targets;
class JNIByteArray;
class Prompter;
@@ -46,8 +44,10 @@ class BlameCallback;
class ProplistCallback;
class LogMessageCallback;
class InfoCallback;
+class CommitCallback;
class ListCallback;
class StatusCallback;
+class OutputStream;
class PatchCallback;
class ChangelistCallback;
class CommitMessage;
@@ -69,16 +69,6 @@ class SVNClient :public SVNBase
void unlock(Targets &targets, bool force);
void lock(Targets &targets, const char *comment, bool force);
jobject revProperties(const char *path, Revision &revision);
- void cancelOperation();
- void commitMessageHandler(CommitMessage *commitMessage);
- const char *getConfigDirectory();
-
- /**
- * Set the configuration directory, taking the usual steps to
- * ensure that Subversion's config file templates exist in the
- * specified location.
- */
- void setConfigDirectory(const char *configDir);
void blame(const char *path, Revision &pegRevision,
Revision &revisionStart, Revision &revisionEnd,
@@ -86,14 +76,11 @@ class SVNClient :public SVNBase
BlameCallback *callback);
void relocate(const char *from, const char *to, const char *path,
bool recurse);
- jbyteArray fileContent(const char *path, Revision &revision,
- Revision &pegRevision);
void streamFileContent(const char *path, Revision &revision,
- Revision &pegRevision, jobject outputStream,
- size_t bufSize);
+ Revision &pegRevision, OutputStream &outputStream);
void propertySet(const char *path, const char *name, const char *value,
svn_depth_t depth, StringArray &changelists, bool force,
- RevpropTable &revprops);
+ RevpropTable &revprops, CommitCallback *callback);
void properties(const char *path, Revision &revision,
Revision &pegRevision, svn_depth_t depth,
StringArray &changelists, ProplistCallback *callback);
@@ -114,9 +101,9 @@ class SVNClient :public SVNBase
bool ignoreAncestry, bool dryRun, bool recordOnly);
void mergeReintegrate(const char *path, Revision &pegRevision,
const char *localPath, bool dryRun);
- void doImport(const char *path, const char *url, const char *message,
+ void doImport(const char *path, const char *url, CommitMessage *message,
svn_depth_t depth, bool noIgnore, bool ignoreUnknownNodeTypes,
- RevpropTable &revprops);
+ RevpropTable &revprops, CommitCallback *callback);
jlong doSwitch(const char *path, const char *url, Revision &revision,
Revision &pegRevision, svn_depth_t depth,
bool depthIsSticky, bool ignoreExternals,
@@ -128,28 +115,28 @@ class SVNClient :public SVNBase
void resolve(const char *path, svn_depth_t depth,
svn_wc_conflict_choice_t choice);
void cleanup(const char *path);
- void mkdir(Targets &targets, const char *message, bool makeParents,
- RevpropTable &revprops);
+ void mkdir(Targets &targets, CommitMessage *message, bool makeParents,
+ RevpropTable &revprops, CommitCallback *callback);
void move(Targets &srcPaths, const char *destPath,
- const char *message, bool force, bool moveAsChild,
- bool makeParents, RevpropTable &revprops);
+ CommitMessage *message, bool force, bool moveAsChild,
+ bool makeParents, RevpropTable &revprops, CommitCallback *callback);
void copy(CopySources ©Sources, const char *destPath,
- const char *message, bool copyAsChild, bool makeParents,
- bool ignoreExternals, RevpropTable &revprops);
- jlong commit(Targets &targets, const char *message, svn_depth_t depth,
- bool noUnlock, bool keepChangelist,
- StringArray &changelists, RevpropTable &revprops);
+ CommitMessage *message, bool copyAsChild, bool makeParents,
+ bool ignoreExternals, RevpropTable &revprops,
+ CommitCallback *callback);
+ void commit(Targets &targets, CommitMessage *message, svn_depth_t depth,
+ bool noUnlock, bool keepChangelist,
+ StringArray &changelists, RevpropTable &revprops,
+ CommitCallback *callback);
jlongArray update(Targets &targets, Revision &revision, svn_depth_t depth,
bool depthIsSticky, bool ignoreExternals,
bool allowUnverObstructions);
void add(const char *path, svn_depth_t depth, bool force, bool no_ignore,
bool add_parents);
void revert(const char *path, svn_depth_t depth, StringArray &changelists);
- void remove(Targets &targets, const char *message, bool force,
- bool keep_local, RevpropTable &revprops);
- void notification2(ClientNotifyCallback *notify2);
- void setConflictResolver(ConflictResolverCallback *conflictResolver);
- void setProgressListener(ProgressListener *progressListener);
+ void remove(Targets &targets, CommitMessage *message, bool force,
+ bool keep_local, RevpropTable &revprops,
+ CommitCallback *callback);
jlong checkout(const char *moduleName, const char *destPath,
Revision &revision, Revision &pegRevsion, svn_depth_t depth,
bool ignoreExternals, bool allowUnverObstructions);
@@ -158,9 +145,6 @@ class SVNClient :public SVNBase
bool discoverPaths, bool includeMergedRevisions,
StringArray &revProps,
long limit, LogMessageCallback *callback);
- void setPrompt(Prompter *prompter);
- void password(const char *pi_password);
- void username(const char *pi_username);
jstring getAdminDirectoryName();
jboolean isAdminDirectory(const char *name);
void addToChangelist(Targets &srcPaths, const char *changelist,
@@ -205,17 +189,14 @@ class SVNClient :public SVNBase
svn_depth_t depth, StringArray &changelists,
bool ignoreAncestry, DiffSummaryReceiver &receiver);
+ ClientContext &getClientContext();
+
const char *getLastPath();
- void dispose(jobject jthis);
+ void dispose();
static SVNClient *getCppObject(jobject jthis);
- SVNClient();
+ SVNClient(jobject jthis_in);
virtual ~SVNClient();
private:
- static svn_error_t *checkCancel(void *cancelBaton);
- svn_client_ctx_t *getContext(const char *message);
- svn_stream_t *createReadStream(apr_pool_t *pool, const char *path,
- Revision &revision, Revision &pegRevision,
- size_t &size);
/**
* Shared implementation for diff() APIs. When pegRevision is
* provided, revision1 and revision2 equate to startRevision and
@@ -228,31 +209,8 @@ class SVNClient :public SVNBase
bool ignoreAncestry, bool noDiffDelete, bool force,
bool showCopiesAsAdds);
- ClientNotifyCallback *m_notify2;
- ConflictResolverCallback *m_conflictResolver;
- ProgressListener *m_progressListener;
- Prompter *m_prompter;
Path m_lastPath;
- bool m_cancelOperation;
- CommitMessage *m_commitMessage;
-
- /**
- * Implements the svn_client_get_commit_log3_t API.
- */
- static svn_error_t *getCommitMessage(const char **log_msg,
- const char **tmp_file,
- const apr_array_header_t *
- commit_items,
- void *baton,
- apr_pool_t *pool);
- /**
- * Produce a baton for the getCommitMessage() callback.
- */
- void *getCommitMessageBaton(const char *message);
-
- std::string m_userName;
- std::string m_passWord;
- std::string m_configDir;
+ ClientContext context;
};
#endif // SVNCLIENT_H
Modified: subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNRepos.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNRepos.cpp?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNRepos.cpp (original)
+++ subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNRepos.cpp Fri Dec 10 21:23:03 2010
@@ -53,10 +53,10 @@ SVNRepos *SVNRepos::getCppObject(jobject
return (cppAddr == 0 ? NULL : reinterpret_cast<SVNRepos *>(cppAddr));
}
-void SVNRepos::dispose(jobject jthis)
+void SVNRepos::dispose()
{
static jfieldID fid = 0;
- SVNBase::dispose(jthis, &fid, JAVA_PACKAGE"/SVNRepos");
+ SVNBase::dispose(&fid, JAVA_PACKAGE"/SVNRepos");
}
void SVNRepos::create(File &path, bool disableFsyncCommits,
@@ -613,7 +613,7 @@ void SVNRepos::upgrade(File &path, Repos
);
}
-jobject SVNRepos::lslocks(File &path)
+jobject SVNRepos::lslocks(File &path, svn_depth_t depth)
{
SVN::Pool requestPool;
svn_repos_t *repos;
@@ -631,8 +631,8 @@ jobject SVNRepos::lslocks(File &path)
requestPool.pool()), NULL);
fs = svn_repos_fs (repos);
/* Fetch all locks on or below the root directory. */
- SVN_JNI_ERR(svn_repos_fs_get_locks(&locks, repos, "/", NULL, NULL,
- requestPool.pool()),
+ SVN_JNI_ERR(svn_repos_fs_get_locks2(&locks, repos, "/", depth, NULL, NULL,
+ requestPool.pool()),
NULL);
JNIEnv *env = JNIUtil::getEnv();
Modified: subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNRepos.h
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNRepos.h?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNRepos.h (original)
+++ subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/SVNRepos.h Fri Dec 10 21:23:03 2010
@@ -42,7 +42,7 @@ class SVNRepos : public SVNBase
{
public:
void rmlocks(File &path, StringArray &locks);
- jobject lslocks(File &path);
+ jobject lslocks(File &path, svn_depth_t depth);
void verify(File &path, Revision &revisionStart, Revision &revisionEnd,
ReposNotifyCallback *notifyCallback);
void setRevProp(File &path, Revision &revision,
@@ -69,7 +69,7 @@ class SVNRepos : public SVNBase
void pack(File &path, ReposNotifyCallback *callback);
SVNRepos();
virtual ~SVNRepos();
- void dispose(jobject jthis);
+ void dispose();
static SVNRepos *getCppObject(jobject jthis);
private:
Modified: subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Fri Dec 10 21:23:03 2010
@@ -32,10 +32,8 @@
#include "SVNClient.h"
#include "Revision.h"
#include "RevisionRange.h"
+#include "OutputStream.h"
#include "EnumMapper.h"
-#include "ClientNotifyCallback.h"
-#include "ConflictResolverCallback.h"
-#include "ProgressListener.h"
#include "CommitMessage.h"
#include "Prompter.h"
#include "Targets.h"
@@ -44,6 +42,7 @@
#include "BlameCallback.h"
#include "ProplistCallback.h"
#include "PatchCallback.h"
+#include "CommitCallback.h"
#include "LogMessageCallback.h"
#include "InfoCallback.h"
#include "StatusCallback.h"
@@ -61,7 +60,7 @@ Java_org_apache_subversion_javahl_SVNCli
(JNIEnv *env, jobject jthis)
{
JNIEntry(SVNClient, ctNative);
- SVNClient *obj = new SVNClient;
+ SVNClient *obj = new SVNClient(jthis);
return obj->getCppAddr();
}
@@ -76,7 +75,7 @@ Java_org_apache_subversion_javahl_SVNCli
JNIUtil::throwError(_("bad C++ this"));
return;
}
- cl->dispose(jthis);
+ cl->dispose();
}
JNIEXPORT void JNICALL
@@ -212,7 +211,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- cl->username(username);
+ cl->getClientContext().username(username);
}
JNIEXPORT void JNICALL
@@ -236,7 +235,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- cl->password(password);
+ cl->getClientContext().password(password);
}
JNIEXPORT void JNICALL
@@ -254,7 +253,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- cl->setPrompt(prompter);
+ cl->getClientContext().setPrompt(prompter);
}
JNIEXPORT void JNICALL
@@ -345,84 +344,10 @@ Java_org_apache_subversion_javahl_SVNCli
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_SVNClient_notification2
-(JNIEnv *env, jobject jthis, jobject jnotify2)
-{
- JNIEntry(SVNClient, notification2);
- SVNClient *cl = SVNClient::getCppObject(jthis);
- if (cl == NULL)
- {
- JNIUtil::throwError(_("bad C++ this"));
- return;
- }
- ClientNotifyCallback *notify2 = ClientNotifyCallback::makeCNotify(jnotify2);
- if (JNIUtil::isExceptionThrown())
- return;
-
- cl->notification2(notify2);
-}
-
-JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_SVNClient_setConflictResolver
-(JNIEnv *env, jobject jthis, jobject jconflictResolver)
-{
- JNIEntry(SVNClient, setConflictResolver);
- SVNClient *cl = SVNClient::getCppObject(jthis);
- if (cl == NULL)
- {
- JNIUtil::throwError(_("bad C++ this"));
- return;
- }
- ConflictResolverCallback *listener =
- ConflictResolverCallback::makeCConflictResolverCallback(jconflictResolver);
- if (JNIUtil::isExceptionThrown())
- return;
-
- cl->setConflictResolver(listener);
-}
-
-JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_SVNClient_setProgressListener
-(JNIEnv *env, jobject jthis, jobject jprogressListener)
-{
- JNIEntry(SVNClient, setProgressListener);
- SVNClient *cl = SVNClient::getCppObject(jthis);
- if (cl == NULL)
- {
- JNIUtil::throwError(_("bad C++ this"));
- return;
- }
- ProgressListener *listener =
- ProgressListener::makeCProgressListener(jprogressListener);
- if (JNIUtil::isExceptionThrown())
- return;
-
- cl->setProgressListener(listener);
-}
-
-JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_SVNClient_commitMessageHandler
-(JNIEnv *env, jobject jthis, jobject jcommitMessage)
-{
- JNIEntry(SVNClient, commitMessageHandler);
- SVNClient *cl = SVNClient::getCppObject(jthis);
- if (cl == NULL)
- {
- JNIUtil::throwError("bad C++ this");
- return;
- }
- CommitMessage *commitMessage =
- CommitMessage::makeCCommitMessage(jcommitMessage);
- if (JNIUtil::isExceptionThrown())
- return;
-
- cl->commitMessageHandler(commitMessage);
-}
-
-JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_remove
-(JNIEnv *env, jobject jthis, jobject jtargets, jstring jmessage,
- jboolean jforce, jboolean keepLocal, jobject jrevpropTable)
+(JNIEnv *env, jobject jthis, jobject jtargets, jboolean jforce,
+ jboolean keepLocal, jobject jrevpropTable, jobject jmessage,
+ jobject jcallback)
{
JNIEntry(SVNClient, remove);
SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -433,7 +358,10 @@ Java_org_apache_subversion_javahl_SVNCli
}
StringArray targetsArr(jtargets);
Targets targets(targetsArr);
- JNIStringHolder message(jmessage);
+ if (JNIUtil::isExceptionThrown())
+ return;
+
+ CommitMessage message(jmessage);
if (JNIUtil::isExceptionThrown())
return;
@@ -441,8 +369,9 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- cl->remove(targets, message, jforce ? true : false,
- keepLocal ? true : false, revprops);
+ CommitCallback callback(jcallback);
+ cl->remove(targets, &message, jforce ? true : false,
+ keepLocal ? true : false, revprops, jcallback ? &callback : NULL);
}
JNIEXPORT void JNICALL
@@ -516,44 +445,49 @@ Java_org_apache_subversion_javahl_SVNCli
jallowUnverObstructions ? true : false);
}
-JNIEXPORT jlong JNICALL
+JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_commit
-(JNIEnv *env, jobject jthis, jobject jtargets, jstring jmessage, jobject jdepth,
+(JNIEnv *env, jobject jthis, jobject jtargets, jobject jdepth,
jboolean jnoUnlock, jboolean jkeepChangelist, jobject jchangelists,
- jobject jrevpropTable)
+ jobject jrevpropTable, jobject jmessage, jobject jcallback)
{
JNIEntry(SVNClient, commit);
SVNClient *cl = SVNClient::getCppObject(jthis);
if (cl == NULL)
{
JNIUtil::throwError(_("bad C++ this"));
- return -1;
+ return;
}
StringArray targetsArr(jtargets);
Targets targets(targetsArr);
- JNIStringHolder message(jmessage);
if (JNIUtil::isExceptionThrown())
- return -1;
+ return;
+
+ CommitMessage message(jmessage);
+ if (JNIUtil::isExceptionThrown())
+ return;
// Build the changelist vector from the Java array.
StringArray changelists(jchangelists);
if (JNIUtil::isExceptionThrown())
- return -1;
+ return;
RevpropTable revprops(jrevpropTable);
if (JNIUtil::isExceptionThrown())
- return -1;
+ return;
- return cl->commit(targets, message, EnumMapper::toDepth(jdepth),
- jnoUnlock ? true : false, jkeepChangelist ? true : false,
- changelists, revprops);
+ CommitCallback callback(jcallback);
+ cl->commit(targets, &message, EnumMapper::toDepth(jdepth),
+ jnoUnlock ? true : false, jkeepChangelist ? true : false,
+ changelists, revprops,
+ jcallback ? &callback : NULL);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_copy
(JNIEnv *env, jobject jthis, jobject jcopySources, jstring jdestPath,
- jstring jmessage, jboolean jcopyAsChild, jboolean jmakeParents,
- jboolean jignoreExternals, jobject jrevpropTable)
+ jboolean jcopyAsChild, jboolean jmakeParents, jboolean jignoreExternals,
+ jobject jrevpropTable, jobject jmessage, jobject jcallback)
{
JNIEntry(SVNClient, copy);
@@ -575,7 +509,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
-JNIStringHolder message(jmessage);
+ CommitMessage message(jmessage);
if (JNIUtil::isExceptionThrown())
return;
@@ -583,16 +517,17 @@ JNIStringHolder message(jmessage);
if (JNIUtil::isExceptionThrown())
return;
- cl->copy(copySources, destPath, message, jcopyAsChild ? true : false,
+ CommitCallback callback(jcallback);
+ cl->copy(copySources, destPath, &message, jcopyAsChild ? true : false,
jmakeParents ? true : false, jignoreExternals ? true : false,
- revprops);
+ revprops, jcallback ? &callback : NULL);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_move
(JNIEnv *env, jobject jthis, jobject jsrcPaths, jstring jdestPath,
- jstring jmessage, jboolean jforce, jboolean jmoveAsChild,
- jboolean jmakeParents, jobject jrevpropTable)
+ jboolean jforce, jboolean jmoveAsChild, jboolean jmakeParents,
+ jobject jrevpropTable, jobject jmessage, jobject jcallback)
{
JNIEntry(SVNClient, move);
@@ -609,7 +544,8 @@ Java_org_apache_subversion_javahl_SVNCli
JNIStringHolder destPath(jdestPath);
if (JNIUtil::isExceptionThrown())
return;
- JNIStringHolder message(jmessage);
+
+ CommitMessage message(jmessage);
if (JNIUtil::isExceptionThrown())
return;
@@ -617,15 +553,16 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- cl->move(srcPaths, destPath, message, jforce ? true : false,
+ CommitCallback callback(jcallback);
+ cl->move(srcPaths, destPath, &message, jforce ? true : false,
jmoveAsChild ? true : false, jmakeParents ? true : false,
- revprops);
+ revprops, jcallback ? &callback : NULL);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_mkdir
-(JNIEnv *env, jobject jthis, jobject jtargets, jstring jmessage,
- jboolean jmakeParents, jobject jrevpropTable)
+(JNIEnv *env, jobject jthis, jobject jtargets, jboolean jmakeParents,
+ jobject jrevpropTable, jobject jmessage, jobject jcallback)
{
JNIEntry(SVNClient, mkdir);
SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -636,7 +573,10 @@ Java_org_apache_subversion_javahl_SVNCli
}
StringArray targetsArr(jtargets);
Targets targets(targetsArr);
- JNIStringHolder message(jmessage);
+ if (JNIUtil::isExceptionThrown())
+ return;
+
+ CommitMessage message(jmessage);
if (JNIUtil::isExceptionThrown())
return;
@@ -644,7 +584,9 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- cl->mkdir(targets, message, jmakeParents ? true : false, revprops);
+ CommitCallback callback(jcallback);
+ cl->mkdir(targets, &message, jmakeParents ? true : false, revprops,
+ jcallback ? &callback : NULL);
}
JNIEXPORT void JNICALL
@@ -760,9 +702,9 @@ Java_org_apache_subversion_javahl_SVNCli
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_doImport
-(JNIEnv *env, jobject jthis, jstring jpath, jstring jurl, jstring jmessage,
- jobject jdepth, jboolean jnoIgnore, jboolean jignoreUnknownNodeTypes,
- jobject jrevpropTable)
+(JNIEnv *env, jobject jthis, jstring jpath, jstring jurl, jobject jdepth,
+ jboolean jnoIgnore, jboolean jignoreUnknownNodeTypes, jobject jrevpropTable,
+ jobject jmessage, jobject jcallback)
{
JNIEntry(SVNClient, doImport);
SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -779,7 +721,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- JNIStringHolder message(jmessage);
+ CommitMessage message(jmessage);
if (JNIUtil::isExceptionThrown())
return;
@@ -787,9 +729,11 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- cl->doImport(path, url, message, EnumMapper::toDepth(jdepth),
+ CommitCallback callback(jcallback);
+ cl->doImport(path, url, &message, EnumMapper::toDepth(jdepth),
jnoIgnore ? true : false,
- jignoreUnknownNodeTypes ? true : false, revprops);
+ jignoreUnknownNodeTypes ? true : false, revprops,
+ jcallback ? &callback : NULL);
}
JNIEXPORT jobject JNICALL
@@ -971,7 +915,8 @@ Java_org_apache_subversion_javahl_SVNCli
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_propertySet
(JNIEnv *env, jobject jthis, jstring jpath, jstring jname, jstring jvalue,
- jobject jdepth, jobject jchangelists, jboolean jforce, jobject jrevpropTable)
+ jobject jdepth, jobject jchangelists, jboolean jforce, jobject jrevpropTable,
+ jobject jcallback)
{
JNIEntry(SVNClient, propertySet);
SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -1000,8 +945,9 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
+ CommitCallback callback(jcallback);
cl->propertySet(path, name, value, EnumMapper::toDepth(jdepth), changelists,
- jforce ? true:false, revprops);
+ jforce ? true:false, revprops, jcallback ? &callback : NULL);
}
JNIEXPORT jbyteArray JNICALL
@@ -1364,37 +1310,10 @@ Java_org_apache_subversion_javahl_SVNCli
jignoreAncestry ? true : false, receiver);
}
-JNIEXPORT jbyteArray JNICALL
-Java_org_apache_subversion_javahl_SVNClient_fileContent
-(JNIEnv *env, jobject jthis, jstring jpath, jobject jrevision,
- jobject jpegRevision)
-{
- JNIEntry(SVNClient, fileContent);
- SVNClient *cl = SVNClient::getCppObject(jthis);
- if (cl == NULL)
- {
- JNIUtil::throwError(_("bad C++ this"));
- return NULL;
- }
- JNIStringHolder path(jpath);
- if (JNIUtil::isExceptionThrown())
- return NULL;
-
- Revision revision(jrevision);
- if (JNIUtil::isExceptionThrown())
- return NULL;
-
- Revision pegRevision(jpegRevision);
- if (JNIUtil::isExceptionThrown())
- return NULL;
-
- return cl->fileContent(path, revision, pegRevision);
-}
-
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_streamFileContent
(JNIEnv *env, jobject jthis, jstring jpath, jobject jrevision,
- jobject jpegRevision, jint bufSize, jobject jstream)
+ jobject jpegRevision, jobject jstream)
{
JNIEntry(SVNClient, streamFileContent);
SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -1415,7 +1334,11 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- cl->streamFileContent(path, revision, pegRevision, jstream, bufSize);
+ OutputStream dataOut(jstream);
+ if (JNIUtil::isExceptionThrown())
+ return;
+
+ cl->streamFileContent(path, revision, pegRevision, dataOut);
}
JNIEXPORT jstring JNICALL
@@ -1576,7 +1499,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- cl->setConfigDirectory(configDir);
+ cl->getClientContext().setConfigDirectory(configDir);
}
JNIEXPORT jstring JNICALL
@@ -1591,7 +1514,7 @@ Java_org_apache_subversion_javahl_SVNCli
return NULL;
}
- const char *configDir = cl->getConfigDirectory();
+ const char *configDir = cl->getClientContext().getConfigDirectory();
return JNIUtil::makeJString(configDir);
}
@@ -1606,7 +1529,7 @@ Java_org_apache_subversion_javahl_SVNCli
JNIUtil::throwError("bad C++ this");
return;
}
- cl->cancelOperation();
+ cl->getClientContext().cancelOperation();
}
JNIEXPORT void JNICALL
Modified: subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp (original)
+++ subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp Fri Dec 10 21:23:03 2010
@@ -30,6 +30,7 @@
#include "JNIStringHolder.h"
#include "JNIByteArray.h"
#include "SVNRepos.h"
+#include "EnumMapper.h"
#include "Revision.h"
#include "InputStream.h"
#include "OutputStream.h"
@@ -59,7 +60,7 @@ Java_org_apache_subversion_javahl_SVNRep
JNIUtil::throwError(_("bad C++ this"));
return;
}
- cl->dispose(jthis);
+ cl->dispose();
}
JNIEXPORT void JNICALL
@@ -407,7 +408,7 @@ Java_org_apache_subversion_javahl_SVNRep
JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_SVNRepos_lslocks
-(JNIEnv *env, jobject jthis, jobject jpath)
+(JNIEnv *env, jobject jthis, jobject jpath, jobject jdepth)
{
JNIEntry(SVNRepos, lslocks);
SVNRepos *cl = SVNRepos::getCppObject(jthis);
@@ -421,7 +422,7 @@ Java_org_apache_subversion_javahl_SVNRep
if (JNIUtil::isExceptionThrown())
return NULL;
- return cl->lslocks(path);
+ return cl->lslocks(path, EnumMapper::toDepth(jdepth));
}
JNIEXPORT void JNICALL
Modified: subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java (original)
+++ subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java Fri Dec 10 21:23:03 2010
@@ -198,15 +198,6 @@ public interface ISVNClient
void setProgressCallback(ProgressCallback listener);
/**
- * Sets the commit message handler. This allows more complex commit message
- * with the list of the elements to be commited as input.
- * @param messageHandler callback for entering commit messages
- * if this is set the message parameter is ignored.
- * @since 1.0
- */
- void commitMessageHandler(CommitMessage messageHandler);
-
- /**
* Sets a file for deletion.
* @param path path or url to be deleted
* @param message if path is a url, this will be the commit message.
@@ -218,8 +209,9 @@ public interface ISVNClient
* @throws ClientException
* @since 1.5
*/
- void remove(Set<String> path, String message, boolean force,
- boolean keepLocal, Map<String, String> revpropTable)
+ void remove(Set<String> path, boolean force, boolean keepLocal,
+ Map<String, String> revpropTable, CommitMessageCallback handler,
+ CommitCallback callback)
throws ClientException;
/**
@@ -284,10 +276,10 @@ public interface ISVNClient
* @throws ClientException
* @since 1.5
*/
- long commit(Set<String> path, String message, Depth depth,
- boolean noUnlock, boolean keepChangelist,
- Collection<String> changelists,
- Map<String, String> revpropTable)
+ void commit(Set<String> path, Depth depth, boolean noUnlock,
+ boolean keepChangelist, Collection<String> changelists,
+ Map<String, String> revpropTable, CommitMessageCallback handler,
+ CommitCallback callback)
throws ClientException;
/**
@@ -308,9 +300,10 @@ public interface ISVNClient
* @throws ClientException If the copy operation fails.
* @since 1.7
*/
- void copy(List<CopySource> sources, String destPath, String message,
+ void copy(List<CopySource> sources, String destPath,
boolean copyAsChild, boolean makeParents,
- boolean ignoreExternals, Map<String, String> revpropTable)
+ boolean ignoreExternals, Map<String, String> revpropTable,
+ CommitMessageCallback handler, CommitCallback callback)
throws ClientException;
/**
@@ -331,9 +324,10 @@ public interface ISVNClient
* @throws ClientException If the move operation fails.
* @since 1.5
*/
- void move(Set<String> srcPaths, String destPath, String message,
- boolean force, boolean moveAsChild, boolean makeParents,
- Map<String, String> revpropTable)
+ void move(Set<String> srcPaths, String destPath, boolean force,
+ boolean moveAsChild, boolean makeParents,
+ Map<String, String> revpropTable,
+ CommitMessageCallback handler, CommitCallback callback)
throws ClientException;
/**
@@ -348,8 +342,9 @@ public interface ISVNClient
* @throws ClientException
* @since 1.5
*/
- void mkdir(Set<String> path, String message, boolean makeParents,
- Map<String, String> revpropTable)
+ void mkdir(Set<String> path, boolean makeParents,
+ Map<String, String> revpropTable,
+ CommitMessageCallback handler, CommitCallback callback)
throws ClientException;
/**
@@ -429,9 +424,10 @@ public interface ISVNClient
*
* @since 1.5
*/
- void doImport(String path, String url, String message, Depth depth,
+ void doImport(String path, String url, Depth depth,
boolean noIgnore, boolean ignoreUnknownNodeTypes,
- Map<String, String> revpropTable)
+ Map<String, String> revpropTable,
+ CommitMessageCallback handler, CommitCallback callback)
throws ClientException;
/**
@@ -682,7 +678,7 @@ public interface ISVNClient
*/
void propertySet(String path, String name, String value, Depth depth,
Collection<String> changelists, boolean force,
- Map<String, String> revpropTable)
+ Map<String, String> revpropTable, CommitCallback callback)
throws ClientException;
/**
@@ -695,7 +691,7 @@ public interface ISVNClient
* @since 1.5
*/
void propertyRemove(String path, String name, Depth depth,
- Collection<String> changelists)
+ Collection<String> changelists, CommitCallback callback)
throws ClientException;
/**
@@ -711,7 +707,8 @@ public interface ISVNClient
* @since 1.5
*/
void propertyCreate(String path, String name, String value, Depth depth,
- Collection<String> changelists, boolean force)
+ Collection<String> changelists, boolean force,
+ CommitCallback callback)
throws ClientException;
/**
@@ -793,7 +790,7 @@ public interface ISVNClient
* @since 1.0
*/
void streamFileContent(String path, Revision revision, Revision pegRevision,
- int bufferSize, OutputStream stream)
+ OutputStream stream)
throws ClientException;
/**
Modified: subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java (original)
+++ subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java Fri Dec 10 21:23:03 2010
@@ -217,10 +217,12 @@ public interface ISVNRepos {
/**
* list all locks in the repository
* @param path the path to the repository
+ * @param depth the depth to recurse
* @throws ClientException throw in case of problem
- * @since 1.2
+ * @since 1.7
*/
- public abstract Set<Lock> lslocks(File path) throws ClientException;
+ public abstract Set<Lock> lslocks(File path, Depth depth)
+ throws ClientException;
/**
* remove multiple locks from the repository
Modified: subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Fri Dec 10 21:23:03 2010
@@ -26,6 +26,7 @@ package org.apache.subversion.javahl;
import org.apache.subversion.javahl.callback.*;
import java.io.OutputStream;
+import java.io.ByteArrayOutputStream;
import java.util.Collection;
import java.util.Set;
@@ -65,9 +66,7 @@ public class SVNClient implements ISVNCl
}
}
- /** Don't call this function! Public fucntion for backward compat reasons
- */
- public long getCppAddr()
+ private long getCppAddr()
{
return cppAddr;
}
@@ -94,6 +93,8 @@ public class SVNClient implements ISVNCl
*/
protected long cppAddr;
+ private ClientContext clientContext = new ClientContext();
+
/**
* @since 1.0
*/
@@ -174,29 +175,34 @@ public class SVNClient implements ISVNCl
/**
* @since 1.2
*/
- public native void notification2(ClientNotifyCallback notify);
+ public void notification2(ClientNotifyCallback notify)
+ {
+ clientContext.notify = notify;
+ }
/**
* @since 1.5
*/
- public native void setConflictResolver(ConflictResolverCallback listener);
+ public void setConflictResolver(ConflictResolverCallback listener)
+ {
+ clientContext.resolver = listener;
+ }
/**
* @since 1.5
*/
- public native void setProgressCallback(ProgressCallback listener);
-
- /**
- * @since 1.0
- */
- public native void commitMessageHandler(CommitMessage messageHandler);
+ public void setProgressCallback(ProgressCallback listener)
+ {
+ clientContext.listener = listener;
+ }
/**
* @since 1.5
*/
- public native void remove(Set<String> paths, String message, boolean force,
+ public native void remove(Set<String> paths, boolean force,
boolean keepLocal,
- Map<String, String> revpropTable)
+ Map<String, String> revpropTable,
+ CommitMessageCallback handler, CommitCallback callback)
throws ClientException;
/**
@@ -225,36 +231,39 @@ public class SVNClient implements ISVNCl
/**
* @since 1.5
*/
- public native long commit(Set<String> paths, String message, Depth depth,
- boolean noUnlock, boolean keepChangelist,
+ public native void commit(Set<String> paths, Depth depth, boolean noUnlock,
+ boolean keepChangelist,
Collection<String> changelists,
- Map<String, String> revpropTable)
+ Map<String, String> revpropTable,
+ CommitMessageCallback handler, CommitCallback callback)
throws ClientException;
/**
* @since 1.7
*/
public native void copy(List<CopySource> sources, String destPath,
- String message, boolean copyAsChild,
- boolean makeParents, boolean ignoreExternals,
- Map<String, String> revpropTable)
+ boolean copyAsChild, boolean makeParents,
+ boolean ignoreExternals,
+ Map<String, String> revpropTable,
+ CommitMessageCallback handler, CommitCallback callback)
throws ClientException;
/**
* @since 1.5
*/
public native void move(Set<String> srcPaths, String destPath,
- String message, boolean force, boolean moveAsChild,
+ boolean force, boolean moveAsChild,
boolean makeParents,
- Map<String, String> revpropTable)
+ Map<String, String> revpropTable,
+ CommitMessageCallback handler, CommitCallback callback)
throws ClientException;
/**
* @since 1.5
*/
- public native void mkdir(Set<String> paths, String message,
- boolean makeParents,
- Map<String, String> revpropTable)
+ public native void mkdir(Set<String> paths, boolean makeParents,
+ Map<String, String> revpropTable,
+ CommitMessageCallback handler, CommitCallback callback)
throws ClientException;
/**
@@ -291,10 +300,11 @@ public class SVNClient implements ISVNCl
/**
* @since 1.5
*/
- public native void doImport(String path, String url, String message,
- Depth depth, boolean noIgnore,
+ public native void doImport(String path, String url, Depth depth,
+ boolean noIgnore,
boolean ignoreUnknownNodeTypes,
- Map<String, String> revpropTable)
+ Map<String, String> revpropTable,
+ CommitMessageCallback handler, CommitCallback callback)
throws ClientException;
/**
@@ -406,17 +416,20 @@ public class SVNClient implements ISVNCl
public native void propertySet(String path, String name, String value,
Depth depth, Collection<String> changelists,
boolean force,
- Map<String, String> revpropTable)
+ Map<String, String> revpropTable,
+ CommitCallback callback)
throws ClientException;
/**
* @since 1.5
*/
public void propertyRemove(String path, String name, Depth depth,
- Collection<String> changelists)
+ Collection<String> changelists,
+ CommitCallback callback)
throws ClientException
{
- propertySet(path, name, null, depth, changelists, false, null);
+ propertySet(path, name, null, depth, changelists, false, null,
+ callback);
}
/**
@@ -424,10 +437,11 @@ public class SVNClient implements ISVNCl
*/
public void propertyCreate(String path, String name, String value,
Depth depth, Collection<String> changelists,
- boolean force)
+ boolean force, CommitCallback callback)
throws ClientException
{
- propertySet(path, name, value, depth, changelists, force, null);
+ propertySet(path, name, value, depth, changelists, force, null,
+ callback);
}
/**
@@ -460,15 +474,21 @@ public class SVNClient implements ISVNCl
/**
* @since 1.2
*/
- public native byte[] fileContent(String path, Revision revision,
- Revision pegRevision)
- throws ClientException;
+ public byte[] fileContent(String path, Revision revision,
+ Revision pegRevision)
+ throws ClientException
+ {
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+
+ streamFileContent(path, revision, pegRevision, stream);
+ return stream.toByteArray();
+ }
/**
* @since 1.0
*/
public native void streamFileContent(String path, Revision revision,
- Revision pegRevision, int bufferSize,
+ Revision pegRevision,
OutputStream stream)
throws ClientException;
@@ -627,4 +647,38 @@ public class SVNClient implements ISVNCl
PatchCallback callback)
throws ClientException;
+ /**
+ * A private class to hold the contextual information required to
+ * persist in this object, such as notification handlers.
+ */
+ private class ClientContext
+ implements ClientNotifyCallback, ProgressCallback,
+ ConflictResolverCallback
+ {
+ public ClientNotifyCallback notify = null;
+ public ProgressCallback listener = null;
+ public ConflictResolverCallback resolver = null;
+
+ public void onNotify(ClientNotifyInformation notifyInfo)
+ {
+ if (notify != null)
+ notify.onNotify(notifyInfo);
+ }
+
+ public void onProgress(ProgressEvent event)
+ {
+ if (listener != null)
+ listener.onProgress(event);
+ }
+
+ public ConflictResult resolve(ConflictDescriptor conflict)
+ throws SubversionException
+ {
+ if (resolver != null)
+ return resolver.resolve(conflict);
+ else
+ return new ConflictResult(ConflictResult.Choice.postpone,
+ null);
+ }
+ }
}
Modified: subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java (original)
+++ subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java Fri Dec 10 21:23:03 2010
@@ -205,10 +205,12 @@ public class SVNRepos implements ISVNRep
/**
* list all locks in the repository
* @param path the path to the repository
+ * @param depth the depth to recurse
* @throws ClientException throw in case of problem
- * @since 1.2
+ * @since 1.7
*/
- public native Set<Lock> lslocks(File path) throws ClientException;
+ public native Set<Lock> lslocks(File path, Depth depth)
+ throws ClientException;
/**
* remove multiple locks from the repository
Modified: subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/UserPasswordCallback.java
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/UserPasswordCallback.java?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/UserPasswordCallback.java (original)
+++ subversion/branches/ignore-mergeinfo/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/UserPasswordCallback.java Fri Dec 10 21:23:03 2010
@@ -24,9 +24,13 @@
package org.apache.subversion.javahl.callback;
/**
- * The original interface for receiving callbacks for authentication.
- * Consider this code deprecated -- new applications should use
- * PromptUserPassword3 instead.
+ * <p>The interface for requesting authentication credentials from the
+ * user. Should the javahl bindings need the matching information,
+ * these methodes will be called.</p>
+ *
+ * <p>This callback can also be used to provide the equivalent of the
+ * <code>--no-auth-cache</code> and <code>--non-interactive</code>
+ * arguments accepted by the command-line client.</p>
*/
public interface UserPasswordCallback
{
@@ -41,12 +45,6 @@ public interface UserPasswordCallback
public static final int AcceptTemporary = 1;
/**
- * @deprecated Use the correctly spelled "AcceptTemporary"
- * constant instead.
- */
- public static final int AccecptTemporary = AcceptTemporary;
-
- /**
* Accept the connection to the server <i>forever</i>.
*/
public static final int AcceptPermanently = 2;
@@ -106,4 +104,52 @@ public interface UserPasswordCallback
* @return the password
*/
public String getPassword();
+
+ /**
+ * Request a user name and password from the user, and (usually)
+ * store the auth credential caching preference specified by
+ * <code>maySave</code> (used by {@link #userAllowedSave()}).
+ * Applications wanting to emulate the behavior of
+ * <code>--non-interactive</code> will implement this method in a
+ * manner which does not require user interaction (e.g. a no-op
+ * which assumes pre-cached auth credentials).
+ *
+ * @param realm The realm from which the question originates.
+ * @param username The name of the user in <code>realm</code>.
+ * @param maySave Whether caching of credentials is allowed.
+ * Usually affects the return value of the {@link
+ * #userAllowedSave()} method.
+ * @return Whether the prompt for authentication credentials was
+ * successful (e.g. in a GUI application whether the dialog box
+ * was canceled).
+ */
+ public boolean prompt(String realm, String username, boolean maySave);
+
+ /**
+ * Ask the user a question, and (usually) store the auth
+ * credential caching preference specified by <code>maySave</code>
+ * (used by {@link #userAllowedSave()}). Applications wanting to
+ * emulate the behavior of <code>--non-interactive</code> will
+ * implement this method in a manner which does not require user
+ * interaction (e.g. a no-op).
+ *
+ * @param realm The realm from which the question originates.
+ * @param question The text of the question.
+ * @param showAnswer Whether the answer may be displayed.
+ * @param maySave Whether caching of credentials is allowed.
+ * Usually affects the return value of the {@link
+ * #userAllowedSave()} method.
+ * @return answer as entered or null if canceled
+ */
+ public String askQuestion(String realm, String question,
+ boolean showAnswer, boolean maySave);
+
+ /**
+ * @return Whether the caller allowed caching of credentials the
+ * last time {@link #prompt(String, String, boolean)} was called.
+ * Applications wanting to emulate the behavior of
+ * <code>--no-auth-cache</code> will probably always return
+ * <code>false</code>.
+ */
+ public boolean userAllowedSave();
}