changeset 42262:a0c5e06e9b1a

revset: extract private constant of {nullrev, wdirrev} set I'll add a few more users of this constant to get around wdir identifiers.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 30 Apr 2019 15:10:07 +0900
parents 96bc1ef4a302
children 6bc1245cd598
files mercurial/revset.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Tue Apr 30 15:22:03 2019 +0900
+++ b/mercurial/revset.py	Tue Apr 30 15:10:07 2019 +0900
@@ -52,6 +52,9 @@
 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 @@
     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])