1 $ branches=.hg/cache/branchheads |
|
2 $ echo '[extensions]' >> $HGRCPATH |
|
3 $ echo 'mq =' >> $HGRCPATH |
|
4 |
|
5 $ show_branch_cache() |
|
6 > { |
|
7 > # force cache (re)generation |
|
8 > hg log -r does-not-exist 2> /dev/null |
|
9 > hg log -r tip --template 'tip: {rev}\n' |
|
10 > if [ -f $branches ]; then |
|
11 > sort $branches |
|
12 > else |
|
13 > echo No branch cache |
|
14 > fi |
|
15 > if [ "$1" = 1 ]; then |
|
16 > for b in foo bar; do |
|
17 > hg log -r $b --template "branch $b: "'{rev}\n' |
|
18 > done |
|
19 > fi |
|
20 > } |
|
21 |
|
22 $ hg init a |
|
23 $ cd a |
|
24 $ hg qinit -c |
|
25 |
|
26 |
|
27 mq patch on an empty repo |
|
28 |
|
29 $ hg qnew -d '0 0' p1 |
|
30 $ show_branch_cache |
|
31 tip: 0 |
|
32 No branch cache |
|
33 |
|
34 $ echo > pfile |
|
35 $ hg add pfile |
|
36 $ hg qrefresh -m 'patch 1' |
|
37 $ show_branch_cache |
|
38 tip: 0 |
|
39 d986d5caac23a7d44a46efc0ddaf5eb9665844cf 0 |
|
40 d986d5caac23a7d44a46efc0ddaf5eb9665844cf default |
|
41 |
|
42 some regular revisions |
|
43 |
|
44 $ hg qpop |
|
45 popping p1 |
|
46 patch queue now empty |
|
47 $ echo foo > foo |
|
48 $ hg add foo |
|
49 $ echo foo > .hg/branch |
|
50 $ hg ci -m 'branch foo' |
|
51 |
|
52 $ echo bar > bar |
|
53 $ hg add bar |
|
54 $ echo bar > .hg/branch |
|
55 $ hg ci -m 'branch bar' |
|
56 $ show_branch_cache |
|
57 tip: 1 |
|
58 c229711f16da3d7591f89b1b8d963b79bda22714 1 |
|
59 c229711f16da3d7591f89b1b8d963b79bda22714 bar |
|
60 dc25e3827021582e979f600811852e36cbe57341 foo |
|
61 |
|
62 add some mq patches |
|
63 |
|
64 $ hg qpush |
|
65 applying p1 |
|
66 now at: p1 |
|
67 $ show_branch_cache |
|
68 tip: 2 |
|
69 c229711f16da3d7591f89b1b8d963b79bda22714 1 |
|
70 c229711f16da3d7591f89b1b8d963b79bda22714 bar |
|
71 dc25e3827021582e979f600811852e36cbe57341 foo |
|
72 |
|
73 $ hg qnew -d '0 0' p2 |
|
74 $ echo foo > .hg/branch |
|
75 $ echo foo2 >> foo |
|
76 $ hg qrefresh -m 'patch 2' |
|
77 $ show_branch_cache 1 |
|
78 tip: 3 |
|
79 982611f6955f9c48d3365decea203217c945ef0d 2 |
|
80 982611f6955f9c48d3365decea203217c945ef0d bar |
|
81 dc25e3827021582e979f600811852e36cbe57341 foo |
|
82 branch foo: 3 |
|
83 branch bar: 2 |
|
84 |
|
85 removing the cache |
|
86 |
|
87 $ rm $branches |
|
88 $ show_branch_cache 1 |
|
89 tip: 3 |
|
90 c229711f16da3d7591f89b1b8d963b79bda22714 1 |
|
91 c229711f16da3d7591f89b1b8d963b79bda22714 bar |
|
92 dc25e3827021582e979f600811852e36cbe57341 foo |
|
93 branch foo: 3 |
|
94 branch bar: 2 |
|
95 |
|
96 importing rev 1 (the cache now ends in one of the patches) |
|
97 |
|
98 $ hg qimport -r 1 -n p0 |
|
99 $ show_branch_cache 1 |
|
100 tip: 3 |
|
101 c229711f16da3d7591f89b1b8d963b79bda22714 1 |
|
102 c229711f16da3d7591f89b1b8d963b79bda22714 bar |
|
103 dc25e3827021582e979f600811852e36cbe57341 foo |
|
104 branch foo: 3 |
|
105 branch bar: 2 |
|
106 $ hg log -r qbase --template 'qbase: {rev}\n' |
|
107 qbase: 1 |
|
108 |
|
109 detect an invalid cache |
|
110 |
|
111 $ hg qpop -a |
|
112 popping p2 |
|
113 popping p1 |
|
114 popping p0 |
|
115 patch queue now empty |
|
116 $ hg qpush -a |
|
117 applying p0 |
|
118 applying p1 |
|
119 applying p2 |
|
120 now at: p2 |
|
121 $ show_branch_cache |
|
122 tip: 3 |
|
123 dc25e3827021582e979f600811852e36cbe57341 0 |
|
124 dc25e3827021582e979f600811852e36cbe57341 foo |
|
125 |
|
126 $ cd .. |
|