def MatchSvnGlob(url, base_url, glob_spec, allow_wildcards):
    'Return the corresponding git ref if |base_url| together with |glob_spec|\n  matches the full |url|.\n\n  If |allow_wildcards| is true, |glob_spec| can contain wildcards (see below).\n  '
    (fetch_suburl, as_ref) = glob_spec.split(':')
    if allow_wildcards:
        glob_match = re.match('(.+/)?(\\*|{[^/]*})(/.+)?', fetch_suburl)
        if glob_match:
            branch_re = re.escape(base_url)
            if glob_match.group(1):
                branch_re += ('/' + re.escape(glob_match.group(1)))
            wildcard = glob_match.group(2)
            if (wildcard == '*'):
                branch_re += '([^/]*)'
            else:
                wildcard = re.escape(wildcard)
                wildcard = re.sub('^\\\\{', '(', wildcard)
                wildcard = re.sub('\\\\,', '|', wildcard)
                wildcard = re.sub('\\\\}$', ')', wildcard)
                branch_re += wildcard
            if glob_match.group(3):
                branch_re += re.escape(glob_match.group(3))
            match = re.match(branch_re, url)
            if match:
                return re.sub('\\*$', match.group(1), as_ref)
    if fetch_suburl:
        full_url = ((base_url + '/') + fetch_suburl)
    else:
        full_url = base_url
    if (full_url == url):
        return as_ref
    return None
Return the corresponding git ref if |base_url| together with |glob_spec|
matches the full |url|.

If |allow_wildcards| is true, |glob_spec| can contain wildcards (see below).
def MatchSvnGlob(url, base_url, glob_spec, allow_wildcards):
    'Return the corresponding git ref if |base_url| together with |glob_spec|\n  matches the full |url|.\n\n  If |allow_wildcards| is true, |glob_spec| can contain wildcards (see below).\n  '
    (fetch_suburl, as_ref) = glob_spec.split(':')
    if allow_wildcards:
        glob_match = re.match('(.+/)?(\\*|{[^/]*})(/.+)?', fetch_suburl)
        if glob_match:
            branch_re = re.escape(base_url)
            if glob_match.group(1):
                branch_re += ('/' + re.escape(glob_match.group(1)))
            wildcard = glob_match.group(2)
            if (wildcard == '*'):
                branch_re += '([^/]*)'
            else:
                wildcard = re.escape(wildcard)
                wildcard = re.sub('^\\\\{', '(', wildcard)
                wildcard = re.sub('\\\\,', '|', wildcard)
                wildcard = re.sub('\\\\}$', ')', wildcard)
                branch_re += wildcard
            if glob_match.group(3):
                branch_re += re.escape(glob_match.group(3))
            match = re.match(branch_re, url)
            if match:
                return re.sub('\\*$', match.group(1), as_ref)
    if fetch_suburl:
        full_url = ((base_url + '/') + fetch_suburl)
    else:
        full_url = base_url
    if (full_url == url):
        return as_ref
    return None