comparison mercurial/localrepo.py @ 17995:a5d85476da6e

clfilter: ensure `branchcache` logic runs unfiltered The current branchcache construction is not aware of filtering. We keep the status quo, ensuring that the branch cache logic is computed as before: without any filtering.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 26 Nov 2012 19:25:44 +0100
parents 8899bf48116a
children b3af182a1944
comparison
equal deleted inserted replaced
17994:8899bf48116a 17995:a5d85476da6e
611 self._updatebranchcache(partial, ctxgen) 611 self._updatebranchcache(partial, ctxgen)
612 self._writebranchcache(partial, self.changelog.tip(), tiprev) 612 self._writebranchcache(partial, self.changelog.tip(), tiprev)
613 613
614 return partial 614 return partial
615 615
616 @unfilteredmeth # Until we get a smarter cache management
616 def updatebranchcache(self): 617 def updatebranchcache(self):
617 tip = self.changelog.tip() 618 tip = self.changelog.tip()
618 if self._branchcache is not None and self._branchcachetip == tip: 619 if self._branchcache is not None and self._branchcachetip == tip:
619 return 620 return
620 621
663 bt = {} 664 bt = {}
664 for bn, heads in self.branchmap().iteritems(): 665 for bn, heads in self.branchmap().iteritems():
665 bt[bn] = self._branchtip(heads) 666 bt[bn] = self._branchtip(heads)
666 return bt 667 return bt
667 668
669 @unfilteredmeth # Until we get a smarter cache management
668 def _readbranchcache(self): 670 def _readbranchcache(self):
669 partial = {} 671 partial = {}
670 try: 672 try:
671 f = self.opener("cache/branchheads") 673 f = self.opener("cache/branchheads")
672 lines = f.read().split('\n') 674 lines = f.read().split('\n')
695 if self.ui.debugflag: 697 if self.ui.debugflag:
696 self.ui.warn(str(inst), '\n') 698 self.ui.warn(str(inst), '\n')
697 partial, last, lrev = {}, nullid, nullrev 699 partial, last, lrev = {}, nullid, nullrev
698 return partial, last, lrev 700 return partial, last, lrev
699 701
702 @unfilteredmeth # Until we get a smarter cache management
700 def _writebranchcache(self, branches, tip, tiprev): 703 def _writebranchcache(self, branches, tip, tiprev):
701 try: 704 try:
702 f = self.opener("cache/branchheads", "w", atomictemp=True) 705 f = self.opener("cache/branchheads", "w", atomictemp=True)
703 f.write("%s %s\n" % (hex(tip), tiprev)) 706 f.write("%s %s\n" % (hex(tip), tiprev))
704 for label, nodes in branches.iteritems(): 707 for label, nodes in branches.iteritems():
706 f.write("%s %s\n" % (hex(node), encoding.fromlocal(label))) 709 f.write("%s %s\n" % (hex(node), encoding.fromlocal(label)))
707 f.close() 710 f.close()
708 except (IOError, OSError): 711 except (IOError, OSError):
709 pass 712 pass
710 713
714 @unfilteredmeth # Until we get a smarter cache management
711 def _updatebranchcache(self, partial, ctxgen): 715 def _updatebranchcache(self, partial, ctxgen):
712 """Given a branchhead cache, partial, that may have extra nodes or be 716 """Given a branchhead cache, partial, that may have extra nodes or be
713 missing heads, and a generator of nodes that are at least a superset of 717 missing heads, and a generator of nodes that are at least a superset of
714 heads missing, this function updates partial to be correct. 718 heads missing, this function updates partial to be correct.
715 """ 719 """
1049 except AttributeError: 1053 except AttributeError:
1050 pass 1054 pass
1051 1055
1052 delcache('_tagscache') 1056 delcache('_tagscache')
1053 1057
1054 self._branchcache = None # in UTF-8 1058 self.unfiltered()._branchcache = None # in UTF-8
1055 self._branchcachetip = None 1059 self.unfiltered()._branchcachetip = None
1056 obsolete.clearobscaches(self) 1060 obsolete.clearobscaches(self)
1057 1061
1058 def invalidatedirstate(self): 1062 def invalidatedirstate(self):
1059 '''Invalidates the dirstate, causing the next call to dirstate 1063 '''Invalidates the dirstate, causing the next call to dirstate
1060 to check if it was modified since the last time it was read, 1064 to check if it was modified since the last time it was read,