Search in sources :

Example 1 with NamedProcessTag

use of com.thoughtworks.go.util.NamedProcessTag in project gocd by gocd.

the class GitRepoContainingSubmodule method createRepo.

private File createRepo(String repoName) throws Exception {
    File withSubmodules = new File(workingDir, repoName);
    withSubmodules.mkdirs();
    git(withSubmodules).init();
    createCommandLine("git").withEncoding(UTF_8).withWorkingDir(withSubmodules).withArgs("config", "user.name", "go_test").runOrBomb(true, new NamedProcessTag("git_config"));
    createCommandLine("git").withEncoding(UTF_8).withWorkingDir(withSubmodules).withArgs("config", "user.email", "go_test@go_test.me").runOrBomb(true, new NamedProcessTag("git_config"));
    createCommandLine("git").withEncoding(UTF_8).withWorkingDir(withSubmodules).withArgs("config", "commit.gpgSign", "false").runOrBomb(true, new NamedProcessTag("git_config"));
    String fileName = "file-" + System.currentTimeMillis();
    addAndCommitNewFile(withSubmodules, fileName, "Added " + fileName);
    fileName = "file-" + System.currentTimeMillis();
    addAndCommitNewFile(withSubmodules, fileName, "Added " + fileName);
    return withSubmodules;
}
Also used : NamedProcessTag(com.thoughtworks.go.util.NamedProcessTag) File(java.io.File)

Example 2 with NamedProcessTag

use of com.thoughtworks.go.util.NamedProcessTag in project gocd by gocd.

the class GitTestRepo method cloneBundleToFolder.

private void cloneBundleToFolder(File from, File workingDir) {
    GitCommand git = git(workingDir);
    InMemoryStreamConsumer outputStreamConsumer = inMemoryConsumer();
    int returnValue = git.clone(outputStreamConsumer, from.getAbsolutePath());
    if (returnValue != 0) {
        throw new RuntimeException(String.format("[ERROR] Failed to clone. URL [%s] exit value [%d] output [%s]", from.getAbsolutePath(), returnValue, outputStreamConsumer.getAllOutput()));
    }
    createCommandLine("git").withEncoding(UTF_8).withWorkingDir(workingDir).withArgs("config", "user.name", "go_test").runOrBomb(true, new NamedProcessTag("git_config"));
    createCommandLine("git").withEncoding(UTF_8).withWorkingDir(workingDir).withArgs("config", "user.email", "go_test@go_test.me").runOrBomb(true, new NamedProcessTag("git_config"));
    createCommandLine("git").withEncoding(UTF_8).withWorkingDir(workingDir).withArgs("config", "commit.gpgSign", "false").runOrBomb(true, new NamedProcessTag("git_config"));
    git.fetchAndResetToHead(outputStreamConsumer, false);
}
Also used : NamedProcessTag(com.thoughtworks.go.util.NamedProcessTag) InMemoryStreamConsumer(com.thoughtworks.go.util.command.InMemoryStreamConsumer)

Example 3 with NamedProcessTag

use of com.thoughtworks.go.util.NamedProcessTag in project gocd by gocd.

the class ScmVersionInfoProvider method getHgVersion.

private String getHgVersion() {
    try {
        CommandLine hg = createCommandLine("hg").withArgs("version").withEncoding(UTF_8);
        String hgOut = hg.runOrBomb(new NamedProcessTag("hg version check")).outputAsString();
        return hgOut;
    } catch (Exception e) {
        return null;
    }
}
Also used : NamedProcessTag(com.thoughtworks.go.util.NamedProcessTag) CommandLine(com.thoughtworks.go.util.command.CommandLine) CommandLine.createCommandLine(com.thoughtworks.go.util.command.CommandLine.createCommandLine)

Example 4 with NamedProcessTag

use of com.thoughtworks.go.util.NamedProcessTag in project gocd by gocd.

the class HgCommand method checkConnection.

public void checkConnection(UrlArgument repositoryURL) {
    CommandLine hg = createCommandLine("hg").withArgs("id", "--id", "--").withArg(repositoryURL).withNonArgSecrets(secrets).withEncoding(UTF_8);
    execute(hg, new NamedProcessTag(repositoryURL.forDisplay()));
}
Also used : NamedProcessTag(com.thoughtworks.go.util.NamedProcessTag) CommandLine.createCommandLine(com.thoughtworks.go.util.command.CommandLine.createCommandLine)

Example 5 with NamedProcessTag

use of com.thoughtworks.go.util.NamedProcessTag in project gocd by gocd.

the class HgCommand method version.

public HgVersion version() {
    CommandLine hg = createCommandLine("hg").withArgs("version").withEncoding(UTF_8);
    String hgOut = execute(hg, new NamedProcessTag("hg version check")).outputAsString();
    return HgVersion.parse(hgOut);
}
Also used : NamedProcessTag(com.thoughtworks.go.util.NamedProcessTag) CommandLine.createCommandLine(com.thoughtworks.go.util.command.CommandLine.createCommandLine)

Aggregations

NamedProcessTag (com.thoughtworks.go.util.NamedProcessTag)6 CommandLine.createCommandLine (com.thoughtworks.go.util.command.CommandLine.createCommandLine)3 CommandLine (com.thoughtworks.go.util.command.CommandLine)1 InMemoryStreamConsumer (com.thoughtworks.go.util.command.InMemoryStreamConsumer)1 File (java.io.File)1