throw new ScmException( "tagging specific files is not allowed" );
}
// Perform the tagging operation
File bazaarRoot = fileSet.getBasedir();
BazaarConsumer consumer = new BazaarConsumer( getLogger() );
String[] tagCmd = new String[] { BazaarConstants.TAG_CMD, tagName };
ScmResult tagResult = BazaarUtils.execute( consumer, getLogger(), bazaarRoot, tagCmd );
if ( !tagResult.isSuccess() ) {
return new TagScmResult( null, tagResult );
}
// Do "bzr ls -R -r tag:tagName" to get a list of the tagged files
BazaarLsConsumer lsConsumer =
new BazaarLsConsumer( getLogger(), bazaarRoot, ScmFileStatus.TAGGED );
String[] lsCmd = new String[] {
BazaarConstants.LS_CMD,
BazaarConstants.RECURSIVE_OPTION,
BazaarConstants.REVISION_OPTION,
"tag:" + tagName
};
ScmResult lsResult = BazaarUtils.execute(lsConsumer, getLogger(), bazaarRoot, lsCmd);
if ( !lsResult.isSuccess() ) {
return new TagScmResult( null, lsResult );
}
// Push new tags to parent branch if any
BazaarScmProviderRepository bazaarRepository = (BazaarScmProviderRepository) repository;
if ( !bazaarRepository.getURI().equals( fileSet.getBasedir().getAbsolutePath() ) && repository.isPushChanges() )
{
String[] pushCmd = new String[] { BazaarConstants.PUSH_CMD, bazaarRepository.getURI() };
ScmResult pushResult =
BazaarUtils.execute( new BazaarConsumer( getLogger() ), getLogger(), fileSet.getBasedir(), pushCmd );
if ( !pushResult.isSuccess() ) {
return new TagScmResult( null, pushResult );
}
}