hgbook

changeset 65:e3894bb9d1f5

Fix bugs in check_whitespace.py.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri Aug 04 14:00:22 2006 -0700 (2006-08-04)
parents d12a199ed472
children 81a2f7a639ed
files en/examples/data/check_whitespace.py
line diff
     1.1 --- a/en/examples/data/check_whitespace.py	Fri Aug 04 13:43:26 2006 -0700
     1.2 +++ b/en/examples/data/check_whitespace.py	Fri Aug 04 14:00:22 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