revset: fix ancestors(null) to include null revision (issue4512) stable
authorYuya Nishihara <yuya@tcha.org>
Sun, 25 Jan 2015 20:20:27 +0900
branchstable
changeset 23956 b1e026c25552
parent 23955 8a29897d42d2
child 23957 0c4419faacbc
revset: fix ancestors(null) to include null revision (issue4512) Since 13c0327eeb6f, null parent is explicitly excluded. So, there is no reason to have nullrev in the initial seen set.
mercurial/revset.py
tests/test-log.t
tests/test-revset.t
--- a/mercurial/revset.py	Sat Jan 10 13:14:00 2015 +0900
+++ b/mercurial/revset.py	Sun Jan 25 20:20:27 2015 +0900
@@ -31,7 +31,7 @@
             revsnode = revqueue.popleft()
             heapq.heappush(h, -revsnode)
 
-        seen = set([node.nullrev])
+        seen = set()
         while h:
             current = -heapq.heappop(h)
             if current not in seen:
--- a/tests/test-log.t	Sat Jan 10 13:14:00 2015 +0900
+++ b/tests/test-log.t	Sun Jan 25 20:20:27 2015 +0900
@@ -635,6 +635,20 @@
   
 
 
+log -f -r null
+
+  $ hg log -f -r null
+  changeset:   -1:000000000000
+  user:        
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  
+  $ hg log -f -r null -G
+  o  changeset:   -1:000000000000
+     user:
+     date:        Thu Jan 01 00:00:00 1970 +0000
+  
+
+
 log -r .  with two parents
 
   $ hg up -C 3
--- a/tests/test-revset.t	Sat Jan 10 13:14:00 2015 +0900
+++ b/tests/test-revset.t	Sun Jan 25 20:20:27 2015 +0900
@@ -477,6 +477,10 @@
   hg: parse error: rev expects a number
   [255]
 
+Test null revision
+  $ log 'ancestors(null)'
+  -1
+
   $ log 'outgoing()'
   8
   9