Show More
@@ -67,10 +67,10 defaultopts = diffopts() | |||
|
67 | 67 | |
|
68 | 68 | def wsclean(opts, text, blank=True): |
|
69 | 69 | if opts.ignorews: |
|
70 | text = re.sub('[ \t]+', '', text) | |
|
70 | text = re.sub('[ \t\r]+', '', text) | |
|
71 | 71 | elif opts.ignorewsamount: |
|
72 | text = re.sub('[ \t]+', ' ', text) | |
|
73 |
text = |
|
|
72 | text = re.sub('[ \t\r]+', ' ', text) | |
|
73 | text = text.replace(' \n', '\n') | |
|
74 | 74 | if blank and opts.ignoreblanklines: |
|
75 | 75 | text = re.sub('\n+', '', text) |
|
76 | 76 | return text |
@@ -390,3 +390,57 Test whitespace changes and blank lines: | |||
|
390 | 390 | |
|
391 | 391 | $ hg ndiff -wB |
|
392 | 392 | |
|
393 | ||
|
394 | Test \r (carriage return) as used in "DOS" line endings: | |
|
395 | ||
|
396 | $ printf 'hello world\r\n\r\ngoodbye\rworld\n' >foo | |
|
397 | ||
|
398 | $ hg ndiff | |
|
399 | diff -r 540c40a65b78 foo | |
|
400 | --- a/foo | |
|
401 | +++ b/foo | |
|
402 | @@ -1,2 +1,3 @@ | |
|
403 | -hello world | |
|
404 | -goodbye world | |
|
405 | +hello world | |
|
406 | + | |
|
407 | +goodbye | |
|
408 | world | |
|
409 | world | |
|
410 | ||
|
411 | No completely blank lines to ignore: | |
|
412 | ||
|
413 | $ hg ndiff --ignore-blank-lines | |
|
414 | diff -r 540c40a65b78 foo | |
|
415 | --- a/foo | |
|
416 | +++ b/foo | |
|
417 | @@ -1,2 +1,3 @@ | |
|
418 | -hello world | |
|
419 | -goodbye world | |
|
420 | +hello world | |
|
421 | + | |
|
422 | +goodbye | |
|
423 | world | |
|
424 | world | |
|
425 | ||
|
426 | Only new line noticed: | |
|
427 | ||
|
428 | $ hg ndiff --ignore-space-change | |
|
429 | diff -r 540c40a65b78 foo | |
|
430 | --- a/foo | |
|
431 | +++ b/foo | |
|
432 | @@ -1,2 +1,3 @@ | |
|
433 | hello world | |
|
434 | + | |
|
435 | goodbye world | |
|
436 | ||
|
437 | $ hg ndiff --ignore-all-space | |
|
438 | diff -r 540c40a65b78 foo | |
|
439 | --- a/foo | |
|
440 | +++ b/foo | |
|
441 | @@ -1,2 +1,3 @@ | |
|
442 | hello world | |
|
443 | + | |
|
444 | goodbye world | |
|
445 | ||
|
446 | New line not noticed when space change ignored: |
General Comments 0
You need to be logged in to leave comments.
Login now