comparison mercurial/context.py @ 17173:c621f84dbb35

obsolete: compute extinct changesets `extinct` changesets are obsolete changesets with obsolete descendants only. They are of no interest anymore and can be: - exclude from exchange - hidden to the user in most situation - safely garbage collected This changeset just allows mercurial to detect them. The implementation is a bit naive, as for unstable changesets. We better use a simple revset query and a cache, but simple version comes first.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 06 Jul 2012 19:34:09 +0200
parents 9c750c3e4fac
children 62c56c94c77e
comparison
equal deleted inserted replaced
17172:12fdaa30063a 17173:c621f84dbb35
233 def obsolete(self): 233 def obsolete(self):
234 """True if the changeset is obsolete""" 234 """True if the changeset is obsolete"""
235 return (self.node() in self._repo.obsstore.precursors 235 return (self.node() in self._repo.obsstore.precursors
236 and self.phase() > phases.public) 236 and self.phase() > phases.public)
237 237
238 def extinct(self):
239 """True if the changeset is extinct"""
240 # We should just compute a cache a check againts it.
241 # see revset implementation for details
242 #
243 # But this naive implementation does not require cache
244 if self.phase() <= phases.public:
245 return False
246 if not self.obsolete():
247 return False
248 for desc in self.descendants():
249 if not desc.obsolete():
250 return False
251 return True
252
238 def unstable(self): 253 def unstable(self):
239 """True if the changeset is not obsolete but it's ancestor are""" 254 """True if the changeset is not obsolete but it's ancestor are"""
240 # We should just compute /(obsolete()::) - obsolete()/ 255 # We should just compute /(obsolete()::) - obsolete()/
241 # and keep it in a cache. 256 # and keep it in a cache.
242 # 257 #