hgbook

view en/examples/bisect @ 554:91adcea08b33

Fix the bisect section, I hope (bisect is now part of Mercurial).
author Arne Babenhauserheide <bab@draketo.de>
date Wed Jan 21 14:16:38 2009 +0100 (2009-01-21)
parents 7a6bd93174bd
children b08f6a61bf15
line source
1 #!/bin/bash
3 # Don't add the bisect extension. That's not needed anymore.
4 #echo '[extensions]' >> $HGRC
5 #echo 'hbisect =' >> $HGRC
7 # XXX There's some kind of horrible nondeterminism in the execution of
8 # bisect at the moment. Ugh.
10 #$ ignore: .*
12 #$ name: init
14 hg init mybug
15 cd mybug
17 #$ name: commits
19 buggy_change=22
21 for (( i = 0; i < 35; i++ )); do
22 if [[ $i = $buggy_change ]]; then
23 echo 'i have a gub' > myfile$i
24 hg commit -q -A -m 'buggy changeset'
25 else
26 echo 'nothing to see here, move along' > myfile$i
27 hg commit -q -A -m 'normal changeset'
28 fi
29 done
31 #$ name: help
33 hg help bisect
35 #$ name: search.init
37 hg bisect --init
39 #$ name: search.bad-init
41 hg bisect --bad
43 #$ name: search.good-init
45 hg bisect --good 10
47 #$ name: search.step1
49 if grep -q 'i have a gub' *
50 then
51 result=bad
52 else
53 result=good
54 fi
56 echo this revision is $result
57 hg bisect --$result
59 #$ name: search.mytest
61 mytest() {
62 if grep -q 'i have a gub' *
63 then
64 result=bad
65 else
66 result=good
67 fi
69 echo this revision is $result
70 hg bisect --$result
71 }
73 #$ name: search.step2
75 mytest
77 #$ name: search.rest
79 mytest
80 mytest
81 mytest
83 #$ name: search.reset
85 hg bisect --reset
87 #$ name:
89 exit 0