Search in sources :

Example 1 with ClearCaseCheckInConsumer

use of org.apache.maven.scm.provider.clearcase.command.checkin.ClearCaseCheckInConsumer in project maven-scm by apache.

the class ClearCaseTagCommand method executeTagCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeTagCommand(ScmProviderRepository scmProviderRepository, ScmFileSet fileSet, String tag, ScmTagParameters scmTagParameters) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("executing tag command...");
    }
    Commandline cl = createCommandLine(fileSet, tag);
    ClearCaseCheckInConsumer consumer = new ClearCaseCheckInConsumer(getLogger());
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    int exitCode;
    try {
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Creating label: " + tag);
        }
        Commandline newLabelCommandLine = createNewLabelCommandLine(fileSet, tag);
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Executing: " + newLabelCommandLine.getWorkingDirectory().getAbsolutePath() + ">>" + newLabelCommandLine.toString());
        }
        exitCode = CommandLineUtils.executeCommandLine(newLabelCommandLine, new CommandLineUtils.StringStreamConsumer(), stderr);
        if (exitCode == 0) {
            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 TagScmResult(cl.toString(), "The cleartool command failed.", stderr.getOutput(), false);
    }
    return new TagScmResult(cl.toString(), consumer.getCheckedInFiles());
}
Also used : ScmException(org.apache.maven.scm.ScmException) ClearCaseCheckInConsumer(org.apache.maven.scm.provider.clearcase.command.checkin.ClearCaseCheckInConsumer) Commandline(org.codehaus.plexus.util.cli.Commandline) CommandLineUtils(org.codehaus.plexus.util.cli.CommandLineUtils) TagScmResult(org.apache.maven.scm.command.tag.TagScmResult) CommandLineException(org.codehaus.plexus.util.cli.CommandLineException)

Aggregations

ScmException (org.apache.maven.scm.ScmException)1 TagScmResult (org.apache.maven.scm.command.tag.TagScmResult)1 ClearCaseCheckInConsumer (org.apache.maven.scm.provider.clearcase.command.checkin.ClearCaseCheckInConsumer)1 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)1 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)1 Commandline (org.codehaus.plexus.util.cli.Commandline)1