Search in sources :

Example 1 with UnEditScmResult

use of org.apache.maven.scm.command.unedit.UnEditScmResult in project maven-scm by apache.

the class PerforceUnEditCommand method executeUnEditCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeUnEditCommand(ScmProviderRepository repo, ScmFileSet files) throws ScmException {
    Commandline cl = createCommandLine((PerforceScmProviderRepository) repo, files.getBasedir(), files);
    PerforceUnEditConsumer consumer = new PerforceUnEditConsumer();
    try {
        CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
        int exitCode = CommandLineUtils.executeCommandLine(cl, consumer, err);
        if (exitCode != 0) {
            String cmdLine = CommandLineUtils.toString(cl.getCommandline());
            StringBuilder msg = new StringBuilder("Exit code: " + exitCode + " - " + err.getOutput());
            msg.append('\n');
            msg.append("Command line was:" + cmdLine);
            throw new CommandLineException(msg.toString());
        }
    } catch (CommandLineException e) {
        if (getLogger().isErrorEnabled()) {
            getLogger().error("CommandLineException " + e.getMessage(), e);
        }
    }
    if (consumer.isSuccess()) {
        return new UnEditScmResult(cl.toString(), consumer.getEdits());
    }
    return new UnEditScmResult(cl.toString(), "Unable to revert", consumer.getOutput(), consumer.isSuccess());
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) CommandLineUtils(org.codehaus.plexus.util.cli.CommandLineUtils) UnEditScmResult(org.apache.maven.scm.command.unedit.UnEditScmResult) CommandLineException(org.codehaus.plexus.util.cli.CommandLineException)

Example 2 with UnEditScmResult

use of org.apache.maven.scm.command.unedit.UnEditScmResult in project maven-scm by apache.

the class IntegrityScmProvider method unedit.

/**
 * Maps to si revert
 */
@Override
protected UnEditScmResult unedit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
    IntegrityUnEditCommand command = new IntegrityUnEditCommand();
    command.setLogger(getLogger());
    return (UnEditScmResult) command.execute(repository, fileSet, params);
}
Also used : UnEditScmResult(org.apache.maven.scm.command.unedit.UnEditScmResult) IntegrityUnEditCommand(org.apache.maven.scm.provider.integrity.command.unedit.IntegrityUnEditCommand)

Example 3 with UnEditScmResult

use of org.apache.maven.scm.command.unedit.UnEditScmResult in project maven-scm by apache.

the class TfsScmProvider method unedit.

protected UnEditScmResult unedit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    TfsUnEditCommand command = new TfsUnEditCommand();
    command.setLogger(getLogger());
    return (UnEditScmResult) command.execute(repository, fileSet, parameters);
}
Also used : UnEditScmResult(org.apache.maven.scm.command.unedit.UnEditScmResult) TfsUnEditCommand(org.apache.maven.scm.provider.tfs.command.TfsUnEditCommand)

Example 4 with UnEditScmResult

use of org.apache.maven.scm.command.unedit.UnEditScmResult in project maven-scm by apache.

the class JazzScmProvider method unedit.

/**
 * {@inheritDoc}
 */
protected UnEditScmResult unedit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    getLogger().debug("JazzScmProvider:unedit()");
    JazzUnEditCommand command = new JazzUnEditCommand();
    command.setLogger(getLogger());
    return (UnEditScmResult) command.execute(repository, fileSet, parameters);
}
Also used : JazzUnEditCommand(org.apache.maven.scm.provider.jazz.command.unedit.JazzUnEditCommand) UnEditScmResult(org.apache.maven.scm.command.unedit.UnEditScmResult)

Example 5 with UnEditScmResult

use of org.apache.maven.scm.command.unedit.UnEditScmResult in project maven-scm by apache.

the class StarteamScmProvider method unedit.

/**
 * {@inheritDoc}
 */
protected UnEditScmResult unedit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    fileSet = fixUpScmFileSetAbsoluteFilePath(fileSet);
    StarteamUnEditCommand command = new StarteamUnEditCommand();
    command.setLogger(getLogger());
    return (UnEditScmResult) command.execute(repository, fileSet, parameters);
}
Also used : StarteamUnEditCommand(org.apache.maven.scm.provider.starteam.command.unedit.StarteamUnEditCommand) UnEditScmResult(org.apache.maven.scm.command.unedit.UnEditScmResult)

Aggregations

UnEditScmResult (org.apache.maven.scm.command.unedit.UnEditScmResult)12 File (java.io.File)2 IOException (java.io.IOException)2 ScmException (org.apache.maven.scm.ScmException)2 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)2 Commandline (org.codehaus.plexus.util.cli.Commandline)2 APIException (com.mks.api.response.APIException)1 Response (com.mks.api.response.Response)1 ArrayList (java.util.ArrayList)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 ScmFile (org.apache.maven.scm.ScmFile)1 ScmFileSet (org.apache.maven.scm.ScmFileSet)1 ExceptionHandler (org.apache.maven.scm.provider.integrity.ExceptionHandler)1 Sandbox (org.apache.maven.scm.provider.integrity.Sandbox)1 IntegrityUnEditCommand (org.apache.maven.scm.provider.integrity.command.unedit.IntegrityUnEditCommand)1 IntegrityScmProviderRepository (org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository)1 JazzScmCommand (org.apache.maven.scm.provider.jazz.command.JazzScmCommand)1 DebugLoggerConsumer (org.apache.maven.scm.provider.jazz.command.consumer.DebugLoggerConsumer)1 ErrorConsumer (org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer)1 JazzUnEditCommand (org.apache.maven.scm.provider.jazz.command.unedit.JazzUnEditCommand)1