Search in sources :

Example 6 with CvsLogListener

use of org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener in project maven-scm by apache.

the class CvsJavaExportCommand method executeCvsCommand.

/**
 * {@inheritDoc}
 */
protected ExportScmResult 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 ExportScmResult(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 ExportScmResult(cl.toString(), "The cvs command failed.", logListener.getStderr().toString(), false);
    }
    return new ExportScmResult(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) ExportScmResult(org.apache.maven.scm.command.export.ExportScmResult) BufferedReader(java.io.BufferedReader) ScmException(org.apache.maven.scm.ScmException)

Example 7 with CvsLogListener

use of org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener in project maven-scm by apache.

the class CvsJavaTagCommand method executeCvsCommand.

/**
 * {@inheritDoc}
 */
protected TagScmResult executeCvsCommand(Commandline cl) throws ScmException {
    CvsLogListener logListener = new CvsLogListener();
    CvsTagConsumer consumer = new CvsTagConsumer(getLogger());
    try {
        boolean isSuccess = CvsConnection.processCommand(cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger());
        if (!isSuccess) {
            return new TagScmResult(cl.toString(), "The cvs tag 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 TagScmResult(cl.toString(), "The cvs tag command failed.", logListener.getStderr().toString(), false);
    }
    return new TagScmResult(cl.toString(), consumer.getTaggedFiles());
}
Also used : CvsLogListener(org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener) InputStreamReader(java.io.InputStreamReader) ByteArrayInputStream(java.io.ByteArrayInputStream) CvsTagConsumer(org.apache.maven.scm.provider.cvslib.command.tag.CvsTagConsumer) BufferedReader(java.io.BufferedReader) TagScmResult(org.apache.maven.scm.command.tag.TagScmResult) ScmException(org.apache.maven.scm.ScmException)

Example 8 with CvsLogListener

use of org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener in project maven-scm by apache.

the class CvsJavaBranchCommand method executeCvsCommand.

/**
 * {@inheritDoc}
 */
protected BranchScmResult executeCvsCommand(Commandline cl) throws ScmException {
    CvsLogListener logListener = new CvsLogListener();
    CvsBranchConsumer consumer = new CvsBranchConsumer(getLogger());
    try {
        boolean isSuccess = CvsConnection.processCommand(cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger());
        if (!isSuccess) {
            return new BranchScmResult(cl.toString(), "The cvs branch 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.getMessage(), e);
        return new BranchScmResult(cl.toString(), "The cvs branch command failed.", logListener.getStderr().toString(), false);
    }
    return new BranchScmResult(cl.toString(), consumer.getTaggedFiles());
}
Also used : CvsLogListener(org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener) InputStreamReader(java.io.InputStreamReader) ByteArrayInputStream(java.io.ByteArrayInputStream) BufferedReader(java.io.BufferedReader) CvsBranchConsumer(org.apache.maven.scm.provider.cvslib.command.branch.CvsBranchConsumer) BranchScmResult(org.apache.maven.scm.command.branch.BranchScmResult) ScmException(org.apache.maven.scm.ScmException)

Example 9 with CvsLogListener

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

Example 10 with CvsLogListener

use of org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener in project maven-scm by apache.

the class CvsJavaStatusCommand method executeCvsCommand.

/**
 * {@inheritDoc}
 */
protected StatusScmResult executeCvsCommand(Commandline cl) throws ScmException {
    CvsLogListener logListener = new CvsLogListener();
    CvsStatusConsumer consumer = new CvsStatusConsumer(getLogger(), cl.getWorkingDirectory());
    try {
        boolean isSuccess = CvsConnection.processCommand(cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger());
        if (!isSuccess) {
            return new StatusScmResult(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 StatusScmResult(cl.toString(), "The cvs command failed.", logListener.getStderr().toString(), false);
    }
    return new StatusScmResult(cl.toString(), consumer.getChangedFiles());
}
Also used : StatusScmResult(org.apache.maven.scm.command.status.StatusScmResult) CvsLogListener(org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener) CvsStatusConsumer(org.apache.maven.scm.provider.cvslib.command.status.CvsStatusConsumer) InputStreamReader(java.io.InputStreamReader) ByteArrayInputStream(java.io.ByteArrayInputStream) BufferedReader(java.io.BufferedReader) 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