comparison mercurial/revset.py @ 41397:0bd56c291359

cleanup: use p1() and p2() instead of parents()[0] and parents()[1] We have had these methods on both contexts and dirstate for a long time now. Differential Revision: https://phab.mercurial-scm.org/D5706
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 25 Jan 2019 23:36:23 -0800
parents ee7791f2515b
children 59638c6fcb70
comparison
equal deleted inserted replaced
41396:3461814417f3 41397:0bd56c291359
469 for r in getset(repo, fullreposet(repo), x): 469 for r in getset(repo, fullreposet(repo), x):
470 for i in range(n): 470 for i in range(n):
471 try: 471 try:
472 r = cl.parentrevs(r)[0] 472 r = cl.parentrevs(r)[0]
473 except error.WdirUnsupported: 473 except error.WdirUnsupported:
474 r = repo[r].parents()[0].rev() 474 r = repo[r].p1().rev()
475 ps.add(r) 475 ps.add(r)
476 return subset & ps 476 return subset & ps
477 477
478 @predicate('author(string)', safe=True, weight=10) 478 @predicate('author(string)', safe=True, weight=10)
479 def author(repo, subset, x): 479 def author(repo, subset, x):
1570 cl = repo.changelog 1570 cl = repo.changelog
1571 for r in getset(repo, fullreposet(repo), x): 1571 for r in getset(repo, fullreposet(repo), x):
1572 try: 1572 try:
1573 ps.add(cl.parentrevs(r)[0]) 1573 ps.add(cl.parentrevs(r)[0])
1574 except error.WdirUnsupported: 1574 except error.WdirUnsupported:
1575 ps.add(repo[r].parents()[0].rev()) 1575 ps.add(repo[r].p1().rev())
1576 ps -= {node.nullrev} 1576 ps -= {node.nullrev}
1577 # XXX we should turn this into a baseset instead of a set, smartset may do 1577 # XXX we should turn this into a baseset instead of a set, smartset may do
1578 # some optimizations from the fact this is a baseset. 1578 # some optimizations from the fact this is a baseset.
1579 return subset & ps 1579 return subset & ps
1580 1580
1689 ps.add(r) 1689 ps.add(r)
1690 elif n == 1: 1690 elif n == 1:
1691 try: 1691 try:
1692 ps.add(cl.parentrevs(r)[0]) 1692 ps.add(cl.parentrevs(r)[0])
1693 except error.WdirUnsupported: 1693 except error.WdirUnsupported:
1694 ps.add(repo[r].parents()[0].rev()) 1694 ps.add(repo[r].p1().rev())
1695 else: 1695 else:
1696 try: 1696 try:
1697 parents = cl.parentrevs(r) 1697 parents = cl.parentrevs(r)
1698 if parents[1] != node.nullrev: 1698 if parents[1] != node.nullrev:
1699 ps.add(parents[1]) 1699 ps.add(parents[1])