Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
30125:3528117c7b4e | 30126:755730fc1e48 |
---|---|
174 | 174 |
175 def resetstate(repo): | 175 def resetstate(repo): |
176 """remove any bisect state from the repository""" | 176 """remove any bisect state from the repository""" |
177 if repo.vfs.exists("bisect.state"): | 177 if repo.vfs.exists("bisect.state"): |
178 repo.vfs.unlink("bisect.state") | 178 repo.vfs.unlink("bisect.state") |
179 | |
180 def checkstate(state): | |
181 """check we have both 'good' and 'bad' to define a range | |
182 | |
183 Raise Abort exception otherwise.""" | |
184 if state['good'] and state['bad']: | |
185 return True | |
186 if not state['good']: | |
187 raise error.Abort(_('cannot bisect (no known good revisions)')) | |
188 else: | |
189 raise error.Abort(_('cannot bisect (no known bad revisions)')) | |
179 | 190 |
180 def get(repo, status): | 191 def get(repo, status): |
181 """ | 192 """ |
182 Return a list of revision(s) that match the given status: | 193 Return a list of revision(s) that match the given status: |
183 | 194 |