mercurial/hgweb/webutil.py
changeset 36183 44a519ec5077
parent 36180 34e850440271
child 36258 af0a19d8812b
equal deleted inserted replaced
36182:4f0439981a8a 36183:44a519ec5077
   624 
   624 
   625         # identify portions of the pattern, taking care to avoid escaped
   625         # identify portions of the pattern, taking care to avoid escaped
   626         # delimiters. the replace format and flags are optional, but
   626         # delimiters. the replace format and flags are optional, but
   627         # delimiters are required.
   627         # delimiters are required.
   628         match = re.match(
   628         match = re.match(
   629             r'^s%s(.+)(?:(?<=\\\\)|(?<!\\))%s(.*)%s([ilmsux])*$'
   629             br'^s%s(.+)(?:(?<=\\\\)|(?<!\\))%s(.*)%s([ilmsux])*$'
   630             % (delim, delim, delim), pattern)
   630             % (delim, delim, delim), pattern)
   631         if not match:
   631         if not match:
   632             repo.ui.warn(_("websub: invalid pattern for %s: %s\n")
   632             repo.ui.warn(_("websub: invalid pattern for %s: %s\n")
   633                               % (key, pattern))
   633                               % (key, pattern))
   634             continue
   634             continue
   635 
   635 
   636         # we need to unescape the delimiter for regexp and format
   636         # we need to unescape the delimiter for regexp and format
   637         delim_re = re.compile(r'(?<!\\)\\%s' % delim)
   637         delim_re = re.compile(br'(?<!\\)\\%s' % delim)
   638         regexp = delim_re.sub(unesc, match.group(1))
   638         regexp = delim_re.sub(unesc, match.group(1))
   639         format = delim_re.sub(unesc, match.group(2))
   639         format = delim_re.sub(unesc, match.group(2))
   640 
   640 
   641         # the pattern allows for 6 regexp flags, so set them if necessary
   641         # the pattern allows for 6 regexp flags, so set them if necessary
   642         flagin = match.group(3)
   642         flagin = match.group(3)