Browse Source

add description attribute to <p4change>

Submitted by:	Bob Cheek <RCheek@Verbind.com>

patch looks a lot bigger than it is - I removed a ton of tabs from
this file.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268865 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
d10d01a97a
3 changed files with 50 additions and 42 deletions
  1. +2
    -0
      WHATSNEW
  2. +5
    -4
      docs/manual/OptionalTasks/perforce.html
  3. +43
    -38
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java

+ 2
- 0
WHATSNEW View File

@@ -21,6 +21,8 @@ Other changes:

* <tar> will now add empty directories as well

* you can now specify a description for <p4change>

Fixed bugs:
-----------



+ 5
- 4
docs/manual/OptionalTasks/perforce.html View File

@@ -190,14 +190,15 @@ This task sets the ${p4.change} property which can then be passed to P4Submit or
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">None</td>
<td valign="top" align="center">--</td>
<td valign="top" align="center">--</td>
<td valign="top">description</td>
<td valign="top">Description for ChangeList. If none specified, it will
default to "AutoSubmit By Ant"</td>
<td valign="top" align="center">No.</td>
</tr>
</table>

<h3>Examples</h3>
<pre>&lt;p4change /&gt;
<pre>&lt;p4change description="Change Build Number in Script"&gt;
</pre>
<hr>



+ 43
- 38
src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java View File

@@ -75,7 +75,8 @@ import org.apache.tools.ant.*;
*/
public class P4Change extends P4Base {

protected String emptyChangeList = null;
protected String emptyChangeList = null;
protected String description = "AutoSubmit By Ant";

public void execute() throws BuildException {

@@ -83,21 +84,21 @@ public class P4Change extends P4Base {
final Project myProj = project;

P4Handler handler = new P4HandlerAdapter() {
public void process(String line) {
if (util.match("/Change/", line)) {
public void process(String line) {
if (util.match("/Change/", line)) {
//Remove any non-numerical chars - should leave the change number
line = util.substitute("s/[^0-9]//g", line);
int changenumber = Integer.parseInt(line);
log("Change Number is "+changenumber, Project.MSG_INFO);
myProj.setProperty("p4.change", ""+changenumber);
} else if(util.match("/error/", line)) {
throw new BuildException("Perforce Error, check client settings and/or server");
}
}};
//Remove any non-numerical chars - should leave the change number
line = util.substitute("s/[^0-9]//g", line);
int changenumber = Integer.parseInt(line);
log("Change Number is "+changenumber, Project.MSG_INFO);
myProj.setProperty("p4.change", ""+changenumber);
} else if(util.match("/error/", line)) {
throw new BuildException("Perforce Error, check client settings and/or server");
}
}};

handler.setOutput(emptyChangeList);

@@ -109,30 +110,34 @@ public class P4Change extends P4Base {
final StringBuffer stringbuf = new StringBuffer();
execP4Command("change -o", new P4HandlerAdapter() {
public void process(String line) {
if(!util.match("/^#/",line)){
if(util.match("/error/", line)) {
log("Client Error", Project.MSG_VERBOSE);
throw new BuildException("Perforce Error, check client settings and/or server");
} else if(util.match("/<enter description here>/",line)) {
line = util.substitute("s/<enter description here>/AutoSubmit By Ant/", line);
} else if(util.match("/\\/\\//", line)) {
//Match "//" for begining of depot filespec
return;
}
stringbuf.append(line);
stringbuf.append("\n");
}
}});
return stringbuf.toString();
public void process(String line) {
if(!util.match("/^#/",line)){
if(util.match("/error/", line)) {
log("Client Error", Project.MSG_VERBOSE);
throw new BuildException("Perforce Error, check client settings and/or server");
} else if(util.match("/<enter description here>/",line)) {
line = util.substitute("s/<enter description here>/" + description + "/", line);
} else if(util.match("/\\/\\//", line)) {
//Match "//" for begining of depot filespec
return;
}
stringbuf.append(line);
stringbuf.append("\n");
}
}});
return stringbuf.toString();
}

/* Set Description Variable. */
public void setDescription(String desc){
this.description = desc;
}

} //EoF

Loading…
Cancel
Save