Search in sources :

Example 1 with GitLineHandlerListener

use of git4idea.commands.GitLineHandlerListener in project intellij-community by JetBrains.

the class GitCheckoutProvider method doClone.

public static boolean doClone(@NotNull Project project, @NotNull Git git, @NotNull String directoryName, @NotNull String parentDirectory, @NotNull String sourceRepositoryURL) {
    ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
    indicator.setIndeterminate(false);
    GitLineHandlerListener progressListener = GitStandardProgressAnalyzer.createListener(indicator);
    GitCommandResult result = git.clone(project, new File(parentDirectory), sourceRepositoryURL, directoryName, progressListener);
    if (result.success()) {
        return true;
    }
    VcsNotifier.getInstance(project).notifyError("Clone failed", result.getErrorOutputAsHtmlString());
    return false;
}
Also used : ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) GitLineHandlerListener(git4idea.commands.GitLineHandlerListener) GitCommandResult(git4idea.commands.GitCommandResult) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 2 with GitLineHandlerListener

use of git4idea.commands.GitLineHandlerListener in project intellij-community by JetBrains.

the class GitPushOperation method doPush.

@NotNull
private ResultWithOutput doPush(@NotNull GitRepository repository, @NotNull PushSpec<GitPushSource, GitPushTarget> pushSpec) {
    GitPushTarget target = pushSpec.getTarget();
    GitLocalBranch sourceBranch = pushSpec.getSource().getBranch();
    GitRemoteBranch targetBranch = target.getBranch();
    GitLineHandlerListener progressListener = GitStandardProgressAnalyzer.createListener(myProgressIndicator);
    boolean setUpstream = pushSpec.getTarget().isNewBranchCreated() && !branchTrackingInfoIsSet(repository, sourceBranch);
    String tagMode = myTagMode == null ? null : myTagMode.getArgument();
    String spec = sourceBranch.getFullName() + ":" + targetBranch.getNameForRemoteOperations();
    GitCommandResult res = myGit.push(repository, targetBranch.getRemote(), spec, myForce, setUpstream, tagMode, progressListener);
    return new ResultWithOutput(res);
}
Also used : GitLocalBranch(git4idea.GitLocalBranch) GitLineHandlerListener(git4idea.commands.GitLineHandlerListener) GitCommandResult(git4idea.commands.GitCommandResult) GitRemoteBranch(git4idea.GitRemoteBranch) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

GitCommandResult (git4idea.commands.GitCommandResult)2 GitLineHandlerListener (git4idea.commands.GitLineHandlerListener)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 GitLocalBranch (git4idea.GitLocalBranch)1 GitRemoteBranch (git4idea.GitRemoteBranch)1 File (java.io.File)1 NotNull (org.jetbrains.annotations.NotNull)1