/** {@inheritDoc} */
protected CheckInScmResult executeCheckInCommand( ScmProviderRepository repo, ScmFileSet fileSet, String message,
ScmVersion version )
throws ScmException
{
LocalScmProviderRepository repository = (LocalScmProviderRepository) repo;
if ( version != null && StringUtils.isNotEmpty( version.getName() ) )
{
throw new ScmException( "The local scm doesn't support tags." );
}
File root = new File( repository.getRoot() );
String module = repository.getModule();
File source = new File( root, module );
File baseDestination = fileSet.getBasedir();
if ( !baseDestination.exists() )
{
throw new ScmException(
"The working directory doesn't exist (" + baseDestination.getAbsolutePath() + ")." );
}
if ( !root.exists() )
{
throw new ScmException( "The base directory doesn't exist (" + root.getAbsolutePath() + ")." );
}
if ( !source.exists() )
{
throw new ScmException( "The module directory doesn't exist (" + source.getAbsolutePath() + ")." );
}
List<ScmFile> checkedInFiles = new ArrayList<ScmFile>();
try
{
// Only copy files newer than in the repo
File repoRoot = new File( repository.getRoot(), repository.getModule() );
List<File> files = fileSet.getFileList();
if ( files.isEmpty() )
{
@SuppressWarnings( "unchecked" )
List<File> listFiles = FileUtils.getFiles( baseDestination, "**", null, false );
files = listFiles;
}
for ( File file : files )
{
String path = file.getPath().replace( '\\', '/' );
File repoFile = new File( repoRoot, path );
file = new File( baseDestination, path );
ScmFileStatus status;
if ( repoFile.exists() )
{
String repoFileContents = FileUtils.fileRead( repoFile );
String fileContents = FileUtils.fileRead( file );
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "fileContents:" + fileContents );
getLogger().debug( "repoFileContents:" + repoFileContents );
}
if ( fileContents.equals( repoFileContents ) )
{
continue;
}
status = ScmFileStatus.CHECKED_IN;
}
else if ( repository.isFileAdded( path ) )
{
status = ScmFileStatus.CHECKED_IN;
}
else
{