mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[git] Pull: remove fetch+merge hack used for JGit
JGit is no more used for HTTP operations. This fixes IDEA-101902: git pull will be called only for the chosen remote.
This commit is contained in:
@@ -31,17 +31,14 @@ import git4idea.commands.GitStandardProgressAnalyzer;
|
||||
import git4idea.commands.GitTask;
|
||||
import git4idea.commands.GitTaskResultHandlerAdapter;
|
||||
import git4idea.i18n.GitBundle;
|
||||
import git4idea.jgit.GitHttpAdapter;
|
||||
import git4idea.merge.GitMergeUtil;
|
||||
import git4idea.merge.GitPullDialog;
|
||||
import git4idea.repo.GitRemote;
|
||||
import git4idea.repo.GitRepository;
|
||||
import git4idea.repo.GitRepositoryManager;
|
||||
import git4idea.update.GitFetcher;
|
||||
import git4idea.util.GitUIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@@ -86,18 +83,8 @@ public class GitPull extends GitRepositoryAction {
|
||||
return;
|
||||
}
|
||||
|
||||
if (GitHttpAdapter.shouldUseJGit(url)) {
|
||||
boolean fetchSuccessful = new GitFetcher(project, indicator, true).fetchRootsAndNotify(Collections.singleton(repository),
|
||||
"Pull failed", false);
|
||||
if (!fetchSuccessful) {
|
||||
return;
|
||||
}
|
||||
handlerReference.set(dialog.pullOrMergeHandler(null));
|
||||
} else {
|
||||
handlerReference.set(dialog.pullOrMergeHandler(url));
|
||||
}
|
||||
|
||||
|
||||
handlerReference.set(dialog.makeHandler(url));
|
||||
|
||||
final VirtualFile root = dialog.gitRoot();
|
||||
affectedRoots.add(root);
|
||||
String revision = repository.getCurrentRevision();
|
||||
|
||||
@@ -153,15 +153,12 @@ public class GitPullDialog extends DialogWrapper {
|
||||
/**
|
||||
* @return a pull handler configured according to dialog options
|
||||
*/
|
||||
public GitLineHandler pullOrMergeHandler(@Nullable String url) {
|
||||
boolean pull = url != null;
|
||||
GitLineHandler h = new GitLineHandler(myProject, gitRoot(), pull ? GitCommand.PULL : GitCommand.MERGE);
|
||||
public GitLineHandler makeHandler(@NotNull String url) {
|
||||
GitLineHandler h = new GitLineHandler(myProject, gitRoot(), GitCommand.PULL);
|
||||
// ignore merge failure for the pull
|
||||
h.ignoreErrorCode(1);
|
||||
if (pull) {
|
||||
h.setRemoteProtocol(url);
|
||||
h.addProgressParameter();
|
||||
}
|
||||
h.setRemoteProtocol(url);
|
||||
h.addProgressParameter();
|
||||
h.addParameters("--no-stat");
|
||||
if (myNoCommitCheckBox.isSelected()) {
|
||||
h.addParameters("--no-commit");
|
||||
@@ -182,24 +179,15 @@ public class GitPullDialog extends DialogWrapper {
|
||||
h.addParameters("--strategy", strategy);
|
||||
}
|
||||
h.addParameters("-v");
|
||||
if (pull) {
|
||||
h.addProgressParameter();
|
||||
}
|
||||
h.addProgressParameter();
|
||||
|
||||
final List<String> markedBranches = myBranchChooser.getMarkedElements();
|
||||
String remote = getRemote();
|
||||
LOG.assertTrue(remote != null, "Selected remote can't be null here.");
|
||||
if (pull) {
|
||||
// git pull origin master (remote branch name in the format local to that remote)
|
||||
h.addParameters(remote);
|
||||
for (String branch : markedBranches) {
|
||||
h.addParameters(removeRemotePrefix(branch, remote));
|
||||
}
|
||||
} else {
|
||||
// git merge origin/master (remote branch name in format of this repository)
|
||||
for (String branch : markedBranches) {
|
||||
h.addParameters(branch);
|
||||
}
|
||||
// git pull origin master (remote branch name in the format local to that remote)
|
||||
h.addParameters(remote);
|
||||
for (String branch : markedBranches) {
|
||||
h.addParameters(removeRemotePrefix(branch, remote));
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user