[PATCH] grep: only catch re.error when compiling regular expressions

Brodie Rao brodie at bitheap.org
Wed Sep 22 19:19:30 CDT 2010


# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1285200927 18000
# Node ID 9820ba7c8f07d586d457fd63bcd22cd6c3d69162
# Parent  f1e8d6f6e682a74a135ba6509b2de26cc8172046
grep: only catch re.error when compiling regular expressions

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1585,7 +1585,7 @@ def grep(ui, repo, pattern, *pats, **opt
         reflags |= re.I
     try:
         regexp = re.compile(pattern, reflags)
-    except Exception, inst:
+    except re.error, inst:
         ui.warn(_("grep: invalid match pattern: %s\n") % inst)
         return 1
     sep, eol = ':', '\n'


More information about the Mercurial-devel mailing list