use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class GitPatchTest method build_patch_several_roots.
@Test(dataProvider = "patchInSeparateProcess")
public void build_patch_several_roots(boolean patchInSeparateProcess) throws Exception {
myConfigBuilder.setSeparateProcessForPatch(patchInSeparateProcess);
// A build configuration can have several VCS roots, TeamCity builds patches in them one by one
// in unspecified order and then combines them into a single patch. That means a patch for
// individual VCS root should never delete the root directory, because this action could delete
// sources of another VCS root. Also patches should not contain an 'EXIT' command, otherwise
// when agent applies a combined patch it will stop after first 'EXIT'.
// patch8 is combination of patch1 and patch6
setName("patch8");
// patch1
GitVcsSupport support = getSupport();
VcsRoot root1 = getRoot("patch-tests", false);
ByteArrayOutputStream output = new ByteArrayOutputStream();
PatchBuilderImpl builder = new PatchBuilderImpl(output);
support.buildPatch(root1, null, "0dd03338d20d2e8068fbac9f24899d45d443df38", builder, CheckoutRules.DEFAULT);
// patch6
VcsRoot root2 = getRoot("rename-test", false);
// pass an unknown fromRevision 'a...a' to ensure we don't remove the root dir if the fromRevision is not found
support.buildPatch(root2, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "2eed4ae6732536f76a65136a606f635e8ada63b9", builder, CheckoutRules.DEFAULT);
builder.close();
checkPatchResult(output.toByteArray());
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class GitPatchTest method checkPatch.
private void checkPatch(String name, @NotNull String branchName, @Nullable String fromVersion, @NotNull String toVersion, boolean enableSubmodules) throws IOException, VcsException {
setName(name);
GitVcsSupport support = getSupport();
VcsRoot root = getRoot(branchName, enableSubmodules);
ByteArrayOutputStream output = new ByteArrayOutputStream();
PatchBuilderImpl builder = new PatchBuilderImpl(output);
support.buildPatch(root, fromVersion, toVersion, builder, CheckoutRules.DEFAULT);
builder.close();
checkPatchResult(output.toByteArray());
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class AutoCheckoutTest method several_roots.
@TestFor(issues = "TW-49786")
@Test(dataProvider = "severalRootsSetups")
public void several_roots(@NotNull Setup setup) throws Exception {
myVcsSupport = vcsSupportWithRealGit();
VcsRoot root1 = vcsRoot().withId(1).withFetchUrl("http://some.org/repo1.git").withAgentGitPath(getGitPath()).build();
VcsRoot root2 = vcsRoot().withId(2).withFetchUrl("http://some.org/repo2.git").withAgentGitPath(getGitPath()).build();
AgentRunningBuild build = runningBuild().addRootEntry(root1, setup.getCheckoutRules1()).addRootEntry(root2, setup.getCheckoutRules2()).build();
AgentCheckoutAbility canCheckout1 = myVcsSupport.canCheckout(root1, new CheckoutRules(setup.getCheckoutRules1()), build);
AgentCheckoutAbility canCheckout2 = myVcsSupport.canCheckout(root2, new CheckoutRules(setup.getCheckoutRules2()), build);
if (setup.isShouldFail()) {
then(canCheckout1.getCanNotCheckoutReason().getDetails()).contains("Cannot checkout VCS root '" + root1.getName() + "' into the same directory as VCS root '" + root2.getName() + "'");
then(canCheckout2.getCanNotCheckoutReason().getDetails()).contains("Cannot checkout VCS root '" + root2.getName() + "' into the same directory as VCS root '" + root1.getName() + "'");
} else {
then(canCheckout1.getCanNotCheckoutReason()).isNull();
then(canCheckout2.getCanNotCheckoutReason()).isNull();
}
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class BranchSupportTest method test.
/**
* o ee886e4adb70fbe3bdc6f3f6393598b3f02e8009 (change1)
* |
* |
* | o 1391281d33a83a7205f2f05d3eb64c349c636e87 (change2)
* | |
* | /
* |/
* o f3f826ce85d6dad25156b2d7550cedeb1a422f4c
* |
* |
* |
*/
public void test() throws VcsException {
VcsRoot originalRoot = vcsRoot().withFetchUrl(GitUtils.toURL(myRepositoryDir)).withBranch("master").build();
VcsRoot substitutionRoot = vcsRoot().withFetchUrl(GitUtils.toURL(myRepositoryDir)).withBranch("personal-branch1").build();
final String originalRootVersion = "3b9fbfbb43e7edfad018b482e15e7f93cca4e69f";
final String substitutionRootVersion = "1391281d33a83a7205f2f05d3eb64c349c636e87";
GitVcsSupport vcsSupport = gitSupport().withServerPaths(myServerPaths).build();
List<ModificationData> changes = vcsSupport.collectChanges(originalRoot, originalRootVersion, substitutionRoot, substitutionRootVersion, CheckoutRules.DEFAULT);
assertEquals(1, changes.size());
assertEquals(substitutionRoot, changes.get(0).getVcsRootObject());
assertEquals(substitutionRootVersion, changes.get(0).getVersion());
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class BulkPatchBuilderTest method test_merged_patch.
@Test
public void test_merged_patch() throws Exception {
final VcsRoot root = vcsRoot().withFetchUrl(GitUtils.toURL(myRepositoryDir)).withBranch("master").build();
final ArrayList<String> log = new ArrayList<String>();
final BulkPatchBuilder patcher = patcher(new PatchLogger() {
public void log(@NotNull final String message) {
log.add(message);
}
});
runFullPatch(root, patcher);
Assert.assertTrue(log.size() > 0);
}
Aggregations