##// END OF EJS Templates
Merge with crew-stable
Patrick Mezard -
r6468:af2edc9c merge default
parent child Browse files
Show More
@@ -0,0 +1,49 b''
1 #!/bin/sh
2
3 hg init repo
4 cd repo
5 cat > a <<EOF
6 c
7 c
8 a
9 a
10 b
11 a
12 a
13 c
14 c
15 EOF
16 hg ci -Am adda
17 cat > a <<EOF
18 c
19 c
20 a
21 a
22 dd
23 a
24 a
25 c
26 c
27 EOF
28
29 echo '% default context'
30 hg diff --nodates
31
32 echo '% invalid --unified'
33 hg diff --nodates -U foo
34
35 echo '% --unified=2'
36 hg diff --nodates -U 2
37
38 echo '% diff.unified=2'
39 hg --config diff.unified=2 diff --nodates
40
41 echo '% diff.unified=2 --unified=1'
42 hg diff --nodates -U 1
43
44 echo '% invalid diff.unified'
45 hg --config diff.unified=foo diff --nodates
46
47 exit 0
48
49
@@ -0,0 +1,49 b''
1 adding a
2 % default context
3 diff -r cf9f4ba66af2 a
4 --- a/a
5 +++ b/a
6 @@ -2,7 +2,7 @@
7 c
8 a
9 a
10 -b
11 +dd
12 a
13 a
14 c
15 % invalid --unified
16 abort: diff context lines count must be an integer, not 'foo'
17 % --unified=2
18 diff -r cf9f4ba66af2 a
19 --- a/a
20 +++ b/a
21 @@ -3,5 +3,5 @@
22 a
23 a
24 -b
25 +dd
26 a
27 a
28 % diff.unified=2
29 diff -r cf9f4ba66af2 a
30 --- a/a
31 +++ b/a
32 @@ -3,5 +3,5 @@
33 a
34 a
35 -b
36 +dd
37 a
38 a
39 % diff.unified=2 --unified=1
40 diff -r cf9f4ba66af2 a
41 --- a/a
42 +++ b/a
43 @@ -4,3 +4,3 @@
44 a
45 -b
46 +dd
47 a
48 % invalid diff.unified
49 abort: diff context lines count must be an integer, not 'foo'
@@ -3037,7 +3037,7 b' table = {'
3037 _('ignore changes in the amount of white space')),
3037 _('ignore changes in the amount of white space')),
3038 ('B', 'ignore-blank-lines', None,
3038 ('B', 'ignore-blank-lines', None,
3039 _('ignore changes whose lines are all blank')),
3039 _('ignore changes whose lines are all blank')),
3040 ('U', 'unified', 3,
3040 ('U', 'unified', '',
3041 _('number of lines of context to show'))
3041 _('number of lines of context to show'))
3042 ] + walkopts,
3042 ] + walkopts,
3043 _('hg diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...')),
3043 _('hg diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...')),
@@ -5,6 +5,7 b''
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):
@@ -47,6 +48,12 b' class diffopts(object):'
47 v = self.defaults[k]
48 v = self.defaults[k]
48 setattr(self, k, v)
49 setattr(self, k, v)
49
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)
56
50 defaultopts = diffopts()
57 defaultopts = diffopts()
51
58
52 def wsclean(opts, text):
59 def wsclean(opts, text):
@@ -1055,9 +1055,9 b' def applydiff(ui, fp, changed, strip=1, '
1055 return err
1055 return err
1056
1056
1057 def diffopts(ui, opts={}, untrusted=False):
1057 def diffopts(ui, opts={}, untrusted=False):
1058 def get(key, name=None):
1058 def get(key, name=None, getter=ui.configbool):
1059 return (opts.get(key) or
1059 return (opts.get(key) or
1060 ui.configbool('diff', name or key, None, untrusted=untrusted))
1060 getter('diff', name or key, None, untrusted=untrusted))
1061 return mdiff.diffopts(
1061 return mdiff.diffopts(
1062 text=opts.get('text'),
1062 text=opts.get('text'),
1063 git=get('git'),
1063 git=get('git'),
@@ -1066,7 +1066,7 b' def diffopts(ui, opts={}, untrusted=Fals'
1066 ignorews=get('ignore_all_space', 'ignorews'),
1066 ignorews=get('ignore_all_space', 'ignorews'),
1067 ignorewsamount=get('ignore_space_change', 'ignorewsamount'),
1067 ignorewsamount=get('ignore_space_change', 'ignorewsamount'),
1068 ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'),
1068 ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'),
1069 context=get('unified'))
1069 context=get('unified', getter=ui.config))
1070
1070
1071 def updatedir(ui, repo, patches):
1071 def updatedir(ui, repo, patches):
1072 '''Update dirstate after patch application according to metadata'''
1072 '''Update dirstate after patch application according to metadata'''
@@ -205,7 +205,7 b' options:'
205 -w --ignore-all-space ignore white space when comparing lines
205 -w --ignore-all-space ignore white space when comparing lines
206 -b --ignore-space-change ignore changes in the amount of white space
206 -b --ignore-space-change ignore changes in the amount of white space
207 -B --ignore-blank-lines ignore changes whose lines are all blank
207 -B --ignore-blank-lines ignore changes whose lines are all blank
208 -U --unified number of lines of context to show (default: 3)
208 -U --unified number of lines of context to show
209 -I --include include names matching the given patterns
209 -I --include include names matching the given patterns
210 -X --exclude exclude names matching the given patterns
210 -X --exclude exclude names matching the given patterns
211
211
General Comments 0
You need to be logged in to leave comments. Login now