String statusString = line.substring( 0, 1 );
String file = line.substring( 2 );
ScmFileStatus status;
if ( statusString.equals( "A" ) )
{
status = ScmFileStatus.ADDED;
}
else if ( statusString.equals( "M" ) )
{
status = ScmFileStatus.MODIFIED;
}
else if ( statusString.equals( "D" ) )
{
status = ScmFileStatus.DELETED;
}
else if ( statusString.equals( "C" ) )
{
status = ScmFileStatus.CONFLICT;
}
else if ( statusString.equals( "?" ) )
{
status = ScmFileStatus.UNKNOWN;
}
else if ( statusString.equals( "U" ) || statusString.equals( "P" ) )
{
// skip remote changes
return;
}
else
{
if ( logger.isInfoEnabled() )
{
logger.info( "Unknown file status: '" + statusString + "'." );
}
return;
}
// If the file isn't a file; don't add it.
if ( !status.equals( ScmFileStatus.DELETED ) && !new File( workingDirectory, file ).isFile() )
{
return;
}
changedFiles.add( new ScmFile( file, status ) );