Skip to content

Commit

Permalink
IDEA-306278 vcs: warn about invalid CLM state in VcsShelveChangesSaver
Browse files Browse the repository at this point in the history
GitOrigin-RevId: bd9ebe0b2b3603b1c21893c4fdc8bfe36120eac3
  • Loading branch information
AMPivovarov authored and intellij-monorepo-bot committed Dec 21, 2023
1 parent b2669d3 commit 79b5996
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public void save(@NotNull Collection<? extends VirtualFile> rootsToSave) throws
ChangeListManager changeListManager = ChangeListManager.getInstance(project);
Collection<Change> allChanges = changeListManager.getAllChanges();

if (ContainerUtil.exists(allChanges, change -> change.getBeforeRevision() instanceof FakeRevision ||
change.getAfterRevision() instanceof FakeRevision)) {
LOG.error("Local changes are not up-to-date yet. Changes saving may not be accurate.", new Throwable());
}

Set<VirtualFile> rootsSet = new HashSet<>(rootsToSave);
if (changeListManager.areChangeListsEnabled()) {
for (LocalChangeList list : changeListManager.getChangeLists()) {
Expand Down Expand Up @@ -98,7 +103,8 @@ protected void doRollback(@NotNull Collection<? extends VirtualFile> rootsToSave
}

@NotNull
private List<Change> filterChangesByRoots(@NotNull Collection<? extends Change> changes, @NotNull Set<? extends VirtualFile> rootsToSave) {
private List<Change> filterChangesByRoots(@NotNull Collection<? extends Change> changes,
@NotNull Set<? extends VirtualFile> rootsToSave) {
ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
return ContainerUtil.filter(changes, change -> {
return rootsToSave.contains(vcsManager.getVcsRootFor(ChangesUtil.getFilePath(change)));
Expand Down

0 comments on commit 79b5996

Please sign in to comment.