Hi

This is a simple wrapper around the patch command. 

It could be applied in situations like:

* You have a set of private patches you want to apply to a given
project but those are not part of the project (yet).

* Plattform specific patches need to be applied - the RedHat RPM
system's build process for example involves retrieving the "original"
source and applying RedHat's patches in a different step

Sure there are other possibilities.

Stefan

Attachment: Patch.java
Description: Binary data

Index: docs/index.html
===================================================================
RCS file: /home/cvspublic/jakarta-ant/docs/index.html,v
retrieving revision 1.21
diff -u -r1.21 index.html
--- docs/index.html	2000/06/01 06:54:52	1.21
+++ docs/index.html	2000/06/05 16:02:45
@@ -468,6 +468,7 @@
   <li><a href="#javadoc">Javadoc/Javadoc2</a></li>
   <li><a href="#keysubst">KeySubst</a></li>
   <li><a href="#mkdir">Mkdir</a></li>
+  <li><a href="#patch">Patch</a></li>
   <li><a href="#property">Property</a></li>
   <li><a href="#rename">Rename</a></li>
   <li><a href="#replace">Replace</a></li>
@@ -1772,6 +1773,83 @@
 <pre>&lt;mkdir dir=&quot;${dist}/lib&quot; /&gt;</pre>
 <p>creates a directory <code>${dist}/lib</code>.</p>
 <hr>
+<h2><a name="patch">Patch</a></h2>
+<h3>Description</h3>
+<p>Applies a diff file to originals.
+<table border="1" cellpadding="2" cellspacing="0">
+  <tr>
+    <td valign="top"><b>Attribute</b></td>
+    <td valign="top"><b>Description</b></td>
+    <td align="center" valign="top"><b>Required</b></td>
+  </tr>
+  <tr>
+    <td valign="top">dir</td>
+    <td valign="top">the directory in which the command should be executed.</td>
+    <td align="center" valign="top">Yes</td>
+  </tr>
+  <tr>
+    <td valign="top">os</td>
+    <td valign="top">list of Operating Systems on which the command may be
+      executed.</td>
+    <td align="center" valign="top">No</td>
+  </tr>
+  <tr>
+    <td valign="top">output</td> 
+    <td valign="top">the file to which the output of the patch command 
+      should be redirected.</td> 
+    <td align="center" valign="top">No</td>
+  </tr>
+  <tr>
+    <td valign="top">patchfile</td> 
+    <td valign="top">the file that includes the diff output</td>
+    <td align="center" valign="top">Yes</td>
+  </tr>
+  <tr>
+    <td valign="top">originalfile</td> 
+    <td valign="top">the file to patch</td>
+    <td align="center" valign="top">No, tries to guess it from the diff 
+      file</td>
+  </tr>
+  <tr>
+    <td valign="top">backups</td> 
+    <td valign="top">Keep backups of the unpatched files</td>
+    <td align="center" valign="top">No</td>
+  </tr>
+  <tr>
+    <td valign="top">quiet</td> 
+    <td valign="top">Work silently unless an error occurs</td>
+    <td align="center" valign="top">No</td>
+  </tr>
+  <tr>
+    <td valign="top">reverse</td> 
+    <td valign="top">Assume patch was created with old and new files 
+      swapped.</td>
+    <td align="center" valign="top">No</td>
+  </tr>
+  <tr>
+    <td valign="top">ignorewhitespace</td> 
+    <td valign="top">Ignore whitespace differences.</td>
+    <td align="center" valign="top">No</td>
+  </tr>
+  <tr>
+    <td valign="top">strip</td> 
+    <td valign="top">Strip the smallest prefix containing <i>num</i> leading 
+      slashes from filenames.</td>
+    <td align="center" valign="top">No</td>
+  </tr>
+</table>
+<h3>Examples</h3>
+<pre>  &lt;patch patchfile=&quot;module.1.0-1.1.patch&quot; /&gt;</pre>
+<p>applies the diff included in <i>module.1.0-1.1.patch</i> to the
+files in base directory guessing the filename(s) from the diff output.
+<pre>  &lt;patch patchfile=&quot;module.1.0-1.1.patch&quot; strip="1" /&gt;</pre>
+<p>like above but one leading directory part will be removed. i.e. if
+the diff output looked like
+<pre>
+--- a/mod1.0/A	Mon Jun  5 17:28:41 2000
++++ a/mod1.1/A	Mon Jun  5 17:28:49 2000
+</pre> 
+the leading <i>a/</i> will be stripped.
 <h2><a name="property">Property</a></h2>
 <h3>Description</h3>
 <p>Sets a property (by name and value), or set of properties (from file or
Index: src/main/org/apache/tools/ant/taskdefs/defaults.properties
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties,v
retrieving revision 1.11
diff -u -r1.11 defaults.properties
--- src/main/org/apache/tools/ant/taskdefs/defaults.properties	2000/05/24 14:35:22	1.11
+++ src/main/org/apache/tools/ant/taskdefs/defaults.properties	2000/06/05 16:02:50
@@ -29,6 +29,7 @@
 filter=org.apache.tools.ant.taskdefs.Filter
 fixcrlf=org.apache.tools.ant.taskdefs.FixCRLF
 rename=org.apache.tools.ant.taskdefs.Rename
+patch=org.apache.tools.ant.taskdefs.Patch
 
 # optional tasks
 script=org.apache.tools.ant.taskdefs.optional.Script

Reply via email to