revset: for x^2, do not take null as a valid p2 revision
authorYuya Nishihara <yuya@tcha.org>
Fri, 14 Oct 2016 23:33:00 +0900
changeset 30179 cdef35b38026
parent 30178 d61c42c1a35c
child 30180 736f92c44656
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.
mercurial/revset.py
tests/test-revset.t
--- a/mercurial/revset.py	Mon Oct 10 22:30:09 2016 +0200
+++ b/mercurial/revset.py	Fri Oct 14 23:33:00 2016 +0900
@@ -1621,7 +1621,7 @@
             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
 
--- a/tests/test-revset.t	Mon Oct 10 22:30:09 2016 +0200
+++ b/tests/test-revset.t	Fri Oct 14 23:33:00 2016 +0900
@@ -2750,6 +2750,7 @@
   5
   $ log 'merge()^2'
   4
+  $ log '(not merge())^2'
   $ log 'merge()^^'
   3
   $ log 'merge()^1^'