Patchwork [1,of,8] bisect: minor movement of code handle flag updating state

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 9, 2016, 8:57 a.m.
Message ID <f5c9ba11ffa8baef1c8c.1476003455@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/16973/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Pierre-Yves David - Oct. 9, 2016, 8:57 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1472006897 -7200
#      Wed Aug 24 04:48:17 2016 +0200
# Node ID f5c9ba11ffa8baef1c8c0d270094fd96be68b856
# Parent  6e88cd060ba26b564efbd935073c853446cf6845
# EXP-Topic bisect
bisect: minor movement of code handle flag updating state

The code flag handling is quite complicated, we are moving code around to
prepare further simplification.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -866,6 +866,20 @@  def bisect(ui, repo, rev=None, extra=Non
 
     state = hbisect.load_state(repo)
 
+    # update state
+    if good or bad or skip:
+        if rev:
+            nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])]
+        else:
+            nodes = [repo.lookup('.')]
+        if good:
+            state['good'] += nodes
+        elif bad:
+            state['bad'] += nodes
+        elif skip:
+            state['skip'] += nodes
+        hbisect.save_state(repo, state)
+
     if command:
         changesets = 1
         if noupdate:
@@ -914,22 +928,6 @@  def bisect(ui, repo, rev=None, extra=Non
         hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
         return
 
-    # update state
-
-    if rev:
-        nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])]
-    else:
-        nodes = [repo.lookup('.')]
-
-    if good or bad or skip:
-        if good:
-            state['good'] += nodes
-        elif bad:
-            state['bad'] += nodes
-        elif skip:
-            state['skip'] += nodes
-        hbisect.save_state(repo, state)
-
     if not check_state(state):
         return