Search in sources :

Example 1 with ErrorStreamConsumer

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

the class TfsTagCommand method executeTagCommand.

protected ScmResult executeTagCommand(ScmProviderRepository r, ScmFileSet f, String tag, ScmTagParameters scmTagParameters) throws ScmException {
    TfsCommand command = createCommand(r, f, tag, scmTagParameters);
    StringStreamConsumer out = new StringStreamConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();
    int status = command.execute(out, err);
    if (status != 0 || err.hasBeenFed()) {
        return new TagScmResult(command.getCommandString(), "Error code for TFS label command - " + status, err.getOutput(), false);
    }
    List<ScmFile> files = new ArrayList<ScmFile>(f.getFileList().size());
    for (File file : f.getFileList()) {
        files.add(new ScmFile(file.getPath(), ScmFileStatus.TAGGED));
    }
    return new TagScmResult(command.getCommandString(), files);
}
Also used : ArrayList(java.util.ArrayList) StringStreamConsumer(org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer) TagScmResult(org.apache.maven.scm.command.tag.TagScmResult) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) ScmFile(org.apache.maven.scm.ScmFile)

Example 2 with ErrorStreamConsumer

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

the class TfsChangeLogCommand method executeChangeLogCommand.

protected ChangeLogScmResult executeChangeLogCommand(ScmProviderRepository r, ScmFileSet f, Date startDate, Date endDate, ScmBranch branch, String datePattern) throws ScmException {
    List<ChangeSet> changeLogs = new ArrayList<ChangeSet>();
    Iterator<File> iter = f.getFileList().iterator();
    if (!iter.hasNext()) {
        List<File> dir = new ArrayList<File>();
        // No files to iterate
        dir.add(f.getBasedir());
        iter = dir.iterator();
    }
    TfsCommand command = null;
    // tf history takes only one file arg
    while (iter.hasNext()) {
        TfsChangeLogConsumer out = new TfsChangeLogConsumer(getLogger());
        ErrorStreamConsumer err = new ErrorStreamConsumer();
        command = createCommand(r, f, ((File) iter.next()));
        int status = command.execute(out, err);
        if (status != 0 || (!out.hasBeenFed() && err.hasBeenFed())) {
            return new ChangeLogScmResult(command.getCommandString(), "Error code for TFS changelog command - " + status, err.getOutput(), false);
        }
        changeLogs.addAll(out.getLogs());
    }
    return new ChangeLogScmResult(command.getCommandString(), new ChangeLogSet(changeLogs, startDate, endDate));
}
Also used : ChangeLogSet(org.apache.maven.scm.command.changelog.ChangeLogSet) ArrayList(java.util.ArrayList) TfsChangeLogConsumer(org.apache.maven.scm.provider.tfs.command.consumer.TfsChangeLogConsumer) ChangeLogScmResult(org.apache.maven.scm.command.changelog.ChangeLogScmResult) ChangeSet(org.apache.maven.scm.ChangeSet) File(java.io.File) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)

Example 3 with ErrorStreamConsumer

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

the class TfsBranchCommand method executeBranchCommand.

protected ScmResult executeBranchCommand(ScmProviderRepository r, ScmFileSet f, String branch, String message) throws ScmException {
    TfsCommand command = createCommand(r, f, branch);
    StringStreamConsumer out = new StringStreamConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();
    int status = command.execute(out, err);
    getLogger().info("status of branch command is= " + status + "; err= " + err.getOutput());
    if (status != 0 || err.hasBeenFed()) {
        return new BranchScmResult(command.getCommandString(), "Error code for TFS branch command - " + status, err.getOutput(), false);
    }
    return new BranchScmResult(command.getCommandString(), new ArrayList<ScmFile>(0));
}
Also used : StringStreamConsumer(org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer) BranchScmResult(org.apache.maven.scm.command.branch.BranchScmResult) ScmFile(org.apache.maven.scm.ScmFile)

Example 4 with ErrorStreamConsumer

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

the class TfsCheckOutCommand method executeUnmapCommand.

public int executeUnmapCommand(ScmProviderRepository r, ScmFileSet f) throws ScmException {
    TfsScmProviderRepository tfsRepo = (TfsScmProviderRepository) r;
    String url = tfsRepo.getServerPath();
    String workspace = tfsRepo.getWorkspace();
    ErrorStreamConsumer out = new ErrorStreamConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();
    TfsCommand command = new TfsCommand("workfold", r, null, getLogger());
    command.addArgument("-workspace:" + workspace);
    command.addArgument("-unmap");
    command.addArgument(url);
    return command.execute(out, err);
}
Also used : TfsScmProviderRepository(org.apache.maven.scm.provider.tfs.TfsScmProviderRepository) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)

Example 5 with ErrorStreamConsumer

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

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