use of org.jetbrains.idea.svn.history.SvnFileRevision in project intellij-community by JetBrains.
the class BaseSvnFileAnnotation method getToolTip.
public String getToolTip(final int lineNumber) {
final CommitInfo info = myInfos.getOrNull(lineNumber);
if (info == null)
return "";
SvnFileRevision revision = myRevisionMap.get(info.getRevision());
if (revision != null) {
String prefix = myInfos.getAnnotationSource(lineNumber).showMerged() ? "Merge source revision" : "Revision";
return prefix + " " + info.getRevision() + ": " + revision.getCommitMessage();
}
return "";
}
use of org.jetbrains.idea.svn.history.SvnFileRevision in project intellij-community by JetBrains.
the class SvnAnnotationProvider method restore.
@Nullable
@Override
public FileAnnotation restore(@NotNull VcsAnnotation vcsAnnotation, @NotNull VcsAbstractHistorySession session, @NotNull String annotatedContent, boolean forCurrentRevision, VcsRevisionNumber revisionNumber) {
final SvnFileAnnotation annotation = 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();
final Map<VcsRevisionNumber, VcsFileRevision> cachedOtherRevisions = vcsAnnotation.getCachedOtherRevisions();
for (int i = 0; i < basicAnnotation.getNumLines(); i++) {
final VcsRevisionNumber revision = basicAnnotation.getRevision(i);
final VcsRevisionNumber mergedData = data == null ? null : data.getRevision(i);
final SvnFileRevision fileRevision = (SvnFileRevision) historyAsMap.get(revision);
if (fileRevision == null)
return null;
if (mergedData == null) {
annotation.setLineInfo(i, fileRevision.getCommitInfo(), null);
} else {
final SvnFileRevision mergedRevision = (SvnFileRevision) cachedOtherRevisions.get(mergedData);
if (mergedRevision == null)
return null;
annotation.setLineInfo(i, fileRevision.getCommitInfo(), mergedRevision.getCommitInfo());
}
}
if (vcsAnnotation.getFirstRevision() != null) {
annotation.setFirstRevision(((SvnRevisionNumber) vcsAnnotation.getFirstRevision()).getRevision());
}
for (VcsFileRevision revision : session.getRevisionList()) {
annotation.setRevision(((SvnRevisionNumber) revision.getRevisionNumber()).getRevision().getNumber(), (SvnFileRevision) revision);
}
return annotation;
}
use of org.jetbrains.idea.svn.history.SvnFileRevision in project intellij-community by JetBrains.
the class SvnAnnotationProvider method annotate.
public FileAnnotation annotate(final VirtualFile file) throws VcsException {
final SvnDiffProvider provider = (SvnDiffProvider) myVcs.getDiffProvider();
final SVNRevision currentRevision = ((SvnRevisionNumber) provider.getCurrentRevision(file)).getRevision();
final VcsRevisionDescription lastChangedRevision = provider.getCurrentRevisionDescription(file);
if (lastChangedRevision == null) {
throw new VcsException("Can not get current revision for file " + file.getPath());
}
final SVNRevision svnRevision = ((SvnRevisionNumber) lastChangedRevision.getRevisionNumber()).getRevision();
if (!svnRevision.isValid()) {
throw new VcsException("Can not get last changed revision for file: " + file.getPath() + "\nPlease run svn info for this file and file an issue.");
}
return annotate(file, new SvnFileRevision(myVcs, currentRevision, currentRevision, null, null, null, null, null), lastChangedRevision.getRevisionNumber(), true);
}
use of org.jetbrains.idea.svn.history.SvnFileRevision in project intellij-community by JetBrains.
the class RepositoryBrowserComponent method getSelectedVcsFile.
@Nullable
public VirtualFile getSelectedVcsFile() {
final RepositoryTreeNode node = getSelectedNode();
if (node == null)
return null;
DirectoryEntry entry = node.getSVNDirEntry();
if (entry == null || !entry.isFile()) {
return null;
}
String name = entry.getName();
FileTypeManager manager = FileTypeManager.getInstance();
if (entry.getName().lastIndexOf('.') > 0 && !manager.getFileTypeByFileName(name).isBinary()) {
SVNURL url = node.getURL();
final SvnFileRevision revision = new SvnFileRevision(myVCS, SVNRevision.UNDEFINED, SVNRevision.HEAD, url.toString(), entry.getAuthor(), entry.getDate(), null, null);
return new VcsVirtualFile(node.getSVNDirEntry().getName(), revision, VcsFileSystem.getInstance());
} else {
return null;
}
}
Aggregations