def extract_bugs(changelog):
 bug_regexp = re.compile('\\bbug (\\d+)\\b', re.I)
 bugs = set()
 for line in changelog:
  for bug in bug_regexp.findall(line):
   bugs.add(bug)
 return sorted(list(bugs))

def extract_bugs ( changelog ) : bug_regexp = re . compile ( '\\bbug (\\d+)\\b' , re . I ) bugs = set ( ) for line in changelog : for bug in bug_regexp . findall ( line ) : bugs . add ( bug ) return sorted ( list ( bugs ) )
takes output from git log --oneline and extracts bug numbers .