# HG changeset patch # User Yuya Nishihara # Date 2016-10-14 14:33:00 # Node ID cdef35b380268935340ec2190ce07d42648bc199 # Parent d61c42c1a35c1081d9eac5acdaf47221bc42ab79 revset: for x^2, do not take null as a valid p2 revision Since we don't count null p2 revision as a parent, x^2 should never return null even if null is explicitly populated. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1621,7 +1621,7 @@ def parentspec(repo, subset, x, n, order ps.add(cl.parentrevs(r)[0]) elif n == 2: parents = cl.parentrevs(r) - if len(parents) > 1: + if parents[1] != node.nullrev: ps.add(parents[1]) return subset & ps diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -2750,6 +2750,7 @@ parentrevspec 5 $ log 'merge()^2' 4 + $ log '(not merge())^2' $ log 'merge()^^' 3 $ log 'merge()^1^'