[PATCH 7 of 8] bisect: build a displayer only once

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Oct 9 04:57:41 EDT 2016


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1472007981 -7200
#      Wed Aug 24 05:06:21 2016 +0200
# Node ID e5012181a722d5cb544c935400c676fce2d7b0a8
# Parent  eb7d02debaf5ed831f12b509f4175ebb0cd40143
# EXP-Topic bisect
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.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -879,6 +879,8 @@ def bisect(ui, repo, rev=None, extra=Non
         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 @@ def bisect(ui, repo, rev=None, extra=Non
         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 @@ def bisect(ui, repo, rev=None, extra=Non
         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


More information about the Mercurial-devel mailing list