Search in sources :

Example 11 with CvsLogListener

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());
}
Also used : CvsUpdateConsumer(org.apache.maven.scm.provider.cvslib.command.update.CvsUpdateConsumer) CvsLogListener(org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener) InputStreamReader(java.io.InputStreamReader) ByteArrayInputStream(java.io.ByteArrayInputStream) UpdateScmResult(org.apache.maven.scm.command.update.UpdateScmResult) BufferedReader(java.io.BufferedReader) ScmException(org.apache.maven.scm.ScmException)

Example 12 with CvsLogListener

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());
}
Also used : CvsLogListener(org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener) InputStreamReader(java.io.InputStreamReader) ByteArrayInputStream(java.io.ByteArrayInputStream) CvsCheckOutConsumer(org.apache.maven.scm.provider.cvslib.command.checkout.CvsCheckOutConsumer) BufferedReader(java.io.BufferedReader) CheckOutScmResult(org.apache.maven.scm.command.checkout.CheckOutScmResult) ScmException(org.apache.maven.scm.ScmException)

Aggregations

BufferedReader (java.io.BufferedReader)12 ByteArrayInputStream (java.io.ByteArrayInputStream)12 InputStreamReader (java.io.InputStreamReader)12 CvsLogListener (org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener)12 ScmException (org.apache.maven.scm.ScmException)11 CvsUpdateConsumer (org.apache.maven.scm.provider.cvslib.command.update.CvsUpdateConsumer)2 IOException (java.io.IOException)1 BlameScmResult (org.apache.maven.scm.command.blame.BlameScmResult)1 BranchScmResult (org.apache.maven.scm.command.branch.BranchScmResult)1 ChangeLogScmResult (org.apache.maven.scm.command.changelog.ChangeLogScmResult)1 ChangeLogSet (org.apache.maven.scm.command.changelog.ChangeLogSet)1 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)1 CheckOutScmResult (org.apache.maven.scm.command.checkout.CheckOutScmResult)1 DiffScmResult (org.apache.maven.scm.command.diff.DiffScmResult)1 ExportScmResult (org.apache.maven.scm.command.export.ExportScmResult)1 ListScmResult (org.apache.maven.scm.command.list.ListScmResult)1 RemoveScmResult (org.apache.maven.scm.command.remove.RemoveScmResult)1 StatusScmResult (org.apache.maven.scm.command.status.StatusScmResult)1 TagScmResult (org.apache.maven.scm.command.tag.TagScmResult)1 UpdateScmResult (org.apache.maven.scm.command.update.UpdateScmResult)1