Mercurial > hg
view tests/heredoctest.py @ 20447:abb91b74f758
revset: added lazyset implementation to keyword revset
Performance benchmarking:
$ time hg log -qr "first(keyword(changeset))"
0:9117c6561b0b
real 0m3.466s
user 0m3.345s
sys 0m0.072s
$ time ./hg log -qr "first(keyword(changeset))"
0:9117c6561b0b
real 0m0.365s
user 0m0.199s
sys 0m0.083s
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Wed, 29 Jan 2014 09:04:03 -0800 |
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)