diff 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
line wrap: on
line diff
--- a/mercurial/revset.py	Mon Sep 20 15:33:39 2010 +0200
+++ b/mercurial/revset.py	Fri Sep 17 10:21:02 2010 -0500
@@ -268,7 +268,10 @@
     return l
 
 def grep(repo, subset, x):
-    gr = re.compile(getstring(x, _("grep wants a string")))
+    try:
+        gr = re.compile(getstring(x, _("grep wants a string")))
+    except re.error, e:
+        raise error.ParseError(_('invalid match pattern: %s') % e)
     l = []
     for r in subset:
         c = repo[r]