Search in sources :

Example 11 with GitCommandLine

use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine in project teamcity-git by JetBrains.

the class SetUpstreamCommandImpl method call.

public void call() throws VcsException {
    GitCommandLine cmd = getCmd();
    GitVersion version = cmd.getGitVersion();
    if (version.isLessThan(new GitVersion(1, 7, 0))) {
        // ability to set upstream was added in 1.7.0
        return;
    } else if (version.isLessThan(new GitVersion(1, 8, 0))) {
        cmd.addParameters("branch", "--set-upstream", myLocalBranch, myUpstreamBranch);
    } else {
        cmd.addParameters("branch", "--set-upstream-to=" + myUpstreamBranch);
    }
    CommandUtil.runCommand(cmd.stdErrExpected(false));
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine) GitVersion(jetbrains.buildServer.buildTriggers.vcs.git.GitVersion)

Example 12 with GitCommandLine

use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine in project teamcity-git by JetBrains.

the class DiffCommandImpl method call.

@NotNull
@Override
public List<String> call() throws VcsException {
    GitCommandLine cmd = getCmd();
    cmd.addParameter("diff");
    if (myFormat != null) {
        cmd.addParameter(myFormat);
    }
    if (myCommit1 != null) {
        cmd.addParameter(myCommit1);
    }
    if (myCommit2 != null) {
        cmd.addParameter(myCommit2);
    }
    ExecResult r = CommandUtil.runCommand(cmd);
    String stdout = r.getStdout().trim();
    return StringUtil.isEmpty(stdout) ? Collections.<String>emptyList() : Arrays.asList(StringUtil.splitByLines(stdout));
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine) ExecResult(jetbrains.buildServer.ExecResult) NotNull(org.jetbrains.annotations.NotNull)

Example 13 with GitCommandLine

use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine in project teamcity-git by JetBrains.

the class ListConfigCommandImpl method call.

@NotNull
@Override
public String call() throws VcsException {
    GitCommandLine cmd = getCmd();
    cmd.addParameters("config", "--list");
    if (!cmd.getGitVersion().isLessThan(new GitVersion(2, 8, 0))) {
        cmd.addParameter("--show-origin");
    }
    return CommandUtil.runCommand(cmd).getStdout().trim();
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine) GitVersion(jetbrains.buildServer.buildTriggers.vcs.git.GitVersion) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with GitCommandLine

use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine in project teamcity-git by JetBrains.

the class PackRefsImpl method call.

public void call() throws VcsException {
    GitCommandLine cmd = getCmd();
    cmd.addParameters("pack-refs", "--all");
    CommandUtil.runCommand(cmd);
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine)

Example 15 with GitCommandLine

use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine in project teamcity-git by JetBrains.

the class ResetCommandImpl method call.

public void call() throws VcsException {
    GitCommandLine cmd = getCmd();
    cmd.addParameters("reset");
    if (myHard)
        cmd.addParameter("--hard");
    cmd.addParameter(myRevision);
    runCmd(cmd);
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine)

Aggregations

GitCommandLine (jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine)36 NotNull (org.jetbrains.annotations.NotNull)6 GitVersion (jetbrains.buildServer.buildTriggers.vcs.git.GitVersion)5 ExecResult (jetbrains.buildServer.ExecResult)4 File (java.io.File)3 VcsException (jetbrains.buildServer.vcs.VcsException)3 AgentGitCommandLine (jetbrains.buildServer.buildTriggers.vcs.git.agent.AgentGitCommandLine)2 AgentGitFacadeImpl (jetbrains.buildServer.buildTriggers.vcs.git.agent.AgentGitFacadeImpl)2 FetchCommandImpl (jetbrains.buildServer.buildTriggers.vcs.git.command.impl.FetchCommandImpl)2 StubContext (jetbrains.buildServer.buildTriggers.vcs.git.command.impl.StubContext)2 SkipException (org.testng.SkipException)2 Test (org.testng.annotations.Test)2 ShowRefResult (jetbrains.buildServer.buildTriggers.vcs.git.agent.command.ShowRefResult)1 Nullable (org.jetbrains.annotations.Nullable)1