// if this is neither conflicting nor changed, we skip it
if (!conflicting && !modified)
continue;
ITypedElement right;
if (conflicting) {
GitFileRevision revision = GitFileRevision.inIndex(
repository, gitPath, DirCacheEntry.STAGE_3);
String encoding = CompareCoreUtils.getResourceEncoding(
repository, gitPath);
right = new FileRevisionTypedElement(revision, encoding);
} else
right = CompareUtils.getFileRevisionTypedElement(gitPath,
headCommit, repository);
// can this really happen?
if (right instanceof EmptyTypedElement)
continue;
IFileRevision rev;
// if the file is not conflicting (as it was auto-merged)
// we will show the auto-merged (local) version
Path repositoryPath = new Path(repository.getWorkTree()
.getAbsolutePath());
IPath location = repositoryPath
.append(fit.getEntryPathString());
IFile file = ResourceUtil.getFileForLocation(location);
if (!conflicting || useWorkspace) {
if (file != null)
rev = new LocalFileRevision(file);
else
rev = new WorkingTreeFileRevision(location.toFile());
} else {
rev = GitFileRevision.inIndex(repository, gitPath,
DirCacheEntry.STAGE_2);
}
IRunnableContext runnableContext = getContainer();
if (runnableContext == null)
runnableContext = PlatformUI.getWorkbench().getProgressService();
EditableRevision leftEditable;
if (file != null)
leftEditable = new ResourceEditableRevision(rev, file,
runnableContext);
else
leftEditable = new LocationEditableRevision(rev, location,
runnableContext);
// make sure we don't need a round trip later
try {
leftEditable.cacheContents(monitor);
} catch (CoreException e) {
throw new IOException(e.getMessage());
}
int kind = Differencer.NO_CHANGE;
if (conflicting)
kind = Differencer.CONFLICTING;
else if (modified)
kind = Differencer.PSEUDO_CONFLICT;
IDiffContainer fileParent = getFileParent(result,
repositoryPath, file, location);
ITypedElement anc;
if (ancestorCommit != null)
anc = CompareUtils.getFileRevisionTypedElement(gitPath,
ancestorCommit, repository);
else
anc = null;