equal
deleted
inserted
replaced
4 # |
4 # |
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 from i18n import _ |
8 from i18n import _ |
9 import bdiff, mpatch, util, base85 |
9 import bdiff, mpatch, util, base85, error |
10 import re, struct, zlib |
10 import re, struct, zlib |
11 |
11 |
12 def splitnewlines(text): |
12 def splitnewlines(text): |
13 '''like str.splitlines, but only split on newlines.''' |
13 '''like str.splitlines, but only split on newlines.''' |
14 lines = [l + '\n' for l in text.split('\n')] |
14 lines = [l + '\n' for l in text.split('\n')] |
57 setattr(self, k, v) |
57 setattr(self, k, v) |
58 |
58 |
59 try: |
59 try: |
60 self.context = int(self.context) |
60 self.context = int(self.context) |
61 except ValueError: |
61 except ValueError: |
62 raise util.Abort(_('diff context lines count must be ' |
62 raise error.Abort(_('diff context lines count must be ' |
63 'an integer, not %r') % self.context) |
63 'an integer, not %r') % self.context) |
64 |
64 |
65 def copy(self, **kwargs): |
65 def copy(self, **kwargs): |
66 opts = dict((k, getattr(self, k)) for k in self.defaults) |
66 opts = dict((k, getattr(self, k)) for k in self.defaults) |
67 opts.update(kwargs) |
67 opts.update(kwargs) |