summaryrefslogtreecommitdiff
path: root/subversion/bindings/javahl/native/SVNClient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/bindings/javahl/native/SVNClient.cpp')
-rw-r--r--subversion/bindings/javahl/native/SVNClient.cpp494
1 files changed, 261 insertions, 233 deletions
diff --git a/subversion/bindings/javahl/native/SVNClient.cpp b/subversion/bindings/javahl/native/SVNClient.cpp
index 7cc31c2..4945cc7 100644
--- a/subversion/bindings/javahl/native/SVNClient.cpp
+++ b/subversion/bindings/javahl/native/SVNClient.cpp
@@ -35,6 +35,7 @@
#include "Revision.h"
#include "OutputStream.h"
#include "RevisionRange.h"
+#include "VersionExtended.h"
#include "BlameCallback.h"
#include "ProplistCallback.h"
#include "LogMessageCallback.h"
@@ -44,11 +45,13 @@
#include "StatusCallback.h"
#include "ChangelistCallback.h"
#include "ListCallback.h"
+#include "ImportFilterCallback.h"
#include "JNIByteArray.h"
#include "CommitMessage.h"
#include "EnumMapper.h"
#include "StringArray.h"
#include "RevpropTable.h"
+#include "DiffOptions.h"
#include "CreateJ.h"
#include "svn_auth.h"
#include "svn_dso.h"
@@ -70,7 +73,7 @@
SVNClient::SVNClient(jobject jthis_in)
- : context(jthis_in, pool), m_lastPath("", pool)
+ : m_lastPath("", pool), context(jthis_in, pool)
{
}
@@ -86,10 +89,45 @@ SVNClient *SVNClient::getCppObject(jobject jthis)
return (cppAddr == 0 ? NULL : reinterpret_cast<SVNClient *>(cppAddr));
}
-void SVNClient::dispose()
+void SVNClient::dispose(jobject jthis)
{
static jfieldID fid = 0;
- SVNBase::dispose(&fid, JAVA_PACKAGE"/SVNClient");
+ SVNBase::dispose(jthis, &fid, JAVA_PACKAGE"/SVNClient");
+}
+
+jobject SVNClient::getVersionExtended(bool verbose)
+{
+ JNIEnv *const env = JNIUtil::getEnv();
+
+ jclass clazz = env->FindClass(JAVA_PACKAGE"/types/VersionExtended");
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+
+ static volatile jmethodID ctor = 0;
+ if (!ctor)
+ {
+ ctor = env->GetMethodID(clazz, "<init>", "()V");
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+ }
+
+ static volatile jfieldID fid = 0;
+ if (!fid)
+ {
+ fid = env->GetFieldID(clazz, "cppAddr", "J");
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+ }
+
+ jobject j_ext_info = env->NewObject(clazz, ctor);
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+
+ VersionExtended *vx = new VersionExtended(verbose);
+ env->SetLongField(j_ext_info, fid, vx->getCppAddr());
+
+ env->DeleteLocalRef(clazz);
+ return j_ext_info;
}
jstring SVNClient::getAdminDirectoryName()
@@ -130,14 +168,15 @@ void SVNClient::list(const char *url, Revision &revision,
SVN_JNI_NULL_PTR_EX(url, "path or url", );
Path urlPath(url, subPool);
- SVN_JNI_ERR(urlPath.error_occured(), );
+ SVN_JNI_ERR(urlPath.error_occurred(), );
- SVN_JNI_ERR(svn_client_list2(urlPath.c_str(),
+ SVN_JNI_ERR(svn_client_list3(urlPath.c_str(),
pegRevision.revision(),
revision.revision(),
depth,
direntFields,
fetchLocks,
+ FALSE, // include_externals
ListCallback::callback,
callback,
ctx, subPool.getPool()), );
@@ -161,44 +200,32 @@ SVNClient::status(const char *path, svn_depth_t depth,
callback->setWcCtx(ctx->wc_ctx);
Path checkedPath(path, subPool);
- SVN_JNI_ERR(checkedPath.error_occured(), );
+ SVN_JNI_ERR(checkedPath.error_occurred(), );
rev.kind = svn_opt_revision_unspecified;
SVN_JNI_ERR(svn_client_status5(&youngest, ctx, checkedPath.c_str(),
&rev,
depth,
- getAll, onServer, noIgnore, FALSE,
- ignoreExternals,
+ getAll, onServer, noIgnore, ignoreExternals,
+ FALSE,
changelists.array(subPool),
StatusCallback::callback, callback,
subPool.getPool()), );
}
-void SVNClient::logMessages(const char *path, Revision &pegRevision,
- std::vector<RevisionRange> &logRanges,
- bool stopOnCopy, bool discoverPaths,
- bool includeMergedRevisions, StringArray &revProps,
- long limit, LogMessageCallback *callback)
+/* Convert a vector of revision ranges to an APR array of same. */
+static apr_array_header_t *
+rev_range_vector_to_apr_array(std::vector<RevisionRange> &revRanges,
+ SVN::Pool &subPool)
{
- SVN::Pool subPool(pool);
-
- SVN_JNI_NULL_PTR_EX(path, "path", );
-
- svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
- if (ctx == NULL)
- return;
-
- Targets target(path, subPool);
- const apr_array_header_t *targets = target.array(subPool);
- SVN_JNI_ERR(target.error_occured(), );
-
apr_array_header_t *ranges =
- apr_array_make(subPool.getPool(), logRanges.size(),
- sizeof(svn_opt_revision_range_t *));
+ apr_array_make(subPool.getPool(),
+ static_cast<int>(revRanges.size()),
+ sizeof(svn_opt_revision_range_t *));
std::vector<RevisionRange>::const_iterator it;
- for (it = logRanges.begin(); it != logRanges.end(); ++it)
+ for (it = revRanges.begin(); it != revRanges.end(); ++it)
{
if (it->toRange(subPool)->start.kind
== svn_opt_revision_unspecified
@@ -206,8 +233,8 @@ void SVNClient::logMessages(const char *path, Revision &pegRevision,
== svn_opt_revision_unspecified)
{
svn_opt_revision_range_t *range =
- (svn_opt_revision_range_t *)apr_pcalloc(subPool.getPool(),
- sizeof(*range));
+ reinterpret_cast<svn_opt_revision_range_t *>
+ (apr_pcalloc(subPool.getPool(), sizeof(*range)));
range->start.kind = svn_opt_revision_number;
range->start.value.number = 1;
range->end.kind = svn_opt_revision_head;
@@ -219,8 +246,33 @@ void SVNClient::logMessages(const char *path, Revision &pegRevision,
it->toRange(subPool);
}
if (JNIUtil::isExceptionThrown())
- return;
+ return NULL;
}
+ return ranges;
+}
+
+void SVNClient::logMessages(const char *path, Revision &pegRevision,
+ std::vector<RevisionRange> &logRanges,
+ bool stopOnCopy, bool discoverPaths,
+ bool includeMergedRevisions, StringArray &revProps,
+ long limit, LogMessageCallback *callback)
+{
+ SVN::Pool subPool(pool);
+
+ SVN_JNI_NULL_PTR_EX(path, "path", );
+
+ svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
+ if (ctx == NULL)
+ return;
+
+ Targets target(path, subPool);
+ const apr_array_header_t *targets = target.array(subPool);
+ SVN_JNI_ERR(target.error_occurred(), );
+
+ apr_array_header_t *ranges =
+ rev_range_vector_to_apr_array(logRanges, subPool);
+ if (JNIUtil::isExceptionThrown())
+ return;
SVN_JNI_ERR(svn_client_log5(targets, pegRevision.revision(), ranges,
limit, discoverPaths, stopOnCopy,
@@ -242,8 +294,8 @@ jlong SVNClient::checkout(const char *moduleName, const char *destPath,
Path url(moduleName, subPool);
Path path(destPath, subPool);
- SVN_JNI_ERR(url.error_occured(), -1);
- SVN_JNI_ERR(path.error_occured(), -1);
+ SVN_JNI_ERR(url.error_occurred(), -1);
+ SVN_JNI_ERR(path.error_occurred(), -1);
svn_revnum_t rev;
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
@@ -274,7 +326,7 @@ void SVNClient::remove(Targets &targets, CommitMessage *message, bool force,
return;
const apr_array_header_t *targets2 = targets.array(subPool);
- SVN_JNI_ERR(targets.error_occured(), );
+ SVN_JNI_ERR(targets.error_occurred(), );
SVN_JNI_ERR(svn_client_delete4(targets2, force, keep_local,
revprops.hash(subPool),
@@ -295,14 +347,15 @@ void SVNClient::revert(const char *path, svn_depth_t depth,
Targets target(path, subPool);
const apr_array_header_t *targets = target.array(subPool);
- SVN_JNI_ERR(target.error_occured(), );
+ SVN_JNI_ERR(target.error_occurred(), );
SVN_JNI_ERR(svn_client_revert2(targets, depth,
changelists.array(subPool), ctx,
subPool.getPool()), );
}
void SVNClient::add(const char *path,
- svn_depth_t depth, bool force, bool no_ignore,
+ svn_depth_t depth, bool force,
+ bool no_ignore, bool no_autoprops,
bool add_parents)
{
SVN::Pool subPool(pool);
@@ -310,13 +363,13 @@ void SVNClient::add(const char *path,
SVN_JNI_NULL_PTR_EX(path, "path", );
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), );
+ SVN_JNI_ERR(intPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
return;
- SVN_JNI_ERR(svn_client_add4(intPath.c_str(), depth, force,
- no_ignore, add_parents, ctx,
+ SVN_JNI_ERR(svn_client_add5(intPath.c_str(), depth, force,
+ no_ignore, no_autoprops, add_parents, ctx,
subPool.getPool()), );
}
@@ -333,7 +386,7 @@ jlongArray SVNClient::update(Targets &targets, Revision &revision,
return NULL;
const apr_array_header_t *array = targets.array(subPool);
- SVN_JNI_ERR(targets.error_occured(), NULL);
+ SVN_JNI_ERR(targets.error_occurred(), NULL);
SVN_JNI_ERR(svn_client_update4(&revs, array,
revision.revision(),
depth,
@@ -369,13 +422,16 @@ void SVNClient::commit(Targets &targets, CommitMessage *message,
{
SVN::Pool subPool(pool);
const apr_array_header_t *targets2 = targets.array(subPool);
- SVN_JNI_ERR(targets.error_occured(), );
+ SVN_JNI_ERR(targets.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(message, subPool);
if (ctx == NULL)
return;
- SVN_JNI_ERR(svn_client_commit5(targets2, depth,
- noUnlock, keepChangelist, TRUE,
+ SVN_JNI_ERR(svn_client_commit6(targets2, depth,
+ noUnlock, keepChangelist,
+ TRUE,
+ FALSE, // include_file_externals
+ FALSE, // include_dir_externals
changelists.array(subPool),
revprops.hash(subPool),
CommitCallback::callback, callback,
@@ -399,7 +455,7 @@ void SVNClient::copy(CopySources &copySources, const char *destPath,
}
SVN_JNI_NULL_PTR_EX(destPath, "destPath", );
Path destinationPath(destPath, subPool);
- SVN_JNI_ERR(destinationPath.error_occured(), );
+ SVN_JNI_ERR(destinationPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(message, subPool);
if (ctx == NULL)
@@ -414,24 +470,27 @@ void SVNClient::copy(CopySources &copySources, const char *destPath,
void SVNClient::move(Targets &srcPaths, const char *destPath,
CommitMessage *message, bool force, bool moveAsChild,
- bool makeParents, RevpropTable &revprops,
- CommitCallback *callback)
+ bool makeParents, bool metadataOnly, bool allowMixRev,
+ RevpropTable &revprops, CommitCallback *callback)
{
SVN::Pool subPool(pool);
const apr_array_header_t *srcs = srcPaths.array(subPool);
- SVN_JNI_ERR(srcPaths.error_occured(), );
+ SVN_JNI_ERR(srcPaths.error_occurred(), );
SVN_JNI_NULL_PTR_EX(destPath, "destPath", );
Path destinationPath(destPath, subPool);
- SVN_JNI_ERR(destinationPath.error_occured(), );
+ SVN_JNI_ERR(destinationPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(message, subPool);
if (ctx == NULL)
return;
- SVN_JNI_ERR(svn_client_move6((apr_array_header_t *) srcs,
+ SVN_JNI_ERR(svn_client_move7((apr_array_header_t *) srcs,
destinationPath.c_str(), moveAsChild,
- makeParents, revprops.hash(subPool),
+ makeParents,
+ allowMixRev,
+ metadataOnly,
+ revprops.hash(subPool),
CommitCallback::callback, callback, ctx,
subPool.getPool()), );
}
@@ -446,7 +505,7 @@ void SVNClient::mkdir(Targets &targets, CommitMessage *message,
return;
const apr_array_header_t *targets2 = targets.array(subPool);
- SVN_JNI_ERR(targets.error_occured(), );
+ SVN_JNI_ERR(targets.error_occurred(), );
SVN_JNI_ERR(svn_client_mkdir4(targets2, makeParents,
revprops.hash(subPool),
@@ -459,7 +518,7 @@ void SVNClient::cleanup(const char *path)
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path, "path", );
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), );
+ SVN_JNI_ERR(intPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
@@ -474,7 +533,7 @@ void SVNClient::resolve(const char *path, svn_depth_t depth,
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path, "path", );
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), );
+ SVN_JNI_ERR(intPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
return;
@@ -492,9 +551,9 @@ jlong SVNClient::doExport(const char *srcPath, const char *destPath,
SVN_JNI_NULL_PTR_EX(srcPath, "srcPath", -1);
SVN_JNI_NULL_PTR_EX(destPath, "destPath", -1);
Path sourcePath(srcPath, subPool);
- SVN_JNI_ERR(sourcePath.error_occured(), -1);
+ SVN_JNI_ERR(sourcePath.error_occurred(), -1);
Path destinationPath(destPath, subPool);
- SVN_JNI_ERR(destinationPath.error_occured(), -1);
+ SVN_JNI_ERR(destinationPath.error_occurred(), -1);
svn_revnum_t rev;
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
@@ -525,9 +584,9 @@ jlong SVNClient::doSwitch(const char *path, const char *url,
SVN_JNI_NULL_PTR_EX(path, "path", -1);
SVN_JNI_NULL_PTR_EX(url, "url", -1);
Path intUrl(url, subPool);
- SVN_JNI_ERR(intUrl.error_occured(), -1);
+ SVN_JNI_ERR(intUrl.error_occurred(), -1);
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), -1);
+ SVN_JNI_ERR(intPath.error_occurred(), -1);
svn_revnum_t rev;
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
@@ -552,25 +611,29 @@ jlong SVNClient::doSwitch(const char *path, const char *url,
void SVNClient::doImport(const char *path, const char *url,
CommitMessage *message, svn_depth_t depth,
- bool noIgnore, bool ignoreUnknownNodeTypes,
- RevpropTable &revprops, CommitCallback *callback)
+ bool noIgnore, bool noAutoProps,
+ bool ignoreUnknownNodeTypes,
+ RevpropTable &revprops,
+ ImportFilterCallback *ifCallback,
+ CommitCallback *commitCallback)
{
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path, "path", );
SVN_JNI_NULL_PTR_EX(url, "url", );
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), );
+ SVN_JNI_ERR(intPath.error_occurred(), );
Path intUrl(url, subPool);
- SVN_JNI_ERR(intUrl.error_occured(), );
+ SVN_JNI_ERR(intUrl.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(message, subPool);
if (ctx == NULL)
return;
- SVN_JNI_ERR(svn_client_import4(intPath.c_str(), intUrl.c_str(), depth,
- noIgnore, ignoreUnknownNodeTypes,
+ SVN_JNI_ERR(svn_client_import5(intPath.c_str(), intUrl.c_str(), depth,
+ noIgnore, noAutoProps, ignoreUnknownNodeTypes,
revprops.hash(subPool),
- CommitCallback::callback, callback,
+ ImportFilterCallback::callback, ifCallback,
+ CommitCallback::callback, commitCallback,
ctx, subPool.getPool()), );
}
@@ -593,87 +656,68 @@ SVNClient::suggestMergeSources(const char *path, Revision &pegRevision)
void SVNClient::merge(const char *path1, Revision &revision1,
const char *path2, Revision &revision2,
- const char *localPath, bool force, svn_depth_t depth,
- bool ignoreAncestry, bool dryRun, bool recordOnly)
+ const char *localPath, bool forceDelete, svn_depth_t depth,
+ bool ignoreMergeinfo, bool diffIgnoreAncestry,
+ bool dryRun, bool recordOnly)
{
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path1, "path1", );
SVN_JNI_NULL_PTR_EX(path2, "path2", );
SVN_JNI_NULL_PTR_EX(localPath, "localPath", );
Path intLocalPath(localPath, subPool);
- SVN_JNI_ERR(intLocalPath.error_occured(), );
+ SVN_JNI_ERR(intLocalPath.error_occurred(), );
Path srcPath1(path1, subPool);
- SVN_JNI_ERR(srcPath1.error_occured(), );
+ SVN_JNI_ERR(srcPath1.error_occurred(), );
Path srcPath2(path2, subPool);
- SVN_JNI_ERR(srcPath2.error_occured(), );
+ SVN_JNI_ERR(srcPath2.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
return;
- SVN_JNI_ERR(svn_client_merge4(srcPath1.c_str(), revision1.revision(),
+ SVN_JNI_ERR(svn_client_merge5(srcPath1.c_str(), revision1.revision(),
srcPath2.c_str(), revision2.revision(),
intLocalPath.c_str(),
depth,
- ignoreAncestry, force, recordOnly, dryRun,
+ ignoreMergeinfo, diffIgnoreAncestry,
+ forceDelete, recordOnly, dryRun,
TRUE, NULL, ctx, subPool.getPool()), );
}
void SVNClient::merge(const char *path, Revision &pegRevision,
- std::vector<RevisionRange> &rangesToMerge,
- const char *localPath, bool force, svn_depth_t depth,
- bool ignoreAncestry, bool dryRun, bool recordOnly)
+ std::vector<RevisionRange> *rangesToMerge,
+ const char *localPath, bool forceDelete, svn_depth_t depth,
+ bool ignoreMergeinfo, bool diffIgnoreAncestry,
+ bool dryRun, bool recordOnly)
{
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path, "path", );
SVN_JNI_NULL_PTR_EX(localPath, "localPath", );
Path intLocalPath(localPath, subPool);
- SVN_JNI_ERR(intLocalPath.error_occured(), );
+ SVN_JNI_ERR(intLocalPath.error_occurred(), );
Path srcPath(path, subPool);
- SVN_JNI_ERR(srcPath.error_occured(), );
+ SVN_JNI_ERR(srcPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
return;
apr_array_header_t *ranges =
- apr_array_make(subPool.getPool(), rangesToMerge.size(),
- sizeof(const svn_opt_revision_range_t *));
-
- std::vector<RevisionRange>::const_iterator it;
- for (it = rangesToMerge.begin(); it != rangesToMerge.end(); ++it)
- {
- if (it->toRange(subPool)->start.kind
- == svn_opt_revision_unspecified
- && it->toRange(subPool)->end.kind
- == svn_opt_revision_unspecified)
- {
- svn_opt_revision_range_t *range =
- (svn_opt_revision_range_t *)apr_pcalloc(subPool.getPool(),
- sizeof(*range));
- range->start.kind = svn_opt_revision_number;
- range->start.value.number = 1;
- range->end.kind = svn_opt_revision_head;
- APR_ARRAY_PUSH(ranges, const svn_opt_revision_range_t *) = range;
- }
- else
- {
- APR_ARRAY_PUSH(ranges, const svn_opt_revision_range_t *) =
- it->toRange(subPool);
- }
- if (JNIUtil::isExceptionThrown())
- return;
- }
+ (!rangesToMerge ? NULL
+ : rev_range_vector_to_apr_array(*rangesToMerge, subPool));
+ if (JNIUtil::isExceptionThrown())
+ return;
- SVN_JNI_ERR(svn_client_merge_peg4(srcPath.c_str(),
+ SVN_JNI_ERR(svn_client_merge_peg5(srcPath.c_str(),
ranges,
pegRevision.revision(),
intLocalPath.c_str(),
depth,
- ignoreAncestry, force, recordOnly,
+ ignoreMergeinfo, diffIgnoreAncestry,
+ forceDelete, recordOnly,
dryRun, TRUE, NULL, ctx,
subPool.getPool()), );
}
@@ -685,10 +729,10 @@ void SVNClient::mergeReintegrate(const char *path, Revision &pegRevision,
SVN_JNI_NULL_PTR_EX(path, "path", );
SVN_JNI_NULL_PTR_EX(localPath, "localPath", );
Path intLocalPath(localPath, subPool);
- SVN_JNI_ERR(intLocalPath.error_occured(), );
+ SVN_JNI_ERR(intLocalPath.error_occurred(), );
Path srcPath(path, subPool);
- SVN_JNI_ERR(srcPath.error_occured(), );
+ SVN_JNI_ERR(srcPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
@@ -713,7 +757,7 @@ SVNClient::getMergeinfo(const char *target, Revision &pegRevision)
svn_mergeinfo_t mergeinfo;
Path intLocalTarget(target, subPool);
- SVN_JNI_ERR(intLocalTarget.error_occured(), NULL);
+ SVN_JNI_ERR(intLocalTarget.error_occurred(), NULL);
SVN_JNI_ERR(svn_client_mergeinfo_get_merged(&mergeinfo,
intLocalTarget.c_str(),
pegRevision.revision(), ctx,
@@ -758,9 +802,10 @@ SVNClient::getMergeinfo(const char *target, Revision &pegRevision)
void *val;
apr_hash_this(hi, &path, NULL, &val);
- jstring jpath = JNIUtil::makeJString((const char *) path);
+ jstring jpath =
+ JNIUtil::makeJString(reinterpret_cast<const char *>(path));
jobject jranges =
- CreateJ::RevisionRangeList((apr_array_header_t *) val);
+ CreateJ::RevisionRangeList(reinterpret_cast<svn_rangelist_t *>(val));
env->CallVoidMethod(jmergeinfo, addRevisions, jpath, jranges);
@@ -777,6 +822,8 @@ void SVNClient::getMergeinfoLog(int type, const char *pathOrURL,
Revision &pegRevision,
const char *mergeSourceURL,
Revision &srcPegRevision,
+ Revision &srcStartRevision,
+ Revision &srcEndRevision,
bool discoverChangedPaths,
svn_depth_t depth,
StringArray &revProps,
@@ -790,24 +837,26 @@ void SVNClient::getMergeinfoLog(int type, const char *pathOrURL,
SVN_JNI_NULL_PTR_EX(pathOrURL, "path or url", );
Path urlPath(pathOrURL, subPool);
- SVN_JNI_ERR(urlPath.error_occured(), );
+ SVN_JNI_ERR(urlPath.error_occurred(), );
SVN_JNI_NULL_PTR_EX(mergeSourceURL, "merge source url", );
Path srcURL(mergeSourceURL, subPool);
- SVN_JNI_ERR(srcURL.error_occured(), );
-
- SVN_JNI_ERR(svn_client_mergeinfo_log((type == 1),
- urlPath.c_str(),
- pegRevision.revision(),
- srcURL.c_str(),
- srcPegRevision.revision(),
- LogMessageCallback::callback,
- callback,
- discoverChangedPaths,
- depth,
- revProps.array(subPool),
- ctx,
- subPool.getPool()), );
+ SVN_JNI_ERR(srcURL.error_occurred(), );
+
+ SVN_JNI_ERR(svn_client_mergeinfo_log2((type == 1),
+ urlPath.c_str(),
+ pegRevision.revision(),
+ srcURL.c_str(),
+ srcPegRevision.revision(),
+ srcStartRevision.revision(),
+ srcEndRevision.revision(),
+ LogMessageCallback::callback,
+ callback,
+ discoverChangedPaths,
+ depth,
+ revProps.array(subPool),
+ ctx,
+ subPool.getPool()), );
return;
}
@@ -816,23 +865,25 @@ void SVNClient::getMergeinfoLog(int type, const char *pathOrURL,
* Get a property.
*/
jbyteArray SVNClient::propertyGet(const char *path, const char *name,
- Revision &revision, Revision &pegRevision)
+ Revision &revision, Revision &pegRevision,
+ StringArray &changelists)
{
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path, "path", NULL);
SVN_JNI_NULL_PTR_EX(name, "name", NULL);
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), NULL);
+ SVN_JNI_ERR(intPath.error_occurred(), NULL);
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
return NULL;
apr_hash_t *props;
- SVN_JNI_ERR(svn_client_propget3(&props, name,
+ SVN_JNI_ERR(svn_client_propget5(&props, NULL, name,
intPath.c_str(), pegRevision.revision(),
revision.revision(), NULL, svn_depth_empty,
- NULL, ctx, subPool.getPool()),
+ changelists.array(subPool), ctx,
+ subPool.getPool(), subPool.getPool()),
NULL);
apr_hash_index_t *hi;
@@ -842,35 +893,34 @@ jbyteArray SVNClient::propertyGet(const char *path, const char *name,
return NULL; // no property with this name
svn_string_t *propval;
- apr_hash_this(hi, NULL, NULL, (void**)&propval);
+ apr_hash_this(hi, NULL, NULL, reinterpret_cast<void**>(&propval));
if (propval == NULL)
return NULL;
- return JNIUtil::makeJByteArray((const signed char *)propval->data,
- propval->len);
+ return JNIUtil::makeJByteArray(propval);
}
void SVNClient::properties(const char *path, Revision &revision,
Revision &pegRevision, svn_depth_t depth,
- StringArray &changelists, ProplistCallback *callback)
+ StringArray &changelists,
+ ProplistCallback *callback)
{
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path, "path", );
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), );
+ SVN_JNI_ERR(intPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
return;
- SVN_JNI_ERR(svn_client_proplist3(intPath.c_str(), pegRevision.revision(),
+ SVN_JNI_ERR(svn_client_proplist4(intPath.c_str(), pegRevision.revision(),
revision.revision(), depth,
changelists.array(subPool),
+ callback->inherited(),
ProplistCallback::callback, callback,
ctx, subPool.getPool()), );
-
- return;
}
void SVNClient::propertySetLocal(Targets &targets, const char *name,
@@ -884,8 +934,10 @@ void SVNClient::propertySetLocal(Targets &targets, const char *name,
if (value.isNull())
val = NULL;
else
- val = svn_string_ncreate((const char *)value.getBytes(), value.getLength(),
- subPool.getPool());
+ val = svn_string_ncreate
+ (reinterpret_cast<const char *>(value.getBytes()),
+ value.getLength(),
+ subPool.getPool());
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
@@ -912,11 +964,13 @@ void SVNClient::propertySetRemote(const char *path, long base_rev,
if (value.isNull())
val = NULL;
else
- val = svn_string_ncreate((const char *)value.getBytes(), value.getLength(),
- subPool.getPool());
+ val = svn_string_ncreate
+ (reinterpret_cast<const char *>(value.getBytes()),
+ value.getLength(),
+ subPool.getPool());
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), );
+ SVN_JNI_ERR(intPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(message, subPool);
if (ctx == NULL)
@@ -932,50 +986,35 @@ void SVNClient::propertySetRemote(const char *path, long base_rev,
void SVNClient::diff(const char *target1, Revision &revision1,
const char *target2, Revision &revision2,
Revision *pegRevision, const char *relativeToDir,
- const char *outfileName, svn_depth_t depth,
+ OutputStream &outputStream, svn_depth_t depth,
StringArray &changelists,
bool ignoreAncestry, bool noDiffDelete, bool force,
- bool showCopiesAsAdds)
+ bool showCopiesAsAdds, bool ignoreProps, bool propsOnly,
+ DiffOptions const& options)
{
- svn_error_t *err;
SVN::Pool subPool(pool);
const char *c_relToDir = relativeToDir ?
svn_dirent_canonicalize(relativeToDir, subPool.getPool()) :
relativeToDir;
+ bool noDiffAdded = false; /* ### Promote to argument */
SVN_JNI_NULL_PTR_EX(target1, "target", );
// target2 is ignored when pegRevision is provided.
if (pegRevision == NULL)
SVN_JNI_NULL_PTR_EX(target2, "target2", );
- SVN_JNI_NULL_PTR_EX(outfileName, "outfileName", );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
return;
Path path1(target1, subPool);
- SVN_JNI_ERR(path1.error_occured(), );
-
- apr_file_t *outfile = NULL;
- apr_status_t rv =
- apr_file_open(&outfile,
- svn_dirent_internal_style(outfileName,
- subPool.getPool()),
- APR_CREATE|APR_WRITE|APR_TRUNCATE , APR_OS_DEFAULT,
- subPool.getPool());
- if (rv != APR_SUCCESS)
- {
- SVN_JNI_ERR(svn_error_createf(rv, NULL, _("Cannot open file '%s'"),
- outfileName), );
- }
+ SVN_JNI_ERR(path1.error_occurred(), );
- // We don't use any options to diff.
- apr_array_header_t *diffOptions = apr_array_make(subPool.getPool(),
- 0, sizeof(char *));
+ apr_array_header_t *diffOptions = options.optionsArray(subPool);
if (pegRevision)
{
- err = svn_client_diff_peg5(diffOptions,
+ SVN_JNI_ERR(svn_client_diff_peg6(diffOptions,
path1.c_str(),
pegRevision->revision(),
revision1.revision(),
@@ -983,31 +1022,28 @@ void SVNClient::diff(const char *target1, Revision &revision1,
c_relToDir,
depth,
ignoreAncestry,
+ noDiffAdded,
noDiffDelete,
showCopiesAsAdds,
force,
- FALSE,
+ ignoreProps,
+ propsOnly,
+ options.useGitDiffFormat(),
SVN_APR_LOCALE_CHARSET,
- outfile,
+ outputStream.getStream(subPool),
NULL /* error file */,
changelists.array(subPool),
ctx,
- subPool.getPool());
+ subPool.getPool()),
+ );
}
else
{
// "Regular" diff (without a peg revision).
Path path2(target2, subPool);
- err = path2.error_occured();
- if (err)
- {
- if (outfile)
- goto cleanup;
-
- SVN_JNI_ERR(err, );
- }
+ SVN_JNI_ERR(path2.error_occurred(), );
- err = svn_client_diff5(diffOptions,
+ SVN_JNI_ERR(svn_client_diff6(diffOptions,
path1.c_str(),
revision1.revision(),
path2.c_str(),
@@ -1015,53 +1051,48 @@ void SVNClient::diff(const char *target1, Revision &revision1,
c_relToDir,
depth,
ignoreAncestry,
+ noDiffAdded,
noDiffDelete,
showCopiesAsAdds,
force,
- FALSE,
+ ignoreProps,
+ propsOnly,
+ options.useGitDiffFormat(),
SVN_APR_LOCALE_CHARSET,
- outfile,
- NULL /* error file */,
+ outputStream.getStream(subPool),
+ NULL /* error stream */,
changelists.array(subPool),
ctx,
- subPool.getPool());
+ subPool.getPool()),
+ );
}
-
-cleanup:
- rv = apr_file_close(outfile);
- if (rv != APR_SUCCESS)
- {
- svn_error_clear(err);
-
- SVN_JNI_ERR(svn_error_createf(rv, NULL, _("Cannot close file '%s'"),
- outfileName), );
- }
-
- SVN_JNI_ERR(err, );
}
void SVNClient::diff(const char *target1, Revision &revision1,
const char *target2, Revision &revision2,
- const char *relativeToDir, const char *outfileName,
+ const char *relativeToDir, OutputStream &outputStream,
svn_depth_t depth, StringArray &changelists,
bool ignoreAncestry, bool noDiffDelete, bool force,
- bool showCopiesAsAdds)
+ bool showCopiesAsAdds, bool ignoreProps, bool propsOnly,
+ DiffOptions const& options)
{
diff(target1, revision1, target2, revision2, NULL, relativeToDir,
- outfileName, depth, changelists, ignoreAncestry, noDiffDelete, force,
- showCopiesAsAdds);
+ outputStream, depth, changelists, ignoreAncestry, noDiffDelete, force,
+ showCopiesAsAdds, ignoreProps, propsOnly, options);
}
void SVNClient::diff(const char *target, Revision &pegRevision,
Revision &startRevision, Revision &endRevision,
- const char *relativeToDir, const char *outfileName,
+ const char *relativeToDir, OutputStream &outputStream,
svn_depth_t depth, StringArray &changelists,
bool ignoreAncestry, bool noDiffDelete, bool force,
- bool showCopiesAsAdds)
+ bool showCopiesAsAdds, bool ignoreProps, bool propsOnly,
+ DiffOptions const& options)
{
diff(target, startRevision, NULL, endRevision, &pegRevision,
- relativeToDir, outfileName, depth, changelists,
- ignoreAncestry, noDiffDelete, force, showCopiesAsAdds);
+ relativeToDir, outputStream, depth, changelists,
+ ignoreAncestry, noDiffDelete, force, showCopiesAsAdds,
+ ignoreProps, propsOnly, options);
}
void
@@ -1081,9 +1112,9 @@ SVNClient::diffSummarize(const char *target1, Revision &revision1,
return;
Path path1(target1, subPool);
- SVN_JNI_ERR(path1.error_occured(), );
+ SVN_JNI_ERR(path1.error_occurred(), );
Path path2(target2, subPool);
- SVN_JNI_ERR(path2.error_occured(), );
+ SVN_JNI_ERR(path2.error_occurred(), );
SVN_JNI_ERR(svn_client_diff_summarize2(path1.c_str(), revision1.revision(),
path2.c_str(), revision2.revision(),
@@ -1110,7 +1141,7 @@ SVNClient::diffSummarize(const char *target, Revision &pegRevision,
return;
Path path(target, subPool);
- SVN_JNI_ERR(path.error_occured(), );
+ SVN_JNI_ERR(path.error_occurred(), );
SVN_JNI_ERR(svn_client_diff_summarize_peg2(path.c_str(),
pegRevision.revision(),
@@ -1131,14 +1162,14 @@ void SVNClient::streamFileContent(const char *path, Revision &revision,
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path, "path", );
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), );
+ SVN_JNI_ERR(intPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
return;
SVN_JNI_ERR(svn_client_cat2(outputStream.getStream(subPool),
- path, pegRevision.revision(),
+ intPath.c_str(), pegRevision.revision(),
revision.revision(), ctx, subPool.getPool()),
);
}
@@ -1150,7 +1181,7 @@ jbyteArray SVNClient::revProperty(const char *path,
SVN_JNI_NULL_PTR_EX(path, "path", NULL);
SVN_JNI_NULL_PTR_EX(name, "name", NULL);
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), NULL);
+ SVN_JNI_ERR(intPath.error_occurred(), NULL);
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
@@ -1178,8 +1209,7 @@ jbyteArray SVNClient::revProperty(const char *path,
if (propval == NULL)
return NULL;
- return JNIUtil::makeJByteArray((const signed char *)propval->data,
- propval->len);
+ return JNIUtil::makeJByteArray(propval);
}
void SVNClient::relocate(const char *from, const char *to, const char *path,
bool ignoreExternals)
@@ -1189,13 +1219,13 @@ void SVNClient::relocate(const char *from, const char *to, const char *path,
SVN_JNI_NULL_PTR_EX(from, "from", );
SVN_JNI_NULL_PTR_EX(to, "to", );
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), );
+ SVN_JNI_ERR(intPath.error_occurred(), );
Path intFrom(from, subPool);
- SVN_JNI_ERR(intFrom.error_occured(), );
+ SVN_JNI_ERR(intFrom.error_occurred(), );
Path intTo(to, subPool);
- SVN_JNI_ERR(intTo.error_occured(), );
+ SVN_JNI_ERR(intTo.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
@@ -1213,21 +1243,19 @@ void SVNClient::blame(const char *path, Revision &pegRevision,
{
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path, "path", );
- apr_pool_t *pool = subPool.getPool();
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), );
+ SVN_JNI_ERR(intPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
return;
- SVN_JNI_ERR(svn_client_blame5(intPath.c_str(), pegRevision.revision(),
- revisionStart.revision(),
- revisionEnd.revision(),
- svn_diff_file_options_create(pool),
- ignoreMimeType, includeMergedRevisions,
- BlameCallback::callback, callback, ctx,
- pool),
+ SVN_JNI_ERR(svn_client_blame5(
+ intPath.c_str(), pegRevision.revision(), revisionStart.revision(),
+ revisionEnd.revision(),
+ svn_diff_file_options_create(subPool.getPool()), ignoreMimeType,
+ includeMergedRevisions, BlameCallback::callback, callback, ctx,
+ subPool.getPool()),
);
}
@@ -1238,7 +1266,7 @@ void SVNClient::addToChangelist(Targets &srcPaths, const char *changelist,
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
const apr_array_header_t *srcs = srcPaths.array(subPool);
- SVN_JNI_ERR(srcPaths.error_occured(), );
+ SVN_JNI_ERR(srcPaths.error_occurred(), );
SVN_JNI_ERR(svn_client_add_to_changelist(srcs, changelist, depth,
changelists.array(subPool),
@@ -1252,7 +1280,7 @@ void SVNClient::removeFromChangelists(Targets &srcPaths, svn_depth_t depth,
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
const apr_array_header_t *srcs = srcPaths.array(subPool);
- SVN_JNI_ERR(srcPaths.error_occured(), );
+ SVN_JNI_ERR(srcPaths.error_occurred(), );
SVN_JNI_ERR(svn_client_remove_from_changelists(srcs, depth,
changelists.array(subPool),
@@ -1278,7 +1306,7 @@ void SVNClient::lock(Targets &targets, const char *comment, bool force)
{
SVN::Pool subPool(pool);
const apr_array_header_t *targetsApr = targets.array(subPool);
- SVN_JNI_ERR(targets.error_occured(), );
+ SVN_JNI_ERR(targets.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
SVN_JNI_ERR(svn_client_lock(targetsApr, comment, force, ctx,
@@ -1290,10 +1318,10 @@ void SVNClient::unlock(Targets &targets, bool force)
SVN::Pool subPool(pool);
const apr_array_header_t *targetsApr = targets.array(subPool);
- SVN_JNI_ERR(targets.error_occured(), );
+ SVN_JNI_ERR(targets.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
- SVN_JNI_ERR(svn_client_unlock((apr_array_header_t*)targetsApr, force,
- ctx, subPool.getPool()), );
+ SVN_JNI_ERR(svn_client_unlock(
+ targetsApr, force, ctx, subPool.getPool()), );
}
void SVNClient::setRevProperty(const char *path,
const char *name, Revision &rev,
@@ -1304,7 +1332,7 @@ void SVNClient::setRevProperty(const char *path,
SVN_JNI_NULL_PTR_EX(path, "path", );
SVN_JNI_NULL_PTR_EX(name, "name", );
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), );
+ SVN_JNI_ERR(intPath.error_occurred(), );
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
if (ctx == NULL)
@@ -1342,7 +1370,7 @@ jstring SVNClient::getVersionInfo(const char *path, const char *trailUrl,
SVN_JNI_NULL_PTR_EX(path, "path", NULL);
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), NULL);
+ SVN_JNI_ERR(intPath.error_occurred(), NULL);
int wc_format;
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
@@ -1409,7 +1437,7 @@ void SVNClient::upgrade(const char *path)
return;
Path checkedPath(path, subPool);
- SVN_JNI_ERR(checkedPath.error_occured(), );
+ SVN_JNI_ERR(checkedPath.error_occurred(), );
SVN_JNI_ERR(svn_client_upgrade(path, ctx, subPool.getPool()), );
}
@@ -1420,7 +1448,7 @@ jobject SVNClient::revProperties(const char *path, Revision &revision)
SVN::Pool subPool(pool);
SVN_JNI_NULL_PTR_EX(path, "path", NULL);
Path intPath(path, subPool);
- SVN_JNI_ERR(intPath.error_occured(), NULL);
+ SVN_JNI_ERR(intPath.error_occurred(), NULL);
svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
const char *URL;
@@ -1459,7 +1487,7 @@ SVNClient::info2(const char *path, Revision &revision, Revision &pegRevision,
return;
Path checkedPath(path, subPool);
- SVN_JNI_ERR(checkedPath.error_occured(), );
+ SVN_JNI_ERR(checkedPath.error_occurred(), );
SVN_JNI_ERR(svn_client_info3(checkedPath.c_str(),
pegRevision.revision(),
@@ -1484,9 +1512,9 @@ SVNClient::patch(const char *patchPath, const char *targetPath, bool dryRun,
return;
Path checkedPatchPath(patchPath, subPool);
- SVN_JNI_ERR(checkedPatchPath.error_occured(), );
+ SVN_JNI_ERR(checkedPatchPath.error_occurred(), );
Path checkedTargetPath(targetPath, subPool);
- SVN_JNI_ERR(checkedTargetPath.error_occured(), );
+ SVN_JNI_ERR(checkedTargetPath.error_occurred(), );
// Should parameterize the following, instead of defaulting to FALSE
SVN_JNI_ERR(svn_client_patch(checkedPatchPath.c_str(),