annotate tests/test-mq-caches @ 3486:fbf8320f25c8

make mq play nicely with the branch cache - if no patches are applied, don't do anything different - if the cache includes valid data from one of the patch revisions, use the cache, but don't save anything new - if the cache has data from before the patch revisions only, save what the list of branches would be without the patch revisions
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 23 Oct 2006 23:32:56 -0300
parents
children 89820e9b94f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3486
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
1 #!/bin/sh
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
2
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
3 echo '[extensions]' >> $HGRCPATH
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
4 echo 'hgext.mq=' >> $HGRCPATH
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
5
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
6 show_branch_cache()
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
7 {
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
8 branches=.hg/branches.cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
9 hg log -r tip --template 'tip: #rev#\n'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
10 if [ -f $branches ]; then
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
11 sort $branches
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
12 else
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
13 echo No $branches
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
14 fi
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
15 if [ "$1" = 1 ]; then
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
16 for b in foo bar; do
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
17 hg log -r $b --template "branch $b: "'#rev#\n'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
18 done
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
19 fi
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
20 }
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
21
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
22 hg init a
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
23 cd a
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
24 hg qinit -c
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
25
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
26 echo '# mq patch on an empty repo'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
27 hg qnew p1
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
28 show_branch_cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
29
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
30 echo > pfile
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
31 hg add pfile
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
32 hg qrefresh -m 'patch 1'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
33 show_branch_cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
34
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
35 echo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
36 echo '# some regular revisions'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
37 hg qpop
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
38 echo foo > foo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
39 hg add foo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
40 echo foo > .hg/branch
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
41 hg ci -m 'branch foo' -d '1000000 0'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
42
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
43 echo bar > bar
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
44 hg add bar
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
45 echo bar > .hg/branch
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
46 hg ci -m 'branch bar' -d '1000000 0'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
47 show_branch_cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
48
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
49 echo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
50 echo '# add some mq patches'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
51 hg qpush
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
52 show_branch_cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
53
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
54 hg qnew p2
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
55 echo foo > .hg/branch
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
56 echo foo2 >> foo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
57 hg qrefresh -m 'patch 2'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
58 show_branch_cache 1
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
59
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
60 echo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
61 echo '# removing the cache'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
62 rm -f .hg/branches.cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
63 show_branch_cache 1
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
64
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
65 echo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
66 echo '# importing rev 1 (the cache now ends in one of the patches)'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
67 hg qimport -r 1 -n p0
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
68 show_branch_cache 1
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
69 hg log -r qbase --template 'qbase: #rev#\n'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
70
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
71 echo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
72 echo '# detect an invalid cache'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
73 hg qpop -a
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
74 hg qpush -a
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
75 show_branch_cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
76