Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 12385:9a93f4fb141b stable
grep: only catch re.error when compiling regular expressions
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Wed, 22 Sep 2010 19:15:27 -0500 |
parents | 28ddf67198b2 |
children | 8eedf53547b8 |
comparison
equal
deleted
inserted
replaced
12384:ffcceca7406d | 12385:9a93f4fb141b |
---|---|
1567 reflags = 0 | 1567 reflags = 0 |
1568 if opts.get('ignore_case'): | 1568 if opts.get('ignore_case'): |
1569 reflags |= re.I | 1569 reflags |= re.I |
1570 try: | 1570 try: |
1571 regexp = re.compile(pattern, reflags) | 1571 regexp = re.compile(pattern, reflags) |
1572 except Exception, inst: | 1572 except re.error, inst: |
1573 ui.warn(_("grep: invalid match pattern: %s\n") % inst) | 1573 ui.warn(_("grep: invalid match pattern: %s\n") % inst) |
1574 return 1 | 1574 return 1 |
1575 sep, eol = ':', '\n' | 1575 sep, eol = ':', '\n' |
1576 if opts.get('print0'): | 1576 if opts.get('print0'): |
1577 sep = eol = '\0' | 1577 sep = eol = '\0' |