{
Project project = projectDao.getProject( getProject( context ).getId() );
BuildDefinition buildDefinition = getBuildDefinition( context );
UpdateScmResult scmResult;
ScmResult result;
Date latestUpdateDate = null;
int originalState = project.getState();
project.setState( ContinuumProjectState.UPDATING );
projectDao.updateProject( project );
try
{
BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( project.getId() );
latestUpdateDate = new Date( buildResult.getStartTime() );
}
catch ( Exception e )
{
}
try
{
notifier.checkoutStarted( project, buildDefinition );
// TODO: not sure why this is different to the context, but it all needs to change
File workingDirectory = workingDirectoryService.getWorkingDirectory( project );
ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory );
config.setLatestUpdateDate( latestUpdateDate );
String tag = config.getTag();
String msg =
project.getName() + "', id: '" + project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'" +
( tag != null ? " with branch/tag " + tag + "." : "." );
getLogger().info( "Updating project: " + msg );
scmResult = scm.update( config );
if ( !scmResult.isSuccess() )
{
getLogger().warn( "Error while updating the code for project: '" + msg );
getLogger().warn( "Command output: " + scmResult.getCommandOutput() );
getLogger().warn( "Provider message: " + scmResult.getProviderMessage() );
}
if ( scmResult.getUpdatedFiles() != null && scmResult.getUpdatedFiles().size() > 0 )
{
getLogger().info( "Updated " + scmResult.getUpdatedFiles().size() + " files." );
}
result = convertScmResult( scmResult );
}
catch ( ScmRepositoryException e )