##// END OF EJS Templates
cachevfs: migration the revbranchcache to 'cachevfs'...
Boris Feld -
r33535:755e6532 default
parent child Browse files
Show More
@@ -317,8 +317,8 b' class branchcache(dict):'
317 317 # Revision branch info cache
318 318
319 319 _rbcversion = '-v1'
320 _rbcnames = 'cache/rbc-names' + _rbcversion
321 _rbcrevs = 'cache/rbc-revs' + _rbcversion
320 _rbcnames = 'rbc-names' + _rbcversion
321 _rbcrevs = 'rbc-revs' + _rbcversion
322 322 # [4 byte hash prefix][4 byte branch name number with sign bit indicating open]
323 323 _rbcrecfmt = '>4sI'
324 324 _rbcrecsize = calcsize(_rbcrecfmt)
@@ -356,7 +356,7 b' class revbranchcache(object):'
356 356 self._rbcrevs = bytearray()
357 357 self._rbcsnameslen = 0 # length of names read at _rbcsnameslen
358 358 try:
359 bndata = repo.vfs.read(_rbcnames)
359 bndata = repo.cachevfs.read(_rbcnames)
360 360 self._rbcsnameslen = len(bndata) # for verification before writing
361 361 if bndata:
362 362 self._names = [encoding.tolocal(bn)
@@ -368,7 +368,7 b' class revbranchcache(object):'
368 368
369 369 if self._names:
370 370 try:
371 data = repo.vfs.read(_rbcrevs)
371 data = repo.cachevfs.read(_rbcrevs)
372 372 self._rbcrevs[:] = data
373 373 except (IOError, OSError) as inst:
374 374 repo.ui.debug("couldn't read revision branch cache: %s\n" %
@@ -473,7 +473,7 b' class revbranchcache(object):'
473 473 step = ' names'
474 474 wlock = repo.wlock(wait=False)
475 475 if self._rbcnamescount != 0:
476 f = repo.vfs.open(_rbcnames, 'ab')
476 f = repo.cachevfs.open(_rbcnames, 'ab')
477 477 if f.tell() == self._rbcsnameslen:
478 478 f.write('\0')
479 479 else:
@@ -483,8 +483,8 b' class revbranchcache(object):'
483 483 self._rbcrevslen = 0
484 484 if self._rbcnamescount == 0:
485 485 # before rewriting names, make sure references are removed
486 repo.vfs.unlinkpath(_rbcrevs, ignoremissing=True)
487 f = repo.vfs.open(_rbcnames, 'wb')
486 repo.cachevfs.unlinkpath(_rbcrevs, ignoremissing=True)
487 f = repo.cachevfs.open(_rbcnames, 'wb')
488 488 f.write('\0'.join(encoding.fromlocal(b)
489 489 for b in self._names[self._rbcnamescount:]))
490 490 self._rbcsnameslen = f.tell()
@@ -498,9 +498,10 b' class revbranchcache(object):'
498 498 wlock = repo.wlock(wait=False)
499 499 revs = min(len(repo.changelog),
500 500 len(self._rbcrevs) // _rbcrecsize)
501 f = repo.vfs.open(_rbcrevs, 'ab')
501 f = repo.cachevfs.open(_rbcrevs, 'ab')
502 502 if f.tell() != start:
503 repo.ui.debug("truncating %s to %d\n" % (_rbcrevs, start))
503 repo.ui.debug("truncating cache/%s to %d\n"
504 % (_rbcrevs, start))
504 505 f.seek(start)
505 506 if f.tell() != start:
506 507 start = 0
General Comments 0
You need to be logged in to leave comments. Login now