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 2007/12/07 00:17:06 UTC

svn commit: r601906 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/plugins/conflict/ test/java/org/apache/ivy/plugins/conflict/

Author: maartenc
Date: Thu Dec  6 15:17:05 2007
New Revision: 601906

URL: http://svn.apache.org/viewvc?rev=601906&view=rev
Log:
FIX: Strict conflictmanager seems to not support dynamic revisions (IVY-474)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-conflict-dynamic.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-noconflict-dynamic.xml
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/StrictConflictManager.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/StrictConflictManagerTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=601906&r1=601905&r2=601906&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Dec  6 15:17:05 2007
@@ -54,6 +54,11 @@
 	John Williams
 	Jaroslaw Wypychowski
 
+   version in SVN
+=====================================
+- FIX: Strict conflictmanager seems to not support dynamic revisions (IVY-474)
+
+
    2.0.0-beta1
 =====================================
 - NEW: Share cache with locking (IVY-654)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/StrictConflictManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/StrictConflictManager.java?rev=601906&r1=601905&r2=601906&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/StrictConflictManager.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/StrictConflictManager.java Thu Dec  6 15:17:05 2007
@@ -22,6 +22,7 @@
 import java.util.Iterator;
 
 import org.apache.ivy.core.resolve.IvyNode;
+import org.apache.ivy.plugins.version.VersionMatcher;
 
 public class StrictConflictManager extends AbstractConflictManager {
 
@@ -29,10 +30,17 @@
     }
 
     public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
+        VersionMatcher versionMatcher = getSettings().getVersionMatcher();
+        
         IvyNode lastNode = null;
         for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
             IvyNode node = (IvyNode) iter.next();
 
+            if (versionMatcher.isDynamic(node.getResolvedId())) {
+                // dynamic revision, not enough information to resolve conflict
+                return null;
+            }
+            
             if (lastNode != null && !lastNode.equals(node)) {
                 throw new StrictConflictException(lastNode, node);
             }

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/StrictConflictManagerTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/StrictConflictManagerTest.java?rev=601906&r1=601905&r2=601906&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/StrictConflictManagerTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/StrictConflictManagerTest.java Thu Dec  6 15:17:05 2007
@@ -52,9 +52,25 @@
             getResolveOptions());
     }
 
+    public void testNoConflictWithDynamicRevisionResolve() throws Exception {
+        ivy.resolve(StrictConflictManagerTest.class.getResource("ivy-noconflict-dynamic.xml"),
+            getResolveOptions());
+    }
+
     public void testConflictResolve() throws Exception {
         try {
             ivy.resolve(StrictConflictManagerTest.class.getResource("ivy-conflict.xml"),
+                getResolveOptions());
+
+            fail("Resolve should have failed with a conflict");
+        } catch (StrictConflictException e) {
+            // this is expected
+        }
+    }
+
+    public void testConflictWithDynamicRevisionResolve() throws Exception {
+        try {
+            ivy.resolve(StrictConflictManagerTest.class.getResource("ivy-conflict-dynamic.xml"),
                 getResolveOptions());
 
             fail("Resolve should have failed with a conflict");

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-conflict-dynamic.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-conflict-dynamic.xml?rev=601906&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-conflict-dynamic.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-conflict-dynamic.xml Thu Dec  6 15:17:05 2007
@@ -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="resolve-noconflict" revision="1.0" status="release"/>
+        <dependencies>
+            <dependency org="org1" name="mod1.2" rev="2.+"/>
+            <dependency org="org2" name="mod2.1" rev="0.3"/>
+        </dependencies>
+</ivy-module>

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-noconflict-dynamic.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-noconflict-dynamic.xml?rev=601906&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-noconflict-dynamic.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-noconflict-dynamic.xml Thu Dec  6 15:17:05 2007
@@ -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="resolve-noconflict" revision="1.0" status="release"/>
+        <dependencies>
+            <dependency org="org1" name="mod1.2" rev="[2.0,2.1["/>
+            <dependency org="org2" name="mod2.1" rev="0.3"/>
+        </dependencies>
+</ivy-module>