mercurial/scmutil.py
changeset 51529 4141d12de073
parent 51526 a03fa40afd01
equal deleted inserted replaced
51528:88b0e07dd2cd 51529:4141d12de073
   383             result = _hash_revs(revs)
   383             result = _hash_revs(revs)
   384             cl._filteredrevs_hashcache[key] = result
   384             cl._filteredrevs_hashcache[key] = result
   385     return result
   385     return result
   386 
   386 
   387 
   387 
       
   388 def filtered_and_obsolete_hash(repo, maxrev):
       
   389     """build hashs of filtered and obsolete revisions in the current repoview.
       
   390 
       
   391     Multiple caches perform up-to-date validation by checking that the
       
   392     tiprev and tipnode stored in the cache file match the current repository.
       
   393     However, this is not sufficient for validating repoviews because the set
       
   394     of revisions in the view may change without the repository tiprev and
       
   395     tipnode changing.
       
   396 
       
   397     This function hashes all the revs filtered from the view up to maxrev and
       
   398     returns that SHA-1 digest. The obsolete revisions hashed are only the
       
   399     non-filtered one.
       
   400     """
       
   401     cl = repo.changelog
       
   402     obs_set = obsolete.getrevs(repo, b'obsolete')
       
   403     key = (maxrev, hash(cl.filteredrevs), hash(obs_set))
       
   404 
       
   405     result = cl._filteredrevs_hashcache.get(key)
       
   406     if result is None:
       
   407         filtered_hash = None
       
   408         obs_hash = None
       
   409         filtered_revs, obs_revs = _filtered_and_obs_revs(repo, maxrev)
       
   410         if filtered_revs:
       
   411             filtered_hash = _hash_revs(filtered_revs)
       
   412         if obs_revs:
       
   413             obs_hash = _hash_revs(obs_revs)
       
   414         result = (filtered_hash, obs_hash)
       
   415         cl._filteredrevs_hashcache[key] = result
       
   416     return result
       
   417 
       
   418 
   388 def _filtered_and_obs_revs(repo, max_rev):
   419 def _filtered_and_obs_revs(repo, max_rev):
   389     """return the set of filtered and non-filtered obsolete revision"""
   420     """return the set of filtered and non-filtered obsolete revision"""
   390     cl = repo.changelog
   421     cl = repo.changelog
   391     obs_set = obsolete.getrevs(repo, b'obsolete')
   422     obs_set = obsolete.getrevs(repo, b'obsolete')
   392     filtered_set = cl.filteredrevs
   423     filtered_set = cl.filteredrevs