##// 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 def _readbranchcache(self):
439 def _readbranchcache(self):
440 partial = {}
440 partial = {}
441 try:
441 try:
442 f = self.opener("branchheads.cache")
442 f = self.opener(os.path.join("cache", "branchheads"))
443 lines = f.read().split('\n')
443 lines = f.read().split('\n')
444 f.close()
444 f.close()
445 except (IOError, OSError):
445 except (IOError, OSError):
@@ -467,7 +467,8 b' class localrepository(repo.repository):'
467
467
468 def _writebranchcache(self, branches, tip, tiprev):
468 def _writebranchcache(self, branches, tip, tiprev):
469 try:
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 f.write("%s %s\n" % (hex(tip), tiprev))
472 f.write("%s %s\n" % (hex(tip), tiprev))
472 for label, nodes in branches.iteritems():
473 for label, nodes in branches.iteritems():
473 for node in nodes:
474 for node in nodes:
@@ -12,6 +12,7 b''
12
12
13 from node import nullid, bin, hex, short
13 from node import nullid, bin, hex, short
14 from i18n import _
14 from i18n import _
15 import os.path
15 import encoding
16 import encoding
16 import error
17 import error
17
18
@@ -151,7 +152,7 b' def _readtagcache(ui, repo):'
151 set, caller is responsible for reading tag info from each head.'''
152 set, caller is responsible for reading tag info from each head.'''
152
153
153 try:
154 try:
154 cachefile = repo.opener('tags.cache', 'r')
155 cachefile = repo.opener(os.path.join('cache', 'tags'), 'r')
155 # force reading the file for static-http
156 # force reading the file for static-http
156 cachelines = iter(cachefile)
157 cachelines = iter(cachefile)
157 except IOError:
158 except IOError:
@@ -185,8 +186,8 b' def _readtagcache(ui, repo):'
185 fnode = bin(line[2])
186 fnode = bin(line[2])
186 cachefnode[headnode] = fnode
187 cachefnode[headnode] = fnode
187 except (ValueError, TypeError):
188 except (ValueError, TypeError):
188 # corruption of tags.cache, just recompute it
189 # corruption of the tags cache, just recompute it
189 ui.warn(_('.hg/tags.cache is corrupt, rebuilding it\n'))
190 ui.warn(_('.hg/cache/tags is corrupt, rebuilding it\n'))
190 cacheheads = []
191 cacheheads = []
191 cacherevs = []
192 cacherevs = []
192 cachefnode = {}
193 cachefnode = {}
@@ -248,7 +249,8 b' def _readtagcache(ui, repo):'
248 def _writetagcache(ui, repo, heads, tagfnode, cachetags):
249 def _writetagcache(ui, repo, heads, tagfnode, cachetags):
249
250
250 try:
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 except (OSError, IOError):
254 except (OSError, IOError):
253 return
255 return
254
256
@@ -182,7 +182,8 b' r4 has hardlinks in the working dir (not'
182 $ nlinksdir r4
182 $ nlinksdir r4
183 2 r4/.hg/00changelog.i
183 2 r4/.hg/00changelog.i
184 2 r4/.hg/branch
184 2 r4/.hg/branch
185 2 r4/.hg/branchheads.cache
185 2 r4/.hg/cache/branchheads
186 2 r4/.hg/cache/tags
186 2 r4/.hg/dirstate
187 2 r4/.hg/dirstate
187 2 r4/.hg/hgrc
188 2 r4/.hg/hgrc
188 2 r4/.hg/last-message.txt
189 2 r4/.hg/last-message.txt
@@ -194,7 +195,6 b' r4 has hardlinks in the working dir (not'
194 2 r4/.hg/store/data/f1.i
195 2 r4/.hg/store/data/f1.i
195 2 r4/.hg/store/fncache
196 2 r4/.hg/store/fncache
196 2 r4/.hg/store/undo
197 2 r4/.hg/store/undo
197 2 r4/.hg/tags.cache
198 2 r4/.hg/undo.branch
198 2 r4/.hg/undo.branch
199 2 r4/.hg/undo.desc
199 2 r4/.hg/undo.desc
200 2 r4/.hg/undo.dirstate
200 2 r4/.hg/undo.dirstate
@@ -210,7 +210,8 b' Update back to revision 11 in r4 should '
210 $ nlinksdir r4
210 $ nlinksdir r4
211 2 r4/.hg/00changelog.i
211 2 r4/.hg/00changelog.i
212 1 r4/.hg/branch
212 1 r4/.hg/branch
213 2 r4/.hg/branchheads.cache
213 2 r4/.hg/cache/branchheads
214 2 r4/.hg/cache/tags
214 1 r4/.hg/dirstate
215 1 r4/.hg/dirstate
215 2 r4/.hg/hgrc
216 2 r4/.hg/hgrc
216 2 r4/.hg/last-message.txt
217 2 r4/.hg/last-message.txt
@@ -222,7 +223,6 b' Update back to revision 11 in r4 should '
222 2 r4/.hg/store/data/f1.i
223 2 r4/.hg/store/data/f1.i
223 2 r4/.hg/store/fncache
224 2 r4/.hg/store/fncache
224 2 r4/.hg/store/undo
225 2 r4/.hg/store/undo
225 2 r4/.hg/tags.cache
226 2 r4/.hg/undo.branch
226 2 r4/.hg/undo.branch
227 2 r4/.hg/undo.desc
227 2 r4/.hg/undo.desc
228 2 r4/.hg/undo.dirstate
228 2 r4/.hg/undo.dirstate
@@ -105,7 +105,8 b' group can still write everything'
105 $ python ../printmodes.py ../push
105 $ python ../printmodes.py ../push
106 00770 ../push/.hg/
106 00770 ../push/.hg/
107 00660 ../push/.hg/00changelog.i
107 00660 ../push/.hg/00changelog.i
108 00660 ../push/.hg/branchheads.cache
108 00770 ../push/.hg/cache/
109 00660 ../push/.hg/cache/branchheads
109 00660 ../push/.hg/requires
110 00660 ../push/.hg/requires
110 00770 ../push/.hg/store/
111 00770 ../push/.hg/store/
111 00660 ../push/.hg/store/00changelog.i
112 00660 ../push/.hg/store/00changelog.i
@@ -1,4 +1,4 b''
1 $ branches=.hg/branchheads.cache
1 $ branches=.hg/cache/branchheads
2 $ echo '[extensions]' >> $HGRCPATH
2 $ echo '[extensions]' >> $HGRCPATH
3 $ echo 'mq =' >> $HGRCPATH
3 $ echo 'mq =' >> $HGRCPATH
4
4
@@ -284,12 +284,12 b' qpop'
284 qpush with dump of tag cache
284 qpush with dump of tag cache
285 Dump the tag cache to ensure that it has exactly one head after qpush.
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 $ hg tags > /dev/null
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 1 [\da-f]{40} (re)
293 1 [\da-f]{40} (re)
294
294
295 $ hg qpush
295 $ hg qpush
@@ -297,9 +297,9 b' Dump the tag cache to ensure that it has'
297 now at: test.patch
297 now at: test.patch
298 $ hg tags > /dev/null
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 2 [\da-f]{40} (re)
303 2 [\da-f]{40} (re)
304
304
305 $ checkundo qpush
305 $ checkundo qpush
@@ -1,4 +1,4 b''
1 $ branchcache=.hg/branchheads.cache
1 $ branchcache=.hg/cache/branchheads
2
2
3 $ hg init t
3 $ hg init t
4 $ cd t
4 $ cd t
@@ -64,7 +64,7 b' one pull'
64
64
65 check for HTTP opener failures when cachefile does not exist
65 check for HTTP opener failures when cachefile does not exist
66
66
67 $ rm .hg/*.cache
67 $ rm .hg/cache/*
68 $ cd ../local
68 $ cd ../local
69 $ echo '[hooks]' >> .hg/hgrc
69 $ echo '[hooks]' >> .hg/hgrc
70 $ echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
70 $ echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
@@ -1,7 +1,7 b''
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() {
@@ -36,9 +36,9 b' Setup:'
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
@@ -69,13 +69,13 b" Create a tag behind hg's back:"
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
@@ -216,7 +216,7 b' Detailed dump of tag info:'
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
@@ -325,7 +325,7 b' Strip 2: destroy whole branch, no old he'
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
General Comments 0
You need to be logged in to leave comments. Login now