comparison mercurial/hbisect.py @ 15135:f19de58af225

revset.bisect: move bisect() code to hbisect.py Computing the ranges of csets in the bisection belongs to the hbisect code. This allows for reusing the status computation from many places, not only the revset code, but also to later display the bisection status of a cset... Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
date Sat, 17 Sep 2011 00:20:45 +0200
parents 774da7121fc9
children 18219c0789ae
comparison
equal deleted inserted replaced
15134:81adf7777f8f 15135:f19de58af225
6 # Inspired by git bisect, extension skeleton taken from mq.py. 6 # Inspired by git bisect, extension skeleton taken from mq.py.
7 # 7 #
8 # This software may be used and distributed according to the terms of the 8 # This software may be used and distributed according to the terms of the
9 # GNU General Public License version 2 or any later version. 9 # GNU General Public License version 2 or any later version.
10 10
11 import os 11 import os, error
12 from i18n import _ 12 from i18n import _
13 from node import short, hex 13 from node import short, hex
14 import util 14 import util
15 15
16 def bisect(changelog, state): 16 def bisect(changelog, state):
152 f.write("%s %s\n" % (kind, hex(node))) 152 f.write("%s %s\n" % (kind, hex(node)))
153 f.close() 153 f.close()
154 finally: 154 finally:
155 wlock.release() 155 wlock.release()
156 156
157 def get(repo, status):
158 """
159 Return a list of revision(s) that match the given status:
160
161 - ``good``, ``bad``, ``skip``: as the names imply
162 """
163 state = load_state(repo)
164 if status in ('good', 'bad', 'skip'):
165 return [repo.changelog.rev(n) for n in state[status]]
166 else:
167 raise error.ParseError(_('invalid bisect state'))