[PATCH 4 of 8] bisect: simplify conditional in 'check_state'
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Sun Oct 9 04:57:38 EDT 2016
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1472005393 -7200
# Wed Aug 24 04:23:13 2016 +0200
# Node ID c0e6a5b2b049385418761b9892096e12afd06237
# Parent fb1f6d1e179dcba1b078eb32172aca60e0adb287
# EXP-Topic bisect
bisect: simplify conditional in 'check_state'
Now that extra code about "updating" flag have been removed, we can simplify the
condition flow and remove a level.
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -836,12 +836,12 @@ def bisect(ui, repo, rev=None, extra=Non
Returns 0 on success.
"""
def checkstate(state):
- if not state['good'] or not state['bad']:
- if not state['good']:
- raise error.Abort(_('cannot bisect (no known good revisions)'))
- else:
- raise error.Abort(_('cannot bisect (no known bad revisions)'))
- return True
+ if state['good'] and state['bad']:
+ return True
+ if not state['good']:
+ raise error.Abort(_('cannot bisect (no known good revisions)'))
+ else:
+ raise error.Abort(_('cannot bisect (no known bad revisions)'))
# backward compatibility
if rev in "good bad reset init".split():
More information about the Mercurial-devel
mailing list