Mercurial > hg
changeset 32440:c8fb2a82b5f9
revset: add support for p2(wdir()) to get second parent of working directory
This adds support for finding the second parent of working directory using the
p2 predicate.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 22 May 2017 02:14:22 +0530 |
parents | e72c5263ccaf |
children | 018f638ad88e |
files | mercurial/revset.py tests/test-revset.t |
diffstat | 2 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Mon May 22 02:03:43 2017 +0530 +++ b/mercurial/revset.py Mon May 22 02:14:22 2017 +0530 @@ -1434,7 +1434,12 @@ ps = set() cl = repo.changelog for r in getset(repo, fullreposet(repo), x): - ps.add(cl.parentrevs(r)[1]) + try: + ps.add(cl.parentrevs(r)[1]) + except error.WdirUnsupported: + parents = repo[r].parents() + if len(parents) == 2: + ps.add(parents[1]) ps -= {node.nullrev} # XXX we should turn this into a baseset instead of a set, smartset may do # some optimizations from the fact this is a baseset.