##// END OF EJS Templates
bisect: improve hg bisect -c (relative paths, error handling)...
Benoit Boissinot -
r7590:e5703ec0 default
parent child Browse files
Show More
@@ -328,29 +328,34 b' def bisect(ui, repo, rev=None, extra=Non'
328 state = hbisect.load_state(repo)
328 state = hbisect.load_state(repo)
329
329
330 if command:
330 if command:
331 commandpath = util.find_exe(command)
331 changesets = 1
332 changesets = 1
332 while changesets:
333 try:
333 # update state
334 while changesets:
334 status = os.spawnlp(os.P_WAIT, command)
335 # update state
335 node = repo.lookup(rev or '.')
336 status = os.spawnl(os.P_WAIT, commandpath)
336 if status == 125:
337 if status == 125:
337 transition = "skip"
338 transition = "skip"
338 elif status == 0:
339 elif status == 0:
339 transition = "good"
340 transition = "good"
340 # status < 0 means process was killed
341 # status < 0 means process was killed
341 elif status == 127 or status < 0:
342 elif status == 127:
342 break
343 raise util.Abort(_("failed to execute %s") % command)
343 else:
344 elif status < 0:
344 transition = "bad"
345 raise util.Abort(_("%s killed") % command)
345 state[transition].append(node)
346 else:
346 ui.note(_('Changeset %s: %s\n') % (short(node), transition))
347 transition = "bad"
347 check_state(state, interactive=False)
348 node = repo.lookup(rev or '.')
348 # bisect
349 state[transition].append(node)
349 nodes, changesets, good = hbisect.bisect(repo.changelog, state)
350 ui.note(_('Changeset %s: %s\n') % (short(node), transition))
350 # update to next check
351 check_state(state, interactive=False)
351 cmdutil.bail_if_changed(repo)
352 # bisect
352 hg.clean(repo, nodes[0], show_stats=False)
353 nodes, changesets, good = hbisect.bisect(repo.changelog, state)
353 hbisect.save_state(repo, state)
354 # update to next check
355 cmdutil.bail_if_changed(repo)
356 hg.clean(repo, nodes[0], show_stats=False)
357 finally:
358 hbisect.save_state(repo, state)
354 return print_result(nodes, not status)
359 return print_result(nodes, not status)
355
360
356 # update state
361 # update state
General Comments 0
You need to be logged in to leave comments. Login now