in maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubCheckInCommand.java [48:104]
protected ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
throws ScmException
{
List checkedInFiles = new ArrayList();
try
{
StubScmProviderRepository stubRepo = (StubScmProviderRepository) repository;
File workingCopyRoot = stubRepo.getWorkingCopyRoot( fileSet );
File repoRoot = stubRepo.getRoot();
logger.info( "Committing: " + workingCopyRoot + " > " + repoRoot );
List paths = stubRepo.getPaths( workingCopyRoot, fileSet );
for ( Iterator it = paths.iterator(); it.hasNext(); )
{
String path = (String) it.next();
File srcFile = new File( workingCopyRoot, path );
File dstFile = new File( repoRoot, path );
logger.info( " " + path );
if ( dstFile.isDirectory() )
{
if ( !srcFile.isDirectory() )
{
throw new IOException( "Cannot commit a normal file to a directory: " + srcFile + " -> "
+ dstFile );
}
}
else if ( dstFile.isFile() )
{
if ( !srcFile.isFile() )
{
throw new IOException( "Cannot commit a directory to a normal file: " + srcFile + " -> "
+ dstFile );
}
FileUtils.copyFile( srcFile, dstFile );
}
else
{
throw new IOException( "Cannot commit to non-existing location: " + srcFile + " -> " + dstFile );
}
checkedInFiles.add( new ScmFile( path, ScmFileStatus.CHECKED_IN ) );
}
}
catch ( IOException e )
{
throw new ScmException( "Error while checking in the files.", e );
}
return new CheckInScmResult( null, checkedInFiles );
}