From patchwork Sun Jan 25 14:09:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3, of, 3, STABLE] revset: fix ancestors(null) to include null revision (issue4512) From: Yuya Nishihara X-Patchwork-Id: 7555 Message-Id: <3b1916c5f9208c0d9b38.1422194981@mimosa> To: mercurial-devel@selenic.com Date: Sun, 25 Jan 2015 23:09:41 +0900 # HG changeset patch # User Yuya Nishihara # 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. 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