Search in sources :

Example 21 with VcsRoot

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

the class GitVcsRootTest method fetch_url_for_repository_in_local_filesystem_should_not_contain_password.

public void fetch_url_for_repository_in_local_filesystem_should_not_contain_password() throws Exception {
    String pathInLocalFS = "/path/in/local/fs";
    VcsRoot root = vcsRoot().withFetchUrl(pathInLocalFS).withAuthMethod(AuthenticationMethod.PASSWORD).withUsername("user").withPassword("pass").build();
    GitVcsRoot s = new GitVcsRoot(myMirrorManager, root, new URIishHelperImpl());
    assertEquals(new URIish(pathInLocalFS), s.getRepositoryFetchURL().get());
}
Also used : URIish(org.eclipse.jgit.transport.URIish) VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Example 22 with VcsRoot

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

the class MapFullPathTest method bulk.

public void bulk() throws Exception {
    // clone repository for myRoot and root3
    RepositoryStateData state0 = RepositoryStateData.createSingleVersionState("a7274ca8e024d98c7d59874f19f21d26ee31d41d");
    RepositoryStateData state1 = myGit.getCurrentState(myRoot);
    myGit.getCollectChangesPolicy().collectChanges(myRoot, state0, state1, CheckoutRules.DEFAULT);
    // tracks same repo as myRoot1
    VcsRoot root3 = vcsRoot().withId(3).withFetchUrl(myRemoteRepositoryDir.getAbsolutePath()).build();
    // tracks same repo as myRoot2
    VcsRoot root4 = vcsRoot().withId(4).withFetchUrl(myRemoteRepositoryDir2.getAbsolutePath()).build();
    List<Boolean> result = myGit.checkSuitable(asList(new VcsRootEntry(myRoot, new CheckoutRules("-:dir1")), new VcsRootEntry(myRoot, new CheckoutRules("+:dir1")), new VcsRootEntry(myRoot, new CheckoutRules("+:dir2")), new VcsRootEntry(myRoot2, new CheckoutRules("+:dir2")), new VcsRootEntry(root3, new CheckoutRules("+:dir1")), new VcsRootEntry(root4, new CheckoutRules("+:dir4")), new VcsRootEntry(root3, new CheckoutRules("+:dir5")), new VcsRootEntry(root4, new CheckoutRules("+:dir6"))), asList(// affects root and root3
    "a7274ca8e024d98c7d59874f19f21d26ee31d41d-add81050184d3c818560bdd8839f50024c188586||dir1/text1.txt", // affects no repo
    "abababababababababababababababababababab||."));
    then(result).containsExactly(false, true, false, false, true, false, false, false);
}
Also used : RepositoryStateData(jetbrains.buildServer.vcs.RepositoryStateData) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRootEntry(jetbrains.buildServer.vcs.VcsRootEntry) VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Example 23 with VcsRoot

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

the class GitPatchTest method submodules_and_checkout_rules3.

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

Example 24 with VcsRoot

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

the class GitPatchTest method submodules_and_checkout_rules.

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

Example 25 with VcsRoot

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

the class GitPatchTest method build_patch_should_respect_autocrlf.

@TestFor(issues = "TW-16530")
@Test(dataProvider = "patchInSeparateProcess")
public void build_patch_should_respect_autocrlf(boolean patchInSeparateProcess) throws Exception {
    myConfigBuilder.setSeparateProcessForPatch(patchInSeparateProcess);
    VcsRoot root = vcsRoot().withAutoCrlf(true).withFetchUrl(myMainRepositoryDir.getAbsolutePath()).build();
    setExpectedSeparator("\r\n");
    checkPatch(root, "patch-eol", null, "465ad9f630e451b9f2b782ffb09804c6a98c4bb9", new CheckoutRules("-:dir"));
    String content = new String(getSupport().getContentProvider().getContent("readme.txt", root, "465ad9f630e451b9f2b782ffb09804c6a98c4bb9"));
    assertEquals(content, "Test repository for teamcity.change 1\r\nadd feature\r\n");
}
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