Author: cmpilato
Date: Wed Mar 30 17:23:37 2011
New Revision: 1087023

URL: http://svn.apache.org/viewvc?rev=1087023&view=rev
Log:
Followup to r1087015, updating the Java bindings in light of C API
changes.  This is for issue #3848 ("'svn switch' should protect users
from unintended switches").

* subversion/bindings/javahl/native/SVNClient.h,
* subversion/bindings/javahl/native/SVNClient.cpp
  (SVNClient::doSwitch): Add 'ignoreAncestry' parameter, and now use
    svn_client_switch3().

* subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
  (Java_org_apache_subversion_javahl_SVNClient_doSwitch): Add
    'jignoreAncestry' parameter, and update call to SVNClient::doSwitch().

* subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
  (SVNClient.doSwitch): Add 'ignoreAncestry' parameter.

* subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
  (ISVNClient.doSwitch): Add 'ignoreAncestry' parameter.

* subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
  (SVNClient.doSwitch): Add new form of this, deprecating the previous one.

* subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
  (BasicTests.testBasicSwitch): Update call to doSwitch().

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
    
subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.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=1087023&r1=1087022&r2=1087023&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Wed Mar 30 
17:23:37 2011
@@ -517,7 +517,8 @@ jlong SVNClient::doSwitch(const char *pa
                           Revision &revision, Revision &pegRevision,
                           svn_depth_t depth, bool depthIsSticky,
                           bool ignoreExternals,
-                          bool allowUnverObstructions)
+                          bool allowUnverObstructions,
+                          bool ignoreAncestry)
 {
     SVN::Pool requestPool;
     SVN_JNI_NULL_PTR_EX(path, "path", -1);
@@ -532,7 +533,7 @@ jlong SVNClient::doSwitch(const char *pa
     if (ctx == NULL)
         return -1;
 
-    SVN_JNI_ERR(svn_client_switch2(&rev, intPath.c_str(),
+    SVN_JNI_ERR(svn_client_switch3(&rev, intPath.c_str(),
                                    intUrl.c_str(),
                                    pegRevision.revision(),
                                    revision.revision(),
@@ -540,6 +541,7 @@ jlong SVNClient::doSwitch(const char *pa
                                    depthIsSticky,
                                    ignoreExternals,
                                    allowUnverObstructions,
+                                   ignoreAncestry,
                                    ctx,
                                    requestPool.pool()),
                 -1);

Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.h?rev=1087023&r1=1087022&r2=1087023&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.h Wed Mar 30 
17:23:37 2011
@@ -107,7 +107,7 @@ class SVNClient :public SVNBase
   jlong doSwitch(const char *path, const char *url, Revision &revision,
                  Revision &pegRevision, svn_depth_t depth,
                  bool depthIsSticky, bool ignoreExternals,
-                 bool allowUnverObstructions);
+                 bool allowUnverObstructions, bool ignoreAncestry);
   jlong doExport(const char *srcPath, const char *destPath,
                  Revision &revision, Revision &pegRevision, bool force,
                  bool ignoreExternals, svn_depth_t depth,

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=1087023&r1=1087022&r2=1087023&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
 Wed Mar 30 17:23:37 2011
@@ -669,7 +669,8 @@ JNIEXPORT jlong JNICALL
 Java_org_apache_subversion_javahl_SVNClient_doSwitch
 (JNIEnv *env, jobject jthis, jstring jpath, jstring jurl, jobject jrevision,
  jobject jPegRevision, jobject jdepth, jboolean jdepthIsSticky,
- jboolean jignoreExternals, jboolean jallowUnverObstructions)
+ jboolean jignoreExternals, jboolean jallowUnverObstructions,
+ jboolean jignoreAncestry)
 {
   JNIEntry(SVNClient, doSwitch);
   SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -698,7 +699,8 @@ Java_org_apache_subversion_javahl_SVNCli
                       EnumMapper::toDepth(jdepth),
                       jdepthIsSticky ? true : false,
                       jignoreExternals ? true : false,
-                      jallowUnverObstructions ? true : false);
+                      jallowUnverObstructions ? true : false,
+                      jignoreAncestry ? true : false);
 }
 
 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=1087023&r1=1087022&r2=1087023&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
 Wed Mar 30 17:23:37 2011
@@ -398,12 +398,15 @@ public interface ISVNClient
      *                      then also set the ambient depth value to depth.
      * @param ignoreExternals whether to process externals definitions
      * @param allowUnverObstructions allow unversioned paths that obstruct adds
+     * @param ignoreAncestry whether to skip common ancestry sanity check 
between
+                             <code>path</code> and <code>url</code>
      * @throws ClientException
-     * @since 1.5
+     * @since 1.7
      */
     long doSwitch(String path, String url, Revision revision,
                   Revision pegRevision, Depth depth, boolean depthIsSticky,
-                  boolean ignoreExternals, boolean allowUnverObstructions)
+                  boolean ignoreExternals, boolean allowUnverObstructions,
+                  boolean ignoreAncestry)
             throws ClientException;
 
     /**

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=1087023&r1=1087022&r2=1087023&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
 Wed Mar 30 17:23:37 2011
@@ -296,7 +296,8 @@ public class SVNClient implements ISVNCl
     public native long doSwitch(String path, String url, Revision revision,
                                 Revision pegRevision, Depth depth,
                                 boolean depthIsSticky, boolean ignoreExternals,
-                                boolean allowUnverObstructions)
+                                boolean allowUnverObstructions,
+                                boolean ignoreAncestry)
             throws ClientException;
 
     /**

Modified: 
subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java?rev=1087023&r1=1087022&r2=1087023&view=diff
==============================================================================
--- 
subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
 (original)
+++ 
subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
 Wed Mar 30 17:23:37 2011
@@ -1226,6 +1226,9 @@ public class SVNClient implements SVNCli
     }
 
     /**
+     * @deprecated Use {@link #doSwitch(String, String, Revision, Revision,
+     *                                  int, boolean, boolean, boolean,
+     *                                  boolean)} instead.
      * @since 1.5
      */
     public long doSwitch(String path, String url, Revision revision,
@@ -1234,13 +1237,27 @@ public class SVNClient implements SVNCli
                          boolean allowUnverObstructions)
             throws ClientException
     {
+        return doSwitch(path, url, revision, pegRevision, depth, depthIsSticky,
+                        ignoreExternals, allowUnverObstructions, true);
+    }
+
+    /**
+     * @since 1.7
+     */
+    public long doSwitch(String path, String url, Revision revision,
+                         Revision pegRevision, int depth,
+                         boolean depthIsSticky, boolean ignoreExternals,
+                         boolean allowUnverObstructions,
+                         boolean ignoreAncestry)
+            throws ClientException
+    {
         try
         {
             return aSVNClient.doSwitch(path, url,
                           revision == null ? null : revision.toApache(),
                           pegRevision == null ? null : pegRevision.toApache(),
                           Depth.toADepth(depth), depthIsSticky, 
ignoreExternals,
-                          allowUnverObstructions);
+                          allowUnverObstructions, ignoreAncestry);
         }
         catch (org.apache.subversion.javahl.ClientException ex)
         {

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=1087023&r1=1087022&r2=1087023&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
 Wed Mar 30 17:23:37 2011
@@ -1331,7 +1331,7 @@ public class BasicTests extends SVNTests
                 greekWC.getItemContent("A/D/gamma"));
         thisTest.getWc().setItemIsSwitched("iota", true);
         client.doSwitch(iotaPath, gammaUrl, null, Revision.HEAD, Depth.unknown,
-                false, false, false);
+                        false, false, false, true);
 
         // check the status of the working copy
         thisTest.checkStatus();
@@ -1350,7 +1350,7 @@ public class BasicTests extends SVNTests
         thisTest.getWc().addItem("A/D/H/tau",
                 thisTest.getWc().getItemContent("A/D/G/tau"));
         client.doSwitch(adhPath, adgURL, null, Revision.HEAD, Depth.files,
-                false, false, false);
+                        false, false, false, true);
 
         // check the status of the working copy
         thisTest.checkStatus();


Reply via email to