[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] SVNClient::suggestMergeSources()

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2007-08-27 19:57:34 CEST

I dunno nuttin' 'bout wrapping no APIs in Java, but here's a patch that's
basically a copy-n-paste-n-tweak of a similarly typed API which proports to
expose svn_client_suggest_merge_sources() in JavaHL.

-- 
C. Michael Pilato <cmpilato@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Implement svn_client_suggest_merge_sources for JavaHL.

* subversion/bindings/javahl/native/SVNClient.h,
* subversion/bindings/javahl/native/SVNClient.cpp
  (SVNClient::suggestMergeSources): New member function.

* subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
  SVNClient.suggestMergeSources): New member function.

Index: subversion/bindings/javahl/native/SVNClient.h
===================================================================
--- subversion/bindings/javahl/native/SVNClient.h (revision 26335)
+++ subversion/bindings/javahl/native/SVNClient.h (working copy)
@@ -88,6 +88,7 @@
                   Revision &pegRevision, svn_depth_t depth,
                   ProplistCallback *callback);
   jobject getMergeInfo(const char *target, Revision &rev);
+ jobjectArray suggestMergeSources(const char *path);
   void merge(const char *path1, Revision &revision1, const char *path2,
              Revision &revision2, const char *localPath, bool force,
              svn_depth_t depth, bool ignoreAncestry, bool dryRun);
Index: subversion/bindings/javahl/native/SVNClient.cpp
===================================================================
--- subversion/bindings/javahl/native/SVNClient.cpp (revision 26335)
+++ subversion/bindings/javahl/native/SVNClient.cpp (working copy)
@@ -570,6 +570,35 @@
                                   requestPool.pool()), );
 }
 
+jobjectArray SVNClient::suggestMergeSources(const char *path)
+{
+ Pool requestPool;
+ svn_client_ctx_t *ctx = getContext(NULL);
+ apr_array_header_t *sources;
+
+ SVN_JNI_ERR(svn_client_suggest_merge_sources(&sources, path,
+ ctx, requestPool.pool()),
+ NULL);
+
+ JNIEnv *env = JNIUtil::getEnv();
+ jclass clazz = env->FindClass("java/lang/String");
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+
+ jobjectArray ret = env->NewObjectArray(sources->nelts, clazz, NULL);
+ for (int i = 0; i < sources->nelts; ++i)
+ {
+ const char *source = APR_ARRAY_IDX(sources, i, const char *);
+ jstring jpath = JNIUtil::makeJString(source);
+
+ env->SetObjectArrayElement(ret, i, jpath);
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+ }
+
+ return ret;
+}
+
 void SVNClient::merge(const char *path1, Revision &revision1,
                       const char *path2, Revision &revision2,
                       const char *localPath, bool force, svn_depth_t depth,
Index: subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
===================================================================
--- subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java (revision 26335)
+++ subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java (working copy)
@@ -890,6 +890,14 @@
             throws ClientException;
 
     /**
+ * Return an ordered list of suggested merge source URLs.
+ * @param path the merge target path for which to suggest sources
+ * @throws ClientException
+ */
+ public native String[] suggestMergeSources(String path)
+ throws ClientException;
+
+ /**
      * Merge changes from two paths into a new local path.
      * @param path1 first path or url
      * @param revision1 first revision

Received on Mon Aug 27 19:58:56 2007

This is an archived mail posted to the Subversion Dev mailing list.