import re


def get_mfc_requirements(msg):
    """ Get set of revisions required to be merged with commit """
    requirements = set()
    lines = msg.split('\n')
    for line in lines:
        if re.match('^\s*(x-)?mfc(-|\s+)with\s*:', line, flags=re.IGNORECASE):
            pos = line.find(':')
            line = line[pos+1:]
            revisions = re.split('[, ]+', line.strip())
            for rev in revisions:
                if rev.startswith('r'):
                    rev = rev[1:]
                requirements.add(rev)

    return requirements