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 voidapply(File f, FileHeader fh) call()private booleancanApplyAt(List<String> hunkLines, List<String> newLines, int line) private Fileprivate static booleanprivate booleansetPatch(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
ApplyCommandcommand 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:
callin interfaceCallable<ApplyResult>- Specified by:
callin classGitCommand<ApplyResult>- Throws:
GitAPIExceptionPatchFormatExceptionPatchApplyException
-
getFile
- Throws:
PatchApplyException
-
apply
- Parameters:
f-fh-- Throws:
IOExceptionPatchApplyException
-
canApplyAt
-
isChanged
-
isNoNewlineAtEndOfFile
-