comparison mercurial/fileset.py @ 35692:a62b08f6626b

fileset: do not crash by unary negate operation Backported from minifileset.py.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 13 Jan 2018 15:13:29 +0900
parents 735f47b41521
children 9eb5c400f488
comparison
equal deleted inserted replaced
35691:735f47b41521 35692:a62b08f6626b
134 def minusset(mctx, x, y): 134 def minusset(mctx, x, y):
135 xl = getset(mctx, x) 135 xl = getset(mctx, x)
136 yl = set(getset(mctx, y)) 136 yl = set(getset(mctx, y))
137 return [f for f in xl if f not in yl] 137 return [f for f in xl if f not in yl]
138 138
139 def negateset(mctx, x):
140 raise error.ParseError(_("can't use negate operator in this context"))
141
139 def listset(mctx, a, b): 142 def listset(mctx, a, b):
140 raise error.ParseError(_("can't use a list in this context"), 143 raise error.ParseError(_("can't use a list in this context"),
141 hint=_('see hg help "filesets.x or y"')) 144 hint=_('see hg help "filesets.x or y"'))
142 145
143 # symbols are callable like: 146 # symbols are callable like:
521 'string': stringset, 524 'string': stringset,
522 'symbol': stringset, 525 'symbol': stringset,
523 'and': andset, 526 'and': andset,
524 'or': orset, 527 'or': orset,
525 'minus': minusset, 528 'minus': minusset,
529 'negate': negateset,
526 'list': listset, 530 'list': listset,
527 'group': getset, 531 'group': getset,
528 'not': notset, 532 'not': notset,
529 'func': func, 533 'func': func,
530 } 534 }