{
FileUtils.fileWrite( messageFile.getAbsolutePath(), scmTagParameters.getMessage() );
}
catch ( IOException ex )
{
return new TagScmResult( null, "Error while making a temporary file for the commit message: "
+ ex.getMessage(), null, false );
}
try
{
CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
Commandline clTag = createCommandLine( repository, fileSet.getBasedir(), tag, messageFile );
exitCode = GitCommandLineUtils.execute( clTag, stdout, stderr, getLogger() );
if ( exitCode != 0 )
{
return new TagScmResult( clTag.toString(), "The git-tag command failed.", stderr.getOutput(), false );
}
if( repo.isPushChanges() )
{
// and now push the tag to the configured upstream repository
Commandline clPush = createPushCommandLine( repository, fileSet, tag );
exitCode = GitCommandLineUtils.execute( clPush, stdout, stderr, getLogger() );
if ( exitCode != 0 )
{
return new TagScmResult( clPush.toString(), "The git-push command failed.", stderr.getOutput(), false );
}
}
// plus search for the tagged files
GitListConsumer listConsumer = new GitListConsumer( getLogger(), fileSet.getBasedir(), ScmFileStatus.TAGGED );
Commandline clList = GitListCommand.createCommandLine( repository, fileSet.getBasedir() );
exitCode = GitCommandLineUtils.execute( clList, listConsumer, stderr, getLogger() );
if ( exitCode != 0 )
{
return new CheckOutScmResult( clList.toString(), "The git-ls-files command failed.",
stderr.getOutput(), false );
}
return new TagScmResult( clTag.toString(), listConsumer.getListedFiles() );
}
finally
{
try
{