comparison mercurial/revset.py @ 12320:40c40c6f20b8 stable

revset: handle re.compile() errors in grep() Raise error.ParseError instead of allowing re.error to bubble up.
author Brodie Rao <brodie@bitheap.org>
date Fri, 17 Sep 2010 10:21:02 -0500
parents b75dea24e296
children 11db6fa2961e f314723f36f5
comparison
equal deleted inserted replaced
12319:381f131220ad 12320:40c40c6f20b8
266 if kw in t.lower(): 266 if kw in t.lower():
267 l.append(r) 267 l.append(r)
268 return l 268 return l
269 269
270 def grep(repo, subset, x): 270 def grep(repo, subset, x):
271 gr = re.compile(getstring(x, _("grep wants a string"))) 271 try:
272 gr = re.compile(getstring(x, _("grep wants a string")))
273 except re.error, e:
274 raise error.ParseError(_('invalid match pattern: %s') % e)
272 l = [] 275 l = []
273 for r in subset: 276 for r in subset:
274 c = repo[r] 277 c = repo[r]
275 for e in c.files() + [c.user(), c.description()]: 278 for e in c.files() + [c.user(), c.description()]:
276 if gr.search(e): 279 if gr.search(e):