Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hbisect.py @ 30126:755730fc1e48
bisect: move check_state into the bisect module
Now that the function is simpler, we resume our quest to move the logic into the
bisect module. In the process, we add basic documentation.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 24 Aug 2016 04:25:20 +0200 |
parents | 6e88cd060ba2 |
children | e124e83fd159 |
line wrap: on
line diff
--- a/mercurial/hbisect.py Wed Aug 24 04:23:13 2016 +0200 +++ b/mercurial/hbisect.py Wed Aug 24 04:25:20 2016 +0200 @@ -177,6 +177,17 @@ if repo.vfs.exists("bisect.state"): repo.vfs.unlink("bisect.state") +def checkstate(state): + """check we have both 'good' and 'bad' to define a range + + Raise Abort exception otherwise.""" + 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)')) + def get(repo, status): """ Return a list of revision(s) that match the given status: