mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs: disable "Annotate" action for files with incorrect revision number
Fix "TextRevisionNumber cannot be cast to GitRevisionNumber" exception.
follow-up: 6f0c00d353
This commit is contained in:
+5
@@ -31,6 +31,7 @@ import com.intellij.openapi.vcs.*;
|
||||
import com.intellij.openapi.vcs.annotate.AnnotationProvider;
|
||||
import com.intellij.openapi.vcs.annotate.FileAnnotation;
|
||||
import com.intellij.openapi.vcs.changes.ContentRevision;
|
||||
import com.intellij.openapi.vcs.changes.TextRevisionNumber;
|
||||
import com.intellij.openapi.vcs.history.VcsFileRevision;
|
||||
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
|
||||
import com.intellij.openapi.vcs.vfs.ContentRevisionVirtualFile;
|
||||
@@ -162,6 +163,10 @@ public class AnnotateVcsVirtualFileAction {
|
||||
revisionNumber = revision.getRevisionNumber();
|
||||
}
|
||||
if (filePath == null || revisionNumber == null) return null;
|
||||
if (revisionNumber instanceof TextRevisionNumber ||
|
||||
revisionNumber == VcsRevisionNumber.NULL) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AbstractVcs vcs = VcsUtil.getVcsFor(project, filePath);
|
||||
return vcs != null ? new AnnotationData(vcs, filePath, revisionNumber) : null;
|
||||
|
||||
Reference in New Issue
Block a user