##// END OF EJS Templates
obsolete: compute extinct changesets...
Pierre-Yves David -
r17173:c621f84d default
parent child Browse files
Show More
@@ -235,6 +235,21 b' class changectx(object):'
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()/
@@ -568,6 +568,13 b' def draft(repo, subset, x):'
568 pc = repo._phasecache
568 pc = repo._phasecache
569 return [r for r in subset if pc.phase(repo, r) == phases.draft]
569 return [r for r in subset if pc.phase(repo, r) == phases.draft]
570
570
571 def extinct(repo, subset, x):
572 """``extinct()``
573 obsolete changeset with obsolete descendant only."""
574 getargs(x, 0, 0, _("obsolete takes no arguments"))
575 extinctset = set(repo.revs('(obsolete()::) - (::(not obsolete()))'))
576 return [r for r in subset if r in extinctset]
577
571 def extra(repo, subset, x):
578 def extra(repo, subset, x):
572 """``extra(label, [value])``
579 """``extra(label, [value])``
573 Changesets with the given label in the extra metadata, with the given
580 Changesets with the given label in the extra metadata, with the given
@@ -1365,6 +1372,7 b' symbols = {'
1365 "descendants": descendants,
1372 "descendants": descendants,
1366 "_firstdescendants": _firstdescendants,
1373 "_firstdescendants": _firstdescendants,
1367 "draft": draft,
1374 "draft": draft,
1375 "extinct": extinct,
1368 "extra": extra,
1376 "extra": extra,
1369 "file": hasfile,
1377 "file": hasfile,
1370 "filelog": filelog,
1378 "filelog": filelog,
@@ -320,3 +320,13 b' detect outgoing obsolete and unstable'
320 searching for changes
320 searching for changes
321 abort: push includes an unstable changeset: 7878242aeece!
321 abort: push includes an unstable changeset: 7878242aeece!
322 [255]
322 [255]
323
324 Test that extinct changeset are properly detected
325
326 $ hg log -r 'extinct()'
327 changeset: 3:cdbce2fbb163
328 parent: 1:7c3bad9141dc
329 user: test
330 date: Thu Jan 01 00:00:00 1970 +0000
331 summary: add new_c
332
General Comments 0
You need to be logged in to leave comments. Login now