You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/02/24 22:56:01 UTC

svn commit: r1571461 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/

Author: brane
Date: Mon Feb 24 21:56:01 2014
New Revision: 1571461

URL: http://svn.apache.org/r1571461
Log:
In JavaHL, add a variant of the ISVNClient.revert() method that
takes a set of paths to operate on, instead of just a single path.

[in subversion/bindings/javahl]

* src/org/apache/subversion/javahl/ISVNClient.java
  (ISVNClient.revert): Added an overload that accepts a set of paths.
* src/org/apache/subversion/javahl/SVNClient.java:
   Import java.util.Collections.
  (ISVNClient.revert): Make the native method accept a set of paths.
   Implement the single-path overload as a wrapper.

* native/SVNClient.h (SVNClient::revert): Accept an array of paths.
* native/SVNClient.cpp (SVNClient::revert): Same here.
* native/org_apache_subversion_javahl_SVNClient.cpp
  (Java_org_apache_subversion_javahl_SVNClient_revert): And here.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
    subversion/trunk/subversion/bindings/javahl/native/SVNClient.h
    subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java

Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=1571461&r1=1571460&r2=1571461&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Mon Feb 24 21:56:01 2014
@@ -337,21 +337,18 @@ void SVNClient::remove(Targets &targets,
                                    ctx, subPool.getPool()), );
 }
 
-void SVNClient::revert(const char *path, svn_depth_t depth,
+void SVNClient::revert(StringArray &paths, svn_depth_t depth,
                        StringArray &changelists)
 {
     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(), );
-    SVN_JNI_ERR(svn_client_revert2(targets, depth,
+    Targets targets(paths, subPool);
+    SVN_JNI_ERR(targets.error_occurred(), );
+    SVN_JNI_ERR(svn_client_revert2(targets.array(subPool), depth,
                                    changelists.array(subPool), ctx,
                                    subPool.getPool()), );
 }

Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.h?rev=1571461&r1=1571460&r2=1571461&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.h Mon Feb 24 21:56:01 2014
@@ -148,7 +148,7 @@ class SVNClient :public SVNBase
                     bool allowUnverObstructions);
   void add(const char *path, svn_depth_t depth, bool force,
            bool no_ignore, bool no_autoprops, bool add_parents);
-  void revert(const char *path, svn_depth_t depth, StringArray &changelists);
+  void revert(StringArray &paths, svn_depth_t depth, StringArray &changelists);
   void remove(Targets &targets, CommitMessage *message, bool force,
               bool keep_local, PropertyTable &revprops,
               CommitCallback *callback);

Modified: subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1571461&r1=1571460&r2=1571461&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Mon Feb 24 21:56:01 2014
@@ -410,7 +410,7 @@ Java_org_apache_subversion_javahl_SVNCli
 
 JNIEXPORT void JNICALL
 Java_org_apache_subversion_javahl_SVNClient_revert
-(JNIEnv *env, jobject jthis, jstring jpath, jobject jdepth,
+(JNIEnv *env, jobject jthis, jobject jpaths, jobject jdepth,
  jobject jchangelists)
 {
   JNIEntry(SVNClient, revert);
@@ -420,7 +420,9 @@ Java_org_apache_subversion_javahl_SVNCli
       JNIUtil::throwError(_("bad C++ this"));
       return;
     }
-  JNIStringHolder path(jpath);
+
+  SVN_JNI_NULL_PTR_EX(jpaths, "paths", );
+  StringArray paths(jpaths);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -428,7 +430,7 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return;
 
-  cl->revert(path, EnumMapper::toDepth(jdepth), changelists);
+  cl->revert(paths, EnumMapper::toDepth(jdepth), changelists);
 }
 
 JNIEXPORT void JNICALL

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=1571461&r1=1571460&r2=1571461&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java Mon Feb 24 21:56:01 2014
@@ -221,6 +221,17 @@ public interface ISVNClient
             throws ClientException;
 
     /**
+     * Reverts set of files or directories to a pristine state.
+     * @param path      A set of paths to revert.
+     * @param depth     the depth to recurse into subdirectories
+     * @param changelists changelists to filter by
+     * @throws ClientException
+     * @since 1.9
+     */
+    void revert(Set<String> paths, Depth depth, Collection<String> changelists)
+            throws ClientException;
+
+    /**
      * Reverts a file to a pristine state.
      * @param path      path of the file.
      * @param depth     the depth to recurse into subdirectories

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1571461&r1=1571460&r2=1571461&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Mon Feb 24 21:56:01 2014
@@ -32,6 +32,7 @@ import java.io.FileNotFoundException;
 import java.io.ByteArrayOutputStream;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Set;
 import java.util.List;
 import java.util.Map;
@@ -175,10 +176,17 @@ public class SVNClient implements ISVNCl
                               CommitMessageCallback handler, CommitCallback callback)
             throws ClientException;
 
-    public native void revert(String path, Depth depth,
+    public native void revert(Set<String> paths, Depth depth,
                               Collection<String> changelists)
             throws ClientException;
 
+    public void revert(String path, Depth depth,
+                       Collection<String> changelists)
+            throws ClientException
+    {
+        revert(Collections.singleton(path), depth, changelists);
+    }
+
     public native void add(String path, Depth depth, boolean force,
                            boolean noIgnores, boolean noAutoProps,
                            boolean addParents)