437 return bt |
437 return bt |
438 |
438 |
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): |
446 return {}, nullid, nullrev |
446 return {}, nullid, nullrev |
447 |
447 |
465 partial, last, lrev = {}, nullid, nullrev |
465 partial, last, lrev = {}, nullid, nullrev |
466 return partial, last, lrev |
466 return partial, last, lrev |
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: |
474 f.write("%s %s\n" % (hex(node), encoding.fromlocal(label))) |
475 f.write("%s %s\n" % (hex(node), encoding.fromlocal(label))) |
475 f.rename() |
476 f.rename() |