comparison mercurial/commands.py @ 30125:3528117c7b4e

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.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 24 Aug 2016 04:23:13 +0200
parents 0aea706060cc
children 755730fc1e48
comparison
equal deleted inserted replaced
30124:0aea706060cc 30125:3528117c7b4e
834 See :hg:`help revsets` for more about the `bisect()` keyword. 834 See :hg:`help revsets` for more about the `bisect()` keyword.
835 835
836 Returns 0 on success. 836 Returns 0 on success.
837 """ 837 """
838 def checkstate(state): 838 def checkstate(state):
839 if not state['good'] or not state['bad']: 839 if state['good'] and state['bad']:
840 if not state['good']: 840 return True
841 raise error.Abort(_('cannot bisect (no known good revisions)')) 841 if not state['good']:
842 else: 842 raise error.Abort(_('cannot bisect (no known good revisions)'))
843 raise error.Abort(_('cannot bisect (no known bad revisions)')) 843 else:
844 return True 844 raise error.Abort(_('cannot bisect (no known bad revisions)'))
845 845
846 # backward compatibility 846 # backward compatibility
847 if rev in "good bad reset init".split(): 847 if rev in "good bad reset init".split():
848 ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n")) 848 ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n"))
849 cmd, rev, extra = rev, extra, None 849 cmd, rev, extra = rev, extra, None