--- a/mercurial/branchmap.py Tue Apr 14 12:54:16 2015 -0400
+++ b/mercurial/branchmap.py Wed Apr 01 18:43:29 2015 -0700
@@ -7,6 +7,7 @@
from node import bin, hex, nullid, nullrev
import encoding
+import scmutil
import util
import time
from array import array
@@ -136,27 +137,6 @@
else:
self._closednodes = closednodes
- def _hashfiltered(self, repo):
- """build hash of revision filtered in the current cache
-
- Tracking tipnode and tiprev is not enough to ensure validity of the
- cache as they do not help to distinct cache that ignored various
- revision bellow tiprev.
-
- To detect such difference, we build a cache of all ignored revisions.
- """
- cl = repo.changelog
- if not cl.filteredrevs:
- return None
- key = None
- revs = sorted(r for r in cl.filteredrevs if r <= self.tiprev)
- if revs:
- s = util.sha1()
- for rev in revs:
- s.update('%s;' % rev)
- key = s.digest()
- return key
-
def validfor(self, repo):
"""Is the cache content valid regarding a repo
@@ -164,7 +144,8 @@
- True when cache is up to date or a subset of current repo."""
try:
return ((self.tipnode == repo.changelog.node(self.tiprev))
- and (self.filteredhash == self._hashfiltered(repo)))
+ and (self.filteredhash == \
+ scmutil.filteredhash(repo, self.tiprev)))
except IndexError:
return False
@@ -283,7 +264,7 @@
if tiprev > self.tiprev:
self.tipnode = cl.node(tiprev)
self.tiprev = tiprev
- self.filteredhash = self._hashfiltered(repo)
+ self.filteredhash = scmutil.filteredhash(repo, self.tiprev)
duration = time.time() - starttime
repo.ui.log('branchcache', 'updated %s branch cache in %.4f seconds\n',