private boolean reverseResult(Candidate parent, Candidate source) throws IOException { // On a reverse blame present the application the parent // (as this is what did the removals), however the region // list to enumerate is the source's surviving list. Candidate res = parent.copy(parent.sourceCommit); res.regionList = source.regionList; return result(res); }
/** * Copy the entire result region, but at a new source position. * * @param newSource * the new source position. * @return the same result region, but offset for a new source. */ Region copy(int newSource) { return new Region(resultStart, newSource, length); }
private boolean blameEntireRegionOnParent(Candidate n, RevCommit parent) { // File was not modified, blame parent. n.sourceCommit = parent; push(n); return false; }
private boolean splitBlameWithParent(Candidate n, RevCommit parent) throws IOException { Candidate next = n.create(getRepository(), parent, n.sourcePath); next.sourceBlob = idBuf.toObjectId(); next.loadText(reader); return split(next, n); }
/** * Execute the generator in a blocking fashion until all data is ready. * * @return the complete result. Null if no file exists for the given path. * @throws java.io.IOException * the repository cannot be read. */ public BlameResult computeBlameResult() throws IOException { try { BlameResult r = BlameResult.create(this); if (r != null) r.computeAll(); return r; } finally { close(); } }
/** {@inheritDoc} */ @Override protected RevCommit createCommit(AnyObjectId id) { return new ReverseCommit(id); }
@Override public String toString() { return "Reverse" + super.toString(); //$NON-NLS-1$ } }
private boolean result(Candidate n) throws IOException { n.beginResult(revPool); outCandidate = n; outRegion = n.regionList; return outRegion != null; }
private void push(BlobCandidate toInsert) { Candidate c = queue; if (c != null) { c.remove(SEEN); // will be pushed by toInsert c.regionList = null; toInsert.parent = c; } queue = toInsert; }
/** * Get source author * * @return current author being blamed */ public PersonIdent getSourceAuthor() { return outCandidate.getAuthor(); }
Candidate copy(RevCommit commit) { Candidate r = create(sourceRepository, commit, sourcePath); r.sourceBlob = sourceBlob; r.sourceText = sourceText; r.regionList = regionList; r.renameScore = renameScore; return r; }
@Override int getParentCount() { return ((ReverseCommit) sourceCommit).getChildCount(); }
private boolean done() { close(); return false; }
@Override RevCommit getParent(int idx) { return ((ReverseCommit) sourceCommit).getChild(idx); }
@Override Candidate create(Repository repo, RevCommit commit, PathFilter path) { return new ReverseCandidate(repo, (ReverseCommit) commit, path); }
Candidate create(Repository repo, RevCommit commit, PathFilter path) { return new Candidate(repo, commit, path); }
void takeBlame(EditList editList, Candidate child) { blame(editList, this, child); }
/** * Split the region, assigning a new source position to the first half. * * @param newSource * the new source position. * @param newLen * length of the new region. * @return the first half of the region, at the new source. */ Region splitFirst(int newSource, int newLen) { return new Region(resultStart, newSource, newLen); }