Skip to content

Instantly share code, notes, and snippets.

@evansolomon
Created April 30, 2012 23:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evansolomon/2563530 to your computer and use it in GitHub Desktop.
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
<?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