Patch

Description

Applies a diff file to originals. ; requires "patch" to be on the execution path.

Parameters

Attribute Description Required
patchfile the file that includes the diff output Yes
originalfile the file to patch No, tries to guess it from the diff file
destfile the file to send the output to instead of patching the file(s) in place. since Apache Ant 1.6 No.
backups Keep backups of the unpatched files No
quiet Work silently unless an error occurs No
reverse Assume patch was created with old and new files swapped. No
ignorewhitespace Ignore whitespace differences. No
strip Strip the smallest prefix containing num leading slashes from filenames. No
dir The directory in which to run the patch command. No, default is the project's basedir.
failonerror Stop the buildprocess if the command exits with a return code signaling failure. Defaults to false. since Ant 1.8.0 No

Examples

  <patch patchfile="module.1.0-1.1.patch"/>

applies the diff included in module.1.0-1.1.patch to the files in base directory guessing the filename(s) from the diff output.

  <patch patchfile="module.1.0-1.1.patch" strip="1"/>

like above but one leading directory part will be removed. i.e. if the diff output looked like

--- a/mod1.0/A	Mon Jun  5 17:28:41 2000
+++ a/mod1.1/A	Mon Jun  5 17:28:49 2000
the leading a/ will be stripped.