mercurial/localrepo.py
changeset 4417 0912d8df5e19
parent 4392 9770d260a405
parent 4415 1a63b44f90c9
child 4438 3900f684a150
equal deleted inserted replaced
4413:b008deae9910 4417:0912d8df5e19
   395         partial = {}
   395         partial = {}
   396         try:
   396         try:
   397             f = self.opener("branch.cache")
   397             f = self.opener("branch.cache")
   398             lines = f.read().split('\n')
   398             lines = f.read().split('\n')
   399             f.close()
   399             f.close()
       
   400         except (IOError, OSError):
       
   401             return {}, nullid, nullrev
       
   402 
       
   403         try:
   400             last, lrev = lines.pop(0).split(" ", 1)
   404             last, lrev = lines.pop(0).split(" ", 1)
   401             last, lrev = bin(last), int(lrev)
   405             last, lrev = bin(last), int(lrev)
   402             if not (lrev < self.changelog.count() and
   406             if not (lrev < self.changelog.count() and
   403                     self.changelog.node(lrev) == last): # sanity check
   407                     self.changelog.node(lrev) == last): # sanity check
   404                 # invalidate the cache
   408                 # invalidate the cache
   420             f = self.opener("branch.cache", "w", atomictemp=True)
   424             f = self.opener("branch.cache", "w", atomictemp=True)
   421             f.write("%s %s\n" % (hex(tip), tiprev))
   425             f.write("%s %s\n" % (hex(tip), tiprev))
   422             for label, node in branches.iteritems():
   426             for label, node in branches.iteritems():
   423                 f.write("%s %s\n" % (hex(node), label))
   427                 f.write("%s %s\n" % (hex(node), label))
   424             f.rename()
   428             f.rename()
   425         except IOError:
   429         except (IOError, OSError):
   426             pass
   430             pass
   427 
   431 
   428     def _updatebranchcache(self, partial, start, end):
   432     def _updatebranchcache(self, partial, start, end):
   429         for r in xrange(start, end):
   433         for r in xrange(start, end):
   430             c = self.changectx(r)
   434             c = self.changectx(r)