# HG changeset patch # User Yuya Nishihara # Date 2018-07-08 07:21:26 # Node ID be441eb65f09603386f853b1604aae92bca6b53e # Parent f068495a1c28358c22695545ed15a00b54da0d45 diff: graduate word-diff option from experimental Per 4.6 Sprint notes. I've also made it gated by "formatchanging" since it could change the output if we had an option to highlight words without using colors. diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -147,6 +147,9 @@ coreconfigitem('annotate', 'nobinary', coreconfigitem('annotate', 'noprefix', default=False, ) +coreconfigitem('annotate', 'word-diff', + default=False, +) coreconfigitem('auth', 'cookiefile', default=None, ) @@ -399,6 +402,9 @@ coreconfigitem('diff', 'nobinary', coreconfigitem('diff', 'noprefix', default=False, ) +coreconfigitem('diff', 'word-diff', + default=False, +) coreconfigitem('email', 'bcc', default=None, ) @@ -512,9 +518,6 @@ coreconfigitem('experimental', 'evolutio coreconfigitem('experimental', 'evolution.track-operation', default=True, ) -coreconfigitem('experimental', 'worddiff', - default=False, -) coreconfigitem('experimental', 'maxdeltachainspan', default=-1, ) diff --git a/mercurial/diffutil.py b/mercurial/diffutil.py --- a/mercurial/diffutil.py +++ b/mercurial/diffutil.py @@ -53,7 +53,6 @@ def difffeatureopts(ui, opts=None, untru 'showfunc': get('show_function', 'showfunc'), 'context': get('unified', getter=ui.config), } - buildopts['worddiff'] = ui.configbool('experimental', 'worddiff') buildopts['xdiff'] = ui.configbool('experimental', 'xdiff') if git: @@ -101,5 +100,6 @@ def difffeatureopts(ui, opts=None, untru buildopts['nobinary'] = (not binary if binary is not None else get('nobinary', forceplain=False)) buildopts['noprefix'] = get('noprefix', forceplain=False) + buildopts['worddiff'] = get('word_diff', 'word-diff', forceplain=False) return mdiff.diffopts(**pycompat.strkwargs(buildopts)) diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -702,6 +702,9 @@ for related options for the annotate com ``unified`` Number of lines of context to show. +``word-diff`` + Highlight changed words. + ``email`` --------- diff --git a/tests/test-diff-color.t b/tests/test-diff-color.t --- a/tests/test-diff-color.t +++ b/tests/test-diff-color.t @@ -304,7 +304,7 @@ test inline color diff > three of those lines have > collapsed onto one > EOF - $ hg diff --config experimental.worddiff=False --color=debug + $ hg diff --config diff.word-diff=False --color=debug [diff.diffline|diff --git a/file1 b/file1] [diff.file_a|--- a/file1] [diff.file_b|+++ b/file1] @@ -337,7 +337,7 @@ test inline color diff [diff.deleted|-(to see if it works)] [diff.inserted|+three of those lines have] [diff.inserted|+collapsed onto one] - $ hg diff --config experimental.worddiff=True --color=debug + $ hg diff --config diff.word-diff=True --color=debug [diff.diffline|diff --git a/file1 b/file1] [diff.file_a|--- a/file1] [diff.file_b|+++ b/file1] @@ -384,7 +384,7 @@ multibyte character shouldn't be broken > EOF $ hg ci -m 'slightly change utf8 char' utf8 - $ hg diff --config experimental.worddiff=True --color=debug -c. + $ hg diff --config diff.word-diff=True --color=debug -c. [diff.diffline|diff --git a/utf8 b/utf8] [diff.file_a|--- a/utf8] [diff.file_b|+++ b/utf8]