{
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() );
}