use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec in project teamcity-git by JetBrains.
the class GitDiagnosticsTab method fillModel.
@Override
public void fillModel(@NotNull Map<String, Object> model, @NotNull HttpServletRequest request) {
super.fillModel(model, request);
model.put("nativeGitOperationsEnabled", myMainConfigProcessor.isNativeGitOperationsEnabled());
model.put("isMultinodeSetup", myNodes.getNodes().size() > 1);
try {
final GitExec gitExec = myOperations.detectGit();
model.put("gitExec", gitExec);
model.put("isGitExecError", false);
model.put("nativeGitOperationsSupported", myOperations.isNativeGitOperationsSupported(gitExec));
model.put("projectsWithGitRoots", getProjectsWithGitRoots());
model.put("projectGitRoots", getProjectGitRoots(request));
} catch (VcsException e) {
model.put("gitExecError", e);
model.put("isGitExecError", true);
model.put("nativeGitOperationsSupported", false);
}
}
use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec in project teamcity-git by JetBrains.
the class GitServerVersionHealthReport method report.
@Override
public void report(@NotNull HealthStatusScope scope, @NotNull HealthStatusItemConsumer consumer) {
if (!myGitOperations.isNativeGitOperationsEnabled())
return;
GitExec gitExec = null;
String reason = null;
try {
gitExec = myGitOperations.detectGit();
if (myGitOperations.isNativeGitOperationsSupported(gitExec))
return;
} catch (Exception e) {
reason = e.getMessage();
}
final Map<String, Object> data = new HashMap<>();
data.put("gitExec", gitExec);
data.put("reason", reason);
consumer.consumeGlobal(new HealthStatusItem("GitServerVersionId", CATEGORY, data));
}
use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec in project teamcity-git by JetBrains.
the class GitVersionProvider method version.
@DataProvider
public static Object[][] version(Method testMethod) throws Exception {
String gitPath = getGitPath();
GitVersion version = new AgentGitFacadeImpl(gitPath).version().call();
RequiredGitVersion requirement = testMethod.getAnnotation(RequiredGitVersion.class);
if (requirement == null)
requirement = testMethod.getDeclaringClass().getAnnotation(RequiredGitVersion.class);
if (requirement == null) {
return new Object[][] { new Object[] { new GitExec(gitPath, version) } };
} else {
GitVersion minRequired = GitVersion.parse("git version " + requirement.min());
if (version.isLessThan(minRequired)) {
return new Object[0][];
} else {
return new Object[][] { new Object[] { new GitExec(gitPath, version) } };
}
}
}
use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec 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.buildTriggers.vcs.git.command.GitExec in project teamcity-git by JetBrains.
the class AgentConfigPluginTest method test_path_to_git.
public void test_path_to_git() throws VcsException {
assertEquals("git", getPluginConfig().getPathToGit());
assertEquals("/usr/bin/git", new PluginConfigImpl(myAgentConfig, myBuild, getVcsRoot(), new GitExec("/usr/bin/git", GitVersion.MIN)).getPathToGit());
}
Aggregations