Patchwork [3,of,5] revset: make "null" able to appear in internal _list() expression

login
register
mail settings
Submitter Yuya Nishihara
Date May 29, 2015, 2:38 p.m.
Message ID <a965eb455f7803702865.1432910286@mimosa>
Download mbox | patch
Permalink /patch/9358/
State Accepted
Headers show

Comments

Yuya Nishihara - May 29, 2015, 2:38 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1432902660 -32400
#      Fri May 29 21:31:00 2015 +0900
# Node ID a965eb455f7803702865fdac7ebfeff03f1d5a80
# Parent  5be635444c0156a6d0688d5ba3688a9a9db7f561
revset: make "null" able to appear in internal _list() expression

This is the same workaround introduced at e16456831516. Without this patch,
"null or x" can't be optimized to _list(null x).

Test case will be added by the next patch.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1928,7 +1928,8 @@  def _list(repo, subset, x):
         r = repo[t].rev()
         if r in seen:
             continue
-        if r in subset:
+        if (r in subset
+            or r == node.nullrev and isinstance(subset, fullreposet)):
             ls.append(r)
         seen.add(r)
     return baseset(ls)