use of jetbrains.buildServer.vcs.RepositoryStateData in project teamcity-git by JetBrains.
the class GitLabelingSupportTest method makeCloneOnServer.
private void makeCloneOnServer(@NotNull GitVcsSupport git, @NotNull VcsRoot root) throws VcsException {
RepositoryStateData currentState = git.getCurrentState(root);
String unknownRevision = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
String defaultBranchName = currentState.getDefaultBranchName();
git.collectChanges(root, unknownRevision, currentState.getBranchRevisions().get(defaultBranchName), CheckoutRules.DEFAULT);
}
use of jetbrains.buildServer.vcs.RepositoryStateData in project teamcity-git by JetBrains.
the class GitPerformanceTests method toCleanCheckoutTest.
@Test
public void toCleanCheckoutTest() throws Exception {
final VcsRootImpl root = VcsRootBuilder.vcsRoot().withFetchUrl("E:\\Work\\idea-ultimate").build();
final ServerPaths sp = new ServerPaths(createTempDir().getPath());
final GitSupportBuilder builder = GitSupportBuilder.gitSupport().withServerPaths(sp).withPluginConfig(new PluginConfigBuilder(sp).build());
GitVcsSupport support = builder.build();
RepositoryStateData s = support.getCurrentState(root);
final String state = s.getBranchRevisions().get(s.getDefaultBranchName());
System.out.println("Current state: " + state);
final long startTime = new Date().getTime();
System.out.println("Fetching repository...");
// make sure repository is cloned
final OperationContext ctx = support.createContext(root, "fetch");
try {
builder.getCommitLoader().loadCommit(ctx, ctx.getGitRoot(), state);
} finally {
ctx.close();
}
final long totalTime = new Date().getTime() - startTime;
System.out.println("Clone time: " + totalTime + "ms");
runCleanCheckout(root, support, state);
// some older state
runCleanCheckout(root, support, "395c1639ee346816048b1b74cec83ab4dd162451");
}
use of jetbrains.buildServer.vcs.RepositoryStateData 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");
}
Aggregations