public class BlameResult extends Object
A result is usually updated incrementally as the BlameGenerator digs back further through history. Applications that want to lay annotations down text to the original source file in a viewer may find the BlameResult structure an easy way to acquire the information, at the expense of keeping tables in memory tracking every line of the result file.
This class is not thread-safe.
During blame processing there are two files involved:
Modifier and Type | Method and Description |
---|---|
void |
computeAll()
Compute all pending information.
|
int |
computeNext()
Compute the next available segment and return the first index.
|
void |
computeRange(int start,
int end)
Compute until the entire range has been populated.
|
static BlameResult |
create(BlameGenerator gen)
Construct a new BlameResult for a generator.
|
void |
discardResultContents()
Throw away the
getResultContents() . |
RawText |
getResultContents() |
String |
getResultPath() |
PersonIdent |
getSourceAuthor(int idx)
Get the author that provided the specified line of the result.
|
RevCommit |
getSourceCommit(int idx)
Get the commit that provided the specified line of the result.
|
PersonIdent |
getSourceCommitter(int idx)
Get the committer that provided the specified line of the result.
|
int |
getSourceLine(int idx)
Get the corresponding line number in the source file.
|
String |
getSourcePath(int idx)
Get the file path that provided the specified line of the result.
|
boolean |
hasSourceData(int idx)
Check if the given result line has been annotated yet.
|
boolean |
hasSourceData(int start,
int end)
Check if the given result line has been annotated yet.
|
int |
lastLength() |
String |
toString() |
public static BlameResult create(BlameGenerator gen) throws IOException
gen
- the generator the result will consume records from.IOException
- the repository cannot be read.public String getResultPath()
public RawText getResultContents()
public void discardResultContents()
getResultContents()
.public boolean hasSourceData(int idx)
idx
- line to read data of, 0 based.public boolean hasSourceData(int start, int end)
start
- first index to examine.end
- last index to examine.public RevCommit getSourceCommit(int idx)
The source commit may be null if the line was blamed to an uncommitted revision, such as the working tree copy, or during a reverse blame if the line survives to the end revision (e.g. the branch tip).
idx
- line to read data of, 0 based.idx
. May be null.public PersonIdent getSourceAuthor(int idx)
idx
- line to read data of, 0 based.idx
. May be null.public PersonIdent getSourceCommitter(int idx)
idx
- line to read data of, 0 based.idx
. May be null.public String getSourcePath(int idx)
idx
- line to read data of, 0 based.idx
.public int getSourceLine(int idx)
idx
- line to read data of, 0 based.public void computeAll() throws IOException
IOException
- the repository cannot be read.public int computeNext() throws IOException
Computes one segment and returns to the caller the first index that is
available. After return the caller can also inspect lastLength()
to determine how many lines of the result were computed.
IOException
- the repository cannot be read.public int lastLength()
computeNext()
.public void computeRange(int start, int end) throws IOException
start
- first index to examine (inclusive).end
- end index (exclusive).IOException
- the repository cannot be read.Copyright © 2015 Eclipse JGit Project. All rights reserved.