Search in sources :

Example 1 with Command

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

the class AbstractCvsMkdirCommand method executeMkdirCommand.

/**
 * {@inheritDoc}
 */
protected MkdirScmResult executeMkdirCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message, boolean createInLocal) throws ScmException {
    CommandParameters parameters = new CommandParameters();
    parameters.setString(CommandParameter.MESSAGE, message == null ? "" : message);
    parameters.setString(CommandParameter.BINARY, "false");
    // just invoke add command
    Command cmd = getAddCommand();
    cmd.setLogger(getLogger());
    ScmResult addResult = cmd.execute(repository, fileSet, parameters);
    if (!addResult.isSuccess()) {
        return new MkdirScmResult(addResult.getCommandLine().toString(), "The cvs command failed.", addResult.getCommandOutput(), false);
    }
    List<ScmFile> addedFiles = new ArrayList<ScmFile>();
    for (File file : fileSet.getFileList()) {
        ScmFile scmFile = new ScmFile(file.getPath(), ScmFileStatus.ADDED);
        addedFiles.add(scmFile);
    }
    return new MkdirScmResult(addResult.getCommandLine().toString(), addedFiles);
}
Also used : MkdirScmResult(org.apache.maven.scm.command.mkdir.MkdirScmResult) ScmResult(org.apache.maven.scm.ScmResult) AbstractMkdirCommand(org.apache.maven.scm.command.mkdir.AbstractMkdirCommand) Command(org.apache.maven.scm.command.Command) MkdirScmResult(org.apache.maven.scm.command.mkdir.MkdirScmResult) ArrayList(java.util.ArrayList) CommandParameters(org.apache.maven.scm.CommandParameters) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) ScmFile(org.apache.maven.scm.ScmFile)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 CommandParameters (org.apache.maven.scm.CommandParameters)1 ScmFile (org.apache.maven.scm.ScmFile)1 ScmResult (org.apache.maven.scm.ScmResult)1 Command (org.apache.maven.scm.command.Command)1 AbstractMkdirCommand (org.apache.maven.scm.command.mkdir.AbstractMkdirCommand)1 MkdirScmResult (org.apache.maven.scm.command.mkdir.MkdirScmResult)1