view tests/heredoctest.py @ 18300:745bc16ccef2

largefiles: fix update from a merge with removed files A situation with this case could happen after interrupting an update. Update would fail with: abort: No such file or directory: $TESTTMP/f/.hglf/sub2/large6 Update from a merge without using clean is not possible anyway, so this patch takes a step in the right direction so it gets as far as reporting the right error.
author Mads Kiilerich <madski@unity3d.com>
date Fri, 11 Jan 2013 16:30:29 +0100
parents 5635a4017061
children 9599e86159ac
line wrap: on
line source

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)