mercurial/localrepo.py
changeset 4415 1a63b44f90c9
parent 4329 cea5ba038a1d
child 4417 0912d8df5e19
child 4494 99f411ba0380
equal deleted inserted replaced
4414:b6146466b92a 4415:1a63b44f90c9
   399         partial = {}
   399         partial = {}
   400         try:
   400         try:
   401             f = self.opener("branch.cache")
   401             f = self.opener("branch.cache")
   402             lines = f.read().split('\n')
   402             lines = f.read().split('\n')
   403             f.close()
   403             f.close()
       
   404         except (IOError, OSError):
       
   405             return {}, nullid, nullrev
       
   406 
       
   407         try:
   404             last, lrev = lines.pop(0).split(" ", 1)
   408             last, lrev = lines.pop(0).split(" ", 1)
   405             last, lrev = bin(last), int(lrev)
   409             last, lrev = bin(last), int(lrev)
   406             if not (lrev < self.changelog.count() and
   410             if not (lrev < self.changelog.count() and
   407                     self.changelog.node(lrev) == last): # sanity check
   411                     self.changelog.node(lrev) == last): # sanity check
   408                 # invalidate the cache
   412                 # invalidate the cache
   424             f = self.opener("branch.cache", "w", atomictemp=True)
   428             f = self.opener("branch.cache", "w", atomictemp=True)
   425             f.write("%s %s\n" % (hex(tip), tiprev))
   429             f.write("%s %s\n" % (hex(tip), tiprev))
   426             for label, node in branches.iteritems():
   430             for label, node in branches.iteritems():
   427                 f.write("%s %s\n" % (hex(node), label))
   431                 f.write("%s %s\n" % (hex(node), label))
   428             f.rename()
   432             f.rename()
   429         except IOError:
   433         except (IOError, OSError):
   430             pass
   434             pass
   431 
   435 
   432     def _updatebranchcache(self, partial, start, end):
   436     def _updatebranchcache(self, partial, start, end):
   433         for r in xrange(start, end):
   437         for r in xrange(start, end):
   434             c = self.changectx(r)
   438             c = self.changectx(r)