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/06/21 20:47:03 UTC

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

Author: brane
Date: Sat Jun 21 18:47:02 2014
New Revision: 1604449

URL: http://svn.apache.org/r1604449
Log:
Finalize the JavaHL API changes for 1.9.

[in subversion/bindings/javahl]
* src/org/apache/subversion/javahl/ISVNClient.java,
  src/org/apache/subversion/javahl/SVNClient.java
  (ISVNClient.info2): Remove the overload that was added on trunk and then
   replaced by ISVNClient.info.
  (ISVNClient.cleanup): Add new overload that matches svn_client_cleanup2.
  (ISVNClient.vacuum): New function, matches svn_client_vacuum.

* native/SVNClient.h, native/SVNClient.cpp
  (SVNClient::cleanup): Update prototype and implementation.
  (SVNClient::vacuum): New method.

* native/org_apache_subversion_javahl_SVNClient.cpp
  (Java_org_apache_subversion_javahl_SVNClient_cleanup):
   Update native method wrapper implementation.
  (Java_org_apache_subversion_javahl_SVNClient_vacuum):
   Implement native method wrapper.

* tests/org/apache/subversion/javahl/BasicTests.java
  (BasicTests.collectInfos): Use ISVNClient.info instead of ISVNClient.info2.

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/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=1604449&r1=1604448&r2=1604449&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Sat Jun 21 18:47:02 2014
@@ -510,7 +510,12 @@ void SVNClient::mkdir(Targets &targets, 
                                   ctx, subPool.getPool()), );
 }
 
-void SVNClient::cleanup(const char *path)
+void SVNClient::cleanup(const char *path,
+                        bool break_locks,
+                        bool fix_recorded_timestamps,
+                        bool clear_dav_cache,
+                        bool remove_unused_pristines,
+                        bool include_externals)
 {
     SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
@@ -521,7 +526,13 @@ void SVNClient::cleanup(const char *path
     if (ctx == NULL)
         return;
 
-    SVN_JNI_ERR(svn_client_cleanup(intPath.c_str(), ctx, subPool.getPool()),);
+    SVN_JNI_ERR(svn_client_cleanup2(intPath.c_str(),
+                                    break_locks,
+                                    fix_recorded_timestamps,
+                                    clear_dav_cache,
+                                    remove_unused_pristines,
+                                    include_externals,
+                                    ctx, subPool.getPool()),);
 }
 
 void SVNClient::resolve(const char *path, svn_depth_t depth,
@@ -1479,6 +1490,29 @@ SVNClient::patch(const char *patchPath, 
                                  ctx, subPool.getPool()), );
 }
 
+void SVNClient::vacuum(const char *path,
+                       bool remove_unversioned_items,
+                       bool remove_ignored_items,
+                       bool fix_recorded_timestamps,
+                       bool remove_unused_pristines,
+                       bool include_externals)
+{
+    SVN_JNI_NULL_PTR_EX(path, "path", );
+
+    SVN::Pool subPool(pool);
+    svn_client_ctx_t *ctx = context.getContext(NULL, subPool);
+    if (ctx == NULL)
+        return;
+
+    SVN_JNI_ERR(svn_client_vacuum(path,
+                                  remove_unversioned_items,
+                                  remove_ignored_items,
+                                  fix_recorded_timestamps,
+                                  remove_unused_pristines,
+                                  include_externals,
+                                  ctx, subPool.getPool()), );
+}
+
 jobject
 SVNClient::openRemoteSession(const char* path, int retryAttempts)
 {

Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.h?rev=1604449&r1=1604448&r2=1604449&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.h Sat Jun 21 18:47:02 2014
@@ -63,6 +63,10 @@ class SVNClient :public SVNBase
 {
  public:
   jobject openRemoteSession(const char* path, int);
+  void vacuum(const char *path,
+              bool remove_unversioned_items, bool remove_ignored_items,
+              bool fix_recorded_timestamps, bool remove_unused_pristines,
+              bool include_externals);
   void patch(const char *patchPath, const char *targetPath, bool dryRun,
              int stripCount, bool reverse, bool ignoreWhitespace,
              bool removeTempfiles, PatchCallback *callback);
@@ -131,7 +135,12 @@ class SVNClient :public SVNBase
                  svn_depth_t depth, const char *nativeEOL);
   void resolve(const char *path, svn_depth_t depth,
                svn_wc_conflict_choice_t choice);
-  void cleanup(const char *path);
+  void cleanup(const char *path,
+               bool break_locks,
+               bool fix_recorded_timestamps,
+               bool clear_dav_cache,
+               bool remove_unused_pristines,
+               bool include_externals);
   void mkdir(Targets &targets, CommitMessage *message, bool makeParents,
              PropertyTable &revprops, CommitCallback *callback);
   void move(Targets &srcPaths, const char *destPath,

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=1604449&r1=1604448&r2=1604449&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 Sat Jun 21 18:47:02 2014
@@ -667,7 +667,10 @@ Java_org_apache_subversion_javahl_SVNCli
 
 JNIEXPORT void JNICALL
 Java_org_apache_subversion_javahl_SVNClient_cleanup
-(JNIEnv *env, jobject jthis, jstring jpath)
+(JNIEnv *env, jobject jthis, jstring jpath,
+ jboolean jbreakLocks, jboolean jfixRecordedTimestamps,
+ jboolean jclearDavCache, jboolean jremoveUnusedPristines,
+ jboolean jincludeExternals)
 {
   JNIEntry(SVNClient, cleanup);
   SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -680,7 +683,9 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return;
 
-  cl->cleanup(path);
+  cl->cleanup(path, jbreakLocks, jfixRecordedTimestamps,
+              jclearDavCache, jremoveUnusedPristines,
+              jincludeExternals);
 }
 
 JNIEXPORT void JNICALL
@@ -1947,6 +1952,28 @@ Java_org_apache_subversion_javahl_SVNCli
             jremoveTempfiles ? true : false, &callback);
 }
 
+JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_SVNClient_vacuum
+(JNIEnv *env, jobject jthis, jstring jpath,
+ jboolean jremoveUnversionedItems, jboolean jremoveIgnoredItems,
+ jboolean jfixRecordedTimestamps, jboolean jremoveUnusedPristines,
+ jboolean jincludeExternals)
+{
+  JNIEntry(SVNClient, patch);
+  SVNClient *cl = SVNClient::getCppObject(jthis);
+  if (cl == NULL)
+    {
+      JNIUtil::throwError("bad C++ this");
+      return;
+    }
+
+  JNIStringHolder path(jpath);
+  cl->vacuum(path,
+             jremoveUnversionedItems, jremoveIgnoredItems,
+             jfixRecordedTimestamps, jremoveUnusedPristines,
+             jincludeExternals);
+}
+
 JNIEXPORT jobject JNICALL
 Java_org_apache_subversion_javahl_SVNClient_nativeOpenRemoteSession
 (JNIEnv *env, jobject jthis, jstring jpath, jint jretryAttempts)

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=1604449&r1=1604448&r2=1604449&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 Sat Jun 21 18:47:02 2014
@@ -446,6 +446,30 @@ public interface ISVNClient
      * Recursively cleans up a local directory, finishing any
      * incomplete operations, removing lockfiles, etc.
      * @param path a local directory.
+     * @param breakLocks ### FIXME: Missing docstring in svn_client.h
+     * @param clearDavCache ### FIXME: Missing docstring in svn_client.h
+     * @param removeUnusedPristines ### FIXME: Missing docstring in svn_client.h
+     * @param includeExternals Recurse into externals working copies
+     *        and clean them up, too.
+     * @throws ClientException
+     * @since 1.9
+     */
+    void cleanup(String path,
+                 boolean breakLocks,
+                 boolean fixRecordedTimestamps,
+                 boolean clearDavCache,
+                 boolean removeUnusedPristines,
+                 boolean includeExternals)
+        throws ClientException;
+
+    /**
+     * Recursively cleans up a local directory, finishing any
+     * incomplete operations, removing lockfiles, etc.
+     * <p>
+     * Behaves like the 1.9 version with <code>breakLocks</code> and
+     * <code>includeExternals</code> set to <code>false<code>, and the
+     * other flags to <code>true</code>.
+     * @param path a local directory.
      * @throws ClientException
      */
     void cleanup(String path) throws ClientException;
@@ -1446,28 +1470,10 @@ public interface ISVNClient
     /**
      * Retrieve information about repository or working copy items.
      * <p>
-     * Behaves like {@see ISVNClient#info} with
-     * <code>includeExternals</code> set to <code>fals</code>
-     * @since 1.9
-     */
-    void info2(String pathOrUrl,
-               Revision revision, Revision pegRevision, Depth depth,
-               boolean fetchExcluded, boolean fetchActualOnly,
-               Collection<String> changelists, InfoCallback callback)
-        throws ClientException;
-
-    /**
-     * Retrieve information about repository or working copy items.
-     * <p>
      * Behaves like the 1.9 version, with <code>fetchExcluded</code>
-     * set to <code>false</code> and <code>fetchActualOnly</code> set
-     * to <code>true</code>.
-     * @param pathOrUrl     the path or the url of the item
-     * @param revision      the revision of the item to return
-     * @param pegRevision   the revision to interpret pathOrUrl
-     * @param depth         the depth to recurse
-     * @param changelists   if non-null, filter paths using changelists
-     * @param callback      a callback to receive the infos retrieved
+     * set to <code>false</code>, <code>fetchActualOnly</code> set to
+     * <code>true</code> anf <code>includeExternals</code> set to
+     * <code>false</code>.
      */
     void info2(String pathOrUrl, Revision revision, Revision pegRevision,
                Depth depth, Collection<String> changelists,
@@ -1511,6 +1517,37 @@ public interface ISVNClient
             throws ClientException;
 
     /**
+     * Recursively vacuum a working copy, removing unnecessary data.
+     * <p>
+     * This method will report an error when
+     * <code>removeUnversionedItems</code> or
+     * <code>removeIgnoredItems</code> are set, and the working copy
+     * is already locked. This prevents accidental corruption of the
+     * working copy if this method is invoked while another client is
+     * performing some other operation on the working copy.
+     * @param path The path of the working copy directory.
+     * @param removeUnversionedItems Remove unversioned items from the
+     *        working copy after it has been successfully cleaned up.
+     * @param removeIgnoredItems Remove unversioned items that are
+     *        ignored by Subversion, after the working copy has been
+     *        successfully cleaned up.
+     * @param fixRecordedTimestamps Update timestamps recorded in the
+     *        working copy database to their actual on-disk values.
+     * @param removeUnusedPristines Remove pristine files that are not
+     *        referenced by the working copy.
+     * @param includeExternals Recurse into externals working copies
+     *        and vacuum them, too.
+     * @since 1.9
+     */
+    void vacuum(String path,
+                boolean removeUnversionedItems,
+                boolean removeIgnoredItems,
+                boolean fixRecordedTimestamps,
+                boolean removeUnusedPristines,
+                boolean includeExternals)
+            throws ClientException;
+
+    /**
      * Open a persistent session to a repository.
      * <p>
      * <b>Note:</b> The session object inherits the progress callback,

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=1604449&r1=1604448&r2=1604449&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 Sat Jun 21 18:47:02 2014
@@ -270,8 +270,18 @@ public class SVNClient implements ISVNCl
                              CommitMessageCallback handler, CommitCallback callback)
             throws ClientException;
 
-    public native void cleanup(String path)
-            throws ClientException;
+    public native void cleanup(String path,
+                               boolean breakLocks,
+                               boolean fixRecordedTimestamps,
+                               boolean clearDavCache,
+                               boolean removeUnusedPristines,
+                               boolean includeExternals)
+        throws ClientException;
+
+    public void cleanup(String path) throws ClientException
+    {
+        cleanup(path, false, true, true, true, false);
+    }
 
     public native void resolve(String path, Depth depth,
                                ConflictResult.Choice conflictResult)
@@ -754,17 +764,6 @@ public class SVNClient implements ISVNCl
 
     public void info2(String pathOrUrl, Revision revision,
                       Revision pegRevision, Depth depth,
-                      boolean fetchExcluded, boolean fetchActualOnly,
-                      Collection<String> changelists,
-                      InfoCallback callback)
-            throws ClientException
-    {
-        info(pathOrUrl, revision, pegRevision, depth,
-             fetchExcluded, fetchActualOnly, false, changelists, callback);
-    }
-
-    public void info2(String pathOrUrl, Revision revision,
-                      Revision pegRevision, Depth depth,
                       Collection<String> changelists,
                       InfoCallback callback)
             throws ClientException
@@ -779,6 +778,14 @@ public class SVNClient implements ISVNCl
                              PatchCallback callback)
             throws ClientException;
 
+    public native void vacuum(String wcPath,
+                              boolean removeUnversionedItems,
+                              boolean removeIgnoredItems,
+                              boolean fixRecordedTimestamps,
+                              boolean removeUnusedPristines,
+                              boolean includeExternals)
+            throws ClientException;
+
     public ISVNRemote openRemoteSession(String pathOrUrl)
             throws ClientException, SubversionException
     {

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=1604449&r1=1604448&r2=1604449&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 Sat Jun 21 18:47:02 2014
@@ -2278,7 +2278,7 @@ public class BasicTests extends SVNTests
     }
 
     /**
-     * Test the basic SVNClient.info2 functionality.
+     * Test the basic SVNClient.info functionality.
      * @throws Throwable
      * @since 1.2
      */
@@ -4305,8 +4305,9 @@ public class BasicTests extends SVNTests
     {
        final List<Info> infos = new ArrayList<Info>();
 
-       client.info2(pathOrUrl, revision, pegRevision, depth, true, true,
-                     changelists, new InfoCallback () {
+       client.info(pathOrUrl, revision, pegRevision, depth,
+                   true, true, false,
+                   changelists, new InfoCallback () {
             public void singleInfo(Info info)
             { infos.add(info); }
         });