subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1674406 - in /subversion/trunk/subversion: bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java libsvn_client/copy.c
Date Fri, 17 Apr 2015 21:21:58 GMT
Author: brane
Date: Fri Apr 17 21:21:57 2015
New Revision: 1674406

URL: http://svn.apache.org/r1674406
Log:
Fix issue #4560.

* subversion/libsvn_client/copy.c
  (pin_externals_prop): When the externals_to_pin hash is not NULL,
   do not pin externals that are not mentioned in that hash.

* subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
  (BasicTests.setupPinExternalsTest,
   BasicTests.testCopyPinExternals_wc2wc,
   BasicTests.testCopyPinExternals_wc2repo,
   BasicTests.testCopyPinExternals_repo2wc,
   BasicTests.testCopyPinExternals_repo2repo,
   BasicTests.testCopyPinExternals_repo2repo_explicit): Update test cases.
  (BasicTests.testCopyPinExternals_repo2repo_corkscrew): New test case.


Patch by: stsp
          (Test fixes by me)

Modified:
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
    subversion/trunk/subversion/libsvn_client/copy.c

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=1674406&r1=1674405&r2=1674406&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
Fri Apr 17 21:21:57 2015
@@ -1091,6 +1091,7 @@ public class BasicTests extends SVNTests
     private void setupPinExternalsTest(OneTest thisTest) throws Throwable
     {
         byte[] extref = ("^/A/D/H ADHext\n" +
+                         "^/A/D/H ADHext2\n" +
                          "^/A/D/H@1 peggedADHext\n" +
                          "-r1 ^/A/D/H revvedADHext\n").getBytes();
         Set<String> paths = new HashSet<String>();
@@ -1130,6 +1131,7 @@ public class BasicTests extends SVNTests
 
         // Verification
         String expected = ("^/A/D/H@2 ADHext\n" +
+                           "^/A/D/H@2 ADHext2\n" +
                            "^/A/D/H@1 peggedADHext\n" +
                            "-r1 ^/A/D/H@2 revvedADHext\n");
         String actual =
@@ -1158,6 +1160,7 @@ public class BasicTests extends SVNTests
 
         // Verification
         String expected = ("^/A/D/H@2 ADHext\n" +
+                           "^/A/D/H@2 ADHext2\n" +
                            "^/A/D/H@1 peggedADHext\n" +
                            "-r1 ^/A/D/H@2 revvedADHext\n");
         String actual =
@@ -1186,6 +1189,7 @@ public class BasicTests extends SVNTests
 
         // Verification
         String expected = ("^/A/D/H@2 ADHext\n" +
+                           "^/A/D/H@2 ADHext2\n" +
                            "^/A/D/H@1 peggedADHext\n" +
                            "-r1 ^/A/D/H@2 revvedADHext\n");
         String actual =
@@ -1214,6 +1218,7 @@ public class BasicTests extends SVNTests
 
         // Verification
         String expected = ("^/A/D/H@2 ADHext\n" +
+                           "^/A/D/H@2 ADHext2\n" +
                            "^/A/D/H@1 peggedADHext\n" +
                            "-r1 ^/A/D/H@2 revvedADHext\n");
         String actual =
@@ -1249,6 +1254,44 @@ public class BasicTests extends SVNTests
 
         // Verification
         String expected = ("^/A/D/H@2 ADHext\n" +
+                           "^/A/D/H ADHext2\n" +
+                           "^/A/D/H@1 peggedADHext\n" +
+                           "-r1 ^/A/D/H revvedADHext\n");
+        String actual =
+            new String(client.propertyGet(target, "svn:externals", null, null));
+
+        assertEquals(expected, actual);
+    }
+
+    /**
+     * Test REPO-to-REPO copy with explicit pinned externals that
+     * don't correspond to actual externals
+     * @throws Throwable
+     */
+    public void testCopyPinExternals_repo2repo_corkscrew() throws Throwable
+    {
+        // build the test setup
+        OneTest thisTest = new OneTest();
+        setupPinExternalsTest(thisTest);
+
+        String sourceUrl = thisTest.getUrl() + "/A/B";
+        Map<String, List<ExternalItem>> externalsToPin =
+            new HashMap<String, List<ExternalItem>>();
+        List<ExternalItem> items = new ArrayList<ExternalItem>(1);
+        items.add(new ExternalItem("ADHext", "^/A/D/H", null, null));
+        externalsToPin.put(sourceUrl + "/A", items);
+
+        List<CopySource> sources = new ArrayList<CopySource>(1);
+        sources.add(new CopySource(sourceUrl, null, null));
+        String target = thisTest.getUrl() + "/A/Bcopy";
+        client.copy(sources, target, true, false, false, false,
+                    true,       // pinExternals
+                    externalsToPin,
+                    null, new ConstMsg("Copy WC to REPO"), null);
+
+        // Verification
+        String expected = ("^/A/D/H ADHext\n" +
+                           "^/A/D/H ADHext2\n" +
                            "^/A/D/H@1 peggedADHext\n" +
                            "-r1 ^/A/D/H revvedADHext\n");
         String actual =

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1674406&r1=1674405&r2=1674406&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Fri Apr 17 21:21:57 2015
@@ -330,8 +330,16 @@ pin_externals_prop(svn_string_t **pinned
                                               scratch_pool));
 
   if (externals_to_pin)
-    items_to_pin = svn_hash_gets((apr_hash_t *)externals_to_pin,
-                                 local_abspath_or_url);
+    {
+      items_to_pin = svn_hash_gets((apr_hash_t *)externals_to_pin,
+                                   local_abspath_or_url);
+      if (!items_to_pin)
+        {
+          /* No pinning at all for this path. */
+          *pinned_externals = svn_string_dup(externals_prop_val, result_pool);
+          return SVN_NO_ERROR;
+        }
+    }
   else
     items_to_pin = NULL;
 



Mime
View raw message