comparison mercurial/obsolete.py @ 33129:765c6ab07a88

obsolete: provide a small function to retrieve all mutable revisions More obsolescence related algorithm focus on the mutable revision. We provide a tiny utility function to make it easy to access this set.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 18 Jun 2017 22:38:11 +0200
parents 9d472b219fb0
children 31ab1912678a
comparison
equal deleted inserted replaced
33128:126eae7dae74 33129:765c6ab07a88
1307 clearing)""" 1307 clearing)"""
1308 # only clear cache is there is obsstore data in this repo 1308 # only clear cache is there is obsstore data in this repo
1309 if 'obsstore' in repo._filecache: 1309 if 'obsstore' in repo._filecache:
1310 repo.obsstore.caches.clear() 1310 repo.obsstore.caches.clear()
1311 1311
1312 def _mutablerevs(repo):
1313 """the set of mutable revision in the repository"""
1314 return repo._phasecache.getrevset(repo, (phases.draft, phases.secret))
1315
1312 @cachefor('obsolete') 1316 @cachefor('obsolete')
1313 def _computeobsoleteset(repo): 1317 def _computeobsoleteset(repo):
1314 """the set of obsolete revisions""" 1318 """the set of obsolete revisions"""
1315 getnode = repo.changelog.node 1319 getnode = repo.changelog.node
1316 notpublic = repo._phasecache.getrevset(repo, (phases.draft, phases.secret)) 1320 notpublic = _mutablerevs(repo)
1317 isobs = repo.obsstore.successors.__contains__ 1321 isobs = repo.obsstore.successors.__contains__
1318 obs = set(r for r in notpublic if isobs(getnode(r))) 1322 obs = set(r for r in notpublic if isobs(getnode(r)))
1319 return obs 1323 return obs
1320 1324
1321 @cachefor('unstable') 1325 @cachefor('unstable')