comparison mercurial/mdiff.py @ 12751:8eb758ea738c

mdiff: carriage return (\r) is also ignorable whitespace
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 19 Oct 2010 03:55:06 +0200
parents 2315a95ee887
children 16dc9a32ca04
comparison
equal deleted inserted replaced
12750:05bd2658bbb3 12751:8eb758ea738c
65 65
66 defaultopts = diffopts() 66 defaultopts = diffopts()
67 67
68 def wsclean(opts, text, blank=True): 68 def wsclean(opts, text, blank=True):
69 if opts.ignorews: 69 if opts.ignorews:
70 text = re.sub('[ \t]+', '', text) 70 text = re.sub('[ \t\r]+', '', text)
71 elif opts.ignorewsamount: 71 elif opts.ignorewsamount:
72 text = re.sub('[ \t]+', ' ', text) 72 text = re.sub('[ \t\r]+', ' ', text)
73 text = re.sub('[ \t]+\n', '\n', text) 73 text = text.replace(' \n', '\n')
74 if blank and opts.ignoreblanklines: 74 if blank and opts.ignoreblanklines:
75 text = re.sub('\n+', '', text) 75 text = re.sub('\n+', '', text)
76 return text 76 return text
77 77
78 def diffline(revs, a, b, opts): 78 def diffline(revs, a, b, opts):