Mercurial > hg
view tests/heredoctest.py @ 20419:e61a8395c3c1
convert: make subversion revsplit more stable when meeting revisions without @
revsplit would crash for instance if given a subversion string without @ ...
and that could somehow happen when playing around with convert.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Fri, 07 Feb 2014 17:28:37 +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)