bos@130: #!/bin/bash
bos@130: 
bos@130: echo '[extensions]' >> $HGRC
bos@130: echo 'hbisect =' >> $HGRC
bos@130: 
bos@145: # XXX There's some kind of horrible nondeterminism in the execution of
bos@145: # bisect at the moment.  Ugh.
bos@145: 
bos@145: #$ ignore: .*
bos@145: 
bos@130: #$ name: init
bos@130: 
bos@130: hg init mybug
bos@130: cd mybug
bos@130: 
bos@130: #$ name: commits
bos@130: 
bos@190: buggy_change=22
bos@130: 
bos@190: for (( i = 0; i < 35; i++ )); do
bos@130:   if [[ $i = $buggy_change ]]; then
bos@130:     echo 'i have a gub' > myfile$i
bos@130:     hg commit -q -A -m 'buggy changeset'
bos@130:   else
bos@130:     echo 'nothing to see here, move along' > myfile$i
bos@130:     hg commit -q -A -m 'normal changeset'
bos@130:   fi
bos@130: done
bos@130: 
bos@130: #$ name: help
bos@130: 
bos@130: hg help bisect
bos@130: 
bos@130: #$ name: search.init
bos@130: 
bos@282: hg bisect --init
bos@130: 
bos@130: #$ name: search.bad-init
bos@130: 
bos@282: hg bisect --bad
bos@130: 
bos@130: #$ name: search.good-init
bos@130: 
bos@282: hg bisect --good 10
bos@130: 
bos@130: #$ name: search.step1
bos@130: 
bos@130: if grep -q 'i have a gub' *
bos@130: then
bos@130:   result=bad
bos@130: else
bos@130:   result=good
bos@130: fi
bos@130: 
bos@130: echo this revision is $result
bos@282: hg bisect --$result
bos@130: 
bos@131: #$ name: search.mytest
bos@130: 
bos@130: mytest() {
bos@130:   if grep -q 'i have a gub' *
bos@130:   then
bos@130:     result=bad
bos@130:   else
bos@130:     result=good
bos@130:   fi
bos@130: 
bos@130:   echo this revision is $result
bos@282:   hg bisect --$result
bos@130: }
bos@130:   
bos@130: #$ name: search.step2
bos@130: 
bos@130: mytest
bos@130: 
bos@130: #$ name: search.rest
bos@130: 
bos@130: mytest
bos@130: mytest
bos@130: mytest
bos@130: 
bos@130: #$ name: search.reset
bos@130: 
bos@282: hg bisect --reset
bos@147: 
bos@147: #$ name:
bos@147: 
bos@147: exit 0