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