use of org.apache.maven.scm.command.blame.BlameScmResult in project maven-scm by apache.
the class BazaarBlameCommand method executeBlameCommand.
/**
* {@inheritDoc}
*/
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet workingDirectory, String filename) throws ScmException {
String[] cmd = new String[] { // Show annotations on all lines
BLAME_CMD, // Show annotations on all lines
"--all", // Show commit date in annotations
"--long", filename };
BazaarBlameConsumer consumer = new BazaarBlameConsumer(getLogger());
ScmResult result = BazaarUtils.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 SvnBlameCommand method executeBlameCommand.
/**
* {@inheritDoc}
*/
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet workingDirectory, String filename) throws ScmException {
Commandline cl = createCommandLine((SvnScmProviderRepository) repo, workingDirectory.getBasedir(), filename);
SvnBlameConsumer consumer = new SvnBlameConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
if (getLogger().isInfoEnabled()) {
getLogger().info("Executing: " + SvnCommandLineUtils.cryptPassword(cl));
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
getLogger().info("Working directory: " + cl.getWorkingDirectory().getAbsolutePath());
}
}
int exitCode;
try {
exitCode = SvnCommandLineUtils.execute(cl, consumer, stderr, getLogger());
} catch (CommandLineException ex) {
throw new ScmException("Error while executing command.", ex);
}
if (exitCode != 0) {
return new BlameScmResult(cl.toString(), "The svn 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 PerforceBlameCommand method executeBlameCommand.
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet workingDirectory, String filename) throws ScmException {
// Call annotate command
PerforceScmProviderRepository p4repo = (PerforceScmProviderRepository) repo;
String clientspec = PerforceScmProvider.getClientspecName(getLogger(), p4repo, workingDirectory.getBasedir());
Commandline cl = createCommandLine((PerforceScmProviderRepository) repo, workingDirectory.getBasedir(), filename, clientspec);
PerforceBlameConsumer blameConsumer = new PerforceBlameConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
exitCode = CommandLineUtils.executeCommandLine(cl, blameConsumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing command.", ex);
}
if (exitCode != 0) {
return new BlameScmResult(cl.toString(), "The perforce command failed.", stderr.getOutput(), false);
}
// Call filelog command
cl = createFilelogCommandLine((PerforceScmProviderRepository) repo, workingDirectory.getBasedir(), filename, clientspec);
PerforceFilelogConsumer filelogConsumer = new PerforceFilelogConsumer(getLogger());
try {
exitCode = CommandLineUtils.executeCommandLine(cl, filelogConsumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing command.", ex);
}
if (exitCode != 0) {
return new BlameScmResult(cl.toString(), "The perforce command failed.", stderr.getOutput(), false);
}
// Combine results
List<BlameLine> lines = blameConsumer.getLines();
for (int i = 0; i < lines.size(); i++) {
BlameLine line = lines.get(i);
String revision = line.getRevision();
line.setAuthor(filelogConsumer.getAuthor(revision));
line.setDate(filelogConsumer.getDate(revision));
}
return new BlameScmResult(cl.toString(), lines);
}
use of org.apache.maven.scm.command.blame.BlameScmResult in project maven-scm by apache.
the class IntegrityScmProvider method blame.
/**
* Maps to si annotate
*/
@Override
protected BlameScmResult blame(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
IntegrityBlameCommand command = new IntegrityBlameCommand();
command.setLogger(getLogger());
return (BlameScmResult) command.execute(repository, fileSet, params);
}
use of org.apache.maven.scm.command.blame.BlameScmResult in project maven-scm by apache.
the class HgScmProvider method blame.
/**
* {@inheritDoc}
*/
protected BlameScmResult blame(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
HgBlameCommand command = new HgBlameCommand();
command.setLogger(getLogger());
return (BlameScmResult) command.execute(repository, fileSet, parameters);
}
Aggregations