##// END OF EJS Templates
branchmap: add a cache validation cache, avoid expensive re-hash on every use...
Kyle Lippincott -
r46088:89f0d9f8 default
parent child Browse files
Show More
@@ -403,9 +403,21 b' class changelog(revlog.revlog):'
403 403 self._delayed = False
404 404 self._delaybuf = None
405 405 self._divert = False
406 self.filteredrevs = frozenset()
406 self._filteredrevs = frozenset()
407 self._filteredrevs_hashcache = {}
407 408 self._copiesstorage = opener.options.get(b'copies-storage')
408 409
410 @property
411 def filteredrevs(self):
412 return self._filteredrevs
413
414 @filteredrevs.setter
415 def filteredrevs(self, val):
416 # Ensure all updates go through this function
417 assert isinstance(val, frozenset)
418 self._filteredrevs = val
419 self._filteredrevs_hashcache = {}
420
409 421 def delayupdate(self, tr):
410 422 """delay visibility of index updates to other readers"""
411 423
@@ -364,13 +364,15 b' def filteredhash(repo, maxrev):'
364 364 cl = repo.changelog
365 365 if not cl.filteredrevs:
366 366 return None
367 key = None
367 key = cl._filteredrevs_hashcache.get(maxrev)
368 if not key:
368 369 revs = sorted(r for r in cl.filteredrevs if r <= maxrev)
369 370 if revs:
370 371 s = hashutil.sha1()
371 372 for rev in revs:
372 373 s.update(b'%d;' % rev)
373 374 key = s.digest()
375 cl._filteredrevs_hashcache[maxrev] = key
374 376 return key
375 377
376 378
General Comments 0
You need to be logged in to leave comments. Login now