view tests/heredoctest.py @ 27267:d6859d86a5d5

merge.graft: add option to keep second parent Currently merge.graft re-writes the dirstate so only a single parent is kept. For some cases, like evolving a merge commit, this behaviour is not desired. More specifically, this is needed to fix issue4389.
author Andrew Halberstadt <ahalberstadt@mozilla.com>
date Thu, 03 Dec 2015 23:01:59 -0500
parents 1db2127d2373
children 4179d054b3e9
line wrap: on
line source

import sys

globalvars = {}
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 += l[4:]
        c = compile(snippet, '<heredoc>', 'single')
        try:
            exec(c, globalvars)
        except Exception as inst:
            print(repr(inst))