diff mercurial/revset.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 81adf7777f8f
children 18219c0789ae
line wrap: on
line diff
--- a/mercurial/revset.py	Sun Sep 18 22:54:11 2011 +0200
+++ b/mercurial/revset.py	Sat Sep 17 00:20:45 2011 +0200
@@ -237,13 +237,10 @@
 
 def bisect(repo, subset, x):
     """``bisect(string)``
-    Changesets marked in the specified bisect state (good, bad, skip).
+    Changesets marked in the specified bisect status (good, bad, skip).
     """
-    state = getstring(x, _("bisect requires a string")).lower()
-    if state not in ('good', 'bad', 'skip'):
-        raise error.ParseError(_('invalid bisect state'))
-    marked = set(repo.changelog.rev(n) for n in hbisect.load_state(repo)[state])
-    return [r for r in subset if r in marked]
+    status = getstring(x, _("bisect requires a string")).lower()
+    return [r for r in subset if r in hbisect.get(repo, status)]
 
 # Backward-compatibility
 # - no help entry so that we do not advertise it any more