Search in sources :

Example 11 with ErrorConsumer

use of org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer in project maven-scm by apache.

the class JazzListCommand method executeListCommand.

/**
 * {@inheritDoc}
 */
protected ListScmResult executeListCommand(ScmProviderRepository repo, ScmFileSet fileSet, boolean recursive, ScmVersion version) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("Executing list command...");
    }
    JazzScmProviderRepository jazzRepo = (JazzScmProviderRepository) repo;
    JazzListConsumer listConsumer = new JazzListConsumer(repo, getLogger());
    ErrorConsumer errConsumer = new ErrorConsumer(getLogger());
    JazzScmCommand listCmd = createListCommand(jazzRepo, fileSet, recursive, version);
    int status = listCmd.execute(listConsumer, errConsumer);
    if (status != 0) {
        return new ListScmResult(listCmd.getCommandString(), "Error code for Jazz SCM list command - " + status, errConsumer.getOutput(), false);
    }
    return new ListScmResult(listCmd.getCommandString(), listConsumer.getFiles());
}
Also used : ErrorConsumer(org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer) ListScmResult(org.apache.maven.scm.command.list.ListScmResult) JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand) JazzScmProviderRepository(org.apache.maven.scm.provider.jazz.repository.JazzScmProviderRepository)

Example 12 with ErrorConsumer

use of org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer in project maven-scm by apache.

the class JazzStatusCommand method executeStatusCommand.

/**
 * {@inheritDoc}
 */
public StatusScmResult executeStatusCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("Executing status command...");
    }
    JazzStatusConsumer statusConsumer = new JazzStatusConsumer(repo, getLogger());
    ErrorConsumer errConsumer = new ErrorConsumer(getLogger());
    JazzScmCommand statusCmd = createStatusCommand(repo, fileSet);
    int status = statusCmd.execute(statusConsumer, errConsumer);
    if (status != 0) {
        return new StatusScmResult(statusCmd.getCommandString(), "Error code for Jazz SCM status command - " + status, errConsumer.getOutput(), false);
    }
    if (getLogger().isDebugEnabled()) {
        if (!statusConsumer.getChangedFiles().isEmpty()) {
            getLogger().debug("Iterating over \"Status\" results");
            for (ScmFile file : statusConsumer.getChangedFiles()) {
                getLogger().debug(file.getPath() + " : " + file.getStatus());
            }
        } else {
            getLogger().debug("There are no differences");
        }
    }
    return new StatusScmResult(statusCmd.getCommandString(), statusConsumer.getChangedFiles());
}
Also used : StatusScmResult(org.apache.maven.scm.command.status.StatusScmResult) ErrorConsumer(org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer) JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand) ScmFile(org.apache.maven.scm.ScmFile)

Example 13 with ErrorConsumer

use of org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer in project maven-scm by apache.

the class JazzUnEditCommand method executeUnEditCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeUnEditCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("Executing unedit command...");
    }
    DebugLoggerConsumer uneditConsumer = new DebugLoggerConsumer(getLogger());
    ErrorConsumer errConsumer = new ErrorConsumer(getLogger());
    JazzScmCommand uneditCmd = createUneditCommand(repo, fileSet);
    int status = uneditCmd.execute(uneditConsumer, errConsumer);
    if (status != 0) {
        return new UnEditScmResult(uneditCmd.getCommandString(), "Error code for Jazz SCM unedit command - " + status, errConsumer.getOutput(), false);
    }
    return new UnEditScmResult(uneditCmd.getCommandString(), "Successfully Completed.", uneditConsumer.getOutput(), true);
}
Also used : ErrorConsumer(org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer) UnEditScmResult(org.apache.maven.scm.command.unedit.UnEditScmResult) JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand) DebugLoggerConsumer(org.apache.maven.scm.provider.jazz.command.consumer.DebugLoggerConsumer)

Example 14 with ErrorConsumer

use of org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer in project maven-scm by apache.

the class JazzBlameCommand method executeBlameCommand.

/**
 * {@inheritDoc}
 */
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet fileSet, String filename) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("Executing blame command...");
    }
    JazzScmCommand blameCmd = createBlameCommand(repo, fileSet, filename);
    JazzBlameConsumer blameConsumer = new JazzBlameConsumer(repo, getLogger());
    ErrorConsumer errConsumer = new ErrorConsumer(getLogger());
    int status = blameCmd.execute(blameConsumer, errConsumer);
    if (status != 0) {
        return new BlameScmResult(blameCmd.getCommandString(), "Error code for Jazz SCM blame command - " + status, errConsumer.getOutput(), false);
    }
    return new BlameScmResult(blameCmd.getCommandString(), blameConsumer.getLines());
}
Also used : ErrorConsumer(org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer) BlameScmResult(org.apache.maven.scm.command.blame.BlameScmResult) JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand)

Aggregations

ErrorConsumer (org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer)14 JazzScmCommand (org.apache.maven.scm.provider.jazz.command.JazzScmCommand)13 DebugLoggerConsumer (org.apache.maven.scm.provider.jazz.command.consumer.DebugLoggerConsumer)7 JazzScmProviderRepository (org.apache.maven.scm.provider.jazz.repository.JazzScmProviderRepository)6 ScmFile (org.apache.maven.scm.ScmFile)5 File (java.io.File)3 ArrayList (java.util.ArrayList)3 StatusScmResult (org.apache.maven.scm.command.status.StatusScmResult)3 JazzStatusCommand (org.apache.maven.scm.provider.jazz.command.status.JazzStatusCommand)3 StreamConsumer (org.codehaus.plexus.util.cli.StreamConsumer)3 ScmException (org.apache.maven.scm.ScmException)2 AddScmResult (org.apache.maven.scm.command.add.AddScmResult)2 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)2 HashMap (java.util.HashMap)1 ChangeSet (org.apache.maven.scm.ChangeSet)1 ScmResult (org.apache.maven.scm.ScmResult)1 BlameScmResult (org.apache.maven.scm.command.blame.BlameScmResult)1 ChangeLogScmResult (org.apache.maven.scm.command.changelog.ChangeLogScmResult)1 ChangeLogSet (org.apache.maven.scm.command.changelog.ChangeLogSet)1 CheckOutScmResult (org.apache.maven.scm.command.checkout.CheckOutScmResult)1