tests/heredoctest.py
author David M. Carr <david@carrclan.us>
Wed, 09 Nov 2011 19:46:49 -0500
changeset 15473 d90b0b30464b
parent 15434 5635a4017061
child 22564 9599e86159ac
permissions -rw-r--r--
tests: add test for behavior of forget for explicit path in subrepo Adds a section to test-subrepo.t that demonstrates the current behavior when you pass the full path to a file in a subrepo to hg forget.

import sys

globalvars = {}
localvars = {}
lines = sys.stdin.readlines()
while lines:
    l = lines.pop(0)
    if l.startswith('SALT'):
        print l[:-1]
    elif l.startswith('>>> '):
        snippet = l[4:]
        while lines and lines[0].startswith('... '):
            l = lines.pop(0)
            snippet += "\n" + l[4:]
        c = compile(snippet, '<heredoc>', 'single')
        try:
            exec c in globalvars, localvars
        except Exception, inst:
            print repr(inst)