use of org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener in project maven-scm by apache.
the class CvsJavaUpdateCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected UpdateScmResult executeCvsCommand(Commandline cl) throws ScmException {
CvsLogListener logListener = new CvsLogListener();
CvsUpdateConsumer consumer = new CvsUpdateConsumer(getLogger());
try {
boolean isSuccess = CvsConnection.processCommand(cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger());
if (!isSuccess) {
return new UpdateScmResult(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 UpdateScmResult(cl.toString(), "The cvs command failed.", logListener.getStderr().toString(), false);
}
return new UpdateScmResult(cl.toString(), consumer.getUpdatedFiles());
}
use of org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener in project maven-scm by apache.
the class CvsJavaCheckOutCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected CheckOutScmResult executeCvsCommand(Commandline cl) throws ScmException {
CvsLogListener logListener = new CvsLogListener();
CvsCheckOutConsumer consumer = new CvsCheckOutConsumer(getLogger());
try {
boolean isSuccess = CvsConnection.processCommand(cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger());
if (!isSuccess) {
return new CheckOutScmResult(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 CheckOutScmResult(cl.toString(), "The cvs command failed.", logListener.getStdout().toString(), false);
}
return new CheckOutScmResult(cl.toString(), consumer.getCheckedOutFiles());
}
Aggregations