Show More
@@ -46,6 +46,7 b' stringio = util.stringio' | |||
|
46 | 46 | |
|
47 | 47 | gitre = re.compile(br'diff --git a/(.*) b/(.*)') |
|
48 | 48 | tabsplitter = re.compile(br'(\t+|[^\t]+)') |
|
49 | _nonwordre = re.compile(br'([^a-zA-Z0-9_\x80-\xff])') | |
|
49 | 50 | |
|
50 | 51 | PatchError = error.PatchError |
|
51 | 52 | |
@@ -2578,7 +2579,7 b' def _inlinediff(s1, s2, operation):' | |||
|
2578 | 2579 | raise error.ProgrammingError("Case not expected, operation = %s" % |
|
2579 | 2580 | operation) |
|
2580 | 2581 | |
|
2581 |
s = difflib.ndiff(re.split( |
|
|
2582 | s = difflib.ndiff(_nonwordre.split(s2), _nonwordre.split(s1)) | |
|
2582 | 2583 | for part in s: |
|
2583 | 2584 | if part[0] in operation_skip or len(part) == 2: |
|
2584 | 2585 | continue |
@@ -370,3 +370,23 b' test inline color diff' | |||
|
370 | 370 | [diff.deleted|-(to see if it works)] |
|
371 | 371 | [diff.inserted|+three of those lines ][diff.inserted.highlight|have] |
|
372 | 372 | [diff.inserted|+][diff.inserted.highlight|collapsed][diff.inserted| onto one] |
|
373 | ||
|
374 | multibyte character shouldn't be broken up in word diff: | |
|
375 | ||
|
376 | $ $PYTHON <<'EOF' | |
|
377 | > with open("utf8", "wb") as f: | |
|
378 | > f.write(b"blah \xe3\x82\xa2 blah\n") | |
|
379 | > EOF | |
|
380 | $ hg ci -Am 'add utf8 char' utf8 | |
|
381 | $ $PYTHON <<'EOF' | |
|
382 | > with open("utf8", "wb") as f: | |
|
383 | > f.write(b"blah \xe3\x82\xa4 blah\n") | |
|
384 | > EOF | |
|
385 | $ hg ci -m 'slightly change utf8 char' utf8 | |
|
386 | $ hg diff --config experimental.worddiff=True --color=debug -c. | |
|
387 | [diff.diffline|diff --git a/utf8 b/utf8] | |
|
388 | [diff.file_a|--- a/utf8] | |
|
389 | [diff.file_b|+++ b/utf8] | |
|
390 | [diff.hunk|@@ -1,1 +1,1 @@] | |
|
391 | [diff.deleted|-blah ][diff.deleted.highlight|\xe3\x82\xa2][diff.deleted| blah] (esc) | |
|
392 | [diff.inserted|+blah ][diff.inserted.highlight|\xe3\x82\xa4][diff.inserted| blah] (esc) |
General Comments 0
You need to be logged in to leave comments.
Login now