Browse Source

Add an option to append output, I set it to false

to preserve behavior but I think it would be better
to true.
PR: 5559
Reported by: stefanf@decode.is (Stefan Freyr Stefansson)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270392 13f79535-47bb-0310-9956-ffa450edef68
master
Stephane Bailliez 23 years ago
parent
commit
f1b8684907
2 changed files with 19 additions and 7 deletions
  1. +10
    -5
      docs/manual/CoreTasks/cvs.html
  2. +9
    -2
      src/main/org/apache/tools/ant/taskdefs/Cvs.java

+ 10
- 5
docs/manual/CoreTasks/cvs.html View File

@@ -9,7 +9,7 @@


<h2><a name="cvs">Cvs</a></h2> <h2><a name="cvs">Cvs</a></h2>
<h3>Description</h3> <h3>Description</h3>
<p>Handles packages/modules retrieved from a
<p>Handles packages/modules retrieved from a
<a href="http://www.cvshome.org/" target="_top">CVS</a> repository.</p> <a href="http://www.cvshome.org/" target="_top">CVS</a> repository.</p>
<p>When doing automated builds, the <a href="get.html">get task</a> should be <p>When doing automated builds, the <a href="get.html">get task</a> should be
preferred over the <i>checkout</i> command, because of speed.</p> preferred over the <i>checkout</i> command, because of speed.</p>
@@ -63,7 +63,7 @@ preferred over the <i>checkout</i> command, because of speed.</p>
<tr> <tr>
<td valign="top">noexec</td> <td valign="top">noexec</td>
<td valign="top">report only, don't change any files.</td> <td valign="top">report only, don't change any files.</td>
<td align="center" valign="top">No, default &quot;false&quot;</td>
<td align="center" valign="top">No, default to &quot;false&quot;</td>
</tr> </tr>
<tr> <tr>
<td valign="top">output</td> <td valign="top">output</td>
@@ -75,6 +75,11 @@ preferred over the <i>checkout</i> command, because of speed.</p>
<td valign="top">the file to direct standard error from the command.</td> <td valign="top">the file to direct standard error from the command.</td>
<td align="center" valign="top">No, default error to ANT Log as MSG_WARN.</td> <td align="center" valign="top">No, default error to ANT Log as MSG_WARN.</td>
</tr> </tr>
<tr>
<td valign="top">append</td>
<td valign="top">whether to append output/error when redirecting to a file.</td>
<td align="center" valign="top">No, default to &quot;false&quot;.</td>
</tr>
<tr> <tr>
<td valign="top">port</td> <td valign="top">port</td>
<td valign="top">Port used by CVS to communicate with the server.</td> <td valign="top">Port used by CVS to communicate with the server.</td>
@@ -106,9 +111,9 @@ repository pointed to by the cvsRoot attribute, and stores the files in &quot;${
<p>silently (-q) creates a file called patch.txt which contains a unified (-u) diff which includes new files added via &quot;cvs add&quot; (-N) and can be used as input to patch.</p> <p>silently (-q) creates a file called patch.txt which contains a unified (-u) diff which includes new files added via &quot;cvs add&quot; (-N) and can be used as input to patch.</p>
<pre> &lt;cvs command=&quot;update -A -d&quot;/&gt;</pre> <pre> &lt;cvs command=&quot;update -A -d&quot;/&gt;</pre>
<p>Updates from the head of repository ignoring sticky bits (-A) and creating any new directories as necessary (-d).</p> <p>Updates from the head of repository ignoring sticky bits (-A) and creating any new directories as necessary (-d).</p>
<p>Note: the text of the command is passed to cvs &quot;as-is&quot; so any cvs options should appear
before the command, and any command options should appear after the command as in the diff example
above. See <a href="http://www.cvshome.org/docs/manual/index.html" target="_top">the cvs manual</a> for details,
<p>Note: the text of the command is passed to cvs &quot;as-is&quot; so any cvs options should appear
before the command, and any command options should appear after the command as in the diff example
above. See <a href="http://www.cvshome.org/docs/manual/index.html" target="_top">the cvs manual</a> for details,
specifically the <a href="http://www.cvshome.org/docs/manual/cvs_16.html" target="_top">Guide to CVS commands</a></p> specifically the <a href="http://www.cvshome.org/docs/manual/cvs_16.html" target="_top">Guide to CVS commands</a></p>
<hr><p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights <hr><p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
Reserved.</p> Reserved.</p>


+ 9
- 2
src/main/org/apache/tools/ant/taskdefs/Cvs.java View File

@@ -123,6 +123,9 @@ public class Cvs extends Task {
*/ */
private File dest; private File dest;


/** whether or not to append stdout/stderr to existing files */
private boolean append = false;

/** /**
* the file to direct standard output from the command. * the file to direct standard output from the command.
*/ */
@@ -201,7 +204,7 @@ public class Cvs extends Task {
else { else {
if (output != null) { if (output != null) {
try { try {
outputstream = new PrintStream(new BufferedOutputStream(new FileOutputStream(output)));
outputstream = new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(), append)));
} catch (IOException e) { } catch (IOException e) {
throw new BuildException(e, location); throw new BuildException(e, location);
} }
@@ -211,7 +214,7 @@ public class Cvs extends Task {
} }
if (error != null) { if (error != null) {
try { try {
errorstream = new PrintStream(new BufferedOutputStream(new FileOutputStream(error)));
errorstream = new PrintStream(new BufferedOutputStream(new FileOutputStream(error.getPath(), append)));
} catch (IOException e) { } catch (IOException e) {
throw new BuildException(e, location); throw new BuildException(e, location);
} }
@@ -324,6 +327,10 @@ public class Cvs extends Task {
this.error = error; this.error = error;
} }


public void setAppend(boolean value){
this.append = value;
}

public void setFailOnError(boolean failOnError) { public void setFailOnError(boolean failOnError) {
this.failOnError = failOnError; this.failOnError = failOnError;
} }


Loading…
Cancel
Save