comparison tests/test-tags.t @ 13272:5ccdca7df211

move tags.cache and branchheads.cache to a collected cache folder .hg/cache/ The generation of cache files like tags.cache and branchheads.cache is not an actual reflection of things changing in the whole of the .hg directory (like eg a commit or a rebase or something) but instead these cache files are just part of bookkeeping. As such its convienant to allow various clients to ignore file events to do with these cache files which would otherwise cause a double refresh. Eg one refresh might occur after a commit, but the act of refreshing after the commit would cause Mercurial to generate a new branchheads.cache which would then cause a second refresh, for clients. However if these cache files are moved into a directory like eg .hg/cache/ then GUI clients on OSX (and possibly other platforms) can happily ignore file events in this cache directory.
author jfh <jason@jasonfharris.com>
date Tue, 04 Jan 2011 06:29:08 +0100
parents 93c4da6c4416
children 1e497df514e2
comparison
equal deleted inserted replaced
13271:952baa2f3325 13272:5ccdca7df211
1 Helper functions: 1 Helper functions:
2 2
3 $ cacheexists() { 3 $ cacheexists() {
4 > [ -f .hg/tags.cache ] && echo "tag cache exists" || echo "no tag cache" 4 > [ -f .hg/cache/tags ] && echo "tag cache exists" || echo "no tag cache"
5 > } 5 > }
6 6
7 $ dumptags() { 7 $ dumptags() {
8 > rev=$1 8 > rev=$1
9 > echo "rev $rev: .hgtags:" 9 > echo "rev $rev: .hgtags:"
34 $ cacheexists 34 $ cacheexists
35 tag cache exists 35 tag cache exists
36 36
37 Try corrupting the cache 37 Try corrupting the cache
38 38
39 $ printf 'a b' > .hg/tags.cache 39 $ printf 'a b' > .hg/cache/tags
40 $ hg identify 40 $ hg identify
41 .hg/tags.cache is corrupt, rebuilding it 41 .hg/cache/tags is corrupt, rebuilding it
42 acb14030fe0a tip 42 acb14030fe0a tip
43 $ cacheexists 43 $ cacheexists
44 tag cache exists 44 tag cache exists
45 $ hg identify 45 $ hg identify
46 acb14030fe0a tip 46 acb14030fe0a tip
67 $ hg identify 67 $ hg identify
68 b9154636be93 tip 68 b9154636be93 tip
69 69
70 Repeat with cold tag cache: 70 Repeat with cold tag cache:
71 71
72 $ rm -f .hg/tags.cache 72 $ rm -f .hg/cache/tags
73 $ hg identify 73 $ hg identify
74 b9154636be93 tip 74 b9154636be93 tip
75 75
76 And again, but now unable to write tag cache: 76 And again, but now unable to write tag cache:
77 77
78 $ rm -f .hg/tags.cache 78 $ rm -f .hg/cache/tags
79 $ chmod 555 .hg 79 $ chmod 555 .hg
80 $ hg identify 80 $ hg identify
81 b9154636be93 tip 81 b9154636be93 tip
82 $ chmod 755 .hg 82 $ chmod 755 .hg
83 83
214 rev 4: .hgtags: 214 rev 4: .hgtags:
215 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar 215 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
216 216
217 Dump cache: 217 Dump cache:
218 218
219 $ cat .hg/tags.cache 219 $ cat .hg/cache/tags
220 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d 220 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
221 3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0 221 3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0
222 2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d 222 2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d
223 223
224 78391a272241d70354aa14c874552cad6b51bb42 bar 224 78391a272241d70354aa14c874552cad6b51bb42 bar
323 $ hg --config extensions.mq= strip 4 323 $ hg --config extensions.mq= strip 4
324 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob) 324 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
325 $ hg tags # partly stale 325 $ hg tags # partly stale
326 tip 4:735c3ca72986 326 tip 4:735c3ca72986
327 bar 0:bbd179dfa0a7 327 bar 0:bbd179dfa0a7
328 $ rm -f .hg/tags.cache 328 $ rm -f .hg/cache/tags
329 $ hg tags # cold cache 329 $ hg tags # cold cache
330 tip 4:735c3ca72986 330 tip 4:735c3ca72986
331 bar 0:bbd179dfa0a7 331 bar 0:bbd179dfa0a7
332 332
333 Test tag rank with 3 heads: 333 Test tag rank with 3 heads: