Search in sources :

Example 36 with VcsRoot

use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.

the class LatestAcceptedRevisionTest method master_merged_to_branch.

public void master_merged_to_branch() throws IOException, VcsException {
    GitVcsSupport support = git();
    VcsRoot root = vcsRoot().withFetchUrl(myRepo).build();
    ensureFetchPerformed(support, root, "refs/heads/br2", "9c191865e2f2b05727e067aa4f918f3ed54f1f1a");
    String rev = support.getCollectChangesPolicy().getLatestRevisionAcceptedByCheckoutRules(root, new CheckoutRules("+:src"), "9c191865e2f2b05727e067aa4f918f3ed54f1f1a", Collections.emptySet());
    then(rev).isEqualTo("338563d3115318d610ad54839cab287e94b18925");
}
Also used : GitVcsSupport(jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Example 37 with VcsRoot

use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.

the class LatestAcceptedRevisionTest method both_parents_of_merge_are_interesting.

public void both_parents_of_merge_are_interesting() throws IOException, VcsException {
    GitVcsSupport support = git();
    VcsRoot root = vcsRoot().withFetchUrl(myRepo).build();
    ensureFetchPerformed(support, root, "refs/heads/master", "0ce2e3b06b628633f7b8f73ce634ece1cfe25534");
    String rev = support.getCollectChangesPolicy().getLatestRevisionAcceptedByCheckoutRules(root, new CheckoutRules("+:test"), "0ce2e3b06b628633f7b8f73ce634ece1cfe25534", Collections.emptySet());
    then(rev).isEqualTo("a37f9e92344bd037787a98b1f7c8f80ade6d5b68");
    rev = support.getCollectChangesPolicy().getLatestRevisionAcceptedByCheckoutRules(root, new CheckoutRules("+:test"), "a37f9e92344bd037787a98b1f7c8f80ade6d5b68", Collections.emptySet());
    then(rev).isEqualTo("a37f9e92344bd037787a98b1f7c8f80ade6d5b68");
}
Also used : GitVcsSupport(jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Example 38 with VcsRoot

use of jetbrains.buildServer.vcs.VcsRoot 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();
}
Also used : GitVcsSupport(jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Example 39 with VcsRoot

use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.

the class GitPatchTest method patch_from_unknown_commit_excluded_root_dir.

@TestFor(issues = "TW-40689")
@Test
public void patch_from_unknown_commit_excluded_root_dir() throws Exception {
    VcsRoot root = getRoot("rename-test");
    String unknownCommit = "hahahahahahahahahahahahahahahahahahahaha";
    checkPatch(root, "patch3", unknownCommit, "1837cf38309496165054af8bf7d62a9fe8997202", new CheckoutRules(asList(// this rule caused NPE
    "-:.", "+:dir with space=>dir with space", "+:dir1=>dir1", "+:file_in_branch.txt")));
}
Also used : CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Example 40 with VcsRoot

use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.

the class GitPatchTest method excluded_broken_submodule.

@TestFor(issues = "TW-49782")
@Test(dataProvider = "patchInSeparateProcess")
public void excluded_broken_submodule(boolean patchInSeparateProcess) throws Exception {
    myConfigBuilder.setSeparateProcessForPatch(patchInSeparateProcess);
    VcsRoot root = getRoot("reference-wrong-commit", true);
    // 7253d358a2490321a1808a1c20561b4027d69f77 references wrong submodule commit, but it is excluded by checkout rules, patch should succeed
    checkPatch(root, "excluded_broken_submodule", null, "7253d358a2490321a1808a1c20561b4027d69f77", new CheckoutRules("+:dir"));
}
Also used : CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Aggregations

VcsRoot (jetbrains.buildServer.vcs.VcsRoot)59 CheckoutRules (jetbrains.buildServer.vcs.CheckoutRules)25 TestFor (jetbrains.buildServer.util.TestFor)17 Test (org.testng.annotations.Test)16 GitVcsSupport (jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport)15 AgentCheckoutAbility (jetbrains.buildServer.agent.vcs.AgentCheckoutAbility)10 AgentRunningBuild (jetbrains.buildServer.agent.AgentRunningBuild)9 File (java.io.File)8 VcsException (jetbrains.buildServer.vcs.VcsException)8 URIish (org.eclipse.jgit.transport.URIish)5 RevWalk (org.eclipse.jgit.revwalk.RevWalk)3 CredentialsProvider (org.eclipse.jgit.transport.CredentialsProvider)3 NotNull (org.jetbrains.annotations.NotNull)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 GitVersion (jetbrains.buildServer.buildTriggers.vcs.git.GitVersion)2 GitExec (jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec)2 GitTestUtil.dataFile (jetbrains.buildServer.buildTriggers.vcs.git.tests.GitTestUtil.dataFile)2 TeamCitySshKey (jetbrains.buildServer.ssh.TeamCitySshKey)2 BulkPatchBuilder (jetbrains.buildServer.vcs.BulkPatchService.BulkPatchBuilder)2 RepositoryStateData (jetbrains.buildServer.vcs.RepositoryStateData)2