comparison tests/test-tags.t @ 24762:1062663808ce

tags: write a separate tags cache file for unfiltered repos Since we changed the format of the tags cache, we should bump the filename. Before this patch, "tags" was being used for unfiltered repositories. Change the naming scheme to be consistent and ensure that a new cache file is used. While I was here, I updated the docs to describe the existence of multiple caches. I also added explicit test coverage for the creation of the unfiltered tags cache.
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 16 Apr 2015 11:54:13 -0400
parents 410f3856196f
children a698e088ad29
comparison
equal deleted inserted replaced
24761:61a6d83280d3 24762:1062663808ce
7 > EOF 7 > EOF
8 8
9 Helper functions: 9 Helper functions:
10 10
11 $ cacheexists() { 11 $ cacheexists() {
12 > [ -f .hg/cache/tags-visible ] && echo "tag cache exists" || echo "no tag cache" 12 > [ -f .hg/cache/tags2-visible ] && echo "tag cache exists" || echo "no tag cache"
13 > } 13 > }
14 14
15 $ fnodescacheexists() { 15 $ fnodescacheexists() {
16 > [ -f .hg/cache/hgtagsfnodes1 ] && echo "fnodes cache exists" || echo "no fnodes cache" 16 > [ -f .hg/cache/hgtagsfnodes1 ] && echo "fnodes cache exists" || echo "no fnodes cache"
17 > } 17 > }
54 $ fnodescacheexists 54 $ fnodescacheexists
55 no fnodes cache 55 no fnodes cache
56 56
57 Try corrupting the cache 57 Try corrupting the cache
58 58
59 $ printf 'a b' > .hg/cache/tags-visible 59 $ printf 'a b' > .hg/cache/tags2-visible
60 $ hg identify 60 $ hg identify
61 acb14030fe0a tip 61 acb14030fe0a tip
62 $ cacheexists 62 $ cacheexists
63 tag cache exists 63 tag cache exists
64 $ fnodescacheexists 64 $ fnodescacheexists
100 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...| 100 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
101 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y| 101 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
102 102
103 Repeat with cold tag cache: 103 Repeat with cold tag cache:
104 104
105 $ rm -f .hg/cache/tags-visible .hg/cache/hgtagsfnodes1 105 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
106 $ hg identify 106 $ hg identify
107 b9154636be93 tip 107 b9154636be93 tip
108 108
109 $ fnodescacheexists 109 $ fnodescacheexists
110 fnodes cache exists 110 fnodes cache exists
115 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y| 115 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
116 116
117 And again, but now unable to write tag cache: 117 And again, but now unable to write tag cache:
118 118
119 #if unix-permissions 119 #if unix-permissions
120 $ rm -f .hg/cache/tags-visible .hg/cache/hgtagsfnodes1 120 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
121 $ chmod 555 .hg/cache 121 $ chmod 555 .hg/cache
122 $ hg identify 122 $ hg identify
123 b9154636be93 tip 123 b9154636be93 tip
124 $ chmod 755 .hg/cache 124 $ chmod 755 .hg/cache
125 #endif 125 #endif
126 126
127 Tag cache debug info written to blackbox log 127 Tag cache debug info written to blackbox log
128 128
129 $ rm -f .hg/cache/tags-visible .hg/cache/hgtagsfnodes1 129 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
130 $ hg identify 130 $ hg identify
131 b9154636be93 tip 131 b9154636be93 tip
132 $ hg blackbox -l 5 132 $ hg blackbox -l 5
133 1970/01/01 00:00:00 bob> identify 133 1970/01/01 00:00:00 bob> identify
134 1970/01/01 00:00:00 bob> writing 48 bytes to cache/hgtagsfnodes1 134 1970/01/01 00:00:00 bob> writing 48 bytes to cache/hgtagsfnodes1
136 1970/01/01 00:00:00 bob> writing tags cache file with 1 tags 136 1970/01/01 00:00:00 bob> writing tags cache file with 1 tags
137 1970/01/01 00:00:00 bob> identify exited 0 after ?.?? seconds (glob) 137 1970/01/01 00:00:00 bob> identify exited 0 after ?.?? seconds (glob)
138 138
139 Failure to acquire lock results in no write 139 Failure to acquire lock results in no write
140 140
141 $ rm -f .hg/cache/tags-visible .hg/cache/hgtagsfnodes1 141 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
142 $ echo 'foo:1' > .hg/wlock 142 $ echo 'foo:1' > .hg/wlock
143 $ hg identify 143 $ hg identify
144 b9154636be93 tip 144 b9154636be93 tip
145 $ hg blackbox -l 5 145 $ hg blackbox -l 5
146 1970/01/01 00:00:00 bob> identify 146 1970/01/01 00:00:00 bob> identify
152 $ fnodescacheexists 152 $ fnodescacheexists
153 no fnodes cache 153 no fnodes cache
154 154
155 $ rm .hg/wlock 155 $ rm .hg/wlock
156 156
157 $ rm -f .hg/cache/tags-visible .hg/cache/hgtagsfnodes1 157 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
158 $ hg identify 158 $ hg identify
159 b9154636be93 tip 159 b9154636be93 tip
160 160
161 Create a branch: 161 Create a branch:
162 162
309 rev 4: .hgtags: 309 rev 4: .hgtags:
310 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar 310 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
311 311
312 Dump cache: 312 Dump cache:
313 313
314 $ cat .hg/cache/tags-visible 314 $ cat .hg/cache/tags2-visible
315 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 315 4 0c192d7d5e6b78a714de54a2e9627952a877e25a
316 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar 316 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
317 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar 317 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
318 78391a272241d70354aa14c874552cad6b51bb42 bar 318 78391a272241d70354aa14c874552cad6b51bb42 bar
319 319
351 351
352 $ echo dummy2 > foo 352 $ echo dummy2 > foo
353 $ hg commit -m throwaway2 353 $ hg commit -m throwaway2
354 354
355 $ chmod a-w .hg/cache/hgtagsfnodes1 355 $ chmod a-w .hg/cache/hgtagsfnodes1
356 $ rm -f .hg/cache/tags-visible 356 $ rm -f .hg/cache/tags2-visible
357 357
358 $ hg tags 358 $ hg tags
359 tip 6:b968051b5cf3 359 tip 6:b968051b5cf3
360 bar 1:78391a272241 360 bar 1:78391a272241
361 361
367 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) 367 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob)
368 368
369 $ chmod a+w .hg/cache/hgtagsfnodes1 369 $ chmod a+w .hg/cache/hgtagsfnodes1
370 #endif 370 #endif
371 371
372 $ rm -f .hg/cache/tags-visible 372 $ rm -f .hg/cache/tags2-visible
373 $ hg tags 373 $ hg tags
374 tip 6:b968051b5cf3 374 tip 6:b968051b5cf3
375 bar 1:78391a272241 375 bar 1:78391a272241
376 376
377 $ hg blackbox -l 5 377 $ hg blackbox -l 5
519 $ hg --config extensions.mq= strip 4 519 $ hg --config extensions.mq= strip 4
520 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob) 520 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
521 $ hg tags # partly stale 521 $ hg tags # partly stale
522 tip 4:735c3ca72986 522 tip 4:735c3ca72986
523 bar 0:bbd179dfa0a7 523 bar 0:bbd179dfa0a7
524 $ rm -f .hg/cache/tags-visible 524 $ rm -f .hg/cache/tags2-visible
525 $ hg tags # cold cache 525 $ hg tags # cold cache
526 tip 4:735c3ca72986 526 tip 4:735c3ca72986
527 bar 0:bbd179dfa0a7 527 bar 0:bbd179dfa0a7
528 528
529 Test tag rank with 3 heads: 529 Test tag rank with 3 heads: