use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class ShowDiffFromAnnotation method correctActualLineIfTextEmpty.
private int correctActualLineIfTextEmpty(@NotNull String[] contentsLines, final int actualLine) {
final VcsRevisionNumber revision = myFileAnnotation.getLineRevisionNumber(actualLine);
if (revision == null)
return actualLine;
if (!StringUtil.isEmptyOrSpaces(contentsLines[actualLine]))
return actualLine;
int upperBound = Math.min(actualLine + ourVicinity, contentsLines.length);
for (int i = actualLine + 1; i < upperBound; i++) {
if (revision.equals(myFileAnnotation.getLineRevisionNumber(i)) && !StringUtil.isEmptyOrSpaces(contentsLines[i])) {
return i;
}
}
int lowerBound = Math.max(actualLine - ourVicinity, 0);
for (int i = actualLine - 1; i >= lowerBound; --i) {
if (revision.equals(myFileAnnotation.getLineRevisionNumber(i)) && !StringUtil.isEmptyOrSpaces(contentsLines[i])) {
return i;
}
}
return actualLine;
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class AnnotateDiffViewerAction method createAnnotationsLoader.
@Nullable
private static FileAnnotationLoader createAnnotationsLoader(@NotNull Project project, @NotNull DiffContent content) {
if (content instanceof FileContent) {
VirtualFile file = ((FileContent) content).getFile();
AbstractVcs vcs = VcsUtil.getVcsFor(project, file);
FileAnnotationLoader loader = doCreateAnnotationsLoader(project, vcs, file);
if (loader != null)
return loader;
}
Pair<FilePath, VcsRevisionNumber> info = content.getUserData(DiffUserDataKeysEx.REVISION_INFO);
if (info != null) {
FilePath filePath = info.first;
AbstractVcs vcs = VcsUtil.getVcsFor(project, filePath);
FileAnnotationLoader loader = doCreateAnnotationsLoader(vcs, filePath, info.second);
if (loader != null)
return loader;
}
return null;
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class VcsCurrentRevisionProxy method loadContent.
@NotNull
private Pair<VcsRevisionNumber, byte[]> loadContent() throws VcsException {
VcsRevisionNumber currentRevision = getCurrentRevisionNumber();
ContentRevision contentRevision = myDiffProvider.createFileContent(currentRevision, myFile);
if (contentRevision == null) {
throw new VcsException("Failed to create content for current revision");
}
return Pair.create(currentRevision, contentRevision.getContent().getBytes(myFile.getCharset()));
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class RemoteRevisionsNumbersCache method invalidate.
public void invalidate(final Collection<String> paths) {
synchronized (myLock) {
for (String path : paths) {
final Pair<VcsRoot, VcsRevisionNumber> pair = myData.remove(path);
if (pair != null) {
// vcs [root] seems to not change
final VcsRoot vcsRoot = pair.getFirst();
final LazyRefreshingSelfQueue<String> queue = getQueue(vcsRoot);
queue.forceRemove(path);
queue.addRequest(path);
myData.put(path, Pair.create(vcsRoot, NOT_LOADED));
}
}
}
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class BinaryFilePatchInProgress method createChange.
@NotNull
@Override
protected Change createChange(Project project) {
ContentRevision before = null;
ContentRevision after = null;
if (!myPatch.isNewFile()) {
before = new CurrentBinaryContentRevision(getFilePath()) {
@NotNull
@Override
public VcsRevisionNumber getRevisionNumber() {
return new TextRevisionNumber(VcsBundle.message("local.version.title"));
}
};
}
if (!myPatch.isDeletedFile()) {
after = createNewContentRevision(getFilePath());
}
return new Change(before, after);
}
Aggregations