comparison mercurial/revset.py @ 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 4b86f4f199a9
children 6bc1245cd598
comparison
equal deleted inserted replaced
42261:96bc1ef4a302 42262:a0c5e06e9b1a
49 49
50 baseset = smartset.baseset 50 baseset = smartset.baseset
51 generatorset = smartset.generatorset 51 generatorset = smartset.generatorset
52 spanset = smartset.spanset 52 spanset = smartset.spanset
53 fullreposet = smartset.fullreposet 53 fullreposet = smartset.fullreposet
54
55 # revisions not included in all(), but populated if specified
56 _virtualrevs = (node.nullrev, node.wdirrev)
54 57
55 # Constants for ordering requirement, used in getset(): 58 # Constants for ordering requirement, used in getset():
56 # 59 #
57 # If 'define', any nested functions and operations MAY change the ordering of 60 # If 'define', any nested functions and operations MAY change the ordering of
58 # the entries in the set (but if changes the ordering, it MUST ALWAYS change 61 # the entries in the set (but if changes the ordering, it MUST ALWAYS change
1845 # i18n: "rev" is a keyword 1848 # i18n: "rev" is a keyword
1846 l = int(getstring(l[0], _("rev requires a number"))) 1849 l = int(getstring(l[0], _("rev requires a number")))
1847 except (TypeError, ValueError): 1850 except (TypeError, ValueError):
1848 # i18n: "rev" is a keyword 1851 # i18n: "rev" is a keyword
1849 raise error.ParseError(_("rev expects a number")) 1852 raise error.ParseError(_("rev expects a number"))
1850 if l not in repo.changelog and l not in (node.nullrev, node.wdirrev): 1853 if l not in repo.changelog and l not in _virtualrevs:
1851 return baseset() 1854 return baseset()
1852 return subset & baseset([l]) 1855 return subset & baseset([l])
1853 1856
1854 @predicate('_rev(number)', safe=True) 1857 @predicate('_rev(number)', safe=True)
1855 def _rev(repo, subset, x): 1858 def _rev(repo, subset, x):