hgbook
diff en/examples/data/check_whitespace.py @ 71:ddf533d41c09
Propagate errors correctly.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Tue Aug 29 22:25:18 2006 -0700 (2006-08-29) |
parents | 18210d46491f |
children |
line diff
1.1 --- a/en/examples/data/check_whitespace.py Tue Jul 25 00:18:31 2006 -0700 1.2 +++ b/en/examples/data/check_whitespace.py Tue Aug 29 22:25:18 2006 -0700 1.3 @@ -7,18 +7,18 @@ 1.4 1.5 for line in difflines: 1.6 if header: 1.7 + # remember the name of the file that this diff affects 1.8 + m = re.match(r'(?:---|\+\+\+) ([^\t]+)', line) 1.9 + if m and m.group(1) != '/dev/null': 1.10 + filename = m.group(1).split('/', 1)[-1] 1.11 if line.startswith('+++ '): 1.12 header = False 1.13 - else: 1.14 - # remember the name of the file that this diff affects 1.15 - m = re.match(r'--- [^/]/([^\t])', line) 1.16 - if m: filename = m.group(1) 1.17 continue 1.18 if line.startswith('diff '): 1.19 header = True 1.20 continue 1.21 # hunk header - save the line number 1.22 - m = re.match(r'@@ -(\d+),', line) 1.23 + m = re.match(r'@@ -\d+,\d+ \+(\d+),', line) 1.24 if m: 1.25 linenum = int(m.group(1)) 1.26 continue