subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1463271 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/ tests/org/apache/subversion/javahl/
Date Mon, 01 Apr 2013 19:57:02 GMT
Author: brane
Date: Mon Apr  1 19:57:02 2013
New Revision: 1463271

URL: http://svn.apache.org/r1463271
Log:
Update JavaHL to use the revised svn_client_merge5 and svn_client_merge_peg5 APIs.

[in subversion/bindings/javahl/src/org/apache/subversion/javahl]
* ISVNClient.java, SVNClient.java (ISVNClient.merge): Add two new
   overloads that match the new svn_client functions.
   In the peg-merge case, allow passing a null revision range.

[in subversion/bindings/javahl/native]
* SVNClient.h, SVNClient.cpp (SVNClient::merge): Update the native implementation
   to accept the new svn_client parameters, and also accept a null revision range.
* org_apache_subversion_javahl_SVNClient.cpp: Update JNI native wrappers.


[in subversion/bindings/javahl/tests/org/apache/subversion/javahl]
* BasicTests.java (BasicTests.testMergeUsingHistoryImpliedRange):
   New test case, verifies that null merge range works as expected.

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=1463271&r1=1463270&r2=1463271&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Mon Apr  1 19:57:02 2013
@@ -657,7 +657,8 @@ SVNClient::suggestMergeSources(const cha
 void SVNClient::merge(const char *path1, Revision &revision1,
                       const char *path2, Revision &revision2,
                       const char *localPath, bool forceDelete, svn_depth_t depth,
-                      bool ignoreAncestry, bool dryRun, bool recordOnly)
+                      bool ignoreMergeinfo, bool diffIgnoreAncestry,
+                      bool dryRun, bool recordOnly)
 {
     SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path1, "path1", );
@@ -676,19 +677,20 @@ void SVNClient::merge(const char *path1,
     if (ctx == NULL)
         return;
 
-    SVN_JNI_ERR(svn_client_merge4(srcPath1.c_str(), revision1.revision(),
+    SVN_JNI_ERR(svn_client_merge5(srcPath1.c_str(), revision1.revision(),
                                   srcPath2.c_str(), revision2.revision(),
                                   intLocalPath.c_str(),
                                   depth,
-                                  ignoreAncestry, forceDelete, recordOnly,
-                                  dryRun,
+                                  ignoreMergeinfo, diffIgnoreAncestry,
+                                  forceDelete, recordOnly, dryRun,
                                   TRUE, NULL, ctx, subPool.getPool()), );
 }
 
 void SVNClient::merge(const char *path, Revision &pegRevision,
-                      std::vector<RevisionRange> &rangesToMerge,
+                      std::vector<RevisionRange> *rangesToMerge,
                       const char *localPath, bool forceDelete, svn_depth_t depth,
-                      bool ignoreAncestry, bool dryRun, bool recordOnly)
+                      bool ignoreMergeinfo, bool diffIgnoreAncestry,
+                      bool dryRun, bool recordOnly)
 {
     SVN::Pool subPool(pool);
     SVN_JNI_NULL_PTR_EX(path, "path", );
@@ -704,16 +706,18 @@ void SVNClient::merge(const char *path, 
         return;
 
     apr_array_header_t *ranges =
-      rev_range_vector_to_apr_array(rangesToMerge, subPool);
+      (!rangesToMerge ? NULL
+       : rev_range_vector_to_apr_array(*rangesToMerge, subPool));
     if (JNIUtil::isExceptionThrown())
         return;
 
-    SVN_JNI_ERR(svn_client_merge_peg4(srcPath.c_str(),
+    SVN_JNI_ERR(svn_client_merge_peg5(srcPath.c_str(),
                                       ranges,
                                       pegRevision.revision(),
                                       intLocalPath.c_str(),
                                       depth,
-                                      ignoreAncestry, forceDelete, recordOnly,
+                                      ignoreMergeinfo, diffIgnoreAncestry,
+                                      forceDelete, recordOnly,
                                       dryRun, TRUE, NULL, 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=1463271&r1=1463270&r2=1463271&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.h Mon Apr  1 19:57:02 2013
@@ -100,11 +100,17 @@ class SVNClient :public SVNBase
   void merge(const char *path1, Revision &revision1,
              const char *path2, Revision &revision2,
              const char *localPath, bool forceDelete, svn_depth_t depth,
-             bool ignoreAncestry, bool dryRun, bool recordOnly);
+             bool ignoreMergeInfo, bool diffIgnoreAncestry,
+             bool dryRun, bool recordOnly);
   void merge(const char *path, Revision &pegRevision,
              std::vector<RevisionRange> &rangesToMerge,
              const char *localPath, bool forceDelete, svn_depth_t depth,
              bool ignoreAncestry, bool dryRun, bool recordOnly);
+  void merge(const char *path, Revision &pegRevision,
+             std::vector<RevisionRange> *rangesToMerge,
+             const char *localPath, bool forceDelete, svn_depth_t depth,
+             bool ignoreMergeInfo, bool diffIgnoreAncestry,
+             bool dryRun, bool recordOnly);
   void mergeReintegrate(const char *path, Revision &pegRevision,
                         const char *localPath, bool dryRun);
   void doImport(const char *path, const char *url, CommitMessage *message,

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=1463271&r1=1463270&r2=1463271&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 Apr  1 19:57:02 2013
@@ -796,11 +796,11 @@ Java_org_apache_subversion_javahl_SVNCli
 }
 
 JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_SVNClient_merge__Ljava_lang_String_2Lorg_apache_subversion_javahl_types_Revision_2Ljava_lang_String_2Lorg_apache_subversion_javahl_types_Revision_2Ljava_lang_String_2ZLorg_apache_subversion_javahl_types_Depth_2ZZZ
+Java_org_apache_subversion_javahl_SVNClient_merge__Ljava_lang_String_2Lorg_apache_subversion_javahl_types_Revision_2Ljava_lang_String_2Lorg_apache_subversion_javahl_types_Revision_2Ljava_lang_String_2ZLorg_apache_subversion_javahl_types_Depth_2ZZZZ
 (JNIEnv *env, jobject jthis, jstring jpath1, jobject jrevision1,
  jstring jpath2, jobject jrevision2, jstring jlocalPath, jboolean jforceDelete,
- jobject jdepth, jboolean jignoreAncestry, jboolean jdryRun,
- jboolean jrecordOnly)
+ jobject jdepth, jboolean jignoreMergeinfo, jboolean jdiffIgnoreAncestry,
+ jboolean jdryRun, jboolean jrecordOnly)
 {
   JNIEntry(SVNClient, merge);
   SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -830,16 +830,20 @@ Java_org_apache_subversion_javahl_SVNCli
     return;
 
   cl->merge(path1, revision1, path2, revision2, localPath,
-            jforceDelete ? true:false, EnumMapper::toDepth(jdepth),
-            jignoreAncestry ? true:false, jdryRun ? true:false,
+            jforceDelete ? true:false,
+            EnumMapper::toDepth(jdepth),
+            jignoreMergeinfo ? true:false,
+            jdiffIgnoreAncestry ? true:false,
+            jdryRun ? true:false,
             jrecordOnly ? true:false);
 }
 
 JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_SVNClient_merge__Ljava_lang_String_2Lorg_apache_subversion_javahl_types_Revision_2Ljava_util_List_2Ljava_lang_String_2ZLorg_apache_subversion_javahl_types_Depth_2ZZZ
+Java_org_apache_subversion_javahl_SVNClient_merge__Ljava_lang_String_2Lorg_apache_subversion_javahl_types_Revision_2Ljava_util_List_2Ljava_lang_String_2ZLorg_apache_subversion_javahl_types_Depth_2ZZZZ
 (JNIEnv *env, jobject jthis, jstring jpath, jobject jpegRevision,
  jobject jranges, jstring jlocalPath, jboolean jforceDelete, jobject jdepth,
- jboolean jignoreAncestry, jboolean jdryRun, jboolean jrecordOnly)
+ jboolean jignoreMergeinfo, jboolean jdiffIgnoreAncestry,
+ jboolean jdryRun, jboolean jrecordOnly)
 {
   JNIEntry(SVNClient, merge);
   SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -861,27 +865,35 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return;
 
+  std::vector<RevisionRange> *revisionRanges = NULL;
+  std::vector<RevisionRange> realRevisionRanges;
   // Build the revision range vector from the Java array.
-  Array ranges(jranges);
-  if (JNIUtil::isExceptionThrown())
-    return;
-
-  std::vector<RevisionRange> revisionRanges;
-  std::vector<jobject> rangeVec = ranges.vector();
-
-  for (std::vector<jobject>::const_iterator it = rangeVec.begin();
-        it < rangeVec.end(); ++it)
+  if (jranges)
     {
-      RevisionRange revisionRange(*it);
+      Array ranges(jranges);
       if (JNIUtil::isExceptionThrown())
         return;
 
-      revisionRanges.push_back(revisionRange);
+      std::vector<jobject> rangeVec = ranges.vector();
+
+      for (std::vector<jobject>::const_iterator it = rangeVec.begin();
+           it < rangeVec.end(); ++it)
+        {
+          RevisionRange revisionRange(*it);
+          if (JNIUtil::isExceptionThrown())
+            return;
+
+          realRevisionRanges.push_back(revisionRange);
+        }
+      revisionRanges = &realRevisionRanges;
     }
 
   cl->merge(path, pegRevision, revisionRanges, localPath,
-            jforceDelete ? true:false, EnumMapper::toDepth(jdepth),
-            jignoreAncestry ? true:false, jdryRun ? true:false,
+            jforceDelete ? true:false,
+            EnumMapper::toDepth(jdepth),
+            jignoreMergeinfo ? true:false,
+            jdiffIgnoreAncestry ? true:false,
+            jdryRun ? true:false,
             jrecordOnly ? true:false);
 }
 

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=1463271&r1=1463270&r2=1463271&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 Apr  1 19:57:02 2013
@@ -488,6 +488,30 @@ public interface ISVNClient
     Set<String> suggestMergeSources(String path, Revision pegRevision)
             throws SubversionException;
 
+
+    /**
+     * Merge changes from two paths into a new local path.
+     *
+     * @param path1          first path or url
+     * @param revision1      first revision
+     * @param path2          second path or url
+     * @param revision2      second revision
+     * @param localPath      target local path
+     * @param force          overwrite local changes
+     * @param depth          how deep to traverse into subdirectories
+     * @param ignoreMergeinfo ignore merge history, treat sources as unrelated
+     * @param diffIgnoreAncestry always treat source files as related
+     * @param dryRun         do not change anything
+     * @param recordOnly     record mergeinfo but do not run merge
+     * @throws ClientException
+     * @since 1.8
+     */
+    void merge(String path1, Revision revision1, String path2,
+               Revision revision2, String localPath, boolean force, Depth depth,
+               boolean ignoreMergeinfo, boolean diffIgnoreAncestry,
+               boolean dryRun, boolean recordOnly)
+            throws ClientException;
+
     /**
      * Merge changes from two paths into a new local path.
      *
@@ -502,6 +526,8 @@ public interface ISVNClient
      * @param dryRun         do not change anything
      * @param recordOnly     record mergeinfo but do not run merge
      * @throws ClientException
+     * @note Behaves like the 1.8 where ignoreAncestry maps to
+     *       both ignoreMergeinfo and diffIgnoreAncestry
      */
     void merge(String path1, Revision revision1, String path2,
                Revision revision2, String localPath, boolean force, Depth depth,
@@ -512,7 +538,31 @@ public interface ISVNClient
      * Merge set of revisions into a new local path.
      * @param path          path or url
      * @param pegRevision   revision to interpret path
-     * @param revisions     revisions to merge
+     * @param revisions     revisions to merge; may be null, indicating that
+     *                      the optimal range should be determined automatcially
+     * @param localPath     target local path
+     * @param force         overwrite local changes
+     * @param depth         how deep to traverse into subdirectories
+     * @param ignoreMergeinfo ignore merge history, treat sources as unrelated
+     * @param diffIgnoreAncestry always treat source files as related
+     * @param dryRun        do not change anything
+     * @param recordOnly    record mergeinfo but do not run merge
+     * @throws ClientException
+     * @since 1.8
+     */
+    void merge(String path, Revision pegRevision, List<RevisionRange> revisions,
+               String localPath, boolean force, Depth depth,
+               boolean ignoreMergeinfo, boolean diffIgnoreAncestry,
+               boolean dryRun, boolean recordOnly)
+             throws ClientException;
+
+    /**
+     * Merge set of revisions into a new local path.
+     * @param path          path or url
+     * @param pegRevision   revision to interpret path
+     * @param revisions     revisions to merge;
+     *                      may be null, indicating that the optimal range
+     *                      should be determined automatcially (new in 1.8)
      * @param localPath     target local path
      * @param force         overwrite local changes
      * @param depth         how deep to traverse into subdirectories
@@ -520,6 +570,8 @@ public interface ISVNClient
      * @param dryRun        do not change anything
      * @param recordOnly    record mergeinfo but do not run merge
      * @throws ClientException
+     * @note Behaves like the 1.8 where ignoreAncestry maps to
+     *       both ignoreMergeinfo and diffIgnoreAncestry
      */
     void merge(String path, Revision pegRevision, List<RevisionRange> revisions,
                String localPath, boolean force, Depth depth,

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=1463271&r1=1463270&r2=1463271&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 Apr  1 19:57:02 2013
@@ -275,16 +275,39 @@ public class SVNClient implements ISVNCl
     public native void merge(String path1, Revision revision1, String path2,
                              Revision revision2, String localPath,
                              boolean force, Depth depth,
+                             boolean ignoreMergeinfo, boolean diffIgnoreAncestry,
+                             boolean dryRun, boolean recordOnly)
+            throws ClientException;
+
+    public void merge(String path1, Revision revision1, String path2,
+                             Revision revision2, String localPath,
+                             boolean force, Depth depth,
                              boolean ignoreAncestry, boolean dryRun,
                              boolean recordOnly)
-            throws ClientException;
+            throws ClientException
+    {
+        merge(path1, revision2, path2, revision2, localPath, force, depth,
+              ignoreAncestry, ignoreAncestry, dryRun, recordOnly);
+    }
 
     public native void merge(String path, Revision pegRevision,
                              List<RevisionRange> revisions, String localPath,
-                             boolean force, Depth depth, boolean ignoreAncestry,
+                             boolean force, Depth depth,
+                             boolean ignoreMergeinfo, boolean diffIgnoreAncestry,
                              boolean dryRun, boolean recordOnly)
             throws ClientException;
 
+    public void merge(String path, Revision pegRevision,
+                      List<RevisionRange> revisions, String localPath,
+                      boolean force, Depth depth, boolean ignoreAncestry,
+                      boolean dryRun, boolean recordOnly)
+            throws ClientException
+    {
+        merge(path, pegRevision, revisions, localPath, force, depth,
+              ignoreAncestry, ignoreAncestry, dryRun, recordOnly);
+    }
+
+
     public native void mergeReintegrate(String path, Revision pegRevision,
                                         String localPath, boolean dryRun)
             throws ClientException;

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=1463271&r1=1463270&r2=1463271&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
Mon Apr  1 19:57:02 2013
@@ -2536,6 +2536,43 @@ public class BasicTests extends SVNTests
     }
 
     /**
+     * Test merge with automatic source and revision determination
+     * (e.g. 'svn merge -g) with implied revision range.
+     * @throws Throwable
+     * @since 1.8
+     */
+    public void testMergeUsingHistoryImpliedRange() throws Throwable
+    {
+        OneTest thisTest = setupAndPerformMerge();
+
+        // Test that getMergeinfo() returns null.
+        assertNull(client.getMergeinfo(new File(thisTest.getWCPath(), "A")
+                                       .toString(), Revision.HEAD));
+
+        // Merge and commit some changes (r4).
+        appendText(thisTest, "A/mu", "xxx", 4);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 4,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
+
+        String branchPath = thisTest.getWCPath() + "/branches/A";
+        String modUrl = thisTest.getUrl() + "/A";
+        client.merge(modUrl, Revision.HEAD, null,
+                     branchPath, true, Depth.infinity, false, false, false);
+
+        // commit the changes so that we can verify merge
+        addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl().toString(),
+                              "branches/A", NodeKind.dir,
+                              CommitItemStateFlags.PropMods);
+        addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl().toString(),
+                              "branches/A/mu", NodeKind.file,
+                              CommitItemStateFlags.TextMods);
+        checkCommitRevision(thisTest, "wrong revision number from commit", 5,
+                            thisTest.getWCPathSet(), "log msg", Depth.infinity,
+                            false, false, null, null);
+    }
+
+    /**
      * Test reintegrating a branch with trunk
      * (e.g. 'svn merge --reintegrate').
      * @throws Throwable



Mime
View raw message