comparison mercurial/revset.py @ 33416:9467d5337292

revset: add experimental relation and subscript operators The proposed syntax [1] was originally 'set{n rel}', but it seemed slightly confusing if template is involved. On the other hand, we want to keep 'set[n]' for future extension. So this patch introduces 'set#rel[n]' ternary operator. I chose '#' just because it looks like applying an attribute. This also adds stubs for 'set[n]' and 'set#rel' operators since these syntax elements are fundamental for constructing 'set#rel[n]'. [1]: https://www.mercurial-scm.org/wiki/RevsetOperatorPlan#ideas_from_mpm
author Yuya Nishihara <yuya@tcha.org>
date Sat, 08 Jul 2017 13:07:59 +0900
parents 5d63e5f40bea
children d1b13d4995ed
comparison
equal deleted inserted replaced
33415:371f59c6a89e 33416:9467d5337292
148 else: 148 else:
149 return _orsetlist(repo, subset, xs) 149 return _orsetlist(repo, subset, xs)
150 150
151 def notset(repo, subset, x, order): 151 def notset(repo, subset, x, order):
152 return subset - getset(repo, subset, x) 152 return subset - getset(repo, subset, x)
153
154 def relationset(repo, subset, x, y, order):
155 raise error.ParseError(_("can't use a relation in this context"))
156
157 def relsubscriptset(repo, subset, x, y, z, order):
158 raise error.ParseError(_("can't use a relation in this context"))
159
160 def subscriptset(repo, subset, x, y, order):
161 raise error.ParseError(_("can't use a subscript in this context"))
153 162
154 def listset(repo, subset, *xs): 163 def listset(repo, subset, *xs):
155 raise error.ParseError(_("can't use a list in this context"), 164 raise error.ParseError(_("can't use a list in this context"),
156 hint=_('see hg help "revsets.x or y"')) 165 hint=_('see hg help "revsets.x or y"'))
157 166
2002 "symbol": stringset, 2011 "symbol": stringset,
2003 "and": andset, 2012 "and": andset,
2004 "or": orset, 2013 "or": orset,
2005 "not": notset, 2014 "not": notset,
2006 "difference": differenceset, 2015 "difference": differenceset,
2016 "relation": relationset,
2017 "relsubscript": relsubscriptset,
2018 "subscript": subscriptset,
2007 "list": listset, 2019 "list": listset,
2008 "keyvalue": keyvaluepair, 2020 "keyvalue": keyvaluepair,
2009 "func": func, 2021 "func": func,
2010 "ancestor": ancestorspec, 2022 "ancestor": ancestorspec,
2011 "parent": parentspec, 2023 "parent": parentspec,