comparison mercurial/commands.py @ 4877:242026115e6a

hg grep: handle re.compile errors & update tests/test-grep
author Giorgos Keramidas <keramida@ceid.upatras.gr>
date Mon, 09 Jul 2007 17:41:14 +0300
parents 9858477ed74c
children da8640113b5a be5dc5e3ab2d
comparison
equal deleted inserted replaced
4867:0e2d0a78f81a 4877:242026115e6a
1090 use the --all flag. 1090 use the --all flag.
1091 """ 1091 """
1092 reflags = 0 1092 reflags = 0
1093 if opts['ignore_case']: 1093 if opts['ignore_case']:
1094 reflags |= re.I 1094 reflags |= re.I
1095 regexp = re.compile(pattern, reflags) 1095 try:
1096 regexp = re.compile(pattern, reflags)
1097 except Exception, inst:
1098 ui.warn(_("grep: invalid match pattern: %s!\n") % inst)
1099 return None
1096 sep, eol = ':', '\n' 1100 sep, eol = ':', '\n'
1097 if opts['print0']: 1101 if opts['print0']:
1098 sep = eol = '\0' 1102 sep = eol = '\0'
1099 1103
1100 fcache = {} 1104 fcache = {}