Show More
@@ -57,13 +57,13 b' class diffopts(object):' | |||||
57 |
|
57 | |||
58 | defaultopts = diffopts() |
|
58 | defaultopts = diffopts() | |
59 |
|
59 | |||
60 | def wsclean(opts, text): |
|
60 | def wsclean(opts, text, blank=True): | |
61 | if opts.ignorews: |
|
61 | if opts.ignorews: | |
62 | text = re.sub('[ \t]+', '', text) |
|
62 | text = re.sub('[ \t]+', '', text) | |
63 | elif opts.ignorewsamount: |
|
63 | elif opts.ignorewsamount: | |
64 | text = re.sub('[ \t]+', ' ', text) |
|
64 | text = re.sub('[ \t]+', ' ', text) | |
65 | text = re.sub('[ \t]+\n', '\n', text) |
|
65 | text = re.sub('[ \t]+\n', '\n', text) | |
66 | if opts.ignoreblanklines: |
|
66 | if blank and opts.ignoreblanklines: | |
67 | text = re.sub('\n+', '', text) |
|
67 | text = re.sub('\n+', '', text) | |
68 | return text |
|
68 | return text | |
69 |
|
69 | |||
@@ -183,6 +183,10 b' def bunidiff(t1, t2, l1, l2, header1, he' | |||||
183 | # below finds the spaces between those matching sequences and translates |
|
183 | # below finds the spaces between those matching sequences and translates | |
184 | # them into diff output. |
|
184 | # them into diff output. | |
185 | # |
|
185 | # | |
|
186 | if opts.ignorews or opts.ignorewsamount: | |||
|
187 | t1 = wsclean(opts, t1, False) | |||
|
188 | t2 = wsclean(opts, t2, False) | |||
|
189 | ||||
186 | diff = bdiff.blocks(t1, t2) |
|
190 | diff = bdiff.blocks(t1, t2) | |
187 | hunk = None |
|
191 | hunk = None | |
188 | for i, s1 in enumerate(diff): |
|
192 | for i, s1 in enumerate(diff): | |
@@ -208,7 +212,7 b' def bunidiff(t1, t2, l1, l2, header1, he' | |||||
208 | if not old and not new: |
|
212 | if not old and not new: | |
209 | continue |
|
213 | continue | |
210 |
|
214 | |||
211 |
if opts. |
|
215 | if opts.ignoreblanklines: | |
212 | if wsclean(opts, "".join(old)) == wsclean(opts, "".join(new)): |
|
216 | if wsclean(opts, "".join(old)) == wsclean(opts, "".join(new)): | |
213 | continue |
|
217 | continue | |
214 |
|
218 |
@@ -181,11 +181,9 b' diff -r 540c40a65b78 foo' | |||||
181 | --- a/foo |
|
181 | --- a/foo | |
182 | +++ b/foo |
|
182 | +++ b/foo | |
183 | @@ -1,2 +1,3 @@ |
|
183 | @@ -1,2 +1,3 @@ | |
184 |
|
|
184 | hello world | |
185 | -goodbye world |
|
|||
186 | +hello world |
|
|||
187 | + |
|
185 | + | |
188 |
|
|
186 | goodbye world | |
189 | hg diff -Bb |
|
187 | hg diff -Bb | |
190 | >>> four diffs showing changed whitespace <<< |
|
188 | >>> four diffs showing changed whitespace <<< | |
191 | hg diff |
|
189 | hg diff | |
@@ -212,18 +210,16 b' diff -r 540c40a65b78 foo' | |||||
212 | +++ b/foo |
|
210 | +++ b/foo | |
213 | @@ -1,2 +1,2 @@ |
|
211 | @@ -1,2 +1,2 @@ | |
214 | -hello world |
|
212 | -hello world | |
215 | -goodbye world |
|
|||
216 | +helloworld |
|
213 | +helloworld | |
217 |
|
|
214 | goodbye world | |
218 | hg diff -Bb |
|
215 | hg diff -Bb | |
219 | diff -r 540c40a65b78 foo |
|
216 | diff -r 540c40a65b78 foo | |
220 | --- a/foo |
|
217 | --- a/foo | |
221 | +++ b/foo |
|
218 | +++ b/foo | |
222 | @@ -1,2 +1,2 @@ |
|
219 | @@ -1,2 +1,2 @@ | |
223 | -hello world |
|
220 | -hello world | |
224 | -goodbye world |
|
|||
225 | +helloworld |
|
221 | +helloworld | |
226 |
|
|
222 | goodbye world | |
227 | hg diff -w |
|
223 | hg diff -w | |
228 | >>> five diffs showing changed whitespace <<< |
|
224 | >>> five diffs showing changed whitespace <<< | |
229 | hg diff |
|
225 | hg diff | |
@@ -256,34 +252,30 b' diff -r 540c40a65b78 foo' | |||||
256 | +++ b/foo |
|
252 | +++ b/foo | |
257 | @@ -1,2 +1,5 @@ |
|
253 | @@ -1,2 +1,5 @@ | |
258 | -hello world |
|
254 | -hello world | |
259 | -goodbye world |
|
|||
260 | +helloworld |
|
255 | +helloworld | |
261 | + |
|
256 | + | |
262 | + |
|
257 | + | |
263 | + |
|
258 | + | |
264 |
|
|
259 | goodbye world | |
265 | hg diff -Bb |
|
260 | hg diff -Bb | |
266 | diff -r 540c40a65b78 foo |
|
261 | diff -r 540c40a65b78 foo | |
267 | --- a/foo |
|
262 | --- a/foo | |
268 | +++ b/foo |
|
263 | +++ b/foo | |
269 | @@ -1,2 +1,5 @@ |
|
264 | @@ -1,2 +1,5 @@ | |
270 | -hello world |
|
265 | -hello world | |
271 | -goodbye world |
|
|||
272 | +helloworld |
|
266 | +helloworld | |
273 | + |
|
267 | + | |
274 | + |
|
268 | + | |
275 | + |
|
269 | + | |
276 |
|
|
270 | goodbye world | |
277 | hg diff -w |
|
271 | hg diff -w | |
278 | diff -r 540c40a65b78 foo |
|
272 | diff -r 540c40a65b78 foo | |
279 | --- a/foo |
|
273 | --- a/foo | |
280 | +++ b/foo |
|
274 | +++ b/foo | |
281 | @@ -1,2 +1,5 @@ |
|
275 | @@ -1,2 +1,5 @@ | |
282 |
|
|
276 | hello world | |
283 | -goodbye world |
|
|||
284 | +helloworld |
|
|||
285 | + |
|
277 | + | |
286 | + |
|
278 | + | |
287 | + |
|
279 | + | |
288 |
|
|
280 | goodbye world | |
289 | hg diff -wB |
|
281 | hg diff -wB |
General Comments 0
You need to be logged in to leave comments.
Login now