use of org.apache.maven.scm.command.diff.DiffScmResult in project maven-scm by apache.
the class StarteamDiffCommand method executeDiffCommand.
// ----------------------------------------------------------------------
// AbstractDiffCommand Implementation
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
protected DiffScmResult executeDiffCommand(ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion startVersion, ScmVersion endVersion) throws ScmException {
if (getLogger().isInfoEnabled()) {
getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
}
if (fileSet.getFileList().isEmpty()) {
throw new ScmException("This provider doesn't support diff command on a subsets of a directory");
}
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
StarteamDiffConsumer consumer = new StarteamDiffConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
Commandline cl = createCommandLine(repository, fileSet, startVersion, endVersion);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new DiffScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
return new DiffScmResult(cl.toString(), consumer.getChangedFiles(), consumer.getDifferences(), consumer.getPatch());
}
use of org.apache.maven.scm.command.diff.DiffScmResult in project maven-scm by apache.
the class BazaarScmProvider method diff.
/**
* {@inheritDoc}
*/
public DiffScmResult diff(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
BazaarDiffCommand command = new BazaarDiffCommand();
command.setLogger(getLogger());
return (DiffScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.diff.DiffScmResult in project maven-scm by apache.
the class IntegrityScmProvider method diff.
/**
* Maps to si diff
*/
@Override
protected DiffScmResult diff(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
IntegrityDiffCommand command = new IntegrityDiffCommand();
command.setLogger(getLogger());
return (DiffScmResult) command.execute(repository, fileSet, params);
}
use of org.apache.maven.scm.command.diff.DiffScmResult in project maven-scm by apache.
the class HgDiffCommand method executeDiffCommand.
/**
* {@inheritDoc}
*/
protected DiffScmResult executeDiffCommand(ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion startRevision, ScmVersion endRevision) throws ScmException {
String[] diffCmd;
if (startRevision != null && !StringUtils.isEmpty(startRevision.getName())) {
String revArg = startRevision.getName();
if (endRevision != null && !StringUtils.isEmpty(endRevision.getName())) {
revArg += ".." + endRevision;
}
diffCmd = new String[] { HgCommandConstants.DIFF_CMD, HgCommandConstants.REVISION_OPTION, revArg };
} else {
diffCmd = new String[] { HgCommandConstants.DIFF_CMD };
}
diffCmd = HgUtils.expandCommandLine(diffCmd, fileSet);
HgDiffConsumer consumer = new HgDiffConsumer(getLogger(), fileSet.getBasedir());
ScmResult result = HgUtils.execute(consumer, getLogger(), fileSet.getBasedir(), diffCmd);
return new DiffScmResult(consumer.getChangedFiles(), consumer.getDifferences(), consumer.getPatch(), result);
}
use of org.apache.maven.scm.command.diff.DiffScmResult in project maven-scm by apache.
the class CvsJavaDiffCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected DiffScmResult executeCvsCommand(Commandline cl) throws ScmException {
CvsLogListener logListener = new CvsLogListener();
CvsDiffConsumer consumer = new CvsDiffConsumer(getLogger(), cl.getWorkingDirectory());
try {
boolean isSuccess = CvsConnection.processCommand(cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger());
if (!isSuccess) {
return new DiffScmResult(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) {
e.printStackTrace();
return new DiffScmResult(cl.toString(), "The cvs command failed.", logListener.getStdout().toString(), false);
}
return new DiffScmResult(cl.toString(), consumer.getChangedFiles(), consumer.getDifferences(), consumer.getPatch());
}
Aggregations