VcsAnnotation (FileAnnotation fileAnnotation) { if (!(fileAnnotation instanceof SvnFileAnnotation svnFileAnnotation)) return null; final AnnotationSourceSwitcher annotationSourceSwitcher = svnFileAnnotation.getAnnotationSourceSwitcher(); if (annotationSourceSwitcher != null) { annotationSourceSwitcher.switchTo(AnnotationSource.LOCAL); } final int size = svnFileAnnotation.getLineCount(); final VcsUsualLineAnnotationData lineAnnotationData = new VcsUsualLineAnnotationData(size); for (int i = 0; i < size; i++) { final VcsRevisionNumber revisionNumber = svnFileAnnotation.getLineRevisionNumber(i); lineAnnotationData.put(i, revisionNumber); } final VcsAnnotation vcsAnnotation = new VcsAnnotation(VcsUtil.getFilePath(svnFileAnnotation.getFile()), lineAnnotationData, svnFileAnnotation.getFirstRevisionNumber()); if (annotationSourceSwitcher != null) { final VcsRareLineAnnotationData merged = new VcsRareLineAnnotationData(size); final Map<VcsRevisionNumber, VcsFileRevision> addMap = new HashMap<>(); annotationSourceSwitcher.switchTo(AnnotationSource.MERGE); for (int i = 0; i < size; i++) { if (annotationSourceSwitcher.mergeSourceAvailable(i)) { final VcsRevisionNumber number = svnFileAnnotation.getLineRevisionNumber(i); if (number == null) continue; merged.put(i, number); addMap.put(number, svnFileAnnotation.getRevision(((SvnRevisionNumber)number).getRevision().getNumber())); } } if (!merged.isEmpty()) { vcsAnnotation.addAnnotation(MERGED_KEY, merged); vcsAnnotation.addCachedOtherRevisions(addMap); } } return vcsAnnotation; }