mercurial/commands.py
changeset 30123 2e360578688d
parent 30122 b710dca9937a
child 30124 0aea706060cc
equal deleted inserted replaced
30122:b710dca9937a 30123:2e360578688d
   833 
   833 
   834       See :hg:`help revsets` for more about the `bisect()` keyword.
   834       See :hg:`help revsets` for more about the `bisect()` keyword.
   835 
   835 
   836     Returns 0 on success.
   836     Returns 0 on success.
   837     """
   837     """
   838     def check_state(state, interactive=True):
   838     def checkstate(state, interactive=True):
   839         if not state['good'] or not state['bad']:
   839         if not state['good'] or not state['bad']:
   840             if (good or bad or skip or reset) and interactive:
   840             if (good or bad or skip or reset) and interactive:
   841                 return
   841                 return
   842             if not state['good']:
   842             if not state['good']:
   843                 raise error.Abort(_('cannot bisect (no known good revisions)'))
   843                 raise error.Abort(_('cannot bisect (no known good revisions)'))
   911                     transition = "bad"
   911                     transition = "bad"
   912                 ctx = scmutil.revsingle(repo, rev, node)
   912                 ctx = scmutil.revsingle(repo, rev, node)
   913                 rev = None # clear for future iterations
   913                 rev = None # clear for future iterations
   914                 state[transition].append(ctx.node())
   914                 state[transition].append(ctx.node())
   915                 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
   915                 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
   916                 check_state(state, interactive=False)
   916                 checkstate(state, interactive=False)
   917                 # bisect
   917                 # bisect
   918                 nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
   918                 nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
   919                 # update to next check
   919                 # update to next check
   920                 node = nodes[0]
   920                 node = nodes[0]
   921                 if not noupdate:
   921                 if not noupdate:
   926             hbisect.save_state(repo, state)
   926             hbisect.save_state(repo, state)
   927         displayer = cmdutil.show_changeset(ui, repo, {})
   927         displayer = cmdutil.show_changeset(ui, repo, {})
   928         hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
   928         hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
   929         return
   929         return
   930 
   930 
   931     if not check_state(state):
   931     if not checkstate(state):
   932         return
   932         return
   933 
   933 
   934     # actually bisect
   934     # actually bisect
   935     nodes, changesets, good = hbisect.bisect(repo.changelog, state)
   935     nodes, changesets, good = hbisect.bisect(repo.changelog, state)
   936     if extend:
   936     if extend: