subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1553254 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/ tests/org/apache/subversion/javahl/
Date Tue, 24 Dec 2013 06:37:14 GMT
Author: brane
Date: Tue Dec 24 06:37:13 2013
New Revision: 1553254

URL: http://svn.apache.org/r1553254
Log:
Fixed a bug in JavaHL's ISVNClient.getChangelists; it was lobotomized to
ignore the difference between a NULL and an empty changelist name array.

[in subversion/bindings/javahl]
* src/org/apache/subversion/javahl/ISVNClient.java
  (ISVNClient.getChangelists): Updated docstring.

* native/SVNClient.h (SVNClient::getChangelists):
   Changed the 'changelists' parameter to a pointer instead of a reference.
* native/SVNClient.cpp (SVNClient::getChangelists):
   Preserved semantics of NULL changelist array.
* native/org_apache_subversion_javahl_SVNClient.cpp
  (Java_org_apache_subversion_javahl_SVNClient_getChaangelists): Ditto.

* tests/org/apache/subversion/javahl/BasicTests.java
  (BasicTests.MyChangelistCallback):
   Maintain a set of all non-null changelists seen by the callback.
  (BasicTests.testGetAllChangelists): New test case.

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/tests/org/apache/subversion/javahl/BasicTests.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=1553254&r1=1553253&r2=1553254&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Tue Dec 24 06:37:13 2013
@@ -1234,15 +1234,17 @@ void SVNClient::removeFromChangelists(Ta
 }
 
 void SVNClient::getChangelists(const char *rootPath,
-                               StringArray &changelists,
+                               StringArray *changelists,
                                svn_depth_t depth,
                                ChangelistCallback *callback)
 {
     SVN::Pool subPool(pool);
     svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
 
-    SVN_JNI_ERR(svn_client_get_changelists(rootPath,
-                                           changelists.array(subPool),
+    const apr_array_header_t *cl_array = (!changelists ? NULL
+                                          : changelists->array(subPool));
+
+    SVN_JNI_ERR(svn_client_get_changelists(rootPath, cl_array,
                                            depth, ChangelistCallback::callback,
                                            callback, 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=1553254&r1=1553253&r2=1553254&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.h Tue Dec 24 06:37:13 2013
@@ -167,7 +167,7 @@ class SVNClient :public SVNBase
                        svn_depth_t depth, StringArray &changelists);
   void removeFromChangelists(Targets &srcPaths, svn_depth_t depth,
                              StringArray &changelists);
-  void getChangelists(const char *path, StringArray &changelists,
+  void getChangelists(const char *path, StringArray *changelists,
                       svn_depth_t depth, ChangelistCallback *callback);
   void status(const char *path, svn_depth_t depth, bool onServer,
               bool getAll, bool noIgnore, bool ignoreExternals,

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=1553254&r1=1553253&r2=1553254&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
Tue Dec 24 06:37:13 2013
@@ -1786,8 +1786,9 @@ Java_org_apache_subversion_javahl_SVNCli
     return;
 
   ChangelistCallback callback(jchangelistCallback);
-  cl->getChangelists(root_path, changelists, EnumMapper::toDepth(jdepth),
-                     &callback);
+  cl->getChangelists(root_path,
+                     (jchangelists ? &changelists : NULL),
+                     EnumMapper::toDepth(jdepth), &callback);
 }
 
 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=1553254&r1=1553253&r2=1553254&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
Tue Dec 24 06:37:13 2013
@@ -1222,7 +1222,8 @@ public interface ISVNClient
     /**
      * Recursively get the paths which belong to a changelist
      * @param rootPath    the wc path under which to check
-     * @param changelists the changelists to look under
+     * @param changelists the changelists to look under;
+     *     if <code>null</code>, all changelists will be considered.
      * @param depth       the depth to recurse
      * @param callback    the callback to return the changelists through
      */

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=1553254&r1=1553253&r2=1553254&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Tue Dec 24 06:37:13 2013
@@ -2346,6 +2346,33 @@ public class BasicTests extends SVNTests
         assertTrue(clCallback.isEmpty());
     }
 
+    public void testGetAllChangelists() throws Throwable
+    {
+        OneTest thisTest = new OneTest();
+        final String cl1 = "changelist_one";
+        final String cl2 = "changelist_too";
+        MyChangelistCallback clCallback = new MyChangelistCallback();
+
+        String path = fileToSVNPath(new File(thisTest.getWCPath(), "iota"),
+                                    true);
+        Set<String> paths = new HashSet<String>(1);
+        paths.add(path);
+        client.addToChangelist(paths, cl1, Depth.infinity, null);
+        paths.remove(path);
+
+        path = fileToSVNPath(new File(thisTest.getWCPath(), "A/B/lambda"),
+                             true);
+        paths.add(path);
+        client.addToChangelist(paths, cl2, Depth.infinity, null);
+
+        client.getChangelists(thisTest.getWCPath(), null,
+                              Depth.infinity, clCallback);
+        Collection<String> changelists = clCallback.getChangelists();
+        assertEquals(2, changelists.size());
+        assertTrue("Contains " + cl1, changelists.contains(cl1));
+        assertTrue("Contains " + cl2, changelists.contains(cl2));
+    }
+
     /**
      * Helper method for testing mergeinfo retrieval.  Assumes
      * that <code>targetPath</code> has both merge history and
@@ -3993,8 +4020,13 @@ public class BasicTests extends SVNTests
     {
         private static final long serialVersionUID = 1L;
 
+        private HashSet<String> allChangelists = new HashSet<String>();
+
         public void doChangelist(String path, String changelist)
         {
+            if (changelist != null)
+                allChangelists.add(changelist);
+
             path = fileToSVNPath(new File(path), true);
             if (super.containsKey(path))
             {
@@ -4015,6 +4047,11 @@ public class BasicTests extends SVNTests
         {
             return super.get(path);
         }
+
+        public Collection<String> getChangelists()
+        {
+            return allChangelists;
+        }
     }
 
     private class MyInfoCallback implements InfoCallback {



Mime
View raw message