Search in sources :

Example 6 with FileListConsumer

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

the class TfsCheckOutCommand method executeCheckOutCommand.

protected CheckOutScmResult executeCheckOutCommand(ScmProviderRepository r, ScmFileSet f, ScmVersion v, boolean recursive, boolean shallow) throws ScmException {
    TfsScmProviderRepository tfsRepo = (TfsScmProviderRepository) r;
    String url = tfsRepo.getServerPath();
    String tfsUrl = tfsRepo.getTfsUrl();
    String workspace = tfsRepo.getWorkspace();
    // Try creating workspace
    boolean workspaceProvided = workspace != null && !workspace.trim().equals("");
    if (workspaceProvided) {
        createWorkspace(r, f, workspace, tfsUrl);
    }
    TfsCommand command;
    int status;
    if (workspaceProvided) {
        status = executeUnmapCommand(r, f);
    }
    ErrorStreamConsumer out = new ErrorStreamConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();
    if (workspaceProvided) {
        command = new TfsCommand("workfold", r, null, getLogger());
        command.addArgument("-workspace:" + workspace);
        command.addArgument("-map");
        command.addArgument(url);
        command.addArgument(f.getBasedir().getAbsolutePath());
        status = command.execute(out, err);
        if (status != 0 || err.hasBeenFed()) {
            return new CheckOutScmResult(command.getCommandString(), "Error code for TFS checkout (workfold map) command - " + status, err.getOutput(), false);
        }
    }
    FileListConsumer fileConsumer = new FileListConsumer();
    err = new ErrorStreamConsumer();
    command = createGetCommand(r, f, v, recursive);
    status = command.execute(fileConsumer, err);
    if (status != 0 || err.hasBeenFed()) {
        return new CheckOutScmResult(command.getCommandString(), "Error code for TFS checkout (get) command - " + status, err.getOutput(), false);
    }
    return new CheckOutScmResult(command.getCommandString(), fileConsumer.getFiles());
}
Also used : FileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer) CheckOutScmResult(org.apache.maven.scm.command.checkout.CheckOutScmResult) TfsScmProviderRepository(org.apache.maven.scm.provider.tfs.TfsScmProviderRepository) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)

Example 7 with FileListConsumer

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

the class TfsEditCommand method executeEditCommand.

protected ScmResult executeEditCommand(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 EditScmResult(command.getCommandString(), "Error code for TFS edit command - " + status, err.getOutput(), false);
    }
    return new EditScmResult(command.getCommandString(), out.getFiles());
}
Also used : FileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer) EditScmResult(org.apache.maven.scm.command.edit.EditScmResult) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)

Example 8 with FileListConsumer

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

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

the class TfsChangeLogCommandTest 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 10 with FileListConsumer

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

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