##// END OF EJS Templates
mq: qdiff: support all diffopts
Jason Orendorff -
r6668:034f4449 default
parent child Browse files
Show More
@@ -967,10 +967,7 b' class queue:'
967 967 self.ui.write("No patches applied\n")
968 968 return
969 969 qp = self.qparents(repo, top)
970 if opts.get('git'):
971 self.diffopts().git = True
972 if opts.get('unified') is not None:
973 self.diffopts().context = opts['unified']
970 self._diffopts = patch.diffopts(self.ui, opts)
974 971 self.printdiff(repo, qp, files=pats, opts=opts)
975 972
976 973 def refresh(self, repo, pats=None, **opts):
@@ -2355,10 +2352,8 b' cmdtable = {'
2355 2352 _('hg qcommit [OPTION]... [FILE]...')),
2356 2353 "^qdiff":
2357 2354 (diff,
2358 [('g', 'git', None, _('use git extended diff format')),
2359 ('U', 'unified', 3, _('number of lines of context to show')),
2360 ] + commands.walkopts,
2361 _('hg qdiff [-I] [-X] [-U NUM] [-g] [FILE]...')),
2355 commands.diffopts + commands.diffopts2 + commands.walkopts,
2356 _('hg qdiff [OPTION]... [FILE]...')),
2362 2357 "qdelete|qremove|qrm":
2363 2358 (delete,
2364 2359 [('k', 'keep', None, _('keep patch file')),
@@ -2932,6 +2932,23 b' logopts = ['
2932 2932 ('M', 'no-merges', None, _('do not show merges')),
2933 2933 ] + templateopts
2934 2934
2935 diffopts = [
2936 ('a', 'text', None, _('treat all files as text')),
2937 ('g', 'git', None, _('use git extended diff format')),
2938 ('', 'nodates', None, _("don't include dates in diff headers"))
2939 ]
2940
2941 diffopts2 = [
2942 ('p', 'show-function', None, _('show which function each change is in')),
2943 ('w', 'ignore-all-space', None,
2944 _('ignore white space when comparing lines')),
2945 ('b', 'ignore-space-change', None,
2946 _('ignore changes in the amount of white space')),
2947 ('B', 'ignore-blank-lines', None,
2948 _('ignore changes whose lines are all blank')),
2949 ('U', 'unified', '', _('number of lines of context to show'))
2950 ]
2951
2935 2952 table = {
2936 2953 "^add": (add, walkopts + dryrunopts, _('hg add [OPTION]... [FILE]...')),
2937 2954 "addremove":
@@ -3071,29 +3088,14 b' table = {'
3071 3088 "debugwalk": (debugwalk, walkopts, _('hg debugwalk [OPTION]... [FILE]...')),
3072 3089 "^diff":
3073 3090 (diff,
3074 [('r', 'rev', [], _('revision')),
3075 ('a', 'text', None, _('treat all files as text')),
3076 ('p', 'show-function', None,
3077 _('show which function each change is in')),
3078 ('g', 'git', None, _('use git extended diff format')),
3079 ('', 'nodates', None, _("don't include dates in diff headers")),
3080 ('w', 'ignore-all-space', None,
3081 _('ignore white space when comparing lines')),
3082 ('b', 'ignore-space-change', None,
3083 _('ignore changes in the amount of white space')),
3084 ('B', 'ignore-blank-lines', None,
3085 _('ignore changes whose lines are all blank')),
3086 ('U', 'unified', '',
3087 _('number of lines of context to show'))
3088 ] + walkopts,
3091 [('r', 'rev', [], _('revision'))
3092 ] + diffopts + diffopts2 + walkopts,
3089 3093 _('hg diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...')),
3090 3094 "^export":
3091 3095 (export,
3092 3096 [('o', 'output', '', _('print output to file with formatted name')),
3093 ('a', 'text', None, _('treat all files as text')),
3094 ('g', 'git', None, _('use git extended diff format')),
3095 ('', 'nodates', None, _("don't include dates in diff headers")),
3096 ('', 'switch-parent', None, _('diff against the second parent'))],
3097 ('', 'switch-parent', None, _('diff against the second parent'))
3098 ] + diffopts,
3097 3099 _('hg export [OPTION]... [-o OUTFILESPEC] REV...')),
3098 3100 "grep":
3099 3101 (grep,
@@ -201,9 +201,9 b' options:'
201 201
202 202 -r --rev revision
203 203 -a --text treat all files as text
204 -p --show-function show which function each change is in
205 204 -g --git use git extended diff format
206 205 --nodates don't include dates in diff headers
206 -p --show-function show which function each change is in
207 207 -w --ignore-all-space ignore white space when comparing lines
208 208 -b --ignore-space-change ignore changes in the amount of white space
209 209 -B --ignore-blank-lines ignore changes whose lines are all blank
@@ -25,3 +25,35 b' hg qdiff | sed -e "s/\\(+++ [a-zA-Z0-9_/.'
25 25 echo % qdiff dirname
26 26 hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
27 27 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
28
29 echo % qdiff filename
30 hg qdiff --nodates base
31
32 echo % revert
33 hg revert -a
34
35 echo % qpop
36 hg qpop
37
38 echo % qdelete mqbase
39 hg qdelete mqbase
40
41 echo % commit 2
42 printf '1\n2\n3\n4\nhello world\ngoodbye world\n7\n8\n9\n' > lines
43 hg ci -Amlines -d '2 0'
44
45 echo % qnew 2
46 hg qnew -mmqbase2 mqbase2
47 printf '\n\n1\n2\n3\n4\nhello world\n goodbye world\n7\n8\n9\n' > lines
48
49 echo % qdiff -U 1
50 hg qdiff --nodates -U 1
51
52 echo % qdiff -b
53 hg qdiff --nodates -b
54
55 echo % qdiff -U 1 -B
56 hg qdiff --nodates -U 1 -B
57
58 echo qdiff -w
59 hg qdiff --nodates -w
@@ -17,3 +17,71 b' diff -r 67e992f2c4f3 base'
17 17 @@ -1,1 +1,1 @@
18 18 -base
19 19 +patched
20 % qdiff filename
21 diff -r 67e992f2c4f3 base
22 --- a/base
23 +++ b/base
24 @@ -1,1 +1,1 @@
25 -base
26 +patched
27 % revert
28 % qpop
29 Patch queue now empty
30 % qdelete mqbase
31 % commit 2
32 adding lines
33 % qnew 2
34 % qdiff -U 1
35 diff -r 35fb829491c1 lines
36 --- a/lines
37 +++ b/lines
38 @@ -1,1 +1,3 @@
39 +
40 +
41 1
42 @@ -4,4 +6,4 @@
43 4
44 -hello world
45 -goodbye world
46 +hello world
47 + goodbye world
48 7
49 % qdiff -b
50 diff -r 35fb829491c1 lines
51 --- a/lines
52 +++ b/lines
53 @@ -1,9 +1,11 @@
54 +
55 +
56 1
57 2
58 3
59 4
60 -hello world
61 -goodbye world
62 +hello world
63 + goodbye world
64 7
65 8
66 9
67 % qdiff -U 1 -B
68 diff -r 35fb829491c1 lines
69 --- a/lines
70 +++ b/lines
71 @@ -4,4 +6,4 @@
72 4
73 -hello world
74 -goodbye world
75 +hello world
76 + goodbye world
77 7
78 qdiff -w
79 diff -r 35fb829491c1 lines
80 --- a/lines
81 +++ b/lines
82 @@ -1,3 +1,5 @@
83 +
84 +
85 1
86 2
87 3
General Comments 0
You need to be logged in to leave comments. Login now