use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class BulkPatchBuilderTest method test_local_idea.
@Test(enabled = false)
public void test_local_idea() throws Exception {
// /does not work for real repository: Fetcher call is mostly endless
final String ultimate_local = "E:\\Work\\idea-ultimate\\.git";
VcsRoot root = vcsRoot().withFetchUrl(ultimate_local).withRepositoryPathOnServer(ultimate_local).withBranch("master").build();
final BulkPatchBuilder patcher = patcher(new PatchLogger() {
public void log(@NotNull final String message) {
}
});
runFullPatch(root, patcher);
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class GitPerformanceTests method incrementalIntellijFetch.
@Test
public // @Test(invocationCount = 100)
void incrementalIntellijFetch() throws Exception {
final VcsRootImpl root = VcsRootBuilder.vcsRoot().withBranchSpec("+:refs/heads/*").withFetchUrl("ssh://git@git.jetbrains.team/intellij.git").withAuthMethod(AuthenticationMethod.PRIVATE_KEY_DEFAULT).build();
final ServerPaths sp = new ServerPaths("/Users/victory/Tests/server_paths");
final ServerPluginConfig config = new PluginConfigBuilder(sp).setSeparateProcessForFetch(true).build();
final GitSupportBuilder builder = GitSupportBuilder.gitSupport().withServerPaths(sp).withPluginConfig(config).withFetchCommand(new NativeGitCommands(config, () -> new GitExec("git", new GitVersion(2, 34, 0)), new VcsRootSshKeyManager() {
@Nullable
@Override
public TeamCitySshKey getKey(@NotNull VcsRoot root) {
return null;
}
}));
GitVcsSupport support = builder.build();
final RepositoryStateData currentState = support.getCurrentState(root);
final long startTime = new Date().getTime();
System.out.println("Fetching repository...");
final OperationContext ctx = support.createContext(root, "fetch");
try {
support.getCollectChangesPolicy().ensureRepositoryStateLoadedFor(ctx, currentState, true);
} finally {
ctx.close();
}
final long totalTime = new Date().getTime() - startTime;
System.out.println("Fetch time: " + totalTime + "ms");
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class CleanerTest method test_clean.
@Test(dataProvider = "true,false")
public void test_clean(Boolean useJgitGC) throws VcsException, InterruptedException {
final int mirrorExpirationTimeoutMillis = 8000;
myConfigBuilder.setMirrorExpirationTimeoutMillis(mirrorExpirationTimeoutMillis);
if (useJgitGC) {
myConfigBuilder.setRunJGitGC(true);
myConfigBuilder.setRunNativeGC(false);
} else {
myConfigBuilder.setRunJGitGC(false);
myConfigBuilder.setRunNativeGC(true);
}
initCleanup();
File baseMirrorsDir = myRepositoryManager.getBaseMirrorsDir();
generateGarbage(baseMirrorsDir);
Thread.sleep(2 * myConfig.getMirrorExpirationTimeoutMillis());
final VcsRoot root = GitTestUtil.getVcsRoot();
mySupport.collectChanges(root, "70dbcf426232f7a33c7e5ebdfbfb26fc8c467a46", "a894d7d58ffde625019a9ecf8267f5f1d1e5c341", CheckoutRules.DEFAULT);
// make sure repo timestamp will be updated
setInternalProperty("teamcity.git.accessTimeUpdateRateMinutes", "0");
// it will create dir in cache directory
mySupport.getCurrentState(root);
File repositoryDir = getRepositoryDir(root);
final File timestamp = new File(repositoryDir, "timestamp");
assertTrue(timestamp.isFile());
assertTrue(System.currentTimeMillis() - mySupport.getRepositoryManager().getLastUsedTime(repositoryDir) < mirrorExpirationTimeoutMillis);
myCleanup.run();
assertTrue(myCleanupCalled.get());
File[] files = baseMirrorsDir.listFiles(new FileFilter() {
public boolean accept(File f) {
return f.isDirectory();
}
});
assertEquals(1, files.length);
assertEquals(repositoryDir, files[0]);
// check that repository is fine after git gc
mySupport.getCurrentState(root);
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class AutoCheckoutTest method should_respect_root_settings_when_checking_multi_root_constraints.
@TestFor(issues = "TW-49786")
public void should_respect_root_settings_when_checking_multi_root_constraints() throws Exception {
myVcsSupport = vcsSupportWithRealGit();
// second root has broken git path, we should not take it into account
// during canCheckout() for the first VCS root
VcsRoot root1 = vcsRoot().withId(1).withAgentGitPath(getGitPath()).withFetchUrl("http://some.org/repo1.git").build();
VcsRoot root2 = vcsRoot().withId(2).withAgentGitPath("wrongGitPath").withFetchUrl("http://some.org/repo2.git").build();
AgentRunningBuild build = runningBuild().addRootEntry(root1, "+:dir1").addRootEntry(root2, "+:dir2").build();
AgentCheckoutAbility canCheckout1 = myVcsSupport.canCheckout(root1, new CheckoutRules("+:dir1"), build);
AgentCheckoutAbility canCheckout2 = myVcsSupport.canCheckout(root2, new CheckoutRules("+:dir2"), build);
then(canCheckout1.getCanNotCheckoutReason()).isNull();
then(canCheckout2.getCanNotCheckoutReason().getType()).isEqualTo(AgentCanNotCheckoutReason.NO_VCS_CLIENT);
then(canCheckout2.getCanNotCheckoutReason().getDetails()).contains("Unable to run git at path wrongGitPath");
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class AutoCheckoutTest method include_rule_with_mapping_is_used_without_sparse_checkout.
public void include_rule_with_mapping_is_used_without_sparse_checkout() throws IOException, VcsException {
myVcsSupport = vcsSupportWithFakeGitOfVersion(GIT_WITH_SPARSE_CHECKOUT);
VcsRoot vcsRoot = vcsRootWithAgentGitPath();
AgentRunningBuild build = runningBuild().sharedConfigParams(PluginConfigImpl.USE_SPARSE_CHECKOUT, "false").addRootEntry(vcsRoot, "+:a/b/c => d").build();
AgentCheckoutAbility canCheckout = myVcsSupport.canCheckout(vcsRoot, new CheckoutRules("+:a/b/c => d"), build);
then(canCheckout.getCanNotCheckoutReason().getType()).isEqualTo(AgentCanNotCheckoutReason.NOT_SUPPORTED_CHECKOUT_RULES);
then(canCheckout.getCanNotCheckoutReason().getDetails()).contains("Unsupported rules for agent-side checkout: +:a/b/c => d");
}
Aggregations