use of org.apache.maven.scm.command.blame.BlameScmResult in project maven-scm by apache.
the class HgBlameCommand method executeBlameCommand.
/**
* {@inheritDoc}
*/
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet workingDirectory, String filename) throws ScmException {
String[] cmd = new String[] { // list the author
BLAME_CMD, // list the author
"--user", // list the date
"--date", // list the global revision number
"--changeset", filename };
HgBlameConsumer consumer = new HgBlameConsumer(getLogger());
ScmResult result = HgUtils.execute(consumer, getLogger(), workingDirectory.getBasedir(), cmd);
return new BlameScmResult(consumer.getLines(), result);
}
use of org.apache.maven.scm.command.blame.BlameScmResult in project maven-scm by apache.
the class ClearCaseScmProvider method blame.
/**
* {@inheritDoc}
*/
protected BlameScmResult blame(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
ClearCaseBlameCommand command = new ClearCaseBlameCommand();
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 ClearCaseBlameCommand method executeBlameCommand.
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet workingDirectory, String filename) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing blame command...");
}
Commandline cl = createCommandLine(workingDirectory.getBasedir(), filename);
ClearCaseBlameConsumer consumer = new ClearCaseBlameConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
}
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 cleartool 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 CvsJavaBlameCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected BlameScmResult executeCvsCommand(Commandline cl, CvsScmProviderRepository repository) {
CvsLogListener logListener = new CvsLogListener();
CvsBlameConsumer consumer = new CvsBlameConsumer(getLogger());
try {
boolean isSuccess = CvsConnection.processCommand(cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger());
if (!isSuccess) {
return new BlameScmResult(cl.toString(), "The cvs command failed.", logListener.getStderr().toString(), false);
}
BufferedReader stream = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(logListener.getStdout().toString().getBytes())));
String line;
while ((line = stream.readLine()) != null) {
consumer.consumeLine(line);
}
} catch (Exception e) {
getLogger().error(e);
return new BlameScmResult(cl.toString(), "The cvs command failed.", logListener.getStdout().toString(), 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 TfsScmProvider method blame.
protected BlameScmResult blame(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
TfsBlameCommand command = new TfsBlameCommand();
command.setLogger(getLogger());
return (BlameScmResult) command.execute(repository, fileSet, parameters);
}
Aggregations