Author: maartenc
Date: Thu Jun 25 22:42:40 2009
New Revision: 788538

URL: http://svn.apache.org/viewvc?rev=788538&view=rev
Log:
FIX: ivy:resolve ignores branch in "dynamic" resolve mode (IVY-1087) (thanks to 
Aleksey Zhukov)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java
    
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ParserSettings.java
    
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=788538&r1=788537&r2=788538&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Jun 25 22:42:40 2009
@@ -85,6 +85,7 @@
     Chris Wood
        Patrick Woodworth
        Jaroslaw Wypychowski
+       Aleksey Zhukov
        
    trunk
 =====================================
@@ -94,6 +95,7 @@
 - IMPROVEMENT: Standalone runner should accept all the same parameters as ant 
tasks (IVY-1090)
 - IMPROVEMENT: Pre and post retrieve artifact events (IVY-1084)
 
+- FIX: ivy:resolve ignores branch in "dynamic" resolve mode (IVY-1087) (thanks 
to Aleksey Zhukov)
 - FIX: [originalname] not expanded during retrieve when module descriptor 
contains extra attributes (IVY-1096)
 - FIX: The Ant output wasn't always prefixed by the name of the task
 - FIX: Ivy buildnumber task does not find artifact in Sonatype Nexus repo 
(IVY-1069)

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java?rev=788538&r1=788537&r2=788538&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java
 (original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java
 Thu Jun 25 22:42:40 2009
@@ -25,6 +25,7 @@
 import java.util.Map.Entry;
 
 import org.apache.ivy.core.RelativeUrlResolver;
+import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.module.status.StatusManager;
 import org.apache.ivy.plugins.conflict.ConflictManager;
@@ -129,6 +130,10 @@
         public File resolveFile(String filename) {
             return delegatedSettings.resolveFile(filename);
         }
+        
+        public String getDefaultBranch(ModuleId moduleId) {
+            return delegatedSettings.getDefaultBranch(moduleId);
+        }
 
         public Map substitute(Map strings) {
             Map substituted = new LinkedHashMap();

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ParserSettings.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ParserSettings.java?rev=788538&r1=788537&r2=788538&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ParserSettings.java 
(original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ParserSettings.java 
Thu Jun 25 22:42:40 2009
@@ -22,6 +22,7 @@
 
 import org.apache.ivy.core.RelativeUrlResolver;
 import org.apache.ivy.core.cache.ResolutionCacheManager;
+import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.module.status.StatusManager;
 import org.apache.ivy.plugins.conflict.ConflictManager;
@@ -52,5 +53,7 @@
     File resolveFile(String filename);
     
     File getBaseDir();
+    
+    String getDefaultBranch(ModuleId moduleId);
 
 }

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java?rev=788538&r1=788537&r2=788538&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
 (original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
 Thu Jun 25 22:42:40 2009
@@ -49,6 +49,7 @@
 import org.apache.ivy.core.module.id.ArtifactId;
 import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.conflict.ConflictManager;
 import org.apache.ivy.plugins.conflict.FixedConflictManager;
 import org.apache.ivy.plugins.matcher.PatternMatcher;
@@ -521,6 +522,12 @@
             String name = settings.substitute(attributes.getValue("name"));
             String branch = settings.substitute(attributes.getValue("branch"));
             String branchConstraint = 
settings.substitute(attributes.getValue("branchConstraint"));
+            if (branchConstraint == null) {
+                // there was no branch constraint before, so we should
+                // set the branchConstraint to the current default branch
+                branchConstraint = 
settings.getDefaultBranch(ModuleId.newInstance(org, name));
+            }
+
             String rev = settings.substitute(attributes.getValue("rev"));
             String revConstraint = 
settings.substitute(attributes.getValue("revConstraint"));
             revConstraint = revConstraint == null ? rev : revConstraint;


Reply via email to