Search in sources :

Example 1 with RemoveScmResult

use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.

the class AccuRevRemoveCommandTest method testAddFailed.

@Test
public void testAddFailed() throws Exception {
    final ScmFileSet testFileSet = new ScmFileSet(basedir, new File("src/main/java/Foo.java"));
    when(accurev.defunct(basedir, testFileSet.getFileList(), "A deleted file")).thenReturn(null);
    AccuRevRemoveCommand command = new AccuRevRemoveCommand(getLogger());
    CommandParameters commandParameters = new CommandParameters();
    commandParameters.setString(CommandParameter.MESSAGE, "A deleted file");
    RemoveScmResult result = command.remove(repo, testFileSet, commandParameters);
    assertThat(result.isSuccess(), is(false));
    assertThat(result.getProviderMessage(), notNullValue());
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) CommandParameters(org.apache.maven.scm.CommandParameters) File(java.io.File) ScmFileMatcher.assertHasScmFile(org.apache.maven.scm.ScmFileMatcher.assertHasScmFile) RemoveScmResult(org.apache.maven.scm.command.remove.RemoveScmResult) Test(org.junit.Test) AbstractAccuRevCommandTest(org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)

Example 2 with RemoveScmResult

use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.

the class BazaarRemoveCommand method executeRemoveCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeRemoveCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message) throws ScmException {
    String[] command = new String[] { BazaarConstants.REMOVE_CMD };
    BazaarUtils.expandCommandLine(command, fileSet);
    File workingDir = fileSet.getBasedir();
    BazaarRemoveConsumer consumer = new BazaarRemoveConsumer(getLogger(), workingDir);
    ScmResult result = BazaarUtils.execute(consumer, getLogger(), workingDir, command);
    return new RemoveScmResult(consumer.getRemovedFiles(), result);
}
Also used : ScmResult(org.apache.maven.scm.ScmResult) RemoveScmResult(org.apache.maven.scm.command.remove.RemoveScmResult) File(java.io.File) RemoveScmResult(org.apache.maven.scm.command.remove.RemoveScmResult)

Example 3 with RemoveScmResult

use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.

the class PerforceRemoveCommand method executeRemoveCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeRemoveCommand(ScmProviderRepository repo, ScmFileSet files, String message) throws ScmException {
    Commandline cl = createCommandLine((PerforceScmProviderRepository) repo, files.getBasedir(), files);
    PerforceRemoveConsumer consumer = new PerforceRemoveConsumer();
    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) {
        throw new ScmException("CommandLineException " + e.getMessage(), e);
    }
    return new RemoveScmResult(cl.toString(), consumer.getRemovals());
}
Also used : ScmException(org.apache.maven.scm.ScmException) Commandline(org.codehaus.plexus.util.cli.Commandline) CommandLineUtils(org.codehaus.plexus.util.cli.CommandLineUtils) RemoveScmResult(org.apache.maven.scm.command.remove.RemoveScmResult) CommandLineException(org.codehaus.plexus.util.cli.CommandLineException)

Example 4 with RemoveScmResult

use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.

the class IntegrityScmProvider method remove.

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

Example 5 with RemoveScmResult

use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.

the class HgRemoveCommand method executeRemoveCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeRemoveCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message) throws ScmException {
    String[] command = new String[] { HgCommandConstants.REMOVE_CMD };
    command = HgUtils.expandCommandLine(command, fileSet);
    File workingDir = fileSet.getBasedir();
    HgRemoveConsumer consumer = new HgRemoveConsumer(getLogger(), workingDir);
    ScmResult result = HgUtils.execute(consumer, getLogger(), workingDir, command);
    return new RemoveScmResult(consumer.getRemovedFiles(), result);
}
Also used : ScmResult(org.apache.maven.scm.ScmResult) RemoveScmResult(org.apache.maven.scm.command.remove.RemoveScmResult) File(java.io.File) RemoveScmResult(org.apache.maven.scm.command.remove.RemoveScmResult)

Aggregations

RemoveScmResult (org.apache.maven.scm.command.remove.RemoveScmResult)20 File (java.io.File)7 ScmException (org.apache.maven.scm.ScmException)6 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)5 ScmFileSet (org.apache.maven.scm.ScmFileSet)4 Commandline (org.codehaus.plexus.util.cli.Commandline)4 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)3 CommandParameters (org.apache.maven.scm.CommandParameters)2 ScmFileMatcher.assertHasScmFile (org.apache.maven.scm.ScmFileMatcher.assertHasScmFile)2 ScmResult (org.apache.maven.scm.ScmResult)2 AbstractAccuRevCommandTest (org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)2 ScmRepository (org.apache.maven.scm.repository.ScmRepository)2 Test (org.junit.Test)2 APIException (com.mks.api.response.APIException)1 Response (com.mks.api.response.Response)1 BufferedReader (java.io.BufferedReader)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1