changeset 30134:165c9526e594

bisect: extra a small initialisation outside of a loop Having initialisation done during the first iteration is cute, but can be avoided.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 24 Aug 2016 05:09:46 +0200
parents f6dcda7505f9
children 3eae81c0a09d
files mercurial/commands.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Oct 10 23:11:15 2016 +0100
+++ b/mercurial/commands.py	Wed Aug 24 05:09:46 2016 +0200
@@ -893,6 +893,8 @@
             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 @@
                     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