Patchwork [3,of,3,STABLE] revset: fix ancestors(null) to include null revision (issue4512)

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 25, 2015, 2:09 p.m.
Message ID <3b1916c5f9208c0d9b38.1422194981@mimosa>
Download mbox | patch
Permalink /patch/7555/
State Accepted
Commit b1e026c25552f5688bc7b7d747c5db5faf81b1bf
Headers show

Comments

Yuya Nishihara - Jan. 25, 2015, 2:09 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1422184827 -32400
#      Sun Jan 25 20:20:27 2015 +0900
# Branch stable
# Node ID 3b1916c5f9208c0d9b38a7331cfb5cddc67f9d05
# Parent  38fe74636e4bd991eef6853b9bb9c514e29aacb1
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.
Matt Mackall - Jan. 25, 2015, 11:42 p.m.
On Sun, 2015-01-25 at 23:09 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1422184827 -32400
> #      Sun Jan 25 20:20:27 2015 +0900
> # Branch stable
> # Node ID 3b1916c5f9208c0d9b38a7331cfb5cddc67f9d05
> # Parent  38fe74636e4bd991eef6853b9bb9c514e29aacb1
> revset: fix ancestors(null) to include null revision (issue4512)

These are queued for stable, thanks.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -31,7 +31,7 @@  def _revancestors(repo, revs, followfirs
             revsnode = revqueue.popleft()
             heapq.heappush(h, -revsnode)
 
-        seen = set([node.nullrev])
+        seen = set()
         while h:
             current = -heapq.heappop(h)
             if current not in seen:
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -635,6 +635,20 @@  log -f -r 1:tip
   
 
 
+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
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -477,6 +477,10 @@  Test explicit numeric revision
   hg: parse error: rev expects a number
   [255]
 
+Test null revision
+  $ log 'ancestors(null)'
+  -1
+
   $ log 'outgoing()'
   8
   9