mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-66843 Subversion: not-cached annotations are closed on losing and tacking focus back.
This commit is contained in:
+2
-1
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.vcs.annotate;
|
||||
|
||||
import com.intellij.openapi.vcs.history.VcsAbstractHistorySession;
|
||||
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -29,5 +30,5 @@ public interface VcsCacheableAnnotationProvider {
|
||||
FileAnnotation restore(final VcsAnnotation vcsAnnotation,
|
||||
VcsAbstractHistorySession session,
|
||||
String annotatedContent,
|
||||
boolean forCurrentRevision);
|
||||
boolean forCurrentRevision, VcsRevisionNumber revisionNumber);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,8 @@ public class VcsAnnotationCachedProxy implements AnnotationProvider {
|
||||
final VcsAbstractHistorySession history = getHistory(revisionNumber, filePath, historyProvider, vcsAnnotation.getFirstRevision());
|
||||
// question is whether we need "not moved" path here?
|
||||
final ContentRevision fileContent = myVcs.getDiffProvider().createFileContent(revisionNumber, file);
|
||||
final FileAnnotation restored = cacheableAnnotationProvider.restore(vcsAnnotation, history, fileContent.getContent(), currentRevision);
|
||||
final FileAnnotation restored = cacheableAnnotationProvider.restore(vcsAnnotation, history, fileContent.getContent(), currentRevision,
|
||||
revisionNumber);
|
||||
if (restored != null) {
|
||||
return restored;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public class GitAnnotationProvider implements AnnotationProvider, VcsCacheableAn
|
||||
public FileAnnotation restore(VcsAnnotation vcsAnnotation,
|
||||
VcsAbstractHistorySession session,
|
||||
String annotatedContent,
|
||||
boolean forCurrentRevision) {
|
||||
boolean forCurrentRevision, VcsRevisionNumber revisionNumber) {
|
||||
final GitFileAnnotation gitFileAnnotation =
|
||||
new GitFileAnnotation(myProject, vcsAnnotation.getFilePath().getVirtualFile(), forCurrentRevision);
|
||||
gitFileAnnotation.addLogEntries(session.getRevisionList());
|
||||
|
||||
@@ -47,7 +47,12 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
|
||||
}
|
||||
|
||||
public FileAnnotation annotate(final VirtualFile file) throws VcsException {
|
||||
return annotate(file, new SvnFileRevision(myVcs, SVNRevision.WORKING, SVNRevision.WORKING, null, null, null, null, null), true);
|
||||
final SvnRevisionNumber currentRevision = (SvnRevisionNumber)myVcs.getDiffProvider().getCurrentRevision(file);
|
||||
if (currentRevision == null) {
|
||||
throw new VcsException("Can not get current revision for file " + file.getPath());
|
||||
}
|
||||
final SVNRevision svnRevision = currentRevision.getRevision();
|
||||
return annotate(file, new SvnFileRevision(myVcs, svnRevision, svnRevision, null, null, null, null, null), true);
|
||||
}
|
||||
|
||||
public FileAnnotation annotate(final VirtualFile file, final VcsFileRevision revision) throws VcsException {
|
||||
@@ -77,7 +82,7 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
|
||||
contents = LoadTextUtil.getTextByBinaryPresentation(bytes, file, false).toString();
|
||||
}
|
||||
|
||||
final SvnFileAnnotation result = new SvnFileAnnotation(myVcs, file, contents);
|
||||
final SvnFileAnnotation result = new SvnFileAnnotation(myVcs, file, contents, revision.getRevisionNumber());
|
||||
|
||||
SVNWCClient wcClient = myVcs.createWCClient();
|
||||
SVNInfo info = wcClient.doInfo(ioFile, SVNRevision.WORKING);
|
||||
@@ -219,9 +224,9 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
|
||||
public FileAnnotation restore(VcsAnnotation vcsAnnotation,
|
||||
VcsAbstractHistorySession session,
|
||||
String annotatedContent,
|
||||
boolean forCurrentRevision) {
|
||||
boolean forCurrentRevision, VcsRevisionNumber revisionNumber) {
|
||||
final SvnFileAnnotation annotation =
|
||||
new SvnFileAnnotation(myVcs, vcsAnnotation.getFilePath().getVirtualFile(), annotatedContent);
|
||||
new SvnFileAnnotation(myVcs, vcsAnnotation.getFilePath().getVirtualFile(), annotatedContent, revisionNumber);
|
||||
final VcsLineAnnotationData basicAnnotation = vcsAnnotation.getBasicAnnotation();
|
||||
final VcsLineAnnotationData data = vcsAnnotation.getAdditionalAnnotations().get(MERGED_KEY);
|
||||
final Map<VcsRevisionNumber,VcsFileRevision> historyAsMap = session.getHistoryAsMap();
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.util.*;
|
||||
|
||||
public class SvnFileAnnotation implements FileAnnotation {
|
||||
private final String myContents;
|
||||
private final VcsRevisionNumber myBaseRevision;
|
||||
private final MyPartiallyCreatedInfos myInfos;
|
||||
|
||||
private final SvnVcs myVcs;
|
||||
@@ -103,6 +104,10 @@ public class SvnFileAnnotation implements FileAnnotation {
|
||||
};
|
||||
private final SvnEntriesListener myListener = new SvnEntriesListener() {
|
||||
public void onEntriesChanged(VirtualFile directory) {
|
||||
if (directory != myFile.getParent()) return;
|
||||
final VcsRevisionNumber currentRevision = myVcs.getDiffProvider().getCurrentRevision(myFile);
|
||||
if (currentRevision != null && currentRevision.equals(myBaseRevision)) return;
|
||||
|
||||
final AnnotationListener[] listeners = myListeners.toArray(new AnnotationListener[myListeners.size()]);
|
||||
for (int i = 0; i < listeners.length; i++) {
|
||||
listeners[i].onAnnotationChanged();
|
||||
@@ -158,10 +163,11 @@ public class SvnFileAnnotation implements FileAnnotation {
|
||||
}
|
||||
}
|
||||
|
||||
public SvnFileAnnotation(final SvnVcs vcs, final VirtualFile file, final String contents) {
|
||||
public SvnFileAnnotation(final SvnVcs vcs, final VirtualFile file, final String contents, final VcsRevisionNumber baseRevision) {
|
||||
myVcs = vcs;
|
||||
myFile = file;
|
||||
myContents = contents;
|
||||
myBaseRevision = baseRevision;
|
||||
myVcs.getSvnEntriesFileListener().addListener(myListener);
|
||||
myConfiguration = SvnConfiguration.getInstance(vcs.getProject());
|
||||
myShowMergeSources = myConfiguration.SHOW_MERGE_SOURCES_IN_ANNOTATE;
|
||||
|
||||
Reference in New Issue
Block a user