public ScmProviderRepository makeProviderScmRepository( File path )
throws ScmRepositoryException, UnknownRepositoryStructure
{
if ( path == null || !path.isDirectory() )
{
throw new ScmRepositoryException( path.getAbsolutePath() + " isn't a valid directory." );
}
File cvsDirectory = new File( path, "CVS" );
if ( !cvsDirectory.exists() )
{
throw new ScmRepositoryException( path.getAbsolutePath() + " isn't a cvs checkout directory." );
}
File cvsRootFile = new File( cvsDirectory, "Root" );
File moduleFile = new File( cvsDirectory, "Repository" );
String cvsRoot;
String module;
try
{
cvsRoot = FileUtils.fileRead( cvsRootFile ).trim().substring( 1 );
}
catch ( IOException e )
{
throw new ScmRepositoryException( "Can't read " + cvsRootFile.getAbsolutePath() );
}
try
{
module = FileUtils.fileRead( moduleFile ).trim();
}
catch ( IOException e )
{
throw new ScmRepositoryException( "Can't read " + moduleFile.getAbsolutePath() );
}
return makeProviderScmRepository( cvsRoot + ":" + module, ':' );
}