use of org.apache.maven.scm.command.blame.BlameScmResult in project maven-scm by apache.
the class TfsBlameCommand method executeBlameCommand.
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet workingDirectory, String filename) throws ScmException {
Commandline cl = createCommandLine(workingDirectory.getBasedir(), filename);
TfsBlameConsumer consumer = new TfsBlameConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing command.", ex);
}
if (exitCode != 0) {
return new BlameScmResult(cl.toString(), "The tfs command failed.", stderr.getOutput(), false);
}
return new BlameScmResult(cl.toString(), consumer.getLines());
}
use of org.apache.maven.scm.command.blame.BlameScmResult in project maven-scm by apache.
the class CvsExeBlameCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected BlameScmResult executeCvsCommand(Commandline cl, CvsScmProviderRepository repository) throws ScmException {
CvsBlameConsumer consumer = new CvsBlameConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing cvs command.", ex);
}
if (exitCode != 0) {
return new BlameScmResult(cl.toString(), "The cvs command failed.", stderr.getOutput(), false);
}
return new BlameScmResult(cl.toString(), consumer.getLines());
}
use of org.apache.maven.scm.command.blame.BlameScmResult in project maven-scm by apache.
the class IntegrityBlameCommand method executeBlameCommand.
/**
* {@inheritDoc}
*/
@Override
public BlameScmResult executeBlameCommand(ScmProviderRepository repository, ScmFileSet workingDirectory, String filename) throws ScmException {
getLogger().info("Attempting to display blame results for file: " + filename);
if (null == filename || filename.length() == 0) {
throw new ScmException("A single filename is required to execute the blame command!");
}
BlameScmResult result;
IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
// Since the si annotate command is not completely API ready, we will use the CLI for this command
// Ensure shell 'si' client is connected.
doShellConnect(iRepo, workingDirectory);
result = doShellAnnotate(iRepo, workingDirectory, filename);
return result;
}
use of org.apache.maven.scm.command.blame.BlameScmResult in project maven-scm by apache.
the class JazzScmProvider method blame.
/**
* {@inheritDoc}
*/
protected BlameScmResult blame(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
getLogger().debug("JazzScmProvider:blame()");
JazzBlameCommand command = new JazzBlameCommand();
command.setLogger(getLogger());
return (BlameScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.blame.BlameScmResult in project maven-scm by apache.
the class JazzBlameCommand method executeBlameCommand.
/**
* {@inheritDoc}
*/
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet fileSet, String filename) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Executing blame command...");
}
JazzScmCommand blameCmd = createBlameCommand(repo, fileSet, filename);
JazzBlameConsumer blameConsumer = new JazzBlameConsumer(repo, getLogger());
ErrorConsumer errConsumer = new ErrorConsumer(getLogger());
int status = blameCmd.execute(blameConsumer, errConsumer);
if (status != 0) {
return new BlameScmResult(blameCmd.getCommandString(), "Error code for Jazz SCM blame command - " + status, errConsumer.getOutput(), false);
}
return new BlameScmResult(blameCmd.getCommandString(), blameConsumer.getLines());
}
Aggregations