##// END OF EJS Templates
tests: unify test-mq-caches
Nicolas Dumazet -
r11897:0e4bbe18 default
parent child Browse files
Show More
@@ -1,78 +1,124 b''
1 #!/bin/sh
1 $ branches=.hg/branchheads.cache
2 $ echo '[extensions]' >> $HGRCPATH
3 $ echo 'mq =' >> $HGRCPATH
2
4
3 branches=.hg/branchheads.cache
5 $ show_branch_cache()
4 echo '[extensions]' >> $HGRCPATH
6 > {
5 echo 'mq =' >> $HGRCPATH
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
6
28
7 show_branch_cache()
29 $ hg qnew p1
8 {
30 $ show_branch_cache
9 # force cache (re)generation
31 tip: 0
10 hg log -r does-not-exist 2> /dev/null
32 No branch cache
11 hg log -r tip --template 'tip: {rev}\n'
33
12 if [ -f $branches ]; then
34 $ echo > pfile
13 sort $branches
35 $ hg add pfile
14 else
36 $ hg qrefresh -m 'patch 1'
15 echo No branch cache
37 $ show_branch_cache
16 fi
38 tip: 0
17 if [ "$1" = 1 ]; then
39 No branch cache
18 for b in foo bar; do
40
19 hg log -r $b --template "branch $b: "'{rev}\n'
41 some regular revisions
20 done
21 fi
22 }
23
42
24 hg init a
43 $ hg qpop
25 cd a
44 popping p1
26 hg qinit -c
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'
27
50
28 echo '# mq patch on an empty repo'
51 $ echo bar > bar
29 hg qnew p1
52 $ hg add bar
30 show_branch_cache
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
31
60
32 echo > pfile
61 add some mq patches
33 hg add pfile
34 hg qrefresh -m 'patch 1'
35 show_branch_cache
36
62
37 echo
63 $ hg qpush
38 echo '# some regular revisions'
64 applying p1
39 hg qpop
65 now at: p1
40 echo foo > foo
66 $ show_branch_cache
41 hg add foo
67 tip: 2
42 echo foo > .hg/branch
68 3f910abad313ff802d3a23a7529433872df9b3ae 1
43 hg ci -m 'branch foo' -d '1000000 0'
69 3f910abad313ff802d3a23a7529433872df9b3ae bar
70 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
44
71
45 echo bar > bar
72 $ hg qnew p2
46 hg add bar
73 $ echo foo > .hg/branch
47 echo bar > .hg/branch
74 $ echo foo2 >> foo
48 hg ci -m 'branch bar' -d '1000000 0'
75 $ hg qrefresh -m 'patch 2'
49 show_branch_cache
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
50
83
51 echo
84 removing the cache
52 echo '# add some mq patches'
53 hg qpush
54 show_branch_cache
55
85
56 hg qnew p2
86 $ rm $branches
57 echo foo > .hg/branch
87 $ show_branch_cache 1
58 echo foo2 >> foo
88 tip: 3
59 hg qrefresh -m 'patch 2'
89 3f910abad313ff802d3a23a7529433872df9b3ae 1
60 show_branch_cache 1
90 3f910abad313ff802d3a23a7529433872df9b3ae bar
91 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
92 branch foo: 3
93 branch bar: 2
61
94
62 echo
95 importing rev 1 (the cache now ends in one of the patches)
63 echo '# removing the cache'
64 rm $branches
65 show_branch_cache 1
66
96
67 echo
97 $ hg qimport -r 1 -n p0
68 echo '# importing rev 1 (the cache now ends in one of the patches)'
98 $ show_branch_cache 1
69 hg qimport -r 1 -n p0
99 tip: 3
70 show_branch_cache 1
100 3f910abad313ff802d3a23a7529433872df9b3ae 1
71 hg log -r qbase --template 'qbase: {rev}\n'
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
72
109
73 echo
110 $ hg qpop -a
74 echo '# detect an invalid cache'
111 popping p2
75 hg qpop -a
112 popping p1
76 hg qpush -a
113 popping p0
77 show_branch_cache
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
78
124
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now