Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.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 | 2c7c4824969e |
comparison
equal
deleted
inserted
replaced
17172:12fdaa30063a | 17173:c621f84dbb35 |
---|---|
566 Changeset in draft phase.""" | 566 Changeset in draft phase.""" |
567 getargs(x, 0, 0, _("draft takes no arguments")) | 567 getargs(x, 0, 0, _("draft takes no arguments")) |
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 |
574 optional value. | 581 optional value. |
575 | 582 |
1363 "date": date, | 1370 "date": date, |
1364 "desc": desc, | 1371 "desc": desc, |
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, |
1371 "first": first, | 1379 "first": first, |
1372 "follow": follow, | 1380 "follow": follow, |