@Override @Nullable public String getToolTip(int lineNumber) { if (myLines.size() <= lineNumber || lineNumber < 0) { return null; } HgAnnotationLine info = myLines.get(lineNumber); if (info == null) { return null; } for (HgFileRevision revision : myFileRevisions) { if (revision.getRevisionNumber().equals(info.getVcsRevisionNumber())) { return HgVcsMessages.message( "hg4idea.annotation.tool.tip", revision.getRevisionNumber().asString(), revision.getAuthor(), revision.getRevisionDate(), revision.getCommitMessage()); } } return null; }
public static List<? extends VcsFullCommitDetails> createFullCommitsFromResult( @NotNull Project project, @NotNull VirtualFile root, @Nullable HgCommandResult result, @NotNull HgVersion version, boolean silent) { final VcsLogObjectsFactory factory = getObjectsFactoryWithDisposeCheck(project); if (factory == null) { return Collections.emptyList(); } List<HgFileRevision> hgRevisions = getCommitRecords( project, result, new HgFileRevisionLogParser(project, getOriginalHgFile(project, root), version), silent); List<VcsFullCommitDetails> vcsFullCommitDetailsList = new ArrayList<VcsFullCommitDetails>(); for (HgFileRevision revision : hgRevisions) { HgRevisionNumber vcsRevisionNumber = revision.getRevisionNumber(); List<HgRevisionNumber> parents = vcsRevisionNumber.getParents(); HgRevisionNumber firstParent = parents.isEmpty() ? null : parents.get(0); // can have no parents if it is a root List<Hash> parentsHash = new SmartList<Hash>(); for (HgRevisionNumber parent : parents) { parentsHash.add(factory.createHash(parent.getChangeset())); } final Collection<Change> changes = new ArrayList<Change>(); for (String file : revision.getModifiedFiles()) { changes.add( createChange( project, root, file, firstParent, file, vcsRevisionNumber, FileStatus.MODIFIED)); } for (String file : revision.getAddedFiles()) { changes.add( createChange(project, root, null, null, file, vcsRevisionNumber, FileStatus.ADDED)); } for (String file : revision.getDeletedFiles()) { changes.add( createChange( project, root, file, firstParent, null, vcsRevisionNumber, FileStatus.DELETED)); } for (Map.Entry<String, String> copiedFile : revision.getCopiedFiles().entrySet()) { changes.add( createChange( project, root, copiedFile.getKey(), firstParent, copiedFile.getValue(), vcsRevisionNumber, FileStatus.ADDED)); } vcsFullCommitDetailsList.add( factory.createFullDetails( factory.createHash(vcsRevisionNumber.getChangeset()), parentsHash, revision.getRevisionDate().getTime(), root, vcsRevisionNumber.getSubject(), vcsRevisionNumber.getAuthor(), vcsRevisionNumber.getEmail(), vcsRevisionNumber.getCommitMessage(), vcsRevisionNumber.getAuthor(), vcsRevisionNumber.getEmail(), revision.getRevisionDate().getTime(), new ThrowableComputable<Collection<Change>, Exception>() { @Override public Collection<Change> compute() throws Exception { return changes; } })); } return vcsFullCommitDetailsList; }