Mercurial > hgbook
annotate en/examples/bisect @ 130:26b7a4e943aa
Describe the bisect extension.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 28 Dec 2006 14:06:15 -0800 |
parents | |
children | 153efeaa8f57 |
rev | line source |
---|---|
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
1 #!/bin/bash |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
2 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
3 echo '[extensions]' >> $HGRC |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
4 echo 'hbisect =' >> $HGRC |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
5 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
6 #$ name: init |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
7 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
8 hg init mybug |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
9 cd mybug |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
10 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
11 #$ name: commits |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
12 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
13 buggy_change=37 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
14 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
15 for (( i = 0; i < 50; i++ )); do |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
16 if [[ $i = $buggy_change ]]; then |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
17 echo 'i have a gub' > myfile$i |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
18 hg commit -q -A -m 'buggy changeset' |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
19 else |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
20 echo 'nothing to see here, move along' > myfile$i |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
21 hg commit -q -A -m 'normal changeset' |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
22 fi |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
23 done |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
24 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
25 #$ name: help |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
26 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
27 hg help bisect |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
28 hg bisect help |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
29 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
30 #$ name: search.init |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
31 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
32 hg bisect init |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
33 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
34 #$ name: search.bad-init |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
35 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
36 hg bisect bad |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
37 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
38 #$ name: search.good-init |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
39 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
40 hg bisect good 10 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
41 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
42 #$ name: search.step1 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
43 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
44 if grep -q 'i have a gub' * |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
45 then |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
46 result=bad |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
47 else |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
48 result=good |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
49 fi |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
50 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
51 echo this revision is $result |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
52 hg bisect $result |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
53 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
54 #$ name: mytest |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
55 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
56 mytest() { |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
57 if grep -q 'i have a gub' * |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
58 then |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
59 result=bad |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
60 else |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
61 result=good |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
62 fi |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
63 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
64 echo this revision is $result |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
65 hg bisect $result |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
66 } |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
67 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
68 #$ name: search.step2 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
69 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
70 mytest |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
71 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
72 #$ name: search.rest |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
73 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
74 mytest |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
75 mytest |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
76 mytest |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
77 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
78 #$ name: search.reset |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
79 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
80 hg bisect reset |