comparison mercurial/commands.py @ 9584:17da88da1abd

bisect: use util.system and fix good/bad when using -c The existing scheme using util.find_exe and subprocess.call meant we couldn't use simple shell commands in tests. Fix that. Also, it mistakenly used status from the system() call rather than good from the bisect call in reporting results.
author Matt Mackall <mpm@selenic.com>
date Mon, 12 Oct 2009 18:25:46 -0500
parents ceb0f59e1327
children 220d39af2e57
comparison
equal deleted inserted replaced
9583:0491be4448bf 9584:17da88da1abd
338 return 338 return
339 339
340 state = hbisect.load_state(repo) 340 state = hbisect.load_state(repo)
341 341
342 if command: 342 if command:
343 commandpath = util.find_exe(command)
344 if commandpath is None:
345 raise util.Abort(_("cannot find executable: %s") % command)
346 changesets = 1 343 changesets = 1
347 try: 344 try:
348 while changesets: 345 while changesets:
349 # update state 346 # update state
350 status = subprocess.call([commandpath]) 347 status = util.system(command)
351 if status == 125: 348 if status == 125:
352 transition = "skip" 349 transition = "skip"
353 elif status == 0: 350 elif status == 0:
354 transition = "good" 351 transition = "good"
355 # status < 0 means process was killed 352 # status < 0 means process was killed
368 # update to next check 365 # update to next check
369 cmdutil.bail_if_changed(repo) 366 cmdutil.bail_if_changed(repo)
370 hg.clean(repo, nodes[0], show_stats=False) 367 hg.clean(repo, nodes[0], show_stats=False)
371 finally: 368 finally:
372 hbisect.save_state(repo, state) 369 hbisect.save_state(repo, state)
373 return print_result(nodes, not status) 370 return print_result(nodes, good)
374 371
375 # update state 372 # update state
376 node = repo.lookup(rev or '.') 373 node = repo.lookup(rev or '.')
377 if good: 374 if good:
378 state['good'].append(node) 375 state['good'].append(node)