From patchwork Tue Apr 30 06:46:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,2] revset: extract private constant of {nullrev, wdirrev} set From: Yuya Nishihara X-Patchwork-Id: 39905 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Tue, 30 Apr 2019 15:46:01 +0900 # HG changeset patch # User Yuya Nishihara # Date 1556604607 -32400 # Tue Apr 30 15:10:07 2019 +0900 # Node ID c345a29786f4e3071950d6c18f40aeecfdf97afc # Parent ca762c2bbe6b00a4af999eb77a3f6daf48acb0cd revset: extract private constant of {nullrev, wdirrev} set I'll add a few more users of this constant to get around wdir identifiers. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -52,6 +52,9 @@ generatorset = smartset.generatorset spanset = smartset.spanset fullreposet = smartset.fullreposet +# revisions not included in all(), but populated if specified +_virtualrevs = (node.nullrev, node.wdirrev) + # Constants for ordering requirement, used in getset(): # # If 'define', any nested functions and operations MAY change the ordering of @@ -1847,7 +1850,7 @@ def rev(repo, subset, x): except (TypeError, ValueError): # i18n: "rev" is a keyword raise error.ParseError(_("rev expects a number")) - if l not in repo.changelog and l not in (node.nullrev, node.wdirrev): + if l not in repo.changelog and l not in _virtualrevs: return baseset() return subset & baseset([l])