mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-193195 vcs: fix "Compare with Local" for renamed files
This commit is contained in:
+11
-1
@@ -24,6 +24,7 @@ import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.FilePath;
|
||||
import com.intellij.openapi.vcs.VcsDataKeys;
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
@@ -79,9 +80,18 @@ public class ShowDiffWithLocalAction extends AnAction implements DumbAware, AnAc
|
||||
@Nullable
|
||||
private Change getChangeWithLocal(@NotNull Change c) {
|
||||
ContentRevision revision = myUseBeforeVersion ? c.getBeforeRevision() : c.getAfterRevision();
|
||||
ContentRevision otherRevision = myUseBeforeVersion ? c.getAfterRevision() : c.getBeforeRevision();
|
||||
if (!isValidRevision(revision)) return null;
|
||||
|
||||
ContentRevision contentRevision = CurrentContentRevision.create(revision.getFile());
|
||||
FilePath filePath = revision.getFile();
|
||||
if (filePath.getVirtualFile() == null && otherRevision != null) {
|
||||
FilePath otherFile = otherRevision.getFile();
|
||||
if (otherFile.getVirtualFile() != null) {
|
||||
filePath = otherFile;
|
||||
}
|
||||
}
|
||||
|
||||
ContentRevision contentRevision = CurrentContentRevision.create(filePath);
|
||||
return new Change(revision, contentRevision);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user