Search in sources :

Example 21 with AddScmResult

use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.

the class AccuRevAddCommandTest method testAddFailed.

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

Example 22 with AddScmResult

use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.

the class BazaarAddCommand method executeAddCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeAddCommand(ScmProviderRepository repo, ScmFileSet fileSet, String message, boolean binary) throws ScmException {
    String[] addCmd = new String[] { BazaarConstants.ADD_CMD, BazaarConstants.NO_RECURSE_OPTION };
    addCmd = BazaarUtils.expandCommandLine(addCmd, fileSet);
    File workingDir = fileSet.getBasedir();
    BazaarAddConsumer consumer = new BazaarAddConsumer(getLogger(), workingDir);
    ScmResult result = BazaarUtils.execute(consumer, getLogger(), workingDir, addCmd);
    return new AddScmResult(consumer.getAddedFiles(), result);
}
Also used : AddScmResult(org.apache.maven.scm.command.add.AddScmResult) ScmResult(org.apache.maven.scm.ScmResult) AddScmResult(org.apache.maven.scm.command.add.AddScmResult) File(java.io.File)

Example 23 with AddScmResult

use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.

the class BazaarScmProvider method add.

/**
 * {@inheritDoc}
 */
public AddScmResult add(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    BazaarAddCommand command = new BazaarAddCommand();
    command.setLogger(getLogger());
    return (AddScmResult) command.execute(repository, fileSet, parameters);
}
Also used : BazaarAddCommand(org.apache.maven.scm.provider.bazaar.command.add.BazaarAddCommand) AddScmResult(org.apache.maven.scm.command.add.AddScmResult)

Example 24 with AddScmResult

use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.

the class TfsScmProvider method add.

public AddScmResult add(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    TfsAddCommand command = new TfsAddCommand();
    command.setLogger(getLogger());
    return (AddScmResult) command.execute(repository, fileSet, parameters);
}
Also used : AddScmResult(org.apache.maven.scm.command.add.AddScmResult) TfsAddCommand(org.apache.maven.scm.provider.tfs.command.TfsAddCommand)

Example 25 with AddScmResult

use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.

the class TfsAddCommand method executeAddCommand.

protected ScmResult executeAddCommand(ScmProviderRepository r, ScmFileSet f, String m, boolean b) throws ScmException {
    TfsCommand command = createCommand(r, f);
    FileListConsumer fileConsumer = new FileListConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();
    int status = command.execute(fileConsumer, err);
    if (status != 0 || err.hasBeenFed()) {
        return new AddScmResult(command.getCommandString(), "Error code for TFS add command - " + status, err.getOutput(), false);
    }
    return new AddScmResult(command.getCommandString(), fileConsumer.getFiles());
}
Also used : FileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer) AddScmResult(org.apache.maven.scm.command.add.AddScmResult) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)

Aggregations

AddScmResult (org.apache.maven.scm.command.add.AddScmResult)39 File (java.io.File)18 ScmFile (org.apache.maven.scm.ScmFile)12 ScmFileSet (org.apache.maven.scm.ScmFileSet)9 ScmException (org.apache.maven.scm.ScmException)8 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)7 ArrayList (java.util.ArrayList)6 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)6 Commandline (org.codehaus.plexus.util.cli.Commandline)6 CommandParameters (org.apache.maven.scm.CommandParameters)4 ScmRepository (org.apache.maven.scm.repository.ScmRepository)4 ScmResult (org.apache.maven.scm.ScmResult)3 CheckOutScmResult (org.apache.maven.scm.command.checkout.CheckOutScmResult)3 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)3 IOException (java.io.IOException)2 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 ScmFileMatcher.assertHasScmFile (org.apache.maven.scm.ScmFileMatcher.assertHasScmFile)2 AbstractAccuRevCommandTest (org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)2 GitCommandLineUtils (org.apache.maven.scm.provider.git.gitexe.command.GitCommandLineUtils)2 JazzScmCommand (org.apache.maven.scm.provider.jazz.command.JazzScmCommand)2