use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class TfsSDKCommandTest method shouldReturnChangeSetsFromAPreviouslyKnownRevisionUptilTheLatest.
@Test
public void shouldReturnChangeSetsFromAPreviouslyKnownRevisionUptilTheLatest() throws Exception {
Changeset[] changeSets = getChangeSets(42);
when(client.queryHistory(eq(TFS_PROJECT), any(ChangesetVersionSpec.class), anyInt())).thenReturn(changeSets);
TfsSDKCommand spy = spy(tfsCommand);
doReturn(null).when(spy).getModifiedFiles(changeSets[0]);
List<Modification> modifications = spy.modificationsSince(null, new StringRevision("2"));
assertThat(modifications.isEmpty(), is(false));
verify(client, times(2)).queryHistory(eq(TFS_PROJECT), any(ChangesetVersionSpec.class), anyInt());
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class GitCommand method fetchAndResetToHead.
public void fetchAndResetToHead(ProcessOutputStreamConsumer outputStreamConsumer) {
fetch(outputStreamConsumer);
resetWorkingDir(outputStreamConsumer, new StringRevision(remoteBranch()));
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class GitMaterialTest method shouldRemoveSubmoduleFolderFromWorkingDirWhenSubmoduleIsRemovedFromRepo.
@Test
public void shouldRemoveSubmoduleFolderFromWorkingDirWhenSubmoduleIsRemovedFromRepo() throws Exception {
GitSubmoduleRepos submoduleRepos = new GitSubmoduleRepos(temporaryFolder);
submoduleRepos.addSubmodule(SUBMODULE, "sub1");
GitMaterial gitMaterial = new GitMaterial(submoduleRepos.mainRepo().getUrl());
StringRevision revision = new StringRevision("origin/master");
gitMaterial.updateTo(outputStreamConsumer, workingDir, new RevisionContext(revision), new TestSubprocessExecutionContext());
assertThat(new File(workingDir, "sub1"), exists());
submoduleRepos.removeSubmodule("sub1");
outputStreamConsumer = inMemoryConsumer();
gitMaterial.updateTo(outputStreamConsumer, workingDir, new RevisionContext(revision), new TestSubprocessExecutionContext());
assertThat(new File(workingDir, "sub1"), not(exists()));
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class GitSubmoduleRepos method changeSubmoduleUrl.
public void changeSubmoduleUrl(String submoduleName) throws Exception {
File newSubmodule = createRepo("new-submodule");
addAndCommitNewFile(newSubmodule, "new", "make a commit");
git(remoteRepoDir).changeSubmoduleUrl(submoduleName, newSubmodule.getAbsolutePath());
git(remoteRepoDir).submoduleSync();
git(new File(remoteRepoDir, "local-submodule")).fetch(inMemoryConsumer());
git(new File(remoteRepoDir, "local-submodule")).resetHard(inMemoryConsumer(), new StringRevision("origin/master"));
git(remoteRepoDir).add(new File(".gitmodules"));
git(remoteRepoDir).add(new File("local-submodule"));
git(remoteRepoDir).commit("change submodule url");
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class GitCommand method fetchAndResetToHead.
public void fetchAndResetToHead(ConsoleOutputStreamConsumer outputStreamConsumer) {
fetch(outputStreamConsumer);
resetWorkingDir(outputStreamConsumer, new StringRevision(remoteBranch()));
}
Aggregations