in pylib/mercurial-support/run-tests.py [0:0]
def linematch(self, el, l):
if el == l: # perfect match (fast)
return True, True
retry = False
if isoptional(el):
retry = "retry"
el = el[: -len(MARK_OPTIONAL)] + b"\n"
else:
m = optline.match(el)
if m:
conditions = [c for c in m.group(2).split(b' ')]
el = m.group(1) + b"\n"
if not self._iftest(conditions):
# listed feature missing, should not match
return "retry", False
if el.endswith(b" (esc)\n"):
if PYTHON3:
el = el[:-7].decode('unicode_escape') + '\n'
el = el.encode('utf-8')
else:
el = el[:-7].decode('string-escape') + '\n'
if el == l or os.name == 'nt' and el[:-1] + b'\r\n' == l:
return True, True
if el.endswith(b" (re)\n"):
return (TTest.rematch(el[:-6], l) or retry), False
if el.endswith(b" (glob)\n"):
# ignore '(glob)' added to l by 'replacements'
if l.endswith(b" (glob)\n"):
l = l[:-8] + b"\n"
return (TTest.globmatch(el[:-8], l) or retry), False
if os.altsep:
_l = l.replace(b'\\', b'/')
if el == _l or os.name == 'nt' and el[:-1] + b'\r\n' == _l:
return True, True
return retry, True