equal
deleted
inserted
replaced
1 #!/bin/sh |
|
2 |
|
3 branches=.hg/branchheads.cache |
|
4 echo '[extensions]' >> $HGRCPATH |
|
5 echo 'mq =' >> $HGRCPATH |
|
6 |
|
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 echo No branch cache |
|
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 } |
|
23 |
|
24 hg init a |
|
25 cd a |
|
26 hg qinit -c |
|
27 |
|
28 echo '# mq patch on an empty repo' |
|
29 hg qnew p1 |
|
30 show_branch_cache |
|
31 |
|
32 echo > pfile |
|
33 hg add pfile |
|
34 hg qrefresh -m 'patch 1' |
|
35 show_branch_cache |
|
36 |
|
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' |
|
44 |
|
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 |
|
50 |
|
51 echo |
|
52 echo '# add some mq patches' |
|
53 hg qpush |
|
54 show_branch_cache |
|
55 |
|
56 hg qnew p2 |
|
57 echo foo > .hg/branch |
|
58 echo foo2 >> foo |
|
59 hg qrefresh -m 'patch 2' |
|
60 show_branch_cache 1 |
|
61 |
|
62 echo |
|
63 echo '# removing the cache' |
|
64 rm $branches |
|
65 show_branch_cache 1 |
|
66 |
|
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' |
|
72 |
|
73 echo |
|
74 echo '# detect an invalid cache' |
|
75 hg qpop -a |
|
76 hg qpush -a |
|
77 show_branch_cache |
|
78 |
|