You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2008/05/05 23:43:23 UTC

svn commit: r653610 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/core/IvyPatternHelper.java test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java

Author: maartenc
Date: Mon May  5 14:43:23 2008
New Revision: 653610

URL: http://svn.apache.org/viewvc?rev=653610&view=rev
Log:
FIX: Filesystem resolver does not evaluate [branch] token when publishing (IVY-814)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=653610&r1=653609&r2=653610&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon May  5 14:43:23 2008
@@ -79,6 +79,7 @@
 - IMPROVEMENT: Change allownomd and skipbuildwithoutivy into a more semantically correct name (IVY-297)
 - IMPROVEMENT: Smarter determination if an expression is exact or not for RegexpPatternMatcher and GlobPatternMatcher
 
+- FIX: Filesystem resolver does not evaluate [branch] token when publishing (IVY-814)
 - FIX: Using ivy:settings with the "id" attribute not behaving as expected (IVY-809)
 - FIX: onMissingDescriptor doesn't work due to == comparison (IVY-805) (thanks to Ben Hale)
 - FIX: revision token is not set in report outputpattern (IVY-272)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java?rev=653610&r1=653609&r2=653610&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java Mon May  5 14:43:23 2008
@@ -69,8 +69,8 @@
 
     public static String substitute(String pattern, ModuleRevisionId moduleRevision) {
         return substitute(pattern, moduleRevision.getOrganisation(), moduleRevision.getName(),
-            moduleRevision.getRevision(), "ivy", "ivy", "xml", null,
-            moduleRevision.getAttributes());
+            moduleRevision.getBranch(), moduleRevision.getRevision(), "ivy", "ivy", "xml", null,
+            null, moduleRevision.getAttributes());
     }
 
     public static String substitute(String pattern, ModuleRevisionId moduleRevision,

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java?rev=653610&r1=653609&r2=653610&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java Mon May  5 14:43:23 2008
@@ -633,6 +633,45 @@
         }
     }
 
+    public void testPublishTransactionWithBranch() throws Exception {
+        try {
+            FileSystemResolver resolver = new FileSystemResolver();
+            resolver.setName("test");
+            resolver.setSettings(settings);
+
+            resolver.addIvyPattern(
+                "test/repositories/1/[organisation]/[module]/[branch]/[revision]/[artifact].[ext]");
+            resolver.addArtifactPattern(
+                 "test/repositories/1/[organisation]/[module]/[branch]/[revision]/[artifact]-[revision].[ext]");
+
+            ModuleRevisionId mrid = ModuleRevisionId.newInstance("myorg", "mymodule", "mybranch", "myrevision");
+            Artifact ivyArtifact = new DefaultArtifact(mrid, new Date(), "ivy", "ivy", "xml");
+            Artifact artifact = new DefaultArtifact(mrid, new Date(), "myartifact", "mytype",
+                    "myext");
+            File src = new File("test/repositories/ivysettings.xml");
+            
+            resolver.beginPublishTransaction(mrid, false);
+            
+            // files should not be available until the transaction is committed
+            resolver.publish(ivyArtifact, src, false);
+            assertFalse(new File("test/repositories/1/myorg/mymodule/mybranch/myrevision/ivy.xml").exists());
+
+            resolver.publish(artifact, src, false);
+            assertFalse(new File(
+                "test/repositories/1/myorg/mymodule/mybranch/myrevision/myartifact-myrevision.myext")
+                .exists());
+
+            resolver.commitPublishTransaction();
+
+            assertTrue(new File("test/repositories/1/myorg/mymodule/mybranch/myrevision/ivy.xml").exists());
+            assertTrue(new File(
+                    "test/repositories/1/myorg/mymodule/mybranch/myrevision/myartifact-myrevision.myext")
+                    .exists());
+        } finally {
+            FileUtil.forceDelete(new File("test/repositories/1/myorg"));
+        }
+    }
+
     public void testAbortTransaction() throws Exception {
         try {
             FileSystemResolver resolver = new FileSystemResolver();