Browse Source

Add two new attributes in p4submit :

needsresolveproperty and changeproperty
PR: 25711


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275924 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 21 years ago
parent
commit
4db617fc7d
5 changed files with 64 additions and 9 deletions
  1. +3
    -0
      WHATSNEW
  2. +22
    -3
      docs/manual/OptionalTasks/perforce.html
  3. +1
    -1
      src/etc/testcases/taskdefs/optional/perforce/changerenumbered.xml
  4. +6
    -3
      src/etc/testcases/taskdefs/optional/perforce/needsresolve.xml
  5. +32
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java

+ 3
- 0
WHATSNEW View File

@@ -38,6 +38,9 @@ Other changes:


* <fixcrlf> has a new attribute - fixlast. Bugzilla Report 23262. * <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 Changes from Ant 1.5.4 to Ant 1.6.0
=================================== ===================================




+ 22
- 3
docs/manual/OptionalTasks/perforce.html View File

@@ -9,9 +9,8 @@
<li>Les Hughes (<a href="mailto:leslie.hughes@rubus.com">leslie.hughes@rubus.com</a>)</li> <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>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>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> </ul>
<p>Version $Revision$ - $Date$</p>
<hr> <hr>
<h2>Contents</h2> <h2>Contents</h2>
<ul> <ul>
@@ -330,6 +329,20 @@ is not the latest any more.
<td valign="top">The changelist number to submit</td> <td valign="top">The changelist number to submit</td>
<td valign="top" align="center">Yes</td> <td valign="top" align="center">Yes</td>
</tr> </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> </table>


<h3>Examples</h3> <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, Changed p4submit (detection of changes of change numbers,
and of failed submits due to resolution needed)</td> and of failed submits due to resolution needed)</td>
</tr> </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> </table>
<hr> <hr>
<p align="center">Copyright &copy; 2001-2003 Apache Software Foundation. All rights
<p align="center">Copyright &copy; 2001-2004 Apache Software Foundation. All rights
Reserved.</p> Reserved.</p>
</body> </body>
</html> </html>

src/testcases/org/apache/tools/ant/taskdefs/optional/perforce/build1.xml → src/etc/testcases/taskdefs/optional/perforce/changerenumbered.xml View File

@@ -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 --> <!-- this file demonstrates that p4.change will be modified by p4submit -->
<!-- if the change number is modified by the Perforce daemon during the submission --> <!-- if the change number is modified by the Perforce daemon during the submission -->
<project name="build1" default="runtest"> <project name="build1" default="runtest">

src/testcases/org/apache/tools/ant/taskdefs/optional/perforce/build2.xml → src/etc/testcases/taskdefs/optional/perforce/needsresolve.xml View File

@@ -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 --> <!-- 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--> <!-- 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 --> <!-- 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} --> <!-- also using both client specs you should be able to edit the file ${depot_file_spec} -->
<project name="testresolve" default= "test"> <project name="testresolve" default= "test">
<property name="first_client" value="levyant_dev_ant"/> <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" value="levyant_cygwin_test"/>
<property name="second_client_root" value="C:\dev\test"/> <property name="second_client_root" value="C:\dev\test"/>
<property name="depot_file_spec" value="//depot/foobar"/> <property name="depot_file_spec" value="//depot/foobar"/>
@@ -40,14 +40,17 @@
doing a change ${change} on client ${p4.client} doing a change ${change} on client ${p4.client}
</echo> </echo>
<p4edit change="${change}" view="${depot_file_spec}"/> <p4edit change="${change}" view="${depot_file_spec}"/>
<mkdir dir="${client_root}/depot"/>
<echo file="${client_root}/depot/foobar"> <echo file="${client_root}/depot/foobar">
hello ${p4.client} ${change} hello ${p4.client} ${change}
</echo> </echo>
</target> </target>
<target name="submit"> <target name="submit">
<p4submit change="${change}"/>
<p4submit change="${change}" needsresolveproperty="needsresolve" changeproperty="mychange"/>
<echo> <echo>
p4.needsresolve ${p4.needsresolve} after submit p4.needsresolve ${p4.needsresolve} after submit
needsresolveproperty ${needsresolve} after submit
changeproperty ${mychange} after submit
</echo> </echo>
</target> </target>
</project> </project>

+ 32
- 2
src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * 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. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -83,7 +83,14 @@ public class P4Submit extends P4Base {
* change list number * change list number
*/ */
public String change; public String change;

/**
* change property
*/
private String changeProperty;
/**
* needsresolveproperty
*/
private String needsResolveProperty;
/** /**
* set the change list number to submit * set the change list number to submit
* @param change The changelist number to submit; required. * @param change The changelist number to submit; required.
@@ -91,6 +98,23 @@ public class P4Submit extends P4Base {
public void setChange(String change) { public void setChange(String change) {
this.change = 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 * do the work
@@ -133,6 +157,9 @@ public class P4Submit extends P4Base {
int changenumber = Integer.parseInt(chnum); int changenumber = Integer.parseInt(chnum);
log("Perforce change renamed " + changenumber, Project.MSG_INFO); log("Perforce change renamed " + changenumber, Project.MSG_INFO);
getProject().setProperty("p4.change", "" + changenumber); getProject().setProperty("p4.change", "" + changenumber);
if (changeProperty != null) {
getProject().setNewProperty(changeProperty, chnum);
}
found = false; found = false;
} }
if (((myarray.elementAt(counter))).equals("renamed")) { if (((myarray.elementAt(counter))).equals("renamed")) {
@@ -148,6 +175,9 @@ public class P4Submit extends P4Base {
} }
if (util.match("/p4 submit -c/", line)) { if (util.match("/p4 submit -c/", line)) {
getProject().setProperty("p4.needsresolve", "1"); getProject().setProperty("p4.needsresolve", "1");
if (needsResolveProperty != null) {
getProject().setNewProperty(needsResolveProperty, "true");
}
} }


} }


Loading…
Cancel
Save