equal
deleted
inserted
replaced
501 finally: |
501 finally: |
502 os.remove(name) |
502 os.remove(name) |
503 |
503 |
504 def rematch(el, l): |
504 def rematch(el, l): |
505 try: |
505 try: |
506 # hack to deal with graphlog, which looks like bogus regexes |
|
507 if el.startswith('|'): |
|
508 el = '\\' + el |
|
509 # ensure that the regex matches to the end of the string |
506 # ensure that the regex matches to the end of the string |
510 return re.match(el + r'\Z', l) |
507 return re.match(el + r'\Z', l) |
511 except re.error: |
508 except re.error: |
512 # el is an invalid regex |
509 # el is an invalid regex |
513 return False |
510 return False |
529 if pos in expected and expected[pos]: |
526 if pos in expected and expected[pos]: |
530 el = expected[pos].pop(0) |
527 el = expected[pos].pop(0) |
531 |
528 |
532 if el == l: # perfect match (fast) |
529 if el == l: # perfect match (fast) |
533 postout.append(" " + l) |
530 postout.append(" " + l) |
534 elif el and el[2:] and rematch(el, l): # fallback regex match |
531 elif el and el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l): |
535 postout.append(" " + el) |
532 postout.append(" " + el) # fallback regex match |
536 else: # mismatch - let diff deal with it |
533 else: |
537 postout.append(" " + l) |
534 postout.append(" " + l) # let diff deal with it |
538 |
535 |
539 if pos in after: |
536 if pos in after: |
540 postout += after.pop(pos) |
537 postout += after.pop(pos) |
541 |
538 |
542 return exitcode, postout |
539 return exitcode, postout |