annotate tests/test-mq-caches @ 5210:90d9ec0dc69d

merge: forcefully mark files that we get from the second parent as dirty After a hg merge, we want to include in the commit all the files that we got from the second parent, so that we have the correct file-level history. To make them visible to hg commit, we try to mark them as dirty. Unfortunately, right now we can't really mark them as dirty[1] - the best we can do is to mark them as needing a full comparison of their contents, but they will still be considered clean if they happen to be identical to the version in the first parent. This changeset extends the dirstate format in a compatible way, so that we can mark a file as dirty: Right now we use a negative file size to indicate we don't have valid stat data for this entry. In practice, this size is always -1. This patch uses -2 to indicate that the entry is dirty. Older versions of hg won't choke on this dirstate, but they may happily mark the file as clean after a full comparison, destroying all of our hard work. The patch adds a dirstate.normallookup method with the semantics of the current normaldirty, and changes normaldirty to forcefully mark the entry as dirty. This should fix issue522. [1] - well, we could put them in state 'm', but that state has a different meaning.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Thu, 23 Aug 2007 01:48:29 -0300
parents a7af0eeae8a3
children
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 {
4205
a7af0eeae8a3 Move branches.cache to branch.cache
Matt Mackall <mpm@selenic.com>
parents: 3988
diff changeset
8 branches=.hg/branch.cache
3501
89820e9b94f2 test-mq-caches: look up a revision that does not exist to force cache creation
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3486
diff changeset
9 # force cache (re)generation
89820e9b94f2 test-mq-caches: look up a revision that does not exist to force cache creation
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3486
diff changeset
10 hg log -r does-not-exist 2> /dev/null
3486
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
11 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
12 if [ -f $branches ]; then
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
13 sort $branches
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
14 else
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
15 echo No $branches
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
16 fi
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
17 if [ "$1" = 1 ]; then
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
18 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
19 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
20 done
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
21 fi
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
22 }
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
23
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
24 hg init a
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
25 cd a
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
26 hg qinit -c
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
27
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
28 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
29 hg qnew p1
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
30 show_branch_cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
31
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
32 echo > pfile
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
33 hg add pfile
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
34 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
35 show_branch_cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
36
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
37 echo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
38 echo '# some regular revisions'
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
39 hg qpop
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
40 echo foo > foo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
41 hg add foo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
42 echo foo > .hg/branch
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
43 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
44
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
45 echo bar > bar
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
46 hg add bar
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
47 echo bar > .hg/branch
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
48 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
49 show_branch_cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
50
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
51 echo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
52 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
53 hg qpush
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
54 show_branch_cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
55
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
56 hg qnew p2
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
57 echo foo > .hg/branch
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
58 echo foo2 >> foo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
59 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
60 show_branch_cache 1
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
61
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
62 echo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
63 echo '# removing the cache'
4205
a7af0eeae8a3 Move branches.cache to branch.cache
Matt Mackall <mpm@selenic.com>
parents: 3988
diff changeset
64 rm .hg/branch.cache
3486
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
65 show_branch_cache 1
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
66
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
67 echo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
68 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
69 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
70 show_branch_cache 1
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
71 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
72
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
73 echo
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
74 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
75 hg qpop -a
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
76 hg qpush -a
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
77 show_branch_cache
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
78