Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 18113:da1714bd0250
branchmap: factorise access to changelog in updatebranchcache
This prepares merge of `updatebranchcache` and `_branchtags`.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Wed, 19 Dec 2012 17:39:49 +0100 |
parents | 569091b938a9 |
children | 35ce17796e0e |
comparison
equal
deleted
inserted
replaced
18112:569091b938a9 | 18113:da1714bd0250 |
---|---|
682 self._updatebranchcache(partial, ctxgen) | 682 self._updatebranchcache(partial, ctxgen) |
683 return partial | 683 return partial |
684 | 684 |
685 @unfilteredmethod # Until we get a smarter cache management | 685 @unfilteredmethod # Until we get a smarter cache management |
686 def updatebranchcache(self): | 686 def updatebranchcache(self): |
687 tip = self.changelog.tip() | 687 cl = self.changelog |
688 tip = cl.tip() | |
688 if self._branchcache is not None and self._branchcachetip == tip: | 689 if self._branchcache is not None and self._branchcachetip == tip: |
689 return | 690 return |
690 | 691 |
691 oldtip = self._branchcachetip | 692 oldtip = self._branchcachetip |
692 self._branchcachetip = tip | 693 self._branchcachetip = tip |
693 if oldtip is None or oldtip not in self.changelog.nodemap: | 694 if oldtip is None or oldtip not in cl.nodemap: |
694 partial, last, lrev = self._readbranchcache() | 695 partial, last, lrev = self._readbranchcache() |
695 else: | 696 else: |
696 lrev = self.changelog.rev(oldtip) | 697 lrev = cl.rev(oldtip) |
697 partial = self._branchcache | 698 partial = self._branchcache |
698 | 699 |
699 self._branchtags(partial, lrev) | 700 self._branchtags(partial, lrev) |
700 # this private cache holds all heads (not just the branch tips) | 701 # this private cache holds all heads (not just the branch tips) |
701 self._branchcache = partial | 702 self._branchcache = partial |