# HG changeset patch # User Pierre-Yves David # Date 2016-08-24 03:09:46 # Node ID 165c9526e594bdd1b3f28677bdae077423b7c23c # Parent f6dcda7505f9bcc45812be4c4050d2f9420bad3f bisect: extra a small initialisation outside of a loop Having initialisation done during the first iteration is cute, but can be avoided. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -893,6 +893,8 @@ def bisect(ui, repo, rev=None, extra=Non node, p2 = repo.dirstate.parents() if p2 != nullid: raise error.Abort(_('current bisect revision is a merge')) + if rev: + node = repo[scmutil.revsingle(repo, rev, node)].node() try: while changesets: # update state @@ -910,9 +912,8 @@ def bisect(ui, repo, rev=None, extra=Non raise error.Abort(_("%s killed") % command) else: transition = "bad" - ctx = scmutil.revsingle(repo, rev, node) - rev = None # clear for future iterations - state[transition].append(ctx.node()) + state[transition].append(node) + ctx = repo[node] ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition)) hbisect.checkstate(state) # bisect