diff options
Diffstat (limited to 'plugins/git4idea/src/git4idea/push/GitPusher.java')
-rw-r--r-- | plugins/git4idea/src/git4idea/push/GitPusher.java | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/plugins/git4idea/src/git4idea/push/GitPusher.java b/plugins/git4idea/src/git4idea/push/GitPusher.java index 31e289dba806..778d2dcd0033 100644 --- a/plugins/git4idea/src/git4idea/push/GitPusher.java +++ b/plugins/git4idea/src/git4idea/push/GitPusher.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,6 @@ import git4idea.config.GitConfigUtil; import git4idea.config.GitVcsSettings; import git4idea.config.UpdateMethod; import git4idea.history.GitHistoryUtils; -import git4idea.jgit.GitHttpAdapter; import git4idea.repo.GitBranchTrackInfo; import git4idea.repo.GitRemote; import git4idea.repo.GitRepository; @@ -48,7 +47,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.*; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; /** * Collects information to push and performs the push. @@ -321,13 +320,8 @@ public final class GitPusher { } String url = pushUrls.iterator().next(); GitSimplePushResult pushResult; - if (GitHttpAdapter.shouldUseJGit(url)) { - pushResult = GitHttpAdapter.push(repository, remote.getName(), url, formPushSpec(pushSpec, remote)); - } - else { - pushResult = pushNatively(repository, pushSpec, url); - } - + pushResult = pushNatively(repository, pushSpec, url); + if (pushResult.getType() == GitSimplePushResult.Type.SUCCESS) { setUpstream(repository, pushSpec.getSource(), pushSpec.getRemote(), pushSpec.getDest()); } @@ -478,9 +472,7 @@ public final class GitPusher { // and don't show the dialog again if user has chosen not to ask again updateSettings = readUpdateSettings(); if (!mySettings.autoUpdateIfPushRejected()) { - final GitRejectedPushUpdateDialog dialog = new GitRejectedPushUpdateDialog(myProject, rejectedPushesForCurrentBranch.keySet(), updateSettings); - final int exitCode = showDialogAndGetExitCode(dialog); - updateSettings = new UpdateSettings(dialog.shouldUpdateAll(), getUpdateMethodFromDialogExitCode(exitCode)); + updateSettings = showDialogAndGetExitCode(rejectedPushesForCurrentBranch, updateSettings); saveUpdateSettings(updateSettings); } } @@ -519,20 +511,23 @@ public final class GitPusher { return new UpdateSettings(updateAllRoots, updateMethod); } - private int showDialogAndGetExitCode(@NotNull final GitRejectedPushUpdateDialog dialog) { - final AtomicInteger exitCode = new AtomicInteger(); + private UpdateSettings showDialogAndGetExitCode(final Map<GitRepository, GitBranch> rejectedPushesForCurrentBranch, + final UpdateSettings initialSettings) { + final AtomicReference<UpdateSettings> updateSettings = new AtomicReference<UpdateSettings>(); UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { + final GitRejectedPushUpdateDialog dialog = new GitRejectedPushUpdateDialog(myProject, rejectedPushesForCurrentBranch.keySet(), initialSettings); dialog.show(); - exitCode.set(dialog.getExitCode()); - } + final int exitCode = dialog.getExitCode(); + if (exitCode != DialogWrapper.CANCEL_EXIT_CODE) { + mySettings.setAutoUpdateIfPushRejected(dialog.shouldAutoUpdateInFuture()); + } + updateSettings.set(new UpdateSettings(dialog.shouldUpdateAll(), getUpdateMethodFromDialogExitCode(exitCode))); + + } }); - int code = exitCode.get(); - if (code != DialogWrapper.CANCEL_EXIT_CODE) { - mySettings.setAutoUpdateIfPushRejected(dialog.shouldAutoUpdateInFuture()); - } - return code; + return updateSettings.get(); } /** |