ContentRevision (VcsRevisionNumber revisionNumber, VirtualFile file) { if (file == null) { return null; } VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, file); if (vcsRoot == null) { return null; } HgRevisionNumber hgRevisionNumber = (HgRevisionNumber) revisionNumber; if (hgRevisionNumber.isWorkingVersion()) { throw new IllegalStateException("Should not compare against working copy"); } HgFile hgFile = new HgFile(vcsRoot, HgUtil.getOriginalFileName(VcsUtil.getFilePath(file), ChangeListManager.getInstance(project))); return HgContentRevision.create(project, hgFile, hgRevisionNumber); }