[vcs-log] fix vcs log history for selection view data context

Revision should be returned when NOT the local one, not the other way around.

#IJPL-197012 Fixed


(cherry picked from commit 6bddafc938fa144ae8658c216f86c9d959181af9)

IJ-CR-169871

GitOrigin-RevId: bc26f0661724a5b203e4a9ceff64d52eaaabf53e
This commit is contained in:
Ivan Semenov
2025-07-17 13:07:39 +02:00
committed by intellij-monorepo-bot
parent 2320b4cf05
commit 0fdbcc27a5
2 changed files with 8 additions and 3 deletions

View File

@@ -15,6 +15,9 @@ import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.Date;
/**
* This is a synthetic revision representing the current state of the file in the working copy
*/
public class CurrentRevision implements VcsFileRevision {
private static final Logger LOG = Logger.getInstance(CurrentRevision.class);

View File

@@ -465,11 +465,13 @@ public final class VcsSelectionHistoryDialog extends FrameWrapper implements UiD
sink.set(CommonDataKeys.PROJECT, myProject);
sink.set(VcsDataKeys.VCS_VIRTUAL_FILE, myFile);
VcsFileRevision localRevision = myBlockLoader.getLocalRevision();
VcsFileRevision selectedObject = myList.getSelectedObject();
sink.set(VcsDataKeys.VCS_FILE_REVISION, selectedObject instanceof CurrentRevision o ? o : null);
if (!localRevision.equals(selectedObject)) {
sink.set(VcsDataKeys.VCS_FILE_REVISION, selectedObject);
}
List<VcsFileRevision> selectedObjects = myList.getSelectedObjects();
sink.set(VcsDataKeys.VCS_FILE_REVISIONS, ContainerUtil.filter(
selectedObjects, Conditions.notEqualTo(myBlockLoader.getLocalRevision()))
sink.set(VcsDataKeys.VCS_FILE_REVISIONS, ContainerUtil.filter(selectedObjects, Conditions.notEqualTo(localRevision))
.toArray(new VcsFileRevision[0]));
sink.set(VcsDataKeys.VCS, myActiveVcs.getKeyInstanceMethod());