Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 17171:9c750c3e4fac
obsolete: compute unstable changeset
An unstable changeset is a changeset *not* obsolete but with some obsolete
ancestors.
The current logic to decide if a changeset is unstable is naive and very
inefficient. A better solution is to compute the set of unstable changeset with
a simple revset and to cache the result. But this require cache invalidation
logic. Simpler version goes first.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Fri, 06 Jul 2012 00:18:09 +0200 |
parents | b3c20b0f5f5a |
children | c621f84dbb35 |
comparison
equal
deleted
inserted
replaced
17170:63a4a3871607 | 17171:9c750c3e4fac |
---|---|
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 unstable(self): | |
239 """True if the changeset is not obsolete but it's ancestor are""" | |
240 # We should just compute /(obsolete()::) - obsolete()/ | |
241 # and keep it in a cache. | |
242 # | |
243 # But this naive implementation does not require cache | |
244 if self.phase() <= phases.public: | |
245 return False | |
246 if self.obsolete(): | |
247 return False | |
248 for anc in self.ancestors(): | |
249 if anc.obsolete(): | |
250 return True | |
251 return False | |
252 | |
238 def _fileinfo(self, path): | 253 def _fileinfo(self, path): |
239 if '_manifest' in self.__dict__: | 254 if '_manifest' in self.__dict__: |
240 try: | 255 try: |
241 return self._manifest[path], self._manifest.flags(path) | 256 return self._manifest[path], self._manifest.flags(path) |
242 except KeyError: | 257 except KeyError: |