mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-69853 GitRebaser to use the ProgressIndicator if one is available.
[Reviewed by irengrig]
This commit is contained in:
@@ -456,6 +456,7 @@ public class GitPushActiveBranchesDialog extends DialogWrapper {
|
||||
|
||||
final Boolean[] result = new Boolean[1];
|
||||
result[0] = false;
|
||||
final ProgressIndicator finalProgressIndicator = progressIndicator;
|
||||
new GitUpdateLikeProcess(myProject) {
|
||||
@Override
|
||||
protected void runImpl(ContinuationContext context) {
|
||||
@@ -464,7 +465,7 @@ public class GitPushActiveBranchesDialog extends DialogWrapper {
|
||||
saver.saveLocalChanges(rootsToReorder);
|
||||
|
||||
try {
|
||||
GitRebaser rebaser = new GitRebaser(myProject);
|
||||
GitRebaser rebaser = new GitRebaser(myProject, finalProgressIndicator);
|
||||
for (Map.Entry<VirtualFile, List<String>> rootToCommits: rebaseInfo.reorderedCommits.entrySet()) {
|
||||
final VirtualFile root = rootToCommits.getKey();
|
||||
GitBranch b = GitBranch.current(myProject, root);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package git4idea.rebase;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
@@ -27,6 +28,7 @@ import git4idea.commands.*;
|
||||
import git4idea.merge.GitMergeConflictResolver;
|
||||
import git4idea.ui.GitUIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -44,9 +46,11 @@ public class GitRebaser {
|
||||
private GitVcs myVcs;
|
||||
private List<GitRebaseUtils.CommitInfo> mySkippedCommits;
|
||||
private static final Logger LOG = Logger.getInstance(GitRebaser.class);
|
||||
private final @Nullable ProgressIndicator myProgressIndicator;
|
||||
|
||||
public GitRebaser(Project project) {
|
||||
public GitRebaser(Project project, ProgressIndicator progressIndicator) {
|
||||
myProject = project;
|
||||
myProgressIndicator = progressIndicator;
|
||||
myVcs = GitVcs.getInstance(project);
|
||||
mySkippedCommits = new ArrayList<GitRebaseUtils.CommitInfo>();
|
||||
}
|
||||
@@ -56,6 +60,7 @@ public class GitRebaser {
|
||||
final GitLineHandler rh = new GitLineHandler(myProject, root, GitCommand.REBASE);
|
||||
rh.addParameters("--abort");
|
||||
GitTask task = new GitTask(myProject, rh, "Aborting rebase");
|
||||
task.setProgressIndicator(myProgressIndicator);
|
||||
task.executeAsync(new GitTaskResultNotificationHandler(myProject, "Rebase aborted", "Abort rebase cancelled", "Error aborting rebase"));
|
||||
}
|
||||
|
||||
@@ -85,6 +90,7 @@ public class GitRebaser {
|
||||
|
||||
final GitTask rebaseTask = new GitTask(myProject, rh, "git rebase " + startOperation);
|
||||
rebaseTask.setProgressAnalyzer(new GitStandardProgressAnalyzer());
|
||||
rebaseTask.setProgressIndicator(myProgressIndicator);
|
||||
return executeRebaseTaskInBackground(root, rh, rebaseConflictDetector, rebaseTask);
|
||||
}
|
||||
|
||||
@@ -130,6 +136,7 @@ public class GitRebaser {
|
||||
rebaseEditorService.configureHandler(h, rebaseEditorNo);
|
||||
|
||||
final GitTask rebaseTask = new GitTask(myProject, h, "Reordering commits");
|
||||
rebaseTask.setProgressIndicator(myProgressIndicator);
|
||||
return executeRebaseTaskInBackground(root, h, rebaseConflictDetector, rebaseTask);
|
||||
} finally {
|
||||
// unregistering rebase service
|
||||
|
||||
@@ -47,7 +47,7 @@ public class GitRebaseUpdater extends GitUpdater {
|
||||
ProgressIndicator progressIndicator,
|
||||
UpdatedFiles updatedFiles) {
|
||||
super(project, root, gitUpdateProcess, progressIndicator, updatedFiles);
|
||||
myRebaser = new GitRebaser(myProject);
|
||||
myRebaser = new GitRebaser(myProject, myProgressIndicator);
|
||||
}
|
||||
|
||||
@Override public boolean isSaveNeeded() {
|
||||
|
||||
@@ -311,7 +311,7 @@ public class GitUpdateProcess {
|
||||
* @return true if rebase is in progress, which means that update can't continue.
|
||||
*/
|
||||
private boolean checkRebaseInProgress() {
|
||||
final GitRebaser rebaser = new GitRebaser(myProject);
|
||||
final GitRebaser rebaser = new GitRebaser(myProject, myProgressIndicator);
|
||||
final Collection<VirtualFile> rebasingRoots = rebaser.getRebasingRoots();
|
||||
if (rebasingRoots.isEmpty()) {
|
||||
return false;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class GitRebaserReorderCommitsTest extends GitSingleUserTest {
|
||||
|
||||
@BeforeMethod @Override protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myRebaser = new GitRebaser(myProject);
|
||||
myRebaser = new GitRebaser(myProject, null);
|
||||
myRoot = myRepo.getDir();
|
||||
myFirstCommit = makeCommit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user