How can you get the current state (history of good/bad revisions) of a bisect from mercurial

998 views Asked by At

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?

4

There are 4 answers

8
Idan K On BEST ANSWER

There's a revset predicate for that:

"bisected(string)"  
 Changesets marked in the specified bisect state (good, bad, skip).

source

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
0
Luke Worth On

In Mercurial 3.8.2 (and probably earlier) you can use this:

hg log --template bisect
0
Joshua Goldberg On

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:

sample bisectstate output

3
Kafumanto On

As suggested in a comment by @adambox, this should work:

hg log -r "bisect(good) or bisect(bad)" --template "{rev}:{node|short} {bisect}\n"