开发者

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

开发者 https://www.devze.com 2023-04-12 11:23 出处:网络
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.

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?


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


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

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


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

hg log --template bisect


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:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号