diff mercurial/commands.py @ 4879:da8640113b5a

Merge with -stable
author Matt Mackall <mpm@selenic.com>
date Sat, 14 Jul 2007 13:34:40 -0500
parents 192cd95c2ba8 242026115e6a
children 2d545b98a7bc
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1107,7 +1107,11 @@ def grep(ui, repo, pattern, *pats, **opt
     reflags = 0
     if opts['ignore_case']:
         reflags |= re.I
-    regexp = re.compile(pattern, reflags)
+    try:
+        regexp = re.compile(pattern, reflags)
+    except Exception, inst:
+        ui.warn(_("grep: invalid match pattern: %s!\n") % inst)
+        return None
     sep, eol = ':', '\n'
     if opts['print0']:
         sep = eol = '\0'