Search in sources :

Example 11 with ErrorStreamConsumer

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

the class TfsUnEditCommand method executeUnEditCommand.

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

Example 12 with ErrorStreamConsumer

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

the class TfsCheckInCommand method executeCheckInCommand.

protected CheckInScmResult executeCheckInCommand(ScmProviderRepository r, ScmFileSet f, String m, ScmVersion v) throws ScmException {
    TfsCommand command = createCommand(r, f, m);
    FileListConsumer fileConsumer = new FileListConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();
    int status = command.execute(fileConsumer, err);
    getLogger().debug("status of checkin command is= " + status + "; err= " + err.getOutput());
    // [SCM-753] support TFS checkin-policies - TFS returns error, that can be ignored.
    if (err.hasBeenFed() && err.getOutput().startsWith(TFS_CHECKIN_POLICIES_ERROR)) {
        getLogger().debug("exclusion: got error " + TFS_CHECKIN_POLICIES_ERROR + " due to checkin policies. Ignoring it...");
    }
    if (status != 0 || (err.hasBeenFed() && !err.getOutput().startsWith(TFS_CHECKIN_POLICIES_ERROR))) {
        getLogger().error("ERROR in command: " + command.getCommandString() + "; Error code for TFS checkin command - " + status);
        return new CheckInScmResult(command.getCommandString(), "Error code for TFS checkin command - " + status, err.getOutput(), false);
    }
    return new CheckInScmResult(command.getCommandString(), fileConsumer.getFiles());
}
Also used : FileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer) CheckInScmResult(org.apache.maven.scm.command.checkin.CheckInScmResult)

Example 13 with ErrorStreamConsumer

use of org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer 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

ErrorStreamConsumer (org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)13 FileListConsumer (org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer)7 ScmFile (org.apache.maven.scm.ScmFile)3 TfsScmProviderRepository (org.apache.maven.scm.provider.tfs.TfsScmProviderRepository)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 StringStreamConsumer (org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer)2 ChangeSet (org.apache.maven.scm.ChangeSet)1 AddScmResult (org.apache.maven.scm.command.add.AddScmResult)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 EditScmResult (org.apache.maven.scm.command.edit.EditScmResult)1 ListScmResult (org.apache.maven.scm.command.list.ListScmResult)1 StatusScmResult (org.apache.maven.scm.command.status.StatusScmResult)1 TagScmResult (org.apache.maven.scm.command.tag.TagScmResult)1 UnEditScmResult (org.apache.maven.scm.command.unedit.UnEditScmResult)1 UpdateScmResult (org.apache.maven.scm.command.update.UpdateScmResult)1