mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[git] Better progress indicator during Update
For multi-root projects mention which repository is being rebased/merged.
This commit is contained in:
@@ -76,7 +76,8 @@ public class GitMergeUpdater extends GitUpdater {
|
||||
GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector = new GitUntrackedFilesOverwrittenByOperationDetector(myRoot);
|
||||
mergeHandler.addLineListener(untrackedFilesDetector);
|
||||
|
||||
final GitTask mergeTask = new GitTask(myProject, mergeHandler, "Merging changes");
|
||||
String progressTitle = makeProgressTitle("Merging");
|
||||
final GitTask mergeTask = new GitTask(myProject, mergeHandler, progressTitle);
|
||||
mergeTask.setProgressIndicator(myProgressIndicator);
|
||||
mergeTask.setProgressAnalyzer(new GitStandardProgressAnalyzer());
|
||||
final AtomicReference<GitUpdateResult> updateResult = new AtomicReference<GitUpdateResult>();
|
||||
|
||||
@@ -73,7 +73,8 @@ public class GitRebaseUpdater extends GitUpdater {
|
||||
GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector = new GitUntrackedFilesOverwrittenByOperationDetector(myRoot);
|
||||
rebaseHandler.addLineListener(untrackedFilesDetector);
|
||||
|
||||
GitTask rebaseTask = new GitTask(myProject, rebaseHandler, "Rebasing");
|
||||
String progressTitle = makeProgressTitle("Rebasing");
|
||||
GitTask rebaseTask = new GitTask(myProject, rebaseHandler, progressTitle);
|
||||
rebaseTask.setProgressIndicator(myProgressIndicator);
|
||||
rebaseTask.setProgressAnalyzer(new GitStandardProgressAnalyzer());
|
||||
final AtomicReference<GitUpdateResult> updateResult = new AtomicReference<GitUpdateResult>();
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.vcs.update.UpdatedFiles;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import git4idea.GitBranch;
|
||||
import git4idea.GitRevisionNumber;
|
||||
import git4idea.GitUtil;
|
||||
import git4idea.GitVcs;
|
||||
import git4idea.branch.GitBranchPair;
|
||||
import git4idea.branch.GitBranchUtil;
|
||||
@@ -33,6 +34,7 @@ import git4idea.commands.GitSimpleHandler;
|
||||
import git4idea.config.GitConfigUtil;
|
||||
import git4idea.config.GitVcsSettings;
|
||||
import git4idea.merge.MergeChangeCollector;
|
||||
import git4idea.repo.GitRepositoryManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -48,11 +50,12 @@ public abstract class GitUpdater {
|
||||
|
||||
@NotNull protected final Project myProject;
|
||||
@NotNull protected final Git myGit;
|
||||
protected final @NotNull VirtualFile myRoot;
|
||||
protected final @NotNull Map<VirtualFile, GitBranchPair> myTrackedBranches;
|
||||
protected final @NotNull ProgressIndicator myProgressIndicator;
|
||||
protected final @NotNull UpdatedFiles myUpdatedFiles;
|
||||
protected final @NotNull AbstractVcsHelper myVcsHelper;
|
||||
@NotNull protected final VirtualFile myRoot;
|
||||
@NotNull protected final Map<VirtualFile, GitBranchPair> myTrackedBranches;
|
||||
@NotNull protected final ProgressIndicator myProgressIndicator;
|
||||
@NotNull protected final UpdatedFiles myUpdatedFiles;
|
||||
@NotNull protected final AbstractVcsHelper myVcsHelper;
|
||||
@NotNull protected final GitRepositoryManager myRepositoryManager;
|
||||
protected final GitVcs myVcs;
|
||||
|
||||
protected GitRevisionNumber myBefore; // The revision that was before update
|
||||
@@ -68,6 +71,7 @@ public abstract class GitUpdater {
|
||||
myUpdatedFiles = updatedFiles;
|
||||
myVcsHelper = AbstractVcsHelper.getInstance(project);
|
||||
myVcs = GitVcs.getInstance(project);
|
||||
myRepositoryManager = GitUtil.getRepositoryManager(myProject);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,4 +178,10 @@ public abstract class GitUpdater {
|
||||
String output = handler.run();
|
||||
return output != null && !output.isEmpty();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected String makeProgressTitle(@NotNull String operation) {
|
||||
return myRepositoryManager.moreThanOneRoot() ? String.format("%s %s...", operation, myRoot.getName()) : operation + "...";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user