Search in sources :

Example 21 with ListScmResult

use of org.apache.maven.scm.command.list.ListScmResult in project maven-scm by apache.

the class SvnListCommand method executeListCommand.

/**
 * {@inheritDoc}
 */
protected ListScmResult executeListCommand(ScmProviderRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion version) throws ScmException {
    Commandline cl = createCommandLine((SvnScmProviderRepository) repository, fileSet, recursive, version);
    SvnListConsumer consumer = new SvnListConsumer();
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    if (getLogger().isInfoEnabled()) {
        getLogger().info("Executing: " + SvnCommandLineUtils.cryptPassword(cl));
        if (Os.isFamily(Os.FAMILY_WINDOWS)) {
            getLogger().info("Working directory: " + cl.getWorkingDirectory().getAbsolutePath());
        }
    }
    int exitCode;
    try {
        exitCode = SvnCommandLineUtils.execute(cl, consumer, stderr, getLogger());
    } catch (CommandLineException ex) {
        throw new ScmException("Error while executing command.", ex);
    }
    if (exitCode != 0) {
        return new ListScmResult(cl.toString(), "The svn command failed.", stderr.getOutput(), false);
    }
    return new ListScmResult(cl.toString(), consumer.getFiles());
}
Also used : ScmException(org.apache.maven.scm.ScmException) Commandline(org.codehaus.plexus.util.cli.Commandline) CommandLineUtils(org.codehaus.plexus.util.cli.CommandLineUtils) SvnCommandLineUtils(org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils) ListScmResult(org.apache.maven.scm.command.list.ListScmResult) CommandLineException(org.codehaus.plexus.util.cli.CommandLineException)

Example 22 with ListScmResult

use of org.apache.maven.scm.command.list.ListScmResult in project maven-scm by apache.

the class TfsListCommand method executeListCommand.

protected ListScmResult executeListCommand(ScmProviderRepository r, ScmFileSet f, boolean recursive, ScmVersion v) throws ScmException {
    FileListConsumer out = new ServerFileListConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();
    TfsCommand command = createCommand(r, f, recursive);
    int status = command.execute(out, err);
    if (status != 0 || err.hasBeenFed()) {
        return new ListScmResult(command.getCommandString(), "Error code for TFS list command - " + status, err.getOutput(), false);
    }
    return new ListScmResult(command.getCommandString(), out.getFiles());
}
Also used : ServerFileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ServerFileListConsumer) ServerFileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ServerFileListConsumer) FileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer) ListScmResult(org.apache.maven.scm.command.list.ListScmResult) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)

Aggregations

ListScmResult (org.apache.maven.scm.command.list.ListScmResult)22 ScmException (org.apache.maven.scm.ScmException)8 File (java.io.File)7 ScmFile (org.apache.maven.scm.ScmFile)5 ScmFileSet (org.apache.maven.scm.ScmFileSet)5 MkdirScmResult (org.apache.maven.scm.command.mkdir.MkdirScmResult)4 ArrayList (java.util.ArrayList)3 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)3 ScmResult (org.apache.maven.scm.ScmResult)2 ScmProvider (org.apache.maven.scm.provider.ScmProvider)2 CvsListConsumer (org.apache.maven.scm.provider.cvslib.command.list.CvsListConsumer)2 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)2 Commandline (org.codehaus.plexus.util.cli.Commandline)2 APIException (com.mks.api.response.APIException)1 BufferedReader (java.io.BufferedReader)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 CvsLogListener (org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener)1