use of org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener in project maven-scm by apache.
the class CvsJavaRemoveCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected RemoveScmResult executeCvsCommand(Commandline cl, List<ScmFile> removedFiles) throws ScmException {
CvsLogListener logListener = new CvsLogListener();
try {
boolean isSuccess = CvsConnection.processCommand(cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger());
if (!isSuccess) {
return new RemoveScmResult(cl.toString(), "The cvs command failed.", logListener.getStderr().toString(), false);
}
BufferedReader stream = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(logListener.getStdout().toString().getBytes())));
if (getLogger().isDebugEnabled()) {
String line;
while ((line = stream.readLine()) != null) {
getLogger().debug(line);
}
}
} catch (Exception e) {
e.printStackTrace();
return new RemoveScmResult(cl.toString(), "The cvs command failed.", logListener.getStderr().toString(), false);
}
return new RemoveScmResult(cl.toString(), removedFiles);
}
use of org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener in project maven-scm by apache.
the class CvsJavaCheckInCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected CheckInScmResult executeCvsCommand(Commandline cl, CvsScmProviderRepository repository, File messageFile) throws ScmException {
CvsLogListener logListener = new CvsLogListener();
CvsCheckInConsumer consumer = new CvsCheckInConsumer(repository.getPath(), getLogger());
try {
boolean isSuccess = CvsConnection.processCommand(cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger());
if (!isSuccess) {
return new CheckInScmResult(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 CheckInScmResult(cl.toString(), "The cvs command failed.", logListener.getStdout().toString(), false);
} finally {
try {
FileUtils.forceDelete(messageFile);
} catch (IOException ex) {
// ignore
}
}
return new CheckInScmResult(cl.toString(), consumer.getCheckedInFiles());
}
use of org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener in project maven-scm by apache.
the class CvsJavaListCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected ListScmResult executeCvsCommand(Commandline cl) throws ScmException {
CvsLogListener logListener = new CvsLogListener();
CvsListConsumer consumer = new CvsListConsumer(getLogger());
try {
boolean isSuccess = CvsConnection.processCommand(cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger());
if (!isSuccess) {
return new ListScmResult(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 ListScmResult(cl.toString(), "The cvs command failed.", logListener.getStderr().toString(), false);
}
return new ListScmResult(cl.toString(), consumer.getEntries());
}
use of org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener 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.provider.cvslib.cvsjava.util.CvsLogListener 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