Mercurial > hg > mercurial-source
changeset 33225:4dd292cec3ad
revset: add support for ancestors(wdir())
This is a part of extending support for wdir() predicate.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 23 May 2017 01:22:33 +0530 |
parents | 018f638ad88e |
children | 34e9b8b94f66 |
files | mercurial/revset.py tests/test-revset.t |
diffstat | 2 files changed, 18 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -75,9 +75,14 @@ if current not in seen: seen.add(current) yield current - for parent in cl.parentrevs(current)[:cut]: - if parent != node.nullrev: - heapq.heappush(h, -parent) + try: + for parent in cl.parentrevs(current)[:cut]: + if parent != node.nullrev: + heapq.heappush(h, -parent) + except error.WdirUnsupported: + for parent in repo[current].parents()[:cut]: + if parent.rev() != node.nullrev: + heapq.heappush(h, -parent.rev()) return generatorset(iterate(), iterasc=False)