LastRevision (@NotNull VirtualFile file) { try { AbstractVcs vcs = VcsUtil.getVcsFor(project, file); if (vcs == null) return null; VcsHistoryProvider historyProvider = vcs.getVcsHistoryProvider(); if (historyProvider == null) return null; FilePath filePath = VcsContextFactory.getInstance().createFilePathOn(file); if (historyProvider instanceof VcsHistoryProviderEx) { VcsFileRevision revision = ((VcsHistoryProviderEx)historyProvider).getLastRevision(filePath); if (revision == null) return null; return LastRevision.create(revision); } else { VcsHistorySession session = historyProvider.createSessionFor(filePath); if (session == null) return null; List<VcsFileRevision> list = session.getRevisionList(); if (list == null || list.isEmpty()) return null; return LastRevision.create(list.get(0)); } } catch (VcsException e) { LOG.warn(e); return null; } }