Search in sources :

Example 16 with GitCommandLine

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

the class SubmoduleInitCommandImpl method call.

public void call() throws VcsException {
    GitCommandLine cmd = getCmd();
    cmd.addParameter("submodule");
    cmd.addParameter("init");
    CommandUtil.runCommand(cmd);
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine)

Example 17 with GitCommandLine

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

the class GetConfigCommandImpl method callWithLevel.

private String callWithLevel(boolean abnormalExitExpected) throws VcsException {
    GitCommandLine cmd = getCmd();
    cmd.addParameters("config", myName);
    return CommandUtil.runCommand(cmd.abnormalExitExpected(abnormalExitExpected).stdErrExpected(false)).getStdout().trim();
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine)

Example 18 with GitCommandLine

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

the class LsTreeCommandImpl method call.

@Override
public LsTreeResult call() throws VcsException {
    GitCommandLine cmd = getCmd();
    cmd.addParameter("ls-tree");
    if (revision != null)
        cmd.addParameter(revision);
    if (path != null)
        cmd.addParameter(path);
    ExecResult r = CommandUtil.runCommand(cmd);
    String stdout = r.getStdout().trim();
    return StringUtil.isEmpty(stdout) ? null : parseLsTreeOutput(stdout);
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine) ExecResult(jetbrains.buildServer.ExecResult)

Example 19 with GitCommandLine

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

the class SetConfigCommandImpl method call.

public void call() throws VcsException {
    GitCommandLine cmd = getCmd();
    if (myUnSet) {
        cmd.addParameters("config", "--unset", myPropertyName);
    } else {
        cmd.addParameters("config", myPropertyName, myValue);
    }
    CommandUtil.runCommand(cmd.stdErrExpected(false));
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine)

Example 20 with GitCommandLine

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

the class ShowRefCommandImpl method call.

@NotNull
public ShowRefResult call() {
    GitCommandLine cmd = getCmd();
    cmd.addParameter("show-ref");
    if (myPattern != null)
        cmd.addParameters(myPattern);
    if (myShowTags)
        cmd.addParameter("--tags");
    try {
        ExecResult result = CommandUtil.runCommand(cmd);
        return new ShowRefResult(parseValidRefs(result.getStdout()), parseInvalidRefs(result.getStderr()), result.getExitCode());
    } catch (VcsException e) {
        getCmd().getContext().getLogger().warning("show-ref command failed, empty result will be returned: " + e.getMessage());
        return new ShowRefResult();
    }
}
Also used : ShowRefResult(jetbrains.buildServer.buildTriggers.vcs.git.agent.command.ShowRefResult) GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine) VcsException(jetbrains.buildServer.vcs.VcsException) ExecResult(jetbrains.buildServer.ExecResult) NotNull(org.jetbrains.annotations.NotNull)

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