comparison mercurial/mdiff.py @ 6467:65029a3aafc2

Let --unified default to diff.unified (issue 1076)
author Patrick Mezard <pmezard@gmail.com>
date Fri, 04 Apr 2008 22:15:14 +0200
parents 3d1f9dcecdea
children ac0bcd951c2c
comparison
equal deleted inserted replaced
6459:8189e03adb44 6467:65029a3aafc2
3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> 3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
4 # 4 #
5 # This software may be used and distributed according to the terms 5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference. 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 from i18n import _
8 import bdiff, mpatch, re, struct, util, md5 9 import bdiff, mpatch, re, struct, util, md5
9 10
10 def splitnewlines(text): 11 def splitnewlines(text):
11 '''like str.splitlines, but only split on newlines.''' 12 '''like str.splitlines, but only split on newlines.'''
12 lines = [l + '\n' for l in text.split('\n')] 13 lines = [l + '\n' for l in text.split('\n')]
44 for k in self.__slots__: 45 for k in self.__slots__:
45 v = opts.get(k) 46 v = opts.get(k)
46 if v is None: 47 if v is None:
47 v = self.defaults[k] 48 v = self.defaults[k]
48 setattr(self, k, v) 49 setattr(self, k, v)
50
51 try:
52 self.context = int(self.context)
53 except ValueError:
54 raise util.Abort(_('diff context lines count must be '
55 'an integer, not %r') % self.context)
49 56
50 defaultopts = diffopts() 57 defaultopts = diffopts()
51 58
52 def wsclean(opts, text): 59 def wsclean(opts, text):
53 if opts.ignorews: 60 if opts.ignorews: