Search in sources :

Example 6 with HgCommand

use of com.thoughtworks.go.domain.materials.mercurial.HgCommand in project gocd by gocd.

the class HgMaterialTest method shouldRefreshWorkingFolderWhenRepositoryChanged.

@Test
public void shouldRefreshWorkingFolderWhenRepositoryChanged() throws Exception {
    new HgCommand(null, workingFolder, "default", hgTestRepo.url().forCommandline(), null).clone(inMemoryConsumer(), hgTestRepo.url());
    File testFile = createNewFileInWorkingFolder();
    HgTestRepo hgTestRepo2 = new HgTestRepo("hgTestRepo2", temporaryFolder);
    hgMaterial = MaterialsMother.hgMaterial(hgTestRepo2.projectRepositoryUrl());
    hgMaterial.latestModification(workingFolder, new TestSubprocessExecutionContext());
    String workingUrl = new HgCommand(null, workingFolder, "default", hgTestRepo.url().forCommandline(), null).workingRepositoryUrl().outputAsString();
    assertThat(workingUrl, is(hgTestRepo2.projectRepositoryUrl()));
    assertThat(testFile.exists(), is(false));
}
Also used : HgCommand(com.thoughtworks.go.domain.materials.mercurial.HgCommand) StringContains.containsString(org.hamcrest.core.StringContains.containsString) HgTestRepo(com.thoughtworks.go.helper.HgTestRepo) File(java.io.File) Test(org.junit.Test)

Example 7 with HgCommand

use of com.thoughtworks.go.domain.materials.mercurial.HgCommand in project gocd by gocd.

the class HgMaterial method getHg.

private HgCommand getHg(File baseDir) {
    InMemoryStreamConsumer output = ProcessOutputStreamConsumer.inMemoryConsumer();
    HgCommand hgCommand = null;
    try {
        hgCommand = hg(baseDir, output);
    } catch (Exception e) {
        bomb(e.getMessage() + " " + output.getStdError(), e);
    }
    return hgCommand;
}
Also used : HgCommand(com.thoughtworks.go.domain.materials.mercurial.HgCommand)

Aggregations

HgCommand (com.thoughtworks.go.domain.materials.mercurial.HgCommand)7 Test (org.junit.Test)4 ConsoleResult (com.thoughtworks.go.util.command.ConsoleResult)2 File (java.io.File)2 StringContains.containsString (org.hamcrest.core.StringContains.containsString)2 StringRevision (com.thoughtworks.go.domain.materials.mercurial.StringRevision)1 HgTestRepo (com.thoughtworks.go.helper.HgTestRepo)1