Author: cduffy
Date: Fri Dec 27 23:07:57 2013
New Revision: 1553758

URL: http://svn.apache.org/r1553758
Log:
IVY-1423: fix revision mapping across namespaces

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ivy-namespace5.xml
    ant/ivy/core/trunk/test/repositories/namespace/C/
    ant/ivy/core/trunk/test/repositories/namespace/C/C/
    ant/ivy/core/trunk/test/repositories/namespace/C/C/1.0.0/
    ant/ivy/core/trunk/test/repositories/namespace/C/C/1.0.0/ivy.xml
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
    ant/ivy/core/trunk/test/repositories/namespace/ivysettings.xml

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1553758&r1=1553757&r2=1553758&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Fri Dec 27 23:07:57 2013
@@ -168,6 +168,7 @@ for detailed view of each issue, please 
 - FIX: Better support for "Bundle-RequiredExecutionEnvironment" from an OSGi 
MANIFEST.MF
 - FIX: When inheriting a module descriptor, also merge the exclude rules
 - FIX: Correct application of mediators (ie. override) during conflict 
resolution (IVY-1455)
+- FIX: Fix revision number mapping across namespaces (IVY-1423)
 
    2.3.0
 =====================================

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java?rev=1553758&r1=1553757&r2=1553758&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java 
(original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java 
Fri Dec 27 23:07:57 2013
@@ -359,7 +359,7 @@ public abstract class BasicResolver exte
         // the metadata artifact which was used to cache the original metadata 
file
         Artifact requestedMetadataArtifact = ivyRef == null ? 
systemMd.getMetadataArtifact()
                 : parser.getMetadataArtifact(
-                    ModuleRevisionId.newInstance(systemMrid, 
ivyRef.getRevision()),
+                    ModuleRevisionId.newInstance(systemMrid, 
systemMd.getRevision()),
                     ivyRef.getResource());
 
         cacheManager.originalToCachedModuleDescriptor(this, ivyRef, 
requestedMetadataArtifact, rmr,
@@ -608,9 +608,11 @@ public abstract class BasicResolver exte
                     + md.getModuleRevisionId().getBranch() + "'; ");
             ok = false;
         }
-        if (ivyRef.getRevision() != null && 
!ivyRef.getRevision().startsWith("working@")) {
+        if (ivyRef.getRevision() != null
+                && !ivyRef.getRevision().startsWith("working@")
+                && 
!mrid.getRevision().equals(md.getModuleRevisionId().getRevision())) {
             ModuleRevisionId expectedMrid = ModuleRevisionId
-                    .newInstance(mrid, ivyRef.getRevision());
+                    .newInstance(mrid, mrid.getRevision());
             if (!getSettings().getVersionMatcher().accept(expectedMrid, md)) {
                 Message.error("\t" + getName() + ": bad revision found in " + 
ivyRef.getResource()
                         + ": expected='" + ivyRef.getRevision() + " found='"

Modified: 
ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=1553758&r1=1553757&r2=1553758&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java 
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java 
Fri Dec 27 23:07:57 2013
@@ -4785,6 +4785,17 @@ public class ResolveTest extends TestCas
 
         assertTrue(report.hasError());
     }
+    
+    public void testNamespaceMapping5() throws Exception {
+        // Verifies that mapping version numbers works
+        Ivy ivy = new Ivy();
+        ivy.configure(new File("test/repositories/namespace/ivysettings.xml"));
+        ResolveReport report = 
ivy.resolve(ResolveTest.class.getResource("ivy-namespace5.xml"),
+            getResolveOptions(new String[] {"*"}));
+        assertNotNull(report);
+        ModuleRevisionId mrid = ModuleRevisionId.newInstance("systemorg3", 
"systemmod3", "1.0");
+        assertTrue(getIvyFileInCache(mrid).exists());
+    }
 
     public void testIVY151() throws Exception {
         Ivy ivy = new Ivy();

Added: 
ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ivy-namespace5.xml
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ivy-namespace5.xml?rev=1553758&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ivy-namespace5.xml 
(added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ivy-namespace5.xml 
Fri Dec 27 23:07:57 2013
@@ -0,0 +1,25 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="1.0">
+    <info organisation="apache" module="namespace" revision="5.0" />
+    
+    <dependencies>
+                  <dependency org="systemorg3" name="systemmod3" rev="1.0" />
+    </dependencies>
+</ivy-module>

Added: ant/ivy/core/trunk/test/repositories/namespace/C/C/1.0.0/ivy.xml
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/namespace/C/C/1.0.0/ivy.xml?rev=1553758&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/namespace/C/C/1.0.0/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/namespace/C/C/1.0.0/ivy.xml Fri Dec 27 
23:07:57 2013
@@ -0,0 +1,26 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="1.0">
+       <info organisation="C"
+              module="C"
+              revision="1.0.0"
+              status="integration"
+              publication="20051101110000"/>
+   <publications/>
+</ivy-module>

Modified: ant/ivy/core/trunk/test/repositories/namespace/ivysettings.xml
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/namespace/ivysettings.xml?rev=1553758&r1=1553757&r2=1553758&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/namespace/ivysettings.xml (original)
+++ ant/ivy/core/trunk/test/repositories/namespace/ivysettings.xml Fri Dec 27 
23:07:57 2013
@@ -60,6 +60,16 @@
                                        <dest module="systemmod2"/>
                                </tosystem>
                        </rule>
+                       <rule>
+                               <fromsystem>
+                                       <src org="systemorg3" 
module="systemmod3" rev="1.0"/>
+                                       <dest org="C" module="C" rev="1.0.0"/>
+                               </fromsystem>
+                               <tosystem>
+                                       <src org="C" module="C" rev="1.0.0"/>
+                                       <dest org="systemorg3" 
module="systemmod3" rev="1.0"/>
+                               </tosystem>
+                       </rule>
                </namespace>
        </namespaces>
        <resolvers>


Reply via email to