{
// noop
}
};
ScmResult result = HgUtils.execute( branchConsumer, getLogger(), workingDir, branchCmd );
HgScmProviderRepository repository = (HgScmProviderRepository) scmProviderRepository;
if ( !result.isSuccess() )
{
throw new ScmException( "Error while executing command " + joinCmd( branchCmd ) );
}
// First commit.
String[] commitCmd =
new String[] { HgCommandConstants.COMMIT_CMD, HgCommandConstants.MESSAGE_OPTION,
scmBranchParameters.getMessage() };
result = HgUtils.execute( new HgConsumer( getLogger() ), getLogger(), workingDir, commitCmd );
if ( !result.isSuccess() )
{
throw new ScmException( "Error while executing command " + joinCmd( commitCmd ) );
}
// now push, if we should.
if ( repository.isPushChanges() )
{
if ( !repository.getURI().equals( fileSet.getBasedir().getAbsolutePath() ) )
{
String[] pushCmd = new String[] {
HgCommandConstants.PUSH_CMD,
HgCommandConstants.NEW_BRANCH_OPTION,
repository.getURI()
};
result = HgUtils.execute( new HgConsumer( getLogger() ), getLogger(), fileSet.getBasedir(), pushCmd );
if ( !result.isSuccess() )
{
throw new ScmException( "Error while executing command " + joinCmd( pushCmd ) );
}
}
}
// do an inventory to return the files branched (all of them)
String[] listCmd = new String[]{ HgCommandConstants.INVENTORY_CMD };
HgListConsumer listconsumer = new HgListConsumer( getLogger() );
result = HgUtils.execute( listconsumer, getLogger(), fileSet.getBasedir(), listCmd );
if ( !result.isSuccess() )
{
throw new ScmException( "Error while executing command " + joinCmd( listCmd ) );
}
List<ScmFile> files = listconsumer.getFiles();