Search in sources :

Example 1 with FileListConsumer

use of org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer in project maven-scm by apache.

the class TfsCommand method execute.

public int execute(StreamConsumer out, ErrorStreamConsumer err) throws ScmException {
    info("Command line - " + getCommandString());
    int status;
    try {
        status = CommandLineUtils.executeCommandLine(command, out, err);
    } catch (CommandLineException e) {
        throw new ScmException("Error while executing TFS command line - " + getCommandString(), e);
    }
    info("err - " + err.getOutput());
    if (out instanceof StringStreamConsumer) {
        StringStreamConsumer sc = (StringStreamConsumer) out;
        debug(sc.getOutput());
    }
    if (out instanceof FileListConsumer) {
        FileListConsumer f = (FileListConsumer) out;
        for (Iterator<ScmFile> i = f.getFiles().iterator(); i.hasNext(); ) {
            ScmFile file = i.next();
            debug(file.getPath());
        }
    }
    return status;
}
Also used : FileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer) ScmException(org.apache.maven.scm.ScmException) StringStreamConsumer(org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer) CommandLineException(org.codehaus.plexus.util.cli.CommandLineException) ScmFile(org.apache.maven.scm.ScmFile)

Example 2 with FileListConsumer

use of org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer in project maven-scm by apache.

the class TfsCheckOutCommandTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    consumer = new FileListConsumer();
}
Also used : FileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer)

Example 3 with FileListConsumer

use of org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer in project maven-scm by apache.

the class TfsEditCommandTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    consumer = new FileListConsumer();
}
Also used : FileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer)

Example 4 with FileListConsumer

use of org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer in project maven-scm by apache.

the class TfsUpdateCommand method executeUpdateCommand.

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

Example 5 with FileListConsumer

use of org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer in project maven-scm by apache.

the class TfsAddCommand method executeAddCommand.

protected ScmResult executeAddCommand(ScmProviderRepository r, ScmFileSet f, String m, boolean b) throws ScmException {
    TfsCommand command = createCommand(r, f);
    FileListConsumer fileConsumer = new FileListConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();
    int status = command.execute(fileConsumer, err);
    if (status != 0 || err.hasBeenFed()) {
        return new AddScmResult(command.getCommandString(), "Error code for TFS add command - " + status, err.getOutput(), false);
    }
    return new AddScmResult(command.getCommandString(), fileConsumer.getFiles());
}
Also used : FileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer) AddScmResult(org.apache.maven.scm.command.add.AddScmResult) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)

Aggregations

FileListConsumer (org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer)11 ErrorStreamConsumer (org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)7 ScmException (org.apache.maven.scm.ScmException)1 ScmFile (org.apache.maven.scm.ScmFile)1 AddScmResult (org.apache.maven.scm.command.add.AddScmResult)1 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)1 CheckOutScmResult (org.apache.maven.scm.command.checkout.CheckOutScmResult)1 EditScmResult (org.apache.maven.scm.command.edit.EditScmResult)1 ListScmResult (org.apache.maven.scm.command.list.ListScmResult)1 UnEditScmResult (org.apache.maven.scm.command.unedit.UnEditScmResult)1 UpdateScmResult (org.apache.maven.scm.command.update.UpdateScmResult)1 TfsScmProviderRepository (org.apache.maven.scm.provider.tfs.TfsScmProviderRepository)1 ServerFileListConsumer (org.apache.maven.scm.provider.tfs.command.consumer.ServerFileListConsumer)1 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)1 StringStreamConsumer (org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer)1