use of com.intellij.history.Label in project intellij-community by JetBrains.
the class HistoryReverterToLabelTest method testFileCreation.
public void testFileCreation() throws Exception {
createChildData(myRoot, "first.txt");
final Label testLabel = LocalHistory.getInstance().putSystemLabel(myProject, "testLabel");
createChildData(myRoot, "foo.txt");
revertToLabel(testLabel, myRoot);
assertNull(myRoot.findChild("foo.txt"));
assertNotNull(myRoot.findChild("first.txt"));
}
use of com.intellij.history.Label in project intellij-community by JetBrains.
the class GitMergeAction method perform.
protected void perform(@NotNull final Project project, @NotNull final List<VirtualFile> gitRoots, @NotNull final VirtualFile defaultRoot) {
final DialogState dialogState = displayDialog(project, gitRoots, defaultRoot);
if (dialogState == null) {
return;
}
final VirtualFile selectedRoot = dialogState.selectedRoot;
final Computable<GitLineHandler> handlerProvider = dialogState.handlerProvider;
final Label beforeLabel = LocalHistory.getInstance().putSystemLabel(project, "Before update");
new Task.Backgroundable(project, dialogState.progressTitle, true) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
final GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project);
final Git git = Git.getInstance();
final GitLocalChangesWouldBeOverwrittenDetector localChangesDetector = new GitLocalChangesWouldBeOverwrittenDetector(selectedRoot, MERGE);
final GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector = new GitUntrackedFilesOverwrittenByOperationDetector(selectedRoot);
final GitSimpleEventDetector mergeConflict = new GitSimpleEventDetector(GitSimpleEventDetector.Event.MERGE_CONFLICT);
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
GitCommandResult result = git.runCommand(() -> {
GitLineHandler handler = handlerProvider.compute();
handler.addLineListener(localChangesDetector);
handler.addLineListener(untrackedFilesDetector);
handler.addLineListener(mergeConflict);
return handler;
});
GitRepository repository = repositoryManager.getRepositoryForRoot(selectedRoot);
assert repository != null : "Repository can't be null for root " + selectedRoot;
String revision = repository.getCurrentRevision();
if (revision == null) {
return;
}
final GitRevisionNumber currentRev = new GitRevisionNumber(revision);
handleResult(result, project, mergeConflict, localChangesDetector, untrackedFilesDetector, repository, currentRev, beforeLabel);
} finally {
token.finish();
}
}
}.queue();
}
Aggregations