##// END OF EJS Templates
diff: add --binary option for git mode diffs...
Alexander Fomin -
r31822:fde4822b default
parent child Browse files
Show More
@@ -162,6 +162,7 b' logopts = ['
162 diffopts = [
162 diffopts = [
163 ('a', 'text', None, _('treat all files as text')),
163 ('a', 'text', None, _('treat all files as text')),
164 ('g', 'git', None, _('use git extended diff format')),
164 ('g', 'git', None, _('use git extended diff format')),
165 ('', 'binary', None, _('generate binary diffs in git mode (default)')),
165 ('', 'nodates', None, _('omit dates from diff headers'))
166 ('', 'nodates', None, _('omit dates from diff headers'))
166 ]
167 ]
167
168
@@ -2210,7 +2210,9 b' def difffeatureopts(ui, opts=None, untru'
2210 'ignoreblanklines')
2210 'ignoreblanklines')
2211 if formatchanging:
2211 if formatchanging:
2212 buildopts['text'] = opts and opts.get('text')
2212 buildopts['text'] = opts and opts.get('text')
2213 buildopts['nobinary'] = get('nobinary', forceplain=False)
2213 binary = None if opts is None else opts.get('binary')
2214 buildopts['nobinary'] = (not binary if binary is not None
2215 else get('nobinary', forceplain=False))
2214 buildopts['noprefix'] = get('noprefix', forceplain=False)
2216 buildopts['noprefix'] = get('noprefix', forceplain=False)
2215
2217
2216 return mdiff.diffopts(**pycompat.strkwargs(buildopts))
2218 return mdiff.diffopts(**pycompat.strkwargs(buildopts))
@@ -216,8 +216,8 b' Show all commands + options'
216 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude, template
216 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude, template
217 clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure
217 clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure
218 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
218 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
219 diff: rev, change, text, git, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, root, include, exclude, subrepos
219 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, root, include, exclude, subrepos
220 export: output, switch-parent, rev, text, git, nodates
220 export: output, switch-parent, rev, text, git, binary, nodates
221 forget: include, exclude
221 forget: include, exclude
222 init: ssh, remotecmd, insecure
222 init: ssh, remotecmd, insecure
223 log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
223 log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
@@ -108,4 +108,37 b' Test text mode with extended git-style d'
108 \ No newline at end of file
108 \ No newline at end of file
109 +\x00\x01\x02\x03 (esc)
109 +\x00\x01\x02\x03 (esc)
110
110
111 Test binary mode with extended git-style diff format
112 $ hg diff --no-binary -r 0 -r 1
113 diff -r fb45f71337ad -r 9ca112d1a3c1 binfile.bin
114 Binary file binfile.bin has changed
115
116 $ hg diff --git --no-binary -r 0 -r 1
117 diff --git a/binfile.bin b/binfile.bin
118 Binary file binfile.bin has changed
119
120 $ hg diff --git --binary -r 0 -r 1
121 diff --git a/binfile.bin b/binfile.bin
122 index eaf36c1daccfdf325514461cd1a2ffbc139b5464..ba71a782e93f3fb63a428383706065e3ec2828e9
123 GIT binary patch
124 literal 5
125 Mc${NkWMbw50018V5dZ)H
126
127 $ hg diff --git --binary --config diff.nobinary=True -r 0 -r 1
128 diff --git a/binfile.bin b/binfile.bin
129 index eaf36c1daccfdf325514461cd1a2ffbc139b5464..ba71a782e93f3fb63a428383706065e3ec2828e9
130 GIT binary patch
131 literal 5
132 Mc${NkWMbw50018V5dZ)H
133
134
135 $ hg diff --git --binary --text -r 0 -r 1
136 diff --git a/binfile.bin b/binfile.bin
137 --- a/binfile.bin
138 +++ b/binfile.bin
139 @@ -1,1 +1,1 @@
140 -\x00\x01\x02\x03 (esc)
141 \ No newline at end of file
142 +\x00\x01\x02\x03 (esc)
143
111 $ cd ..
144 $ cd ..
@@ -545,6 +545,7 b' Test command without options'
545 -c --change REV change made by revision
545 -c --change REV change made by revision
546 -a --text treat all files as text
546 -a --text treat all files as text
547 -g --git use git extended diff format
547 -g --git use git extended diff format
548 --binary generate binary diffs in git mode (default)
548 --nodates omit dates from diff headers
549 --nodates omit dates from diff headers
549 --noprefix omit a/ and b/ prefixes from filenames
550 --noprefix omit a/ and b/ prefixes from filenames
550 -p --show-function show which function each change is in
551 -p --show-function show which function each change is in
General Comments 0
You need to be logged in to leave comments. Login now