Mercurial > hgbook
changeset 65:e3894bb9d1f5
Fix bugs in check_whitespace.py.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Fri, 04 Aug 2006 14:00:22 -0700 |
parents | d12a199ed472 |
children | 81a2f7a639ed |
files | en/examples/data/check_whitespace.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/en/examples/data/check_whitespace.py Fri Aug 04 13:43:26 2006 -0700 +++ b/en/examples/data/check_whitespace.py Fri Aug 04 14:00:22 2006 -0700 @@ -7,18 +7,18 @@ for line in difflines: if header: + # remember the name of the file that this diff affects + m = re.match(r'(?:---|\+\+\+) ([^\t]+)', line) + if m and m.group(1) != '/dev/null': + filename = m.group(1).split('/', 1)[-1] if line.startswith('+++ '): header = False - else: - # remember the name of the file that this diff affects - m = re.match(r'--- [^/]/([^\t])', line) - if m: filename = m.group(1) continue if line.startswith('diff '): header = True continue # hunk header - save the line number - m = re.match(r'@@ -(\d+),', line) + m = re.match(r'@@ -\d+,\d+ \+(\d+),', line) if m: linenum = int(m.group(1)) continue