[PATCH 3 of 8] bisect: remove code about "update-flag" in check_state

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


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1472005360 -7200
#      Wed Aug 24 04:22:40 2016 +0200
# Node ID fb1f6d1e179dcba1b078eb32172aca60e0adb287
# Parent  eb87c5e0831476b6163dd480ae9efca98156bfa1
# EXP-Topic bisect
bisect: remove code about "update-flag" in check_state

Now that the flag dedicated to updating the flag are handled earlier, we do not
need to handle them in the 'check_state' function.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -835,10 +835,8 @@ def bisect(ui, repo, rev=None, extra=Non
 
     Returns 0 on success.
     """
-    def checkstate(state, interactive=True):
+    def checkstate(state):
         if not state['good'] or not state['bad']:
-            if (good or bad or skip or reset) and interactive:
-                return
             if not state['good']:
                 raise error.Abort(_('cannot bisect (no known good revisions)'))
             else:
@@ -879,6 +877,8 @@ def bisect(ui, repo, rev=None, extra=Non
         elif skip:
             state['skip'] += nodes
         hbisect.save_state(repo, state)
+        if not (state['good'] and state['bad']):
+            return
 
     if command:
         changesets = 1
@@ -913,7 +913,7 @@ def bisect(ui, repo, rev=None, extra=Non
                 rev = None # clear for future iterations
                 state[transition].append(ctx.node())
                 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
-                checkstate(state, interactive=False)
+                checkstate(state)
                 # bisect
                 nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
                 # update to next check
@@ -928,8 +928,7 @@ def bisect(ui, repo, rev=None, extra=Non
         hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
         return
 
-    if not checkstate(state):
-        return
+    checkstate(state)
 
     # actually bisect
     nodes, changesets, good = hbisect.bisect(repo.changelog, state)


More information about the Mercurial-devel mailing list