Package org.eclipse.jgit.api
Class BlameCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<BlameResult>
-
- org.eclipse.jgit.api.BlameCommand
-
- All Implemented Interfaces:
java.util.concurrent.Callable<BlameResult>
public class BlameCommand extends GitCommand<BlameResult>
Blame command for building aBlameResultfor a file path.
-
-
Field Summary
Fields Modifier and Type Field Description private DiffAlgorithmdiffAlgorithmprivate java.lang.BooleanfollowFileRenamesprivate java.lang.Stringpathprivate java.util.Collection<ObjectId>reverseEndCommitsprivate ObjectIdstartCommitprivate RawTextComparatortextComparator-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Constructor Description BlameCommand(Repository repo)Constructor for BlameCommand
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BlameResultcall()BlameCommandreverse(AnyObjectId start, java.util.Collection<ObjectId> end)Configure the generator to compute reverse blame (history of deletes).BlameCommandreverse(AnyObjectId start, AnyObjectId end)Configure the command to compute reverse blame (history of deletes).BlameCommandsetDiffAlgorithm(DiffAlgorithm diffAlgorithm)Set diff algorithmBlameCommandsetFilePath(java.lang.String filePath)Set file path.BlameCommandsetFollowFileRenames(boolean follow)Enable (or disable) following file renames.BlameCommandsetStartCommit(AnyObjectId commit)Set start commit idBlameCommandsetTextComparator(RawTextComparator textComparator)Set raw text comparator-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Field Detail
-
path
private java.lang.String path
-
diffAlgorithm
private DiffAlgorithm diffAlgorithm
-
textComparator
private RawTextComparator textComparator
-
startCommit
private ObjectId startCommit
-
reverseEndCommits
private java.util.Collection<ObjectId> reverseEndCommits
-
followFileRenames
private java.lang.Boolean followFileRenames
-
-
Constructor Detail
-
BlameCommand
public BlameCommand(Repository repo)
Constructor for BlameCommand- Parameters:
repo- theRepository
-
-
Method Detail
-
setFilePath
public BlameCommand setFilePath(java.lang.String filePath)
Set file path.- Parameters:
filePath- file path (with/as separator)- Returns:
- this command
-
setDiffAlgorithm
public BlameCommand setDiffAlgorithm(DiffAlgorithm diffAlgorithm)
Set diff algorithm- Parameters:
diffAlgorithm- aDiffAlgorithmobject.- Returns:
- this command
-
setTextComparator
public BlameCommand setTextComparator(RawTextComparator textComparator)
Set raw text comparator- Parameters:
textComparator- aRawTextComparator- Returns:
- this command
-
setStartCommit
public BlameCommand setStartCommit(AnyObjectId commit)
Set start commit id- Parameters:
commit- id of a commit- Returns:
- this command
-
setFollowFileRenames
public BlameCommand setFollowFileRenames(boolean follow)
Enable (or disable) following file renames.If true renames are followed using the standard FollowFilter behavior used by RevWalk (which matches
git log --followin the C implementation). This is not the same as copy/move detection as implemented by the C implementation's ofgit blame -M -C.- Parameters:
follow- enable following.- Returns:
this
-
reverse
public BlameCommand reverse(AnyObjectId start, AnyObjectId end) throws java.io.IOException
Configure the command to compute reverse blame (history of deletes).- Parameters:
start- oldest commit to traverse from. The result file will be loaded from this commit's tree.end- most recent commit to stop traversal at. Usually an active branch tip, tag, or HEAD.- Returns:
this- Throws:
java.io.IOException- the repository cannot be read.
-
reverse
public BlameCommand reverse(AnyObjectId start, java.util.Collection<ObjectId> end) throws java.io.IOException
Configure the generator to compute reverse blame (history of deletes).- Parameters:
start- oldest commit to traverse from. The result file will be loaded from this commit's tree.end- most recent commits to stop traversal at. Usually an active branch tip, tag, or HEAD.- Returns:
this- Throws:
java.io.IOException- the repository cannot be read.
-
call
public BlameResult call() throws GitAPIException
Execute the command
Generate a list of lines with information about when the lines were introduced into the file path.
- Specified by:
callin interfacejava.util.concurrent.Callable<BlameResult>- Specified by:
callin classGitCommand<BlameResult>- Throws:
GitAPIException
-
-