classes/phing/tasks/ext/PatchTask.php

\PatchTask

Patches a file by applying a 'diff' file to it

Requires "patch" to be on the execution path.

Extends from
\Task
author
Andreas Aderhold
copyright
2001,2002 THYRELL. All rights reserved
package
phing.tasks.ext
version
$Revision: 912 $

Constants

Constantstring  CMD = 'patch --batch --silent '

Base command to be executed (must end with a space character!)

string

Properties

Propertyprivatearray  $cmdArgs= 'array'

Command line arguments for patch binary

Default valuearrayDetails
Type
array
Propertyprivatebool  $haltOnFailure= 'false'

Halt on error return value from patch invocation.

Default valuefalseDetails
Type
bool
Propertyprivatestring  $originalFile= ''

File to be patched

Details
Type
string
Propertyprivatestring  $patchFile= ''

Patch file

Details
Type
string
Propertyprivateint  $strip= ''

Value for a "-p" option

Details
Type
int

Methods

methodpublic  main( ) : void
Main task method
Details
throws
when it all goes a bit pear shaped
methodpublic  setBackups( bool $backups ) : void
Flag to create backups

Optional, default - false

Parameters
Name Type Description
$backups bool If true create backups
methodpublic  setDestFile( string $file ) : void
The name of a file to send the output to, instead of patching the file(s) in place

Optional.

Parameters
Name Type Description
$file string File to send the output to
methodpublic  setDir( string $directory ) : void
The directory to run the patch command in

Defaults to the project's base directory.

Parameters
Name Type Description
$directory string Directory to run the patch command in
methodpublic  setForward( bool $flag ) : void
Ignore patches that seem to be reversed or already applied
Parameters
Name Type Description
$flag bool

If true set the -N (--forward) option

methodpublic  setFuzz( string $value ) : void
Set the maximum fuzz factor

Defaults to 0

Parameters
Name Type Description
$value string Value of a fuzz factor
methodpublic  setHaltOnFailure( bool $value ) : void
If true, stop the build process if the patch command exits with an error status.

The default is "false"

Parameters
Name Type Description
$value bool

"true" if it should halt, otherwise "false"

methodpublic  setIgnoreWhiteSpace( bool $ignore ) : void
Flag to ignore whitespace differences;

Default - false

Parameters
Name Type Description
$ignore bool If true ignore whitespace differences
methodpublic  setOriginalFile( string $file ) : void
The file to patch

Optional if it can be inferred from the diff file.

Parameters
Name Type Description
$file string File to patch
methodpublic  setPatchFile( string $file ) : void
The file containing the diff output

Required.

Parameters
Name Type Description
$file string File containing the diff output
Details
throws
if $file not exists
methodpublic  setQuiet( bool $flag ) : void
Work silently unless an error occurs

Optional, default - false

Parameters
Name Type Description
$flag bool

If true suppress set the -s option on the patch command

methodpublic  setReverse( bool $flag ) : void
Assume patch was created with old and new files swapped

Optional, default - false

Parameters
Name Type Description
$flag bool

If true set the -R option on the patch command

methodpublic  setStrip( int $num ) : void
Strip the smallest prefix containing num leading slashes from filenames.

patch's --strip option.

Parameters
Name Type Description
$num int number of lines to strip
Details
throws
if num is < 0, or other errors
Documentation was generated by DocBlox 0.13.1.