From e02e2c4f8b2d49cdc5a703632101a9ea4693de3e Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Thu, 19 Sep 2013 01:29:49 +0400 Subject: [PATCH] IDEA-113780 "Annotate" from history fixed for renamed/moved files --- .../hg4idea/provider/annotate/HgAnnotationProvider.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java index eaad2b9a0e4c..5592151eea8f 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java @@ -29,6 +29,7 @@ import org.zmlx.hg4idea.command.HgAnnotateCommand; import org.zmlx.hg4idea.command.HgLogCommand; import org.zmlx.hg4idea.command.HgWorkingCopyRevisionsCommand; import org.zmlx.hg4idea.execution.HgCommandException; +import org.zmlx.hg4idea.util.HgUtil; import java.util.List; @@ -52,10 +53,12 @@ public class HgAnnotationProvider implements AnnotationProvider { throw new VcsException("vcs root is null for " + file); } final HgFile hgFile = new HgFile(vcsRoot, VfsUtilCore.virtualToIoFile(file)); - final List annotationResult = (new HgAnnotateCommand(myProject)).execute(hgFile, revision); + HgFile fileToAnnotate = revision instanceof HgFileRevision ? HgUtil + .getFileNameInTargetRevision(myProject, ((HgFileRevision)revision).getRevisionNumber(), hgFile) : hgFile; + final List annotationResult = (new HgAnnotateCommand(myProject)).execute(fileToAnnotate, revision); final List logResult; try { - logResult = (new HgLogCommand(myProject)).execute(hgFile, DEFAULT_LIMIT, false); + logResult = (new HgLogCommand(myProject)).execute(fileToAnnotate, DEFAULT_LIMIT, false); } catch (HgCommandException e) { throw new VcsException("Can not annotate, " + HgVcsMessages.message("hg4idea.error.log.command.execution"), e); @@ -69,5 +72,4 @@ public class HgAnnotationProvider implements AnnotationProvider { public boolean isAnnotationValid(VcsFileRevision rev) { return true; } - }