public static String resolveSvnMigratedRevision ( final Revision revision , final String branch ) { if ( revision == null ) { return null ; } final Pattern pattern = Pattern . compile ( "^git-svn-id: .*" + branch + "@([0-9]+) " , Pattern . MULTILINE ) ; final Matcher matcher = pattern . matcher ( revision . getMessage ( ) ) ; if ( matcher . find ( ) ) { return matcher . group ( 1 ) ; } else { return revision . getRevision ( ) ; } }
Helper method to retrieve a canonical revision for git commits migrated from SVN . Migrated commits are detected by the presence of git - svn - id in the commit message .