Mercurial > hg
comparison tests/test-mq-caches.t @ 11897:0e4bbe18ff95
tests: unify test-mq-caches
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Sun, 15 Aug 2010 22:07:23 +0900 |
parents | tests/test-mq-caches@bb5ea66789e3 |
children | 4c94b6d0fb1c |
comparison
equal
deleted
inserted
replaced
11896:286693eaba47 | 11897:0e4bbe18ff95 |
---|---|
1 $ branches=.hg/branchheads.cache | |
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 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 No branch cache | |
40 | |
41 some regular revisions | |
42 | |
43 $ hg qpop | |
44 popping p1 | |
45 patch queue now empty | |
46 $ echo foo > foo | |
47 $ hg add foo | |
48 $ echo foo > .hg/branch | |
49 $ hg ci -m 'branch foo' -d '1000000 0' | |
50 | |
51 $ echo bar > bar | |
52 $ hg add bar | |
53 $ echo bar > .hg/branch | |
54 $ hg ci -m 'branch bar' -d '1000000 0' | |
55 $ show_branch_cache | |
56 tip: 1 | |
57 3f910abad313ff802d3a23a7529433872df9b3ae 1 | |
58 3f910abad313ff802d3a23a7529433872df9b3ae bar | |
59 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo | |
60 | |
61 add some mq patches | |
62 | |
63 $ hg qpush | |
64 applying p1 | |
65 now at: p1 | |
66 $ show_branch_cache | |
67 tip: 2 | |
68 3f910abad313ff802d3a23a7529433872df9b3ae 1 | |
69 3f910abad313ff802d3a23a7529433872df9b3ae bar | |
70 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo | |
71 | |
72 $ hg qnew p2 | |
73 $ echo foo > .hg/branch | |
74 $ echo foo2 >> foo | |
75 $ hg qrefresh -m 'patch 2' | |
76 $ show_branch_cache 1 | |
77 tip: 3 | |
78 3f910abad313ff802d3a23a7529433872df9b3ae 1 | |
79 3f910abad313ff802d3a23a7529433872df9b3ae bar | |
80 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo | |
81 branch foo: 3 | |
82 branch bar: 2 | |
83 | |
84 removing the cache | |
85 | |
86 $ rm $branches | |
87 $ show_branch_cache 1 | |
88 tip: 3 | |
89 3f910abad313ff802d3a23a7529433872df9b3ae 1 | |
90 3f910abad313ff802d3a23a7529433872df9b3ae bar | |
91 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo | |
92 branch foo: 3 | |
93 branch bar: 2 | |
94 | |
95 importing rev 1 (the cache now ends in one of the patches) | |
96 | |
97 $ hg qimport -r 1 -n p0 | |
98 $ show_branch_cache 1 | |
99 tip: 3 | |
100 3f910abad313ff802d3a23a7529433872df9b3ae 1 | |
101 3f910abad313ff802d3a23a7529433872df9b3ae bar | |
102 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo | |
103 branch foo: 3 | |
104 branch bar: 2 | |
105 $ hg log -r qbase --template 'qbase: {rev}\n' | |
106 qbase: 1 | |
107 | |
108 detect an invalid cache | |
109 | |
110 $ hg qpop -a | |
111 popping p2 | |
112 popping p1 | |
113 popping p0 | |
114 patch queue now empty | |
115 $ hg qpush -a | |
116 applying p0 | |
117 applying p1 | |
118 applying p2 | |
119 now at: p2 | |
120 $ show_branch_cache | |
121 tip: 3 | |
122 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff 0 | |
123 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo | |
124 |