# HG changeset patch # User Patrick Mezard # Date 1207340318 -7200 # Node ID af2edc9c5bb99e2e03feb8fa0d7ce99c5c2987dc # Parent 6c4e12682fb985137f7e68dbaa9ee9444b1281b0# Parent 65029a3aafc23e33c7aeb6d4d60b78bc61199763 Merge with crew-stable diff -r 6c4e12682fb9 -r af2edc9c5bb9 mercurial/commands.py --- a/mercurial/commands.py Thu Apr 03 13:47:05 2008 +0200 +++ b/mercurial/commands.py Fri Apr 04 22:18:38 2008 +0200 @@ -3037,7 +3037,7 @@ _('ignore changes in the amount of white space')), ('B', 'ignore-blank-lines', None, _('ignore changes whose lines are all blank')), - ('U', 'unified', 3, + ('U', 'unified', '', _('number of lines of context to show')) ] + walkopts, _('hg diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...')), diff -r 6c4e12682fb9 -r af2edc9c5bb9 mercurial/mdiff.py --- a/mercurial/mdiff.py Thu Apr 03 13:47:05 2008 +0200 +++ b/mercurial/mdiff.py Fri Apr 04 22:18:38 2008 +0200 @@ -5,6 +5,7 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. +from i18n import _ import bdiff, mpatch, re, struct, util, md5 def splitnewlines(text): @@ -47,6 +48,12 @@ v = self.defaults[k] setattr(self, k, v) + try: + self.context = int(self.context) + except ValueError: + raise util.Abort(_('diff context lines count must be ' + 'an integer, not %r') % self.context) + defaultopts = diffopts() def wsclean(opts, text): diff -r 6c4e12682fb9 -r af2edc9c5bb9 mercurial/patch.py --- a/mercurial/patch.py Thu Apr 03 13:47:05 2008 +0200 +++ b/mercurial/patch.py Fri Apr 04 22:18:38 2008 +0200 @@ -1055,9 +1055,9 @@ return err def diffopts(ui, opts={}, untrusted=False): - def get(key, name=None): + def get(key, name=None, getter=ui.configbool): return (opts.get(key) or - ui.configbool('diff', name or key, None, untrusted=untrusted)) + getter('diff', name or key, None, untrusted=untrusted)) return mdiff.diffopts( text=opts.get('text'), git=get('git'), @@ -1066,7 +1066,7 @@ ignorews=get('ignore_all_space', 'ignorews'), ignorewsamount=get('ignore_space_change', 'ignorewsamount'), ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'), - context=get('unified')) + context=get('unified', getter=ui.config)) def updatedir(ui, repo, patches): '''Update dirstate after patch application according to metadata''' diff -r 6c4e12682fb9 -r af2edc9c5bb9 tests/test-diff-unified --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-diff-unified Fri Apr 04 22:18:38 2008 +0200 @@ -0,0 +1,49 @@ +#!/bin/sh + +hg init repo +cd repo +cat > a < a <