Search in sources :

Example 6 with EditScmResult

use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.

the class VssScmProvider method edit.

/**
 * {@inheritDoc}
 */
public EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    VssEditCommand command = new VssEditCommand();
    command.setLogger(getLogger());
    return (EditScmResult) command.execute(repository, fileSet, parameters);
}
Also used : EditScmResult(org.apache.maven.scm.command.edit.EditScmResult) VssEditCommand(org.apache.maven.scm.provider.vss.commands.edit.VssEditCommand)

Example 7 with EditScmResult

use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.

the class VssEditCommand method executeEditCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeEditCommand(ScmProviderRepository repository, ScmFileSet fileSet) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("executing checkout command...");
    }
    VssScmProviderRepository repo = (VssScmProviderRepository) repository;
    List<Commandline> commandLines = buildCmdLine(repo, fileSet);
    VssEditConsumer consumer = new VssEditConsumer(repo, getLogger());
    // TODO handle deleted files from VSS
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    int exitCode;
    StringBuilder sb = new StringBuilder();
    List<ScmFile> updatedFiles = new ArrayList<ScmFile>();
    for (Commandline cl : commandLines) {
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
        }
        exitCode = VssCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
        if (exitCode != 0) {
            String error = stderr.getOutput();
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("VSS returns error: [" + error + "] return code: [" + exitCode + "]");
            }
            if (error.indexOf("A writable copy of") < 0) {
                return new EditScmResult(cl.toString(), "The vss command failed.", error, false);
            }
            // print out the writable copy for manual handling
            if (getLogger().isWarnEnabled()) {
                getLogger().warn(error);
            }
            break;
        }
        sb.append(cl.toString() + '\n');
        updatedFiles.addAll(consumer.getUpdatedFiles());
    }
    return new EditScmResult(sb.toString(), updatedFiles);
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) VssScmProviderRepository(org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository) ArrayList(java.util.ArrayList) ScmFile(org.apache.maven.scm.ScmFile) VssCommandLineUtils(org.apache.maven.scm.provider.vss.commands.VssCommandLineUtils) CommandLineUtils(org.codehaus.plexus.util.cli.CommandLineUtils) EditScmResult(org.apache.maven.scm.command.edit.EditScmResult)

Example 8 with EditScmResult

use of org.apache.maven.scm.command.edit.EditScmResult 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 9 with EditScmResult

use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.

the class ClearCaseEditCommand method executeEditCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeEditCommand(ScmProviderRepository repository, ScmFileSet fileSet) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("executing edit command...");
    }
    Commandline cl = createCommandLine(getLogger(), fileSet);
    ClearCaseEditConsumer consumer = new ClearCaseEditConsumer(getLogger());
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    int exitCode;
    try {
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
        }
        exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
    } catch (CommandLineException ex) {
        throw new ScmException("Error while executing clearcase command.", ex);
    }
    if (exitCode != 0) {
        return new EditScmResult(cl.toString(), "The cleartool command failed.", stderr.getOutput(), false);
    }
    return new EditScmResult(cl.toString(), consumer.getEditFiles());
}
Also used : ScmException(org.apache.maven.scm.ScmException) Commandline(org.codehaus.plexus.util.cli.Commandline) CommandLineUtils(org.codehaus.plexus.util.cli.CommandLineUtils) EditScmResult(org.apache.maven.scm.command.edit.EditScmResult) CommandLineException(org.codehaus.plexus.util.cli.CommandLineException)

Example 10 with EditScmResult

use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.

the class ClearCaseScmProvider method edit.

/**
 * {@inheritDoc}
 */
protected EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    ClearCaseEditCommand command = new ClearCaseEditCommand();
    command.setLogger(getLogger());
    return (EditScmResult) command.execute(repository, fileSet, parameters);
}
Also used : ClearCaseEditCommand(org.apache.maven.scm.provider.clearcase.command.edit.ClearCaseEditCommand) EditScmResult(org.apache.maven.scm.command.edit.EditScmResult)

Aggregations

EditScmResult (org.apache.maven.scm.command.edit.EditScmResult)17 UnEditScmResult (org.apache.maven.scm.command.unedit.UnEditScmResult)5 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)4 Commandline (org.codehaus.plexus.util.cli.Commandline)4 ScmException (org.apache.maven.scm.ScmException)3 File (java.io.File)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 ScmFile (org.apache.maven.scm.ScmFile)2 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)2 APIException (com.mks.api.response.APIException)1 Response (com.mks.api.response.Response)1 LinkedList (java.util.LinkedList)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 ScmFileSet (org.apache.maven.scm.ScmFileSet)1 ClearCaseEditCommand (org.apache.maven.scm.provider.clearcase.command.edit.ClearCaseEditCommand)1 ExceptionHandler (org.apache.maven.scm.provider.integrity.ExceptionHandler)1 Sandbox (org.apache.maven.scm.provider.integrity.Sandbox)1 IntegrityEditCommand (org.apache.maven.scm.provider.integrity.command.edit.IntegrityEditCommand)1 IntegrityScmProviderRepository (org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository)1