blob: 6c9e934f140316724036b13e0d856a8b274db672 [file] [log] [blame] [edit]
"""Encapsulates regex matchers to detect magic keywords in commit messages."""
from __future__ import absolute_import
import re
REVERT = '^Revert'
REVERT_MSG = '^This reverts commit [0-9a-f]{5,40}'
CHERRY_PICK_MSG = r'\(cherry picked from commit [0-9a-f]{5,40}\)'
def is_revert_commit_message(commit_message):
return bool(re.search(REVERT, commit_message, re.MULTILINE) or
re.search(REVERT_MSG, commit_message, re.MULTILINE))
def is_cherry_pick_commit_message(commit_message):
return bool(re.search(CHERRY_PICK_MSG, commit_message, re.MULTILINE))