hgbook
annotate en/examples/bisect @ 494:f89480678965
translated section 13.7
author | Javier Rojas <jerojasro@devnull.li> |
---|---|
date | Wed Jan 07 23:19:40 2009 -0500 (2009-01-07) |
parents | 7a6bd93174bd |
children | 51b5d56744c5 |
rev | line source |
---|---|
bos@130 | 1 #!/bin/bash |
bos@130 | 2 |
igor@332 | 3 if hg -v | head -1 | grep -e "version 0.*" |
igor@332 | 4 then |
igor@332 | 5 #On mercurial 1.0 and later bisect is a builtin |
bos@130 | 6 echo '[extensions]' >> $HGRC |
bos@130 | 7 echo 'hbisect =' >> $HGRC |
igor@332 | 8 fi |
bos@130 | 9 |
bos@145 | 10 # XXX There's some kind of horrible nondeterminism in the execution of |
bos@145 | 11 # bisect at the moment. Ugh. |
bos@145 | 12 |
bos@145 | 13 #$ ignore: .* |
bos@145 | 14 |
bos@130 | 15 #$ name: init |
bos@130 | 16 |
bos@130 | 17 hg init mybug |
bos@130 | 18 cd mybug |
bos@130 | 19 |
bos@130 | 20 #$ name: commits |
bos@130 | 21 |
bos@190 | 22 buggy_change=22 |
bos@130 | 23 |
bos@190 | 24 for (( i = 0; i < 35; i++ )); do |
bos@130 | 25 if [[ $i = $buggy_change ]]; then |
bos@130 | 26 echo 'i have a gub' > myfile$i |
bos@130 | 27 hg commit -q -A -m 'buggy changeset' |
bos@130 | 28 else |
bos@130 | 29 echo 'nothing to see here, move along' > myfile$i |
bos@130 | 30 hg commit -q -A -m 'normal changeset' |
bos@130 | 31 fi |
bos@130 | 32 done |
bos@130 | 33 |
bos@130 | 34 #$ name: help |
bos@130 | 35 |
bos@130 | 36 hg help bisect |
bos@130 | 37 |
bos@130 | 38 #$ name: search.init |
bos@130 | 39 |
igor@332 | 40 if hg -v | head -1 | grep -e "version 0.*" |
igor@332 | 41 then |
igor@332 | 42 #On mercurial 1.0 --init disappeared |
bos@282 | 43 hg bisect --init |
igor@332 | 44 fi |
bos@130 | 45 |
bos@130 | 46 #$ name: search.bad-init |
bos@130 | 47 |
bos@282 | 48 hg bisect --bad |
bos@130 | 49 |
bos@130 | 50 #$ name: search.good-init |
bos@130 | 51 |
bos@282 | 52 hg bisect --good 10 |
bos@130 | 53 |
bos@130 | 54 #$ name: search.step1 |
bos@130 | 55 |
bos@130 | 56 if grep -q 'i have a gub' * |
bos@130 | 57 then |
bos@130 | 58 result=bad |
bos@130 | 59 else |
bos@130 | 60 result=good |
bos@130 | 61 fi |
bos@130 | 62 |
bos@130 | 63 echo this revision is $result |
bos@282 | 64 hg bisect --$result |
bos@130 | 65 |
bos@131 | 66 #$ name: search.mytest |
bos@130 | 67 |
bos@130 | 68 mytest() { |
bos@130 | 69 if grep -q 'i have a gub' * |
bos@130 | 70 then |
bos@130 | 71 result=bad |
bos@130 | 72 else |
bos@130 | 73 result=good |
bos@130 | 74 fi |
bos@130 | 75 |
bos@130 | 76 echo this revision is $result |
bos@282 | 77 hg bisect --$result |
bos@130 | 78 } |
bos@130 | 79 |
bos@130 | 80 #$ name: search.step2 |
bos@130 | 81 |
bos@130 | 82 mytest |
bos@130 | 83 |
bos@130 | 84 #$ name: search.rest |
bos@130 | 85 |
bos@130 | 86 mytest |
bos@130 | 87 mytest |
bos@130 | 88 mytest |
bos@130 | 89 |
bos@130 | 90 #$ name: search.reset |
bos@130 | 91 |
bos@282 | 92 hg bisect --reset |
bos@147 | 93 |
bos@147 | 94 #$ name: |
bos@147 | 95 |
bos@147 | 96 exit 0 |