use of org.apache.maven.scm.provider.cvslib.command.changelog.CvsChangeLogConsumer in project maven-scm by apache.
the class CvsExeChangeLogCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected ChangeLogScmResult executeCvsCommand(Commandline cl, Date startDate, Date endDate, ScmVersion startVersion, ScmVersion endVersion, String datePattern) throws ScmException {
CvsChangeLogConsumer consumer = new CvsChangeLogConsumer(getLogger(), datePattern);
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 ChangeLogScmResult(cl.toString(), "The cvs command failed.", stderr.getOutput(), false);
}
ChangeLogSet changeLogSet = new ChangeLogSet(consumer.getModifications(), startDate, endDate);
changeLogSet.setStartVersion(startVersion);
changeLogSet.setEndVersion(endVersion);
return new ChangeLogScmResult(cl.toString(), changeLogSet);
}
use of org.apache.maven.scm.provider.cvslib.command.changelog.CvsChangeLogConsumer in project maven-scm by apache.
the class CvsJavaChangeLogCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected ChangeLogScmResult executeCvsCommand(Commandline cl, Date startDate, Date endDate, ScmVersion startVersion, ScmVersion endVersion, String datePattern) throws ScmException {
CvsLogListener logListener = new CvsLogListener();
CvsChangeLogConsumer consumer = new CvsChangeLogConsumer(getLogger(), datePattern);
try {
boolean isSuccess = CvsConnection.processCommand(cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger());
if (!isSuccess) {
return new ChangeLogScmResult(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 ChangeLogScmResult(cl.toString(), "The cvs command failed.", logListener.getStdout().toString(), false);
}
ChangeLogSet changeLogSet = new ChangeLogSet(consumer.getModifications(), startDate, endDate);
changeLogSet.setStartVersion(startVersion);
changeLogSet.setEndVersion(endVersion);
return new ChangeLogScmResult(cl.toString(), changeLogSet);
}
Aggregations