Mercurial > hgbook
comparison en/examples/run-example @ 166:08a4467f4891
Try to get the bisect extension to behave.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon, 26 Mar 2007 22:59:43 -0700 |
parents | 8f4c9ae918af |
children | f8b5b782e150 |
comparison
equal
deleted
inserted
replaced
165:06d18465df03 | 166:08a4467f4891 |
---|---|
48 | 48 |
49 class example: | 49 class example: |
50 shell = '/usr/bin/env bash' | 50 shell = '/usr/bin/env bash' |
51 ps1 = '__run_example_ps1__ ' | 51 ps1 = '__run_example_ps1__ ' |
52 ps2 = '__run_example_ps2__ ' | 52 ps2 = '__run_example_ps2__ ' |
53 pi_re = re.compile(r'#\$\s*(name|ignore):\s*(.*)$') | 53 pi_re = re.compile(r'#\$\s*(drop_output|name|ignore):\s*(.*)$') |
54 | 54 |
55 timeout = 5 | 55 timeout = 5 |
56 | 56 |
57 def __init__(self, name, verbose): | 57 def __init__(self, name, verbose): |
58 self.name = name | 58 self.name = name |
186 #r'^diff -r.*', # "diff -r" is followed by hash | 186 #r'^diff -r.*', # "diff -r" is followed by hash |
187 r'^# Date \d+ \d+', # hg patch header | 187 r'^# Date \d+ \d+', # hg patch header |
188 ] | 188 ] |
189 | 189 |
190 err = False | 190 err = False |
191 | |
192 drop_output = False | |
191 | 193 |
192 try: | 194 try: |
193 try: | 195 try: |
194 # eat first prompt string from shell | 196 # eat first prompt string from shell |
195 self.read() | 197 self.read() |
217 ofp = open(ofp_basename + '.tmp', 'w') | 219 ofp = open(ofp_basename + '.tmp', 'w') |
218 else: | 220 else: |
219 ofp = None | 221 ofp = None |
220 elif pi == 'ignore': | 222 elif pi == 'ignore': |
221 ignore.append(rest) | 223 ignore.append(rest) |
224 elif pi == 'drop_output': | |
225 drop_output = dict(yes=1,no=0)[rest.lower()] | |
222 elif hunk.strip(): | 226 elif hunk.strip(): |
223 # it's something we should execute | 227 # it's something we should execute |
224 newps, output = self.sendreceive(hunk) | 228 newps, output = self.sendreceive(hunk) |
225 if not ofp: | 229 if not ofp or drop_output: |
226 continue | 230 continue |
227 # first, print the command we ran | 231 # first, print the command we ran |
228 if not hunk.startswith('#'): | 232 if not hunk.startswith('#'): |
229 nl = hunk.endswith('\n') | 233 nl = hunk.endswith('\n') |
230 hunk = ('%s \\textbf{%s}' % | 234 hunk = ('%s \\textbf{%s}' % |