use of com.thoughtworks.go.util.command.CommandLine in project gocd by gocd.
the class GitCommandTest method shouldGetTheCurrentBranchForTheCheckedOutRepo.
@Test
public void shouldGetTheCurrentBranchForTheCheckedOutRepo() throws IOException {
gitLocalRepoDir = createTempWorkingDirectory();
CommandLine gitCloneCommand = CommandLine.createCommandLine("git").withEncoding("UTF-8").withArg("clone");
gitCloneCommand.withArg("--branch=" + BRANCH).withArg(new UrlArgument(gitFooBranchBundle.projectRepositoryUrl())).withArg(gitLocalRepoDir.getAbsolutePath());
gitCloneCommand.run(inMemoryConsumer(), "");
git = new GitCommand(null, gitLocalRepoDir, BRANCH, false, new HashMap<>(), null);
assertThat(git.getCurrentBranch(), Is.is(BRANCH));
}
use of com.thoughtworks.go.util.command.CommandLine in project gocd by gocd.
the class GitCommandTest method shouldCloneFromMasterWhenNoBranchIsSpecified.
@Test
public void shouldCloneFromMasterWhenNoBranchIsSpecified() {
InMemoryStreamConsumer output = inMemoryConsumer();
git.clone(output, repoUrl);
CommandLine commandLine = CommandLine.createCommandLine("git").withEncoding("UTF-8").withArg("branch").withWorkingDir(gitLocalRepoDir);
commandLine.run(output, "");
assertThat(output.getStdOut(), Is.is("* master"));
}
use of com.thoughtworks.go.util.command.CommandLine in project gocd by gocd.
the class HgCommandTest method hg.
private CommandLine hg(File workingDir, String... arguments) {
CommandLine hg = CommandLine.createCommandLine("hg").withArgs(arguments).withEncoding("utf-8");
hg.setWorkingDir(workingDir);
return hg;
}
use of com.thoughtworks.go.util.command.CommandLine in project gocd by gocd.
the class HgCommandTest method commit.
private void commit(String message, File workingDir) {
CommandLine hg = hg(workingDir, "ci", "-u", "cruise-test", "-m", message);
String[] input = new String[] {};
hg.runOrBomb(null, input);
}
use of com.thoughtworks.go.util.command.CommandLine in project gocd by gocd.
the class HgCommandTest method latestRevisionOf.
private Revision latestRevisionOf() {
CommandLine hg = hg(serverRepo, "log", "--limit", "1", "--template", "{node}");
String[] input = new String[] {};
return new StringRevision(hg.runOrBomb(null, input).outputAsString());
}
Aggregations