comparison mercurial/revset.py @ 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
comparison
equal deleted inserted replaced
32439:e72c5263ccaf 32440:c8fb2a82b5f9
1432 return baseset() 1432 return baseset()
1433 1433
1434 ps = set() 1434 ps = set()
1435 cl = repo.changelog 1435 cl = repo.changelog
1436 for r in getset(repo, fullreposet(repo), x): 1436 for r in getset(repo, fullreposet(repo), x):
1437 ps.add(cl.parentrevs(r)[1]) 1437 try:
1438 ps.add(cl.parentrevs(r)[1])
1439 except error.WdirUnsupported:
1440 parents = repo[r].parents()
1441 if len(parents) == 2:
1442 ps.add(parents[1])
1438 ps -= {node.nullrev} 1443 ps -= {node.nullrev}
1439 # XXX we should turn this into a baseset instead of a set, smartset may do 1444 # XXX we should turn this into a baseset instead of a set, smartset may do
1440 # some optimizations from the fact this is a baseset. 1445 # some optimizations from the fact this is a baseset.
1441 return subset & ps 1446 return subset & ps
1442 1447