Skip to content

Instantly share code, notes, and snippets.

@rhelmer
Created January 11, 2012 23:45
Show Gist options
  • Select an option

  • Save rhelmer/1597520 to your computer and use it in GitHub Desktop.

Select an option

Save rhelmer/1597520 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
import re
bug_pattern = re.compile(r'bug \d+', flags=re.IGNORECASE)
for line in sys.stdin:
commit_msg = line.strip()
bug_msg = bug_pattern.findall(commit_msg)
if bug_msg is None:
print 'missing bug line: %s' % commit_msg
else:
bug_nums = [x[0] for x in bug_msg]
print bug_nums
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment