##// END OF EJS Templates
move tags.cache and branchheads.cache to a collected cache folder .hg/cache/...
jfh -
r13272:5ccdca7d default
parent child Browse files
Show More
@@ -439,7 +439,7 b' class localrepository(repo.repository):'
439 439 def _readbranchcache(self):
440 440 partial = {}
441 441 try:
442 f = self.opener("branchheads.cache")
442 f = self.opener(os.path.join("cache", "branchheads"))
443 443 lines = f.read().split('\n')
444 444 f.close()
445 445 except (IOError, OSError):
@@ -467,7 +467,8 b' class localrepository(repo.repository):'
467 467
468 468 def _writebranchcache(self, branches, tip, tiprev):
469 469 try:
470 f = self.opener("branchheads.cache", "w", atomictemp=True)
470 f = self.opener(os.path.join("cache", "branchheads"), "w",
471 atomictemp=True)
471 472 f.write("%s %s\n" % (hex(tip), tiprev))
472 473 for label, nodes in branches.iteritems():
473 474 for node in nodes:
@@ -12,6 +12,7 b''
12 12
13 13 from node import nullid, bin, hex, short
14 14 from i18n import _
15 import os.path
15 16 import encoding
16 17 import error
17 18
@@ -151,7 +152,7 b' def _readtagcache(ui, repo):'
151 152 set, caller is responsible for reading tag info from each head.'''
152 153
153 154 try:
154 cachefile = repo.opener('tags.cache', 'r')
155 cachefile = repo.opener(os.path.join('cache', 'tags'), 'r')
155 156 # force reading the file for static-http
156 157 cachelines = iter(cachefile)
157 158 except IOError:
@@ -185,8 +186,8 b' def _readtagcache(ui, repo):'
185 186 fnode = bin(line[2])
186 187 cachefnode[headnode] = fnode
187 188 except (ValueError, TypeError):
188 # corruption of tags.cache, just recompute it
189 ui.warn(_('.hg/tags.cache is corrupt, rebuilding it\n'))
189 # corruption of the tags cache, just recompute it
190 ui.warn(_('.hg/cache/tags is corrupt, rebuilding it\n'))
190 191 cacheheads = []
191 192 cacherevs = []
192 193 cachefnode = {}
@@ -248,7 +249,8 b' def _readtagcache(ui, repo):'
248 249 def _writetagcache(ui, repo, heads, tagfnode, cachetags):
249 250
250 251 try:
251 cachefile = repo.opener('tags.cache', 'w', atomictemp=True)
252 cachefile = repo.opener(os.path.join('cache', 'tags'), 'w',
253 atomictemp=True)
252 254 except (OSError, IOError):
253 255 return
254 256
@@ -182,7 +182,8 b' r4 has hardlinks in the working dir (not'
182 182 $ nlinksdir r4
183 183 2 r4/.hg/00changelog.i
184 184 2 r4/.hg/branch
185 2 r4/.hg/branchheads.cache
185 2 r4/.hg/cache/branchheads
186 2 r4/.hg/cache/tags
186 187 2 r4/.hg/dirstate
187 188 2 r4/.hg/hgrc
188 189 2 r4/.hg/last-message.txt
@@ -194,7 +195,6 b' r4 has hardlinks in the working dir (not'
194 195 2 r4/.hg/store/data/f1.i
195 196 2 r4/.hg/store/fncache
196 197 2 r4/.hg/store/undo
197 2 r4/.hg/tags.cache
198 198 2 r4/.hg/undo.branch
199 199 2 r4/.hg/undo.desc
200 200 2 r4/.hg/undo.dirstate
@@ -210,7 +210,8 b' Update back to revision 11 in r4 should '
210 210 $ nlinksdir r4
211 211 2 r4/.hg/00changelog.i
212 212 1 r4/.hg/branch
213 2 r4/.hg/branchheads.cache
213 2 r4/.hg/cache/branchheads
214 2 r4/.hg/cache/tags
214 215 1 r4/.hg/dirstate
215 216 2 r4/.hg/hgrc
216 217 2 r4/.hg/last-message.txt
@@ -222,7 +223,6 b' Update back to revision 11 in r4 should '
222 223 2 r4/.hg/store/data/f1.i
223 224 2 r4/.hg/store/fncache
224 225 2 r4/.hg/store/undo
225 2 r4/.hg/tags.cache
226 226 2 r4/.hg/undo.branch
227 227 2 r4/.hg/undo.desc
228 228 2 r4/.hg/undo.dirstate
@@ -105,7 +105,8 b' group can still write everything'
105 105 $ python ../printmodes.py ../push
106 106 00770 ../push/.hg/
107 107 00660 ../push/.hg/00changelog.i
108 00660 ../push/.hg/branchheads.cache
108 00770 ../push/.hg/cache/
109 00660 ../push/.hg/cache/branchheads
109 110 00660 ../push/.hg/requires
110 111 00770 ../push/.hg/store/
111 112 00660 ../push/.hg/store/00changelog.i
@@ -1,4 +1,4 b''
1 $ branches=.hg/branchheads.cache
1 $ branches=.hg/cache/branchheads
2 2 $ echo '[extensions]' >> $HGRCPATH
3 3 $ echo 'mq =' >> $HGRCPATH
4 4
@@ -284,12 +284,12 b' qpop'
284 284 qpush with dump of tag cache
285 285 Dump the tag cache to ensure that it has exactly one head after qpush.
286 286
287 $ rm -f .hg/tags.cache
287 $ rm -f .hg/cache/tags
288 288 $ hg tags > /dev/null
289 289
290 .hg/tags.cache (pre qpush):
290 .hg/cache/tags (pre qpush):
291 291
292 $ cat .hg/tags.cache
292 $ cat .hg/cache/tags
293 293 1 [\da-f]{40} (re)
294 294
295 295 $ hg qpush
@@ -297,9 +297,9 b' Dump the tag cache to ensure that it has'
297 297 now at: test.patch
298 298 $ hg tags > /dev/null
299 299
300 .hg/tags.cache (post qpush):
300 .hg/cache/tags (post qpush):
301 301
302 $ cat .hg/tags.cache
302 $ cat .hg/cache/tags
303 303 2 [\da-f]{40} (re)
304 304
305 305 $ checkundo qpush
@@ -1,4 +1,4 b''
1 $ branchcache=.hg/branchheads.cache
1 $ branchcache=.hg/cache/branchheads
2 2
3 3 $ hg init t
4 4 $ cd t
@@ -64,7 +64,7 b' one pull'
64 64
65 65 check for HTTP opener failures when cachefile does not exist
66 66
67 $ rm .hg/*.cache
67 $ rm .hg/cache/*
68 68 $ cd ../local
69 69 $ echo '[hooks]' >> .hg/hgrc
70 70 $ echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
@@ -1,7 +1,7 b''
1 1 Helper functions:
2 2
3 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 7 $ dumptags() {
@@ -36,9 +36,9 b' Setup:'
36 36
37 37 Try corrupting the cache
38 38
39 $ printf 'a b' > .hg/tags.cache
39 $ printf 'a b' > .hg/cache/tags
40 40 $ hg identify
41 .hg/tags.cache is corrupt, rebuilding it
41 .hg/cache/tags is corrupt, rebuilding it
42 42 acb14030fe0a tip
43 43 $ cacheexists
44 44 tag cache exists
@@ -69,13 +69,13 b" Create a tag behind hg's back:"
69 69
70 70 Repeat with cold tag cache:
71 71
72 $ rm -f .hg/tags.cache
72 $ rm -f .hg/cache/tags
73 73 $ hg identify
74 74 b9154636be93 tip
75 75
76 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 79 $ chmod 555 .hg
80 80 $ hg identify
81 81 b9154636be93 tip
@@ -216,7 +216,7 b' Detailed dump of tag info:'
216 216
217 217 Dump cache:
218 218
219 $ cat .hg/tags.cache
219 $ cat .hg/cache/tags
220 220 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
221 221 3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0
222 222 2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d
@@ -325,7 +325,7 b' Strip 2: destroy whole branch, no old he'
325 325 $ hg tags # partly stale
326 326 tip 4:735c3ca72986
327 327 bar 0:bbd179dfa0a7
328 $ rm -f .hg/tags.cache
328 $ rm -f .hg/cache/tags
329 329 $ hg tags # cold cache
330 330 tip 4:735c3ca72986
331 331 bar 0:bbd179dfa0a7
General Comments 0
You need to be logged in to leave comments. Login now