org.eclipse.jgit.api

## Class BlameCommand

- java.lang.Object
- - org.eclipse.jgit.api.GitCommand<BlameResult>
  - - org.eclipse.jgit.api.BlameCommand

All Implemented Interfaces:
  Callable<BlameResult>

    public class BlameCommand
    extends GitCommand<BlameResult>

Blame command for building a `BlameResult` for a file path.

### Field Summary

### Fields inherited from class org.eclipse.jgit.api.GitCommand

`repo`

### Constructor Summary

Constructors
Constructor and Description
`BlameCommand(Repository repo)`

### Method Summary

Methods
`BlameResult` `call()` Generate a list of lines with information about when the lines were introduced into the file path.
`BlameCommand` `reverse(AnyObjectId start, AnyObjectId end)` Configure the command to compute reverse blame (history of deletes).
`BlameCommand` `reverse(AnyObjectId start, Collection<ObjectId> end)` Configure the generator to compute reverse blame (history of deletes).
`BlameCommand` `setDiffAlgorithm(DiffAlgorithm diffAlgorithm)` Set diff algorithm
`BlameCommand` `setFilePath(String filePath)` Set file path.
`BlameCommand` `setFollowFileRenames(boolean follow)` Enable (or disable) following file renames.
`BlameCommand` `setStartCommit(AnyObjectId commit)` Set start commit id
`BlameCommand` `setTextComparator(RawTextComparator textComparator)` Set raw text comparator

### Methods inherited from class org.eclipse.jgit.api.GitCommand

`checkCallable, getRepository, setCallable`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### BlameCommand

    public BlameCommand(Repository repo)

Parameters:
  `repo` -

### Method Detail

#### setFilePath

    public BlameCommand setFilePath(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` -
Returns:
  this command

#### setTextComparator

    public BlameCommand setTextComparator(RawTextComparator textComparator)

Set raw text comparator

Parameters:
  `textComparator` -
Returns:
  this command

#### setStartCommit

    public BlameCommand setStartCommit(AnyObjectId commit)

Set start commit id

Parameters:
  `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 --follow` in the C implementation). This is not the same as copy/move detection as implemented by the C implementation's of `git blame -M -C`.

Parameters:
  `follow` - enable following.
Returns:
  `this`

#### reverse

    public BlameCommand reverse(AnyObjectId start,
                       AnyObjectId end)
                         throws 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:
  `IOException` - the repository cannot be read.

#### reverse

    public BlameCommand reverse(AnyObjectId start,
                       Collection<ObjectId> end)
                         throws 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:
  `IOException` - the repository cannot be read.

#### call

    public BlameResult call()
                     throws GitAPIException

Generate a list of lines with information about when the lines were introduced into the file path.

Specified by:
  `call` in interface `Callable<BlameResult>`
Specified by:
  `call` in class `GitCommand<BlameResult>`
Returns:
  list of lines
Throws:
  `GitAPIException` - or subclass thereof when an error occurs