hgbook

diff en/examples/data/check_whitespace.py @ 379:dbc78b312fc0

finished translation of tour-basic
author Javier Rojas <jerojasro@devnull.li>
date Mon Oct 27 23:29:24 2008 -0500 (2008-10-27)
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	Mon Oct 27 23:29:24 2008 -0500
     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