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));
}
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;
}
Aggregations