Search in sources :

Example 26 with GitCommandLine

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

the class GcCommandImpl method call.

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

Example 27 with GitCommandLine

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

the class InitCommandImpl method call.

public void call() throws VcsException {
    GitCommandLine cmd = getCmd();
    cmd.addParameter("init");
    if (myBare)
        cmd.addParameter("--bare");
    if (!cmd.getGitVersion().isLessThan(UpdaterImpl.GIT_INIT_STDERR_DEFAULT_BRANCH_HINT)) {
        // TW-69468
        cmd.addParameter("--initial-branch=" + INITIAL_BRANCH);
    }
    CommandUtil.runCommand(cmd.stdErrExpected(false));
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine)

Example 28 with GitCommandLine

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

the class AddRemoteCommandImpl method call.

public void call() throws VcsException {
    GitCommandLine cmd = getCmd();
    cmd.addParameters("remote", "add", myName, myUrl);
    CommandUtil.runCommand(cmd.stdErrExpected(false));
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine)

Example 29 with GitCommandLine

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

the class CleanCommandImpl method call.

public void call() throws VcsException {
    GitCommandLine cmd = getCmd();
    cmd.addParameters("clean", "-f", "-d");
    switch(myCleanPolicy) {
        case ALL_UNTRACKED:
            cmd.addParameter("-x");
            break;
        case IGNORED_ONLY:
            cmd.addParameter("-X");
            break;
        case NON_IGNORED_ONLY:
            break;
    }
    addExcludes(cmd);
    cmd.withMaxOutputSize(8 * 1024 * 1024);
    try {
        CommandUtil.runCommand(cmd.stdErrExpected(false));
    } catch (VcsException e) {
        Loggers.VCS.warnAndDebugDetails("Failed to clean files", e);
        if (!SystemInfo.isWindows || CommandUtil.isCanceledError(e)) {
            throw e;
        }
        if (CommandUtil.isNoSuchFileOrDirError(e)) {
            throw new VcsException("Some files may be locked: " + e.getMessage(), e);
        }
        final File workingDir = cmd.getWorkingDirectory();
        if (workingDir == null) {
            throw e;
        }
        if (CommandUtil.isFileNameTooLongError(e)) {
            handleLongFileNames(workingDir, e);
        }
    }
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine) VcsException(jetbrains.buildServer.vcs.VcsException) File(java.io.File)

Example 30 with GitCommandLine

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

the class DeleteBranchCommandImpl method call.

public void call() throws VcsException {
    GitCommandLine cmd = getCmd();
    cmd.addParameter("branch");
    cmd.addParameter("-D");
    cmd.addParameter(myName);
    CommandUtil.runCommand(cmd.stdErrExpected(false));
}
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