Class PatchCommand
java.lang.Object
org.variantsync.studies.evolution.simulation.shell.ShellCommand
org.variantsync.studies.evolution.simulation.shell.PatchCommand
Represents a shell 'patch' command that can be executed using a ShellExecutor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionforce()
Assume that the user knows exactly what he or she is doing, and do not ask any questions.forward()
When a patch does not apply, patch usually checks if the patch looks like it has been applied already by trying to reverse- apply the first hunk.Read the patch from patchfile.noBackup()
Do not back up a file if the patch does not match the file exactly and if backups are not otherwise requested.Send output to outfile instead of patching files in place.String[]
parts()
Return the String parts that define and configure the command execution (e.g., ["echo", "Hello World"])static PatchCommand
Recommended
(Path patchFile) A PatchCommand configured as recommended in the documentation of 'patch'rejectFile
(Path rejectPath) Put rejects into rejectPath instead of the default .rej file.strip
(int number) Strip the smallest prefix containing num leading slashes from each file name found in the patch file.toString()
Methods inherited from class org.variantsync.studies.evolution.simulation.shell.ShellCommand
interpretResult
-
Constructor Details
-
PatchCommand
public PatchCommand()
-
-
Method Details
-
Recommended
A PatchCommand configured as recommended in the documentation of 'patch'- Parameters:
patchFile
- The file containing the patch- Returns:
- A configured PatchCommand
-
forward
When a patch does not apply, patch usually checks if the patch looks like it has been applied already by trying to reverse- apply the first hunk. The --forward option prevents that. See also -R.- Returns:
- this command
-
strip
Strip the smallest prefix containing num leading slashes from each file name found in the patch file. A sequence of one or more adjacent slashes is counted as a single slash. This controls how file names found in the patch file are treated, in case you keep your files in a different directory than the person who sent out the patch. For example, supposing the file name in the patch file was- Parameters:
number
- how many leading slashes to slash from the file name- Returns:
- this command
-
outfile
Send output to outfile instead of patching files in place. Do not use this option if outfile is one of the files to be patched. When outfile is -, send output to standard output, and send any messages that would usually go to standard output to standard error.- Parameters:
outputPath
- The outfile path- Returns:
- this command
-
rejectFile
Put rejects into rejectPath instead of the default .rej file. When rejectfile is -, discard rejects. -
input
Read the patch from patchfile. If patchfile is -, read from standard input, the default.- Parameters:
patchFile
- the file to load- Returns:
- this command
-
noBackup
Do not back up a file if the patch does not match the file exactly and if backups are not otherwise requested. This is the default if patch is conforming to POSIX.- Returns:
- this command
-
force
Assume that the user knows exactly what he or she is doing, and do not ask any questions. Skip patches whose headers do not say which file is to be patched; patch files even though they have the wrong version for the Prereq: line in the patch; and assume that patches are not reversed even if they look like they are.- Returns:
- this command
-
parts
Description copied from class:ShellCommand
Return the String parts that define and configure the command execution (e.g., ["echo", "Hello World"])- Specified by:
parts
in classShellCommand
- Returns:
- the parts of the shell command.
-
toString
- Overrides:
toString
in classShellCommand
-