Created
April 30, 2012 23:10
-
-
Save evansolomon/2563530 to your computer and use it in GitHub Desktop.
Find SVN commits where a revision closed a ticket matching the same number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$revision_regex = '/^r(\d+) /'; | |
exec( 'svn log | sed \'s/------------------------------------------------------------------------/NEWCHANGESET/g\' | sed -e \'/[^NEWCHANGESET]$/{N;s/\n//;}\' | sed -e \'/[^NEWCHANGESET]$/{N;s/\n//;}\' | sed -e \'s/NEWCHANGESET//\'', $commits ); | |
foreach( $commits as $commit ) { | |
if( !$commit ) | |
continue; | |
preg_match( $revision_regex, $commit, $revision ); | |
if( !$revision ) | |
continue; | |
$revision = $revision[1]; | |
$ticket_regex = '/fixes #('.$revision.')/i'; | |
preg_match( $ticket_regex, $commit, $ticket ); | |
if( $ticket ) | |
echo $ticket[1] . "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment