Class Candidate
- java.lang.Object
-
- org.eclipse.jgit.blame.Candidate
-
- Direct Known Subclasses:
Candidate.BlobCandidate
,Candidate.HeadCandidate
,Candidate.ReverseCandidate
class Candidate extends java.lang.Object
A source that may have supplied some (or all) of the result file.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 usestakeBlame(EditList, Candidate)
to accept responsibility for sections of the result.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
Candidate.BlobCandidate
Candidate loaded from a file source, and not a commit.(package private) static class
Candidate.HeadCandidate
ACandidate
to blame a working tree file in conflict state.(package private) static class
Candidate.ReverseCandidate
Special candidate type used for reverse blame.
-
Field Summary
Fields Modifier and Type Field 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 insourceCommit
.(package private) RevCommit
sourceCommit
Commit being considered (or blamed, depending on state).(package private) PathFilter
sourcePath
Path of the candidate file insourceCommit
.private Repository
sourceRepository
repository used for LFS blob handling(package private) RawText
sourceText
Complete contents of the file insourceCommit
.
-
Constructor Summary
Constructors Constructor Description Candidate(Repository repo, RevCommit commit, PathFilter path)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Field Detail
-
queueNext
Candidate queueNext
Next candidate in the candidate queue.
-
sourceCommit
RevCommit sourceCommit
Commit being considered (or blamed, depending on state).
-
sourcePath
PathFilter sourcePath
Path of the candidate file insourceCommit
.
-
sourceBlob
ObjectId sourceBlob
Unique name of the candidate blob insourceCommit
.
-
sourceText
RawText sourceText
Complete contents of the file insourceCommit
.
-
regionList
Region regionList
Chain of regions this candidate may be blamed for.This list is always kept sorted by resultStart order, making it simple to merge-join with the sorted EditList during blame assignment.
-
renameScore
int renameScore
Score assigned to the rename to this candidate.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.
-
sourceRepository
private Repository sourceRepository
repository used for LFS blob handling
-
-
Constructor Detail
-
Candidate
Candidate(Repository repo, RevCommit commit, PathFilter path)
-
-
Method Detail
-
beginResult
void beginResult(RevWalk rw) throws MissingObjectException, java.io.IOException
- Throws:
MissingObjectException
java.io.IOException
-
getParentCount
int getParentCount()
-
getParent
RevCommit getParent(int idx)
-
getNextCandidate
Candidate getNextCandidate(int idx)
-
has
boolean has(RevFlag flag)
-
add
void add(RevFlag flag)
-
remove
void remove(RevFlag flag)
-
getTime
int getTime()
-
getAuthor
PersonIdent getAuthor()
-
create
Candidate create(Repository repo, RevCommit commit, PathFilter path)
-
loadText
void loadText(ObjectReader reader) throws java.io.IOException
- Throws:
java.io.IOException
-
clearRegionList
private Region clearRegionList()
-
canMergeRegions
boolean canMergeRegions(Candidate other)
-
mergeRegions
void mergeRegions(Candidate other)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-