use of jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport in project teamcity-git by JetBrains.
the class LatestAcceptedRevisionTest method test_start_and_stop_are_the_same.
public void test_start_and_stop_are_the_same() throws IOException, VcsException {
GitVcsSupport support = git();
VcsRoot root = vcsRoot().withFetchUrl(myRepo).build();
ensureFetchPerformed(support, root, "refs/heads/master", "bbdf67dc5d1d2fa1ce08a0c7db7371f14cd918bf");
String rev = support.getCollectChangesPolicy().getLatestRevisionAcceptedByCheckoutRules(root, new CheckoutRules("+:test"), "bbdf67dc5d1d2fa1ce08a0c7db7371f14cd918bf", Collections.singleton("bbdf67dc5d1d2fa1ce08a0c7db7371f14cd918bf"));
then(rev).isNull();
}
use of jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport in project teamcity-git by JetBrains.
the class GitPatchTest method checkPatch.
private void checkPatch(@NotNull VcsRoot root, String name, @Nullable String fromVersion, @NotNull String toVersion, @NotNull CheckoutRules rules) throws IOException, VcsException {
setName(name);
GitVcsSupport support = getSupport();
ByteArrayOutputStream output = new ByteArrayOutputStream();
PatchBuilderImpl builder = new PatchBuilderImpl(output);
support.buildPatch(root, fromVersion, toVersion, builder, rules);
builder.close();
checkPatchResult(output.toByteArray());
}
use of jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport 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.buildTriggers.vcs.git.GitVcsSupport 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.buildTriggers.vcs.git.GitVcsSupport in project teamcity-git by JetBrains.
the class ContentProviderTest method should_throw_exception_for_unknown_path.
@Test(expectedExceptions = VcsFileNotFoundException.class)
public void should_throw_exception_for_unknown_path() throws Exception {
GitVcsSupport git = createGit();
VcsRoot root = vcsRoot().withFetchUrl(getRemoteRepositoryUrl("repo.git")).withBranch("version-test").build();
String version = getDefaultBranchRevision(git, root);
git.getContentProvider().getContent("unknown file path", root, version);
}
Aggregations