needsresolveproperty and changeproperty PR: 25711 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275924 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -38,6 +38,9 @@ Other changes: | |||
| * <fixcrlf> has a new attribute - fixlast. Bugzilla Report 23262. | |||
| * <p4submit> has 2 new attributes, needsresolveproperty and changeproperty. | |||
| Bugzilla Report 25711. | |||
| Changes from Ant 1.5.4 to Ant 1.6.0 | |||
| =================================== | |||
| @@ -9,9 +9,8 @@ | |||
| <li>Les Hughes (<a href="mailto:leslie.hughes@rubus.com">leslie.hughes@rubus.com</a>)</li> | |||
| <li>Kirk Wylie (<a href="mailto:kirk@radik.com">kirk@radik.com</a>)</li> | |||
| <li>Matt Bishop (<a href="mailto:matt@thebishops.org">matt@thebishops.org</a>)</li> | |||
| <li>Antoine Levy-Lambert (<a href="mailto:levylambert@tiscali-dsl.de">levylambert@tiscali-dsl.de</a>)</li> | |||
| <li>Antoine Levy-Lambert</li> | |||
| </ul> | |||
| <p>Version $Revision$ - $Date$</p> | |||
| <hr> | |||
| <h2>Contents</h2> | |||
| <ul> | |||
| @@ -330,6 +329,20 @@ is not the latest any more. | |||
| <td valign="top">The changelist number to submit</td> | |||
| <td valign="top" align="center">Yes</td> | |||
| </tr> | |||
| <tr> | |||
| <td valign="top">changeproperty</td> | |||
| <td valign="top">Name of a property to which the new change number | |||
| will be assigned if the Perforce server renumbers the change<br> | |||
| Since ant 1.6.1</td> | |||
| <td valign="top" align="center">No</td> | |||
| </tr> | |||
| <tr> | |||
| <td valign="top">needsresolveproperty</td> | |||
| <td valign="top">Name of property which will be set to <code>true</code> | |||
| if the submit requires a resolve<br> | |||
| Since ant 1.6.1</td> | |||
| <td valign="top" align="center">No</td> | |||
| </tr> | |||
| </table> | |||
| <h3>Examples</h3> | |||
| @@ -959,9 +972,15 @@ P4Resolve does not use a change list number (it takes it from the files it is wo | |||
| Changed p4submit (detection of changes of change numbers, | |||
| and of failed submits due to resolution needed)</td> | |||
| </tr> | |||
| <tr> | |||
| <td valign="top">Jan 2004</td> | |||
| <td valign="top">ant 1.6.1</td> | |||
| <td valign="top"> | |||
| Changed p4submit, needsresolveproperty and changeproperty added</td> | |||
| </tr> | |||
| </table> | |||
| <hr> | |||
| <p align="center">Copyright © 2001-2003 Apache Software Foundation. All rights | |||
| <p align="center">Copyright © 2001-2004 Apache Software Foundation. All rights | |||
| Reserved.</p> | |||
| </body> | |||
| </html> | |||
| @@ -1,4 +1,4 @@ | |||
| <!-- author Antoine Levy-Lambert levylambert@tiscali-dsl.de --> | |||
| <!-- author Antoine Levy-Lambert --> | |||
| <!-- this file demonstrates that p4.change will be modified by p4submit --> | |||
| <!-- if the change number is modified by the Perforce daemon during the submission --> | |||
| <project name="build1" default="runtest"> | |||
| @@ -1,11 +1,11 @@ | |||
| <!-- author Antoine Levy-Lambert levylambert@tiscali-dsl.de --> | |||
| <!-- author Antoine Levy-Lambert --> | |||
| <!-- this test shows that p4 submit can now indicate that a file needs to be resolved --> | |||
| <!-- before running the test, edit this xml and change the 5 properties at the top to values which make sense on your system--> | |||
| <!-- the test uses two Perforce client specs which must exist beforehand --> | |||
| <!-- also using both client specs you should be able to edit the file ${depot_file_spec} --> | |||
| <project name="testresolve" default= "test"> | |||
| <property name="first_client" value="levyant_dev_ant"/> | |||
| <property name="first_client_root" value="C:\dev\gnu"/> | |||
| <property name="first_client_root" value="C:\dev\depot"/> | |||
| <property name="second_client" value="levyant_cygwin_test"/> | |||
| <property name="second_client_root" value="C:\dev\test"/> | |||
| <property name="depot_file_spec" value="//depot/foobar"/> | |||
| @@ -40,14 +40,17 @@ | |||
| doing a change ${change} on client ${p4.client} | |||
| </echo> | |||
| <p4edit change="${change}" view="${depot_file_spec}"/> | |||
| <mkdir dir="${client_root}/depot"/> | |||
| <echo file="${client_root}/depot/foobar"> | |||
| hello ${p4.client} ${change} | |||
| </echo> | |||
| </target> | |||
| <target name="submit"> | |||
| <p4submit change="${change}"/> | |||
| <p4submit change="${change}" needsresolveproperty="needsresolve" changeproperty="mychange"/> | |||
| <echo> | |||
| p4.needsresolve ${p4.needsresolve} after submit | |||
| needsresolveproperty ${needsresolve} after submit | |||
| changeproperty ${mychange} after submit | |||
| </echo> | |||
| </target> | |||
| </project> | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * The Apache Software License, Version 1.1 | |||
| * | |||
| * Copyright (c) 2000-2003 The Apache Software Foundation. All rights | |||
| * Copyright (c) 2000-2004 The Apache Software Foundation. All rights | |||
| * reserved. | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without | |||
| @@ -83,7 +83,14 @@ public class P4Submit extends P4Base { | |||
| * change list number | |||
| */ | |||
| public String change; | |||
| /** | |||
| * change property | |||
| */ | |||
| private String changeProperty; | |||
| /** | |||
| * needsresolveproperty | |||
| */ | |||
| private String needsResolveProperty; | |||
| /** | |||
| * set the change list number to submit | |||
| * @param change The changelist number to submit; required. | |||
| @@ -91,6 +98,23 @@ public class P4Submit extends P4Base { | |||
| public void setChange(String change) { | |||
| this.change = change; | |||
| } | |||
| /** | |||
| * property defining the change number if the change number gets renumbered | |||
| * @param changeProperty name of a new property to which the change number | |||
| * will be assigned if it changes | |||
| * @since ant 1.6.1 | |||
| */ | |||
| public void setChangeProperty(String changeProperty) { | |||
| this.changeProperty = changeProperty; | |||
| } | |||
| /** | |||
| * property defining the need to resolve the change list | |||
| * @param needsResolveProperty a property which will be set if the change needs resolve | |||
| * @since ant 1.6.1 | |||
| */ | |||
| public void setNeedsResolveProperty(String needsResolveProperty) { | |||
| this.needsResolveProperty = needsResolveProperty; | |||
| } | |||
| /** | |||
| * do the work | |||
| @@ -133,6 +157,9 @@ public class P4Submit extends P4Base { | |||
| int changenumber = Integer.parseInt(chnum); | |||
| log("Perforce change renamed " + changenumber, Project.MSG_INFO); | |||
| getProject().setProperty("p4.change", "" + changenumber); | |||
| if (changeProperty != null) { | |||
| getProject().setNewProperty(changeProperty, chnum); | |||
| } | |||
| found = false; | |||
| } | |||
| if (((myarray.elementAt(counter))).equals("renamed")) { | |||
| @@ -148,6 +175,9 @@ public class P4Submit extends P4Base { | |||
| } | |||
| if (util.match("/p4 submit -c/", line)) { | |||
| getProject().setProperty("p4.needsresolve", "1"); | |||
| if (needsResolveProperty != null) { | |||
| getProject().setNewProperty(needsResolveProperty, "true"); | |||
| } | |||
| } | |||
| } | |||