Search in sources :

Example 41 with VcsRoot

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

the class GitPatchTest method submodules_and_checkout_rules2.

@TestFor(issues = "TW-50097")
@Test(dataProvider = "patchInSeparateProcess")
public void submodules_and_checkout_rules2(boolean patchInSeparateProcess) throws Exception {
    myConfigBuilder.setSeparateProcessForPatch(patchInSeparateProcess);
    VcsRoot root = getRoot("sub-submodule", true);
    checkPatch(root, "submodules_and_checkout_rules2", null, "ce6044093939bb47283439d97a1c80f759669ff5", new CheckoutRules("+:first-level-submodule/sub-sub"));
}
Also used : CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Example 42 with VcsRoot

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

the class GitVcsRootTest method disabling_custom_clones.

@TestFor(issues = "TW-36401")
public void disabling_custom_clones() throws Exception {
    File cloneDir = new File("");
    VcsRoot root = vcsRoot().withRepositoryPathOnServer(cloneDir.getAbsolutePath()).withFetchUrl("http://some.org/repo").build();
    GitVcsRoot gitRoot1 = new GitVcsRoot(myMirrorManager, root, new URIishHelperImpl());
    assertTrue(FileUtil.isAncestor(myDefaultCachesDir, gitRoot1.getRepositoryDir(), true));
    setInternalProperty(Constants.CUSTOM_CLONE_PATH_ENABLED, "true");
    GitVcsRoot gitRoot2 = new GitVcsRoot(myMirrorManager, root, new URIishHelperImpl());
    assertEquals(cloneDir.getAbsoluteFile(), gitRoot2.getRepositoryDir());
}
Also used : VcsRoot(jetbrains.buildServer.vcs.VcsRoot) File(java.io.File) TestFor(jetbrains.buildServer.util.TestFor)

Example 43 with VcsRoot

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

the class GitVcsRootTest method cred_prod.

public void cred_prod() throws Exception {
    VcsRoot root = vcsRoot().withFetchUrl("git://git@some.org/repository.git").build();
    GitVcsRoot gitRoot = new GitVcsRoot(myMirrorManager, root, new URIishHelperImpl());
    assertNull("User is not stripped from the url with anonymous protocol", gitRoot.getRepositoryFetchURL().getUser());
}
Also used : VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Example 44 with VcsRoot

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

the class GitLabelingSupportTest method testLabels.

public void testLabels() throws Exception {
    VcsRoot root = vcsRoot().withFetchUrl(getRemoteRepositoryDir("repo.git")).build();
    // ensure that all revisions reachable from master are fetched
    buildGit().getLabelingSupport().label("test_label", "2276eaf76a658f96b5cf3eb25f3e1fda90f6b653", root, CheckoutRules.DEFAULT);
    Repository r = new RepositoryBuilder().setGitDir(getRemoteRepositoryDir("repo.git")).build();
    RevWalk revWalk = new RevWalk(r);
    try {
        Ref tagRef = r.getTags().get("test_label");
        RevTag t = revWalk.parseTag(tagRef.getObjectId());
        assertEquals(t.getObject().name(), "2276eaf76a658f96b5cf3eb25f3e1fda90f6b653");
    } finally {
        r.close();
    }
}
Also used : RevTag(org.eclipse.jgit.revwalk.RevTag) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) RevWalk(org.eclipse.jgit.revwalk.RevWalk)

Example 45 with VcsRoot

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

the class GitLabelingSupportTest method tag_with_specified_username.

@Test
public void tag_with_specified_username() throws Exception {
    VcsRoot root = vcsRoot().withFetchUrl(GitUtils.toURL(getRemoteRepositoryDir("repo.git"))).withUsernameForTags("John Doe <john.doe@some.org>").build();
    buildGit().getLabelingSupport().label("label_with_specified_username", "465ad9f630e451b9f2b782ffb09804c6a98c4bb9", root, CheckoutRules.DEFAULT);
    Repository r = new RepositoryBuilder().setGitDir(getRemoteRepositoryDir("repo.git")).build();
    RevWalk revWalk = new RevWalk(r);
    try {
        Ref tagRef = r.getTags().get("label_with_specified_username");
        RevTag t = revWalk.parseTag(tagRef.getObjectId());
        PersonIdent tagger = t.getTaggerIdent();
        assertEquals(tagger.getName(), "John Doe");
        assertEquals(tagger.getEmailAddress(), "john.doe@some.org");
    } finally {
        revWalk.close();
        r.close();
    }
}
Also used : RevTag(org.eclipse.jgit.revwalk.RevTag) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) RevWalk(org.eclipse.jgit.revwalk.RevWalk) Test(org.testng.annotations.Test)

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