From patchwork Sun Oct 9 08:57:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4,of,8] bisect: simplify conditional in 'check_state' From: Pierre-Yves David X-Patchwork-Id: 16972 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sun, 09 Oct 2016 10:57:38 +0200 # HG changeset patch # User Pierre-Yves David # 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():