mercurial/branchmap.py
changeset 31497 a369482e9649
parent 31454 a5bad127128d
child 32181 b98ee1a808bd
equal deleted inserted replaced
31496:670166e0fcaa 31497:a369482e9649
   424                     " - rebuilding revision branch cache from scratch\n")
   424                     " - rebuilding revision branch cache from scratch\n")
   425                 self._clear()
   425                 self._clear()
   426         else:
   426         else:
   427             # rev/node map has changed, invalidate the cache from here up
   427             # rev/node map has changed, invalidate the cache from here up
   428             self._repo.ui.debug("history modification detected - truncating "
   428             self._repo.ui.debug("history modification detected - truncating "
   429                 "revision branch cache to revision %s\n" % rev)
   429                 "revision branch cache to revision %d\n" % rev)
   430             truncate = rbcrevidx + _rbcrecsize
   430             truncate = rbcrevidx + _rbcrecsize
   431             del self._rbcrevs[truncate:]
   431             del self._rbcrevs[truncate:]
   432             self._rbcrevslen = min(self._rbcrevslen, truncate)
   432             self._rbcrevslen = min(self._rbcrevslen, truncate)
   433 
   433 
   434         # fall back to slow path and make sure it will be written to disk
   434         # fall back to slow path and make sure it will be written to disk
   501                     wlock = repo.wlock(wait=False)
   501                     wlock = repo.wlock(wait=False)
   502                 revs = min(len(repo.changelog),
   502                 revs = min(len(repo.changelog),
   503                            len(self._rbcrevs) // _rbcrecsize)
   503                            len(self._rbcrevs) // _rbcrecsize)
   504                 f = repo.vfs.open(_rbcrevs, 'ab')
   504                 f = repo.vfs.open(_rbcrevs, 'ab')
   505                 if f.tell() != start:
   505                 if f.tell() != start:
   506                     repo.ui.debug("truncating %s to %s\n" % (_rbcrevs, start))
   506                     repo.ui.debug("truncating %s to %d\n" % (_rbcrevs, start))
   507                     f.seek(start)
   507                     f.seek(start)
   508                     if f.tell() != start:
   508                     if f.tell() != start:
   509                         start = 0
   509                         start = 0
   510                         f.seek(start)
   510                         f.seek(start)
   511                     f.truncate()
   511                     f.truncate()