tests/heredoctest.py
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Sat, 09 Feb 2013 17:54:01 +0000
changeset 18615 e7b89b5127c2
parent 15434 5635a4017061
child 22564 9599e86159ac
permissions -rw-r--r--
outgoing: fix possible filtering crash in outgoing (issue3814) If there is no outgoiing changesets but we have filtered revision in outgoing.excluded We run into a filtering related crash. The excluded revision should not be there in the first place but discovery need cleanup in default, not stable.

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)