revset: add a revset command to get bisect state.
--- a/mercurial/revset.py Sat Mar 12 17:08:42 2011 +0100
+++ b/mercurial/revset.py Sat Mar 12 18:48:30 2011 +0100
@@ -6,7 +6,7 @@
# GNU General Public License version 2 or any later version.
import re
-import parser, util, error, discovery, help
+import parser, util, error, discovery, help, hbisect
import bookmarks as bookmarksmod
import match as matchmod
from i18n import _
@@ -683,12 +683,27 @@
for r in bookmarksmod.listbookmarks(repo).values()])
return [r for r in subset if r in bms]
+def bisected(repo, subset, x):
+ """``bisected(string)``
+ Changesets marked in the specified bisect state (good, bad, skip).
+ """
+ state = getstring(x, _("bisect requires a string")).lower()
+ if state not in ('good', 'bad', 'skip', 'unknown'):
+ raise ParseError(_('invalid bisect state'))
+ marked = set(repo.changelog.rev(n) for n in hbisect.load_state(repo)[state])
+ l = []
+ for r in subset:
+ if r in marked:
+ l.append(r)
+ return l
+
symbols = {
"adds": adds,
"all": getall,
"ancestor": ancestor,
"ancestors": ancestors,
"author": author,
+ "bisected": bisected,
"bookmark": bookmark,
"branch": branch,
"children": children,
--- a/tests/test-bisect.t Sat Mar 12 17:08:42 2011 +0100
+++ b/tests/test-bisect.t Sat Mar 12 18:48:30 2011 +0100
@@ -377,6 +377,44 @@
date: Thu Jan 01 00:00:06 1970 +0000
summary: msg 6
+ $ hg log -r "bisected(good)"
+ changeset: 0:b99c7b9c8e11
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: msg 0
+
+ changeset: 5:7874a09ea728
+ user: test
+ date: Thu Jan 01 00:00:05 1970 +0000
+ summary: msg 5
+
+ $ hg log -r "bisected(bad)"
+ changeset: 6:a3d5c6fdf0d3
+ user: test
+ date: Thu Jan 01 00:00:06 1970 +0000
+ summary: msg 6
+
+ $ hg log -r "bisected(skip)"
+ changeset: 1:5cd978ea5149
+ user: test
+ date: Thu Jan 01 00:00:01 1970 +0000
+ summary: msg 1
+
+ changeset: 2:db07c04beaca
+ user: test
+ date: Thu Jan 01 00:00:02 1970 +0000
+ summary: msg 2
+
+ changeset: 3:b53bea5e2fcb
+ user: test
+ date: Thu Jan 01 00:00:03 1970 +0000
+ summary: msg 3
+
+ changeset: 4:9b2ba8336a65
+ user: test
+ date: Thu Jan 01 00:00:04 1970 +0000
+ summary: msg 4
+
$ set +e