mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA: local history fix
This commit is contained in:
+4
-2
@@ -26,6 +26,8 @@ import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import com.intellij.util.io.ReadOnlyAttributeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -41,10 +43,10 @@ public class ChangeRevertingVisitor extends ChangeVisitor {
|
||||
|
||||
private boolean isReverting;
|
||||
|
||||
public ChangeRevertingVisitor(IdeaGateway gw, long fromChangeId, long toChangeId) {
|
||||
public ChangeRevertingVisitor(IdeaGateway gw, @NotNull Long fromChangeId, @Nullable Long toChangeId) {
|
||||
myGateway = gw;
|
||||
myFromChangeId = fromChangeId;
|
||||
myToChangeId = toChangeId;
|
||||
myToChangeId = toChangeId == null ? -1 : toChangeId;
|
||||
}
|
||||
|
||||
protected boolean shouldRevert(Change c) {
|
||||
|
||||
@@ -21,20 +21,22 @@ import com.intellij.history.core.changes.Change;
|
||||
import com.intellij.history.integration.IdeaGateway;
|
||||
import com.intellij.history.integration.revertion.ChangeRevertingVisitor;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ChangeRange {
|
||||
private final IdeaGateway myGateway;
|
||||
private final LocalHistoryFacade myVcs;
|
||||
private final long myFromChangeId;
|
||||
private final long myToChangeId;
|
||||
private final Long myFromChangeId;
|
||||
@Nullable private final Long myToChangeId;
|
||||
|
||||
public ChangeRange(IdeaGateway gw, LocalHistoryFacade vcs, long change) {
|
||||
this(gw, vcs, change, change);
|
||||
public ChangeRange(IdeaGateway gw, LocalHistoryFacade vcs, @NotNull Long changeId) {
|
||||
this(gw, vcs, changeId, changeId);
|
||||
}
|
||||
|
||||
public ChangeRange(IdeaGateway gw, LocalHistoryFacade vcs, long fromChangeId, long toChangeId) {
|
||||
private ChangeRange(IdeaGateway gw, LocalHistoryFacade vcs, @Nullable Long fromChangeId, @Nullable Long toChangeId) {
|
||||
myGateway = gw;
|
||||
myVcs = vcs;
|
||||
myFromChangeId = fromChangeId;
|
||||
@@ -54,13 +56,13 @@ public class ChangeRange {
|
||||
try {
|
||||
myVcs.accept(new ChangeRevertingVisitor(myGateway, myToChangeId, myFromChangeId));
|
||||
}
|
||||
catch(ChangeRevertingVisitor.RuntimeIOException e) {
|
||||
catch (ChangeRevertingVisitor.RuntimeIOException e) {
|
||||
throw (IOException)e.getCause();
|
||||
}
|
||||
finally {
|
||||
myVcs.removeListener(l);
|
||||
}
|
||||
|
||||
|
||||
if (reverse != null) {
|
||||
if (first.isNull()) first.set(reverse.myFromChangeId);
|
||||
if (last.isNull()) last.set(reverse.myToChangeId);
|
||||
|
||||
Reference in New Issue
Block a user