class Candidate
extends java.lang.Object
Candidates are kept in a queue by BlameGenerator, allowing the generator to
perform a parallel search down the parents of any merges that are discovered
during the history traversal. Each candidate retains a regionList
describing sections of the result file the candidate has taken responsibility
for either directly or indirectly through its history. Actual blame from this
region list will be assigned to the candidate when its ancestor commit(s) are
themselves converted into Candidate objects and the ancestor's candidate uses
takeBlame(EditList, Candidate)
to accept responsibility for sections
of the result.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Candidate.BlobCandidate
Candidate loaded from a file source, and not a commit.
|
(package private) static class |
Candidate.HeadCandidate
A
Candidate to blame a working tree file in conflict state. |
(package private) static class |
Candidate.ReverseCandidate
Special candidate type used for reverse blame.
|
Modifier and Type | Field and Description |
---|---|
(package private) Candidate |
queueNext
Next candidate in the candidate queue.
|
(package private) Region |
regionList
Chain of regions this candidate may be blamed for.
|
(package private) int |
renameScore
Score assigned to the rename to this candidate.
|
(package private) ObjectId |
sourceBlob
Unique name of the candidate blob in
sourceCommit . |
(package private) RevCommit |
sourceCommit
Commit being considered (or blamed, depending on state).
|
(package private) PathFilter |
sourcePath
Path of the candidate file in
sourceCommit . |
private Repository |
sourceRepository
repository used for LFS blob handling
|
(package private) RawText |
sourceText
Complete contents of the file in
sourceCommit . |
Constructor and Description |
---|
Candidate(Repository repo,
RevCommit commit,
PathFilter path) |
Modifier and Type | Method and Description |
---|---|
private static Region |
add(Region aTail,
Candidate a,
Region n) |
(package private) void |
add(RevFlag flag) |
(package private) void |
beginResult(RevWalk rw) |
private static void |
blame(EditList editList,
Candidate a,
Candidate b) |
(package private) boolean |
canMergeRegions(Candidate other) |
private Region |
clearRegionList() |
(package private) Candidate |
copy(RevCommit commit) |
(package private) Candidate |
create(Repository repo,
RevCommit commit,
PathFilter path) |
(package private) PersonIdent |
getAuthor() |
(package private) Candidate |
getNextCandidate(int idx) |
(package private) RevCommit |
getParent(int idx) |
(package private) int |
getParentCount() |
(package private) int |
getTime() |
(package private) boolean |
has(RevFlag flag) |
(package private) void |
loadText(ObjectReader reader) |
(package private) void |
mergeRegions(Candidate other) |
(package private) void |
remove(RevFlag flag) |
(package private) void |
takeBlame(EditList editList,
Candidate child) |
java.lang.String |
toString() |
Candidate queueNext
RevCommit sourceCommit
PathFilter sourcePath
sourceCommit
.ObjectId sourceBlob
sourceCommit
.RawText sourceText
sourceCommit
.Region regionList
This list is always kept sorted by resultStart order, making it simple to merge-join with the sorted EditList during blame assignment.
int renameScore
Consider the history "A<-B<-C". If the result file S in C was renamed to R in B, the rename score for this rename will be held in this field by the candidate object for B. By storing the score with B, the application can see what the rename score was as it makes the transition from C/S to B/R. This may seem backwards since it was C that performed the rename, but the application doesn't learn about path R until B.
private Repository sourceRepository
Candidate(Repository repo, RevCommit commit, PathFilter path)
void beginResult(RevWalk rw) throws MissingObjectException, java.io.IOException
MissingObjectException
java.io.IOException
int getParentCount()
RevCommit getParent(int idx)
Candidate getNextCandidate(int idx)
boolean has(RevFlag flag)
void add(RevFlag flag)
void remove(RevFlag flag)
int getTime()
PersonIdent getAuthor()
Candidate create(Repository repo, RevCommit commit, PathFilter path)
void loadText(ObjectReader reader) throws java.io.IOException
java.io.IOException
private Region clearRegionList()
boolean canMergeRegions(Candidate other)
void mergeRegions(Candidate other)
public java.lang.String toString()
toString
in class java.lang.Object