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 2010/06/29 22:41:36 UTC
svn commit: r959095 - in /ant/ivy/core/branches/2.2.x: ./
src/java/org/apache/ivy/plugins/parser/xml/
test/java/org/apache/ivy/plugins/parser/xml/
Author: maartenc
Date: Tue Jun 29 20:41:36 2010
New Revision: 959095
URL: http://svn.apache.org/viewvc?rev=959095&view=rev
Log:
Merged changes from trunk into 2.2.x branch.
Modified:
ant/ivy/core/branches/2.2.x/ (props changed)
ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java
ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
ant/ivy/core/branches/2.2.x/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
ant/ivy/core/branches/2.2.x/test/java/org/apache/ivy/plugins/parser/xml/updated.xml
Propchange: ant/ivy/core/branches/2.2.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 29 20:41:36 2010
@@ -1,4 +1,4 @@
/ant/ivy/core/branches/2.0.0:727187-727188,727520-732505
/ant/ivy/core/branches/2.0.0-rc2:707459-708717
/ant/ivy/core/branches/2.0.x:696803-698317
-/ant/ivy/core/trunk:695737,696014-696031,696442
+/ant/ivy/core/trunk:695737,696014-696031,696442,958415-958693
Modified: ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java?rev=959095&r1=959094&r2=959095&view=diff
==============================================================================
--- ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java (original)
+++ ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java Tue Jun 29 20:41:36 2010
@@ -39,6 +39,10 @@ public class UpdateOptions {
*/
private Map resolvedRevisions = Collections.EMPTY_MAP;
/**
+ * Map from ModuleId of dependencies to new branch (as String)
+ */
+ private Map resolvedBranches = Collections.EMPTY_MAP;
+ /**
* the new status, <code>null</code> to keep the old one
*/
private String status = null;
@@ -167,4 +171,11 @@ public class UpdateOptions {
this.generateRevConstraint = generateRevConstraint;
return this;
}
+ public Map getResolvedBranches() {
+ return resolvedBranches;
+ }
+ public UpdateOptions setResolvedBranches(Map resolvedBranches) {
+ this.resolvedBranches = resolvedBranches;
+ return this;
+ }
}
Modified: ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java?rev=959095&r1=959094&r2=959095&view=diff
==============================================================================
--- ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java (original)
+++ ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java Tue Jun 29 20:41:36 2010
@@ -183,6 +183,8 @@ public final class XmlModuleDescriptorUp
private final PrintWriter out;
private final Map resolvedRevisions;
+
+ private final Map resolvedBranches;
private final String status;
@@ -209,6 +211,7 @@ public final class XmlModuleDescriptorUp
this.settings = options.getSettings();
this.out = out;
this.resolvedRevisions = options.getResolvedRevisions();
+ this.resolvedBranches = options.getResolvedBranches();
this.status = options.getStatus();
this.revision = options.getRevision();
this.pubdate = options.getPubdate();
@@ -523,6 +526,8 @@ public final class XmlModuleDescriptorUp
revision, extraAttributes);
ModuleRevisionId systemMrid = ns == null ? localMrid : ns.getToSystemTransformer()
.transform(localMrid);
+
+ String newBranch = (String) resolvedBranches.get(systemMrid);
for (int i = 0; i < attributes.getLength(); i++) {
String attName = attributes.getQName(i);
@@ -548,7 +553,16 @@ public final class XmlModuleDescriptorUp
} else if ("name".equals(attName)) {
write(" name=\"" + systemMrid.getName() + "\"");
} else if ("branch".equals(attName)) {
- write(" branch=\"" + systemMrid.getBranch() + "\"");
+ if(newBranch != null) {
+ write(" branch=\"" + newBranch + "\"");
+ }
+ else if(!resolvedBranches.containsKey(systemMrid)) {
+ write(" branch=\"" + systemMrid.getBranch() + "\"");
+ }
+ else {
+ // if resolvedBranches contains the systemMrid, but the new branch is null,
+ // the branch attribute will be removed altogether
+ }
} else if ("branchConstraint".equals(attName)) {
write(" branchConstraint=\"" + branchConstraint + "\"");
} else if ("conf".equals(attName)) {
@@ -566,10 +580,17 @@ public final class XmlModuleDescriptorUp
}
}
- 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() + "\"");
+ if(attributes.getIndex("branch") == -1)
+ {
+ if (newBranch != null) {
+ // erase an existing branch attribute if its new value is blank
+ if(!newBranch.trim().equals(""))
+ write(" branch=\"" + newBranch + "\"");
+ }
+ else if (options.isUpdateBranch() && systemMrid.getBranch() != null) {
+ // this dependency is on a specific branch, we set it explicitly in the updated file
+ write(" branch=\"" + systemMrid.getBranch() + "\"");
+ }
}
}
Modified: ant/ivy/core/branches/2.2.x/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.2.x/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java?rev=959095&r1=959094&r2=959095&view=diff
==============================================================================
--- ant/ivy/core/branches/2.2.x/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java (original)
+++ ant/ivy/core/branches/2.2.x/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java Tue Jun 29 20:41:36 2010
@@ -61,6 +61,12 @@ public class XmlModuleUpdaterTest extend
"yourorg", "yourmodule2", "branch1", "2+"), "2.5");
resolvedRevisions.put(ModuleRevisionId.newInstance(
"yourorg", "yourmodule6", "trunk", "latest.integration"), "6.3");
+
+ Map resolvedBranches = new HashMap();
+ resolvedBranches.put(ModuleRevisionId.newInstance("yourorg", "yourmodule3", "3.1"),
+ "branch1");
+ resolvedBranches.put(ModuleRevisionId.newInstance(
+ "yourorg", "yourmodule2", "branch1", "2+"), null);
GregorianCalendar cal = new GregorianCalendar();
cal.set(2005, 2, 22, 14, 32, 54);
@@ -70,7 +76,7 @@ public class XmlModuleUpdaterTest extend
XmlModuleDescriptorUpdater.update(
XmlModuleUpdaterTest.class.getResource("test-update.xml"), dest,
getUpdateOptions(ivy.getSettings(), resolvedRevisions,
- "release", "mynewrev", cal.getTime()));
+ "release", "mynewrev", cal.getTime()).setResolvedBranches(resolvedBranches));
assertTrue(dest.exists());
String expected = FileUtil.readEntirely(new BufferedReader(new InputStreamReader(
@@ -110,7 +116,13 @@ public class XmlModuleUpdaterTest extend
"yourorg", "yourmodule2", "branch1", "2+"), "2.5");
resolvedRevisions.put(ModuleRevisionId.newInstance(
"yourorg", "yourmodule6", "trunk", "latest.integration"), "6.3");
-
+
+ Map resolvedBranches = new HashMap();
+ resolvedBranches.put(ModuleRevisionId.newInstance("yourorg", "yourmodule3", "3.1"),
+ "branch1");
+ resolvedBranches.put(ModuleRevisionId.newInstance(
+ "yourorg", "yourmodule2", "branch1", "2+"), null);
+
GregorianCalendar cal = new GregorianCalendar();
cal.set(2005, 2, 22, 14, 32, 54);
@@ -160,7 +172,7 @@ public class XmlModuleUpdaterTest extend
XmlModuleDescriptorUpdater.update(
XmlModuleUpdaterTest.class.getResource("test-update-withvar.xml"), dest,
getUpdateOptions(ivy.getSettings(), resolvedRevisions,
- "release", "mynewrev", cal.getTime()));
+ "release", "mynewrev", cal.getTime()).setResolvedBranches(resolvedBranches));
assertTrue(dest.exists());
String expected = FileUtil.readEntirely(new BufferedReader(new InputStreamReader(
Modified: ant/ivy/core/branches/2.2.x/test/java/org/apache/ivy/plugins/parser/xml/updated.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.2.x/test/java/org/apache/ivy/plugins/parser/xml/updated.xml?rev=959095&r1=959094&r2=959095&view=diff
==============================================================================
--- ant/ivy/core/branches/2.2.x/test/java/org/apache/ivy/plugins/parser/xml/updated.xml (original)
+++ ant/ivy/core/branches/2.2.x/test/java/org/apache/ivy/plugins/parser/xml/updated.xml Tue Jun 29 20:41:36 2010
@@ -57,8 +57,8 @@
<dependency name="mymodule2" rev="2.0"/>
<dependency name="mymodule3" rev="2.0" changing="true" transitive="false"/>
<dependency org="yourorg" name="yourmodule1" branch="trunk" rev="1.1" branchConstraint="branch1" revConstraint="1+" conf="myconf1"/>
- <dependency org="yourorg" name="yourmodule2" branch="branch1" rev="2.5" branchConstraint="branch1" revConstraint="2+" conf="myconf1->yourconf1"/>
- <dependency org="yourorg" name="yourmodule3" rev="3.1" conf="myconf1->yourconf1, yourconf2"/>
+ <dependency org="yourorg" name="yourmodule2" rev="2.5" branchConstraint="branch1" revConstraint="2+" conf="myconf1->yourconf1"/>
+ <dependency org="yourorg" name="yourmodule3" rev="3.1" conf="myconf1->yourconf1, yourconf2" branch="branch1"/>
<dependency org="yourorg" name="yourmodule4" rev="4.1" conf="myconf1, myconf2->yourconf1, yourconf2"/>
<dependency org="yourorg" name="yourmodule5" rev="5.1" conf="myconf1->yourconf1;myconf2->yourconf1, yourconf2"/>