grep: use re2 if possible
Since re2 is enormously faster than Python's re module, this should
help performance, ceteris paribus. grep currently has other huge
performance problems that mask any gain :-(
--- a/mercurial/commands.py Mon Mar 11 12:06:13 2013 -0700
+++ b/mercurial/commands.py Mon Mar 11 12:07:33 2013 -0700
@@ -2960,7 +2960,7 @@
if opts.get('ignore_case'):
reflags |= re.I
try:
- regexp = re.compile(pattern, reflags)
+ regexp = util.compilere(pattern, reflags)
except re.error, inst:
ui.warn(_("grep: invalid match pattern: %s\n") % inst)
return 1