You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2008/06/12 18:54:38 UTC

svn commit: r667158 - in /ant/ivy/core/trunk: src/java/org/apache/ivy/plugins/parser/xml/ test/java/org/apache/ivy/ant/

Author: xavier
Date: Thu Jun 12 09:54:38 2008
New Revision: 667158

URL: http://svn.apache.org/viewvc?rev=667158&view=rev
Log:
fix bug with branchConstraint on deliver

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java?rev=667158&r1=667157&r2=667158&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java Thu Jun 12 09:54:38 2008
@@ -57,6 +57,11 @@
      * Configurations to exclude during update, or <code>null</code> to keep all confs.
      */
     private String[] confsToExclude = null;
+    /**
+     * True to set branch information on dependencies to default branch when omitted, false to keep 
+     * it as is.
+     */
+    private boolean updateBranch = true;
     
     public ParserSettings getSettings() {
         return settings;
@@ -114,4 +119,11 @@
         this.confsToExclude = confsToExclude;
         return this;
     }
+    public boolean isUpdateBranch() {
+        return updateBranch;
+    }
+    public UpdateOptions setUpdateBranch(boolean updateBranch) {
+        this.updateBranch = updateBranch;
+        return this;
+    }
 }

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=667158&r1=667157&r2=667158&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 12 09:54:38 2008
@@ -126,6 +126,7 @@
                         .setStatus(md.getStatus()) 
                         .setRevision(md.getResolvedModuleRevisionId().getRevision()) 
                         .setPubdate(md.getResolvedPublicationDate())
+                        .setUpdateBranch(false)
                         .setNamespace(ns));
         } catch (SAXException e) {
             ParseException ex = new ParseException("exception occured while parsing " + res, 0);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java?rev=667158&r1=667157&r2=667158&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java Thu Jun 12 09:54:38 2008
@@ -173,8 +173,11 @@
         private final List confs;
 
         private final URL relativePathCtx;
+        
+        private final UpdateOptions options;
 
         public UpdaterHandler(URL relativePathCtx, PrintWriter out, final UpdateOptions options) {
+            this.options = options;
             this.settings = options.getSettings();
             this.out = out;
             this.resolvedRevisions = options.getResolvedRevisions();
@@ -418,7 +421,8 @@
                 }
             }
             
-            if (systemMrid.getBranch() != null && attributes.getIndex("branch") == -1) {
+            if (options.isUpdateBranch() 
+                    && systemMrid.getBranch() != null && attributes.getIndex("branch") == -1) {
                 // this dependency is on a specific branch, we set it explicitly in the updated file
                 write(" branch=\"" + systemMrid.getBranch() + "\"");
             }

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java?rev=667158&r1=667157&r2=667158&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java Thu Jun 12 09:54:38 2008
@@ -232,8 +232,10 @@
                 .getModuleRevisionId());
         DependencyDescriptor[] dds = md.getDependencies();
         assertEquals(1, dds.length);
-        assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "BRANCH1", "2.2"), dds[0]
-                .getDependencyRevisionId());
+        assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "BRANCH1", "2.2"), 
+            dds[0].getDependencyRevisionId());
+        assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "latest.integration"), 
+            dds[0].getDynamicConstraintDependencyRevisionId());
     }
 
     public void testWithExtraAttributes() throws Exception {