bisect: build a displayer only once
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 24 Aug 2016 05:06:21 +0200
changeset 30128 e37ee8367ab4
parent 30127 1ee65f1a11a5
child 30129 d69d86e7d6c8
bisect: build a displayer only once There is multiple spot using this, building it early will help to extract more of the logic into the bisect module.
mercurial/commands.py
--- a/mercurial/commands.py	Wed Aug 24 05:04:46 2016 +0200
+++ b/mercurial/commands.py	Wed Aug 24 05:06:21 2016 +0200
@@ -879,6 +879,8 @@
         cmdutil.bailifchanged(repo)
         return hg.clean(repo, node, show_stats=show_stats)
 
+    displayer = cmdutil.show_changeset(ui, repo, {})
+
     if command:
         changesets = 1
         if noupdate:
@@ -921,7 +923,6 @@
         finally:
             state['current'] = [node]
             hbisect.save_state(repo, state)
-        displayer = cmdutil.show_changeset(ui, repo, {})
         hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
         return
 
@@ -941,7 +942,6 @@
         raise error.Abort(_("nothing to extend"))
 
     if changesets == 0:
-        displayer = cmdutil.show_changeset(ui, repo, {})
         hbisect.printresult(ui, repo, state, displayer, nodes, good)
     else:
         assert len(nodes) == 1 # only a single node can be tested next