public String checkinNewContent ( String sourceDirectory , String message ) throws Exception { RmCommand remove = git . rm ( ) ; boolean hasFiles = false ; for ( String filename : new File ( getBaseDirectory ( ) ) . list ( ) ) { if ( ! filename . equals ( ".git" ) ) { remove . addFilepattern ( filename ) ; hasFiles = true ; } } if ( hasFiles ) { log . info ( "Removing old content." ) ; remove . call ( ) ; } log . info ( "Copying in new content." ) ; FileSystemManager . copyAllContent ( sourceDirectory , getBaseDirectory ( ) , true ) ; log . info ( "Adding new content." ) ; AddCommand add = git . add ( ) ; for ( String filename : new File ( getBaseDirectory ( ) ) . list ( ) ) { if ( ! filename . equals ( ".git" ) ) { add . addFilepattern ( filename ) ; } } add . call ( ) ; log . info ( "Committing new content." ) ; git . commit ( ) . setMessage ( message ) . call ( ) ; return getCurrentRevision ( ) ; }
Checks in content from a source directory into the current git repository .