Package org.eclipse.jgit.api
Class ApplyCommand
- All Implemented Interfaces:
Callable<ApplyResult>
Apply a patch to files and/or to the index.
- Since:
- 2.0
- See Also:
-
Field Summary
FieldsFields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
Constructor Summary
ConstructorsConstructorDescriptionApplyCommand
(Repository repo) Constructs the command if the patch is to be applied to the index. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
apply
(File f, FileHeader fh) call()
private boolean
canApplyAt
(List<String> hunkLines, List<String> newLines, int line) private File
private static boolean
private boolean
setPatch
(InputStream in) Set patchMethods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Field Details
-
in
-
-
Constructor Details
-
ApplyCommand
ApplyCommand(Repository repo) Constructs the command if the patch is to be applied to the index.- Parameters:
repo
-
-
-
Method Details
-
setPatch
Set patch- Parameters:
in
- the patch to apply- Returns:
- this instance
-
call
Execute the command
Executes the
ApplyCommand
command with all the options and parameters collected by the setter methods (e.g.setPatch(InputStream)
of this class. Each instance of this class should only be used for one invocation of the command. Don't call this method twice on an instance.- Specified by:
call
in interfaceCallable<ApplyResult>
- Specified by:
call
in classGitCommand<ApplyResult>
- Throws:
GitAPIException
PatchFormatException
PatchApplyException
-
getFile
- Throws:
PatchApplyException
-
apply
- Parameters:
f
-fh
-- Throws:
IOException
PatchApplyException
-
canApplyAt
-
isChanged
-
isNoNewlineAtEndOfFile
-