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