Search in sources :

Example 6 with GitPreservingProcess

use of git4idea.util.GitPreservingProcess in project intellij-community by JetBrains.

the class GithubRebaseAction method rebaseCurrentBranch.

private static void rebaseCurrentBranch(@NotNull final Project project, @NotNull final GitRepository gitRepository, @NotNull final ProgressIndicator indicator) {
    final Git git = ServiceManager.getService(project, Git.class);
    AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
    try {
        List<VirtualFile> rootsToSave = Collections.singletonList(gitRepository.getRoot());
        GitPreservingProcess process = new GitPreservingProcess(project, git, rootsToSave, "Rebasing", "upstream/master", GitVcsSettings.UpdateChangesPolicy.STASH, indicator, () -> {
            doRebaseCurrentBranch(project, gitRepository.getRoot(), indicator);
        });
        process.execute();
    } finally {
        token.finish();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) AccessToken(com.intellij.openapi.application.AccessToken) GitPreservingProcess(git4idea.util.GitPreservingProcess)

Aggregations

GitPreservingProcess (git4idea.util.GitPreservingProcess)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 NotNull (org.jetbrains.annotations.NotNull)2 AccessToken (com.intellij.openapi.application.AccessToken)1 VcsException (com.intellij.openapi.vcs.VcsException)1 Change (com.intellij.openapi.vcs.changes.Change)1 GitCommandResult (git4idea.commands.GitCommandResult)1 GitRepository (git4idea.repo.GitRepository)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1