changeset 30179:cdef35b38026

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.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 14 Oct 2016 23:33:00 +0900
parents d61c42c1a35c
children 736f92c44656
files mercurial/revset.py tests/test-revset.t
diffstat 2 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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^'