use of jetbrains.buildServer.vcs.VcsException in project teamcity-git by JetBrains.
the class AgentGitFacadeImpl method resolvePath.
@NotNull
public String resolvePath(@NotNull File f) throws VcsException {
try {
final GitExec gitExec = getCtx().getGitExec();
if (gitExec.isCygwin()) {
String cygwinBin = gitExec.getCygwinBinPath();
GeneralCommandLine cmd = new GeneralCommandLine();
cmd.setWorkDirectory(cygwinBin);
cmd.setExePath(new File(cygwinBin, "cygpath.exe").getCanonicalPath());
cmd.addParameter(f.getCanonicalPath());
ExecResult res = SimpleCommandLineProcessRunner.runCommandSecure(cmd, cmd.getCommandLineString(), null, new ProcessTimeoutCallback(30));
Throwable error = res.getException();
if (error != null)
throw error;
return res.getStdout().trim();
} else {
return f.getCanonicalPath();
}
} catch (Throwable e) {
throw new VcsException("Error while resolving path " + f.getAbsolutePath() + ": " + e.getMessage(), e);
}
}
use of jetbrains.buildServer.vcs.VcsException in project teamcity-git by JetBrains.
the class GitPathResolverImpl method resolveGitPath.
public String resolveGitPath(final BuildAgentConfiguration agentConfiguration, String pathToResolve) throws VcsException {
ValueResolver resolver = agentConfiguration.getParametersResolver();
ProcessingResult result = resolver.resolve(pathToResolve);
if (!result.isFullyResolved()) {
throw new VcsException("The value is not fully resolved: " + result.getResult());
}
return result.getResult();
}
use of jetbrains.buildServer.vcs.VcsException in project teamcity-git by JetBrains.
the class Cleanup method repack.
private void repack(final File gcRepo) throws VcsException {
long start = System.currentTimeMillis();
GeneralCommandLine cmd = new GeneralCommandLine();
cmd.setWorkingDirectory(gcRepo);
cmd.setExePath(myConfig.getPathToGit());
cmd.addParameter("repack");
cmd.addParameters(myConfig.getRepackCommandArguments());
ExecResult result = SimpleCommandLineProcessRunner.runCommand(cmd, null, new SimpleCommandLineProcessRunner.RunCommandEventsAdapter() {
@Override
public Integer getOutputIdleSecondsTimeout() {
return myConfig.getRepackIdleTimeoutSeconds();
}
@Override
public void onProcessFinished(@NotNull final Process ps) {
CLEANUP.info("[" + gcRepo.getName() + "] \"" + cmd.getCommandLineString() + "\" finished in " + TimePrinter.createMillisecondsFormatter().formatTime((System.currentTimeMillis() - start)));
}
});
VcsException commandError = CommandLineUtil.getCommandLineError("git repack", result);
if (commandError != null) {
CLEANUP.warnAndDebugDetails("Error while running 'git repack' in \"" + gcRepo.getAbsolutePath() + "\"", commandError);
throw commandError;
}
}
use of jetbrains.buildServer.vcs.VcsException in project teamcity-git by JetBrains.
the class Cleanup method packRefs.
private void packRefs(@NotNull File gcRepo) throws VcsException {
long start = System.currentTimeMillis();
GeneralCommandLine cmd = new GeneralCommandLine();
cmd.setWorkingDirectory(gcRepo);
cmd.setExePath(myConfig.getPathToGit());
cmd.addParameter("pack-refs");
cmd.addParameters("--all");
ExecResult result = SimpleCommandLineProcessRunner.runCommand(cmd, null, new SimpleCommandLineProcessRunner.RunCommandEventsAdapter() {
@Override
public Integer getOutputIdleSecondsTimeout() {
return myConfig.getPackRefsIdleTimeoutSeconds();
}
@Override
public void onProcessFinished(@NotNull final Process ps) {
CLEANUP.info("[" + gcRepo.getName() + "] 'git pack-refs --all' finished in " + (System.currentTimeMillis() - start) + "ms");
}
});
VcsException commandError = CommandLineUtil.getCommandLineError("git pack-refs", result);
if (commandError != null) {
CLEANUP.warnAndDebugDetails("Error while running 'git pack-refs' in " + gcRepo.getAbsolutePath(), commandError);
throw commandError;
}
}
use of jetbrains.buildServer.vcs.VcsException 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);
}
}
Aggregations