When doing an hg bisect in eclipse, I like that I can see all of the bads and goods I've marked in the past.
Is there a way to get that information at the command line?
Asked
Active
Viewed 947 times
12

Joshua Goldberg
- 5,059
- 2
- 34
- 39
4 Answers
10
There's a revset predicate for that:
"bisected(string)"
Changesets marked in the specified bisect state (good, bad, skip).
For future reference, Mercurial 2.0 will introduce an improved version (the old one will continue to work):
"bisect(string)"
Changesets marked in the specified bisect status:
- "good", "bad", "skip": csets explicitly marked as good/bad/skip
- "goods", "bads" : csets topologicaly good/bad
- "range" : csets taking part in the bisection
- "pruned" : csets that are goods, bads or skipped
- "untested" : csets whose fate is yet unknown
- "ignored" : csets ignored due to DAG topology

Idan K
- 20,443
- 10
- 63
- 83
-
3+1 for spotting the bisect revset. Any chance of a working example? I would guess something like: `hg log -r "bisected(good) or bisected(bad)"`? – icabod Oct 13 '11 at 09:29
-
Thanks! Couple of notes: I had to upgrade from mercurial 1.6 to 1.9 to get this feature. I also can't find a way (in "hg help templates") to see the good or bad in order to do something like icabod suggested. It would be a shame if it required making two separate logs and then sorting them together in order to visualize, but it looks like that's the case. (Any way to get the "good" and "bad" in the log output?) – Joshua Goldberg Oct 13 '11 at 15:35
-
Joshua: what icabod wrote will get you both the good and bad changesets. What are you missing? – Idan K Oct 13 '11 at 16:41
-
The output doesn't say which is which. (Looking for the word "good" in the report of a good one.) – Joshua Goldberg Oct 13 '11 at 17:25
-
2Yeah, that's not available yet. It will be in 2.0 IIRC, so be sure to check come November. For now, two separate calls is the way. – Idan K Oct 13 '11 at 21:46
-
Just confirming, in the current version of mercurial, you can now add the following to a log template to get the information I was looking for: {bisect|shortbisect}. Thanks! (In case someone reading this is not up to date, there was an intermediate period where this worked but ran extremely slow.) – Joshua Goldberg Oct 08 '12 at 05:07
-
I added another answer with a bash script to format a report using the info from the bisected() predicate. – Joshua Goldberg Feb 14 '13 at 16:47
-
2@icabod I like this one, from my coworker: `hg log -r "bisect(good) or bisect(bad)" --template "{node|short} {bisect}\n"` it gives you just the hash and the good/bad – adambox May 06 '14 at 17:10
7
As suggested in a comment by @adambox, this should work:
hg log -r "bisect(good) or bisect(bad)" --template "{rev}:{node|short} {bisect}\n"

Kafumanto
- 485
- 6
- 8
-
Can you explain why or how is this different/better than the accepted answer? – Dipen Shah Sep 30 '15 at 20:45
-
How to render and see them mixed together is hidden in the comments (@adambox), so I think this is worthwhile. This does what my answer does, and much more simply now that {bisect} is available as a format. I'd just add "or ." to see the current rev which might not be marked yet. – Joshua Goldberg Sep 30 '15 at 23:36
-
The currently accepted answer points out only to the documentation. As said by Joshua, the real answer to his question ("is there a way to get that information at the command line?") is in a comment of adambox. – Kafumanto Oct 03 '15 at 13:44
4
In Mercurial 3.8.2 (and probably earlier) you can use this:
hg log --template bisect

Luke Worth
- 570
- 3
- 18
0
Here's a bash script (I called it bisectstate
) that works now that the bisected()
predicate is available.
(I used colorex
to pretty it up with colors, but you can take that out if you don't have it installed.)
#!/bin/bash -f
style() {
echo "{rev}$1 {author|person} {date|shortdate} {desc|firstline}\n"
}
(hg log -r 'not . and bisect(good)' --template "`style -good:`" ;
hg log -r '. and bisect(range) and not (bisect(good) or bisect(bad) or bisect(skip))' --template "`style -cur:`" ;
hg log -r "not . and bisect(bad)" --template "`style -bad:`" ;
hg log -r 'not . and bisect(skip)' --template "`style -skip:`" ;
hg log -r '. and bisect(good)' --template "`style -cur=good:`" ;
hg log -r '. and bisect(bad)' --template "`style -cur=bad:`" ;
hg log -r '. and bisect(skip)' --template "`style -cur=skip:`" ;
# Include the intermediate, unmarked changes in the bisect range.
hg log -r "bisect(range) and not (. or bisect(good) or bisect(bad) or bisect(skip))" --template "`style`"
) \
| sort | colorex -r bad: -b good: -g 'cur[=:]'
The output looks like this:

Joshua Goldberg
- 5,059
- 2
- 34
- 39