changeset 38591:be441eb65f09

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.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 08 Jul 2018 16:21:26 +0900
parents f068495a1c28
children 21be76e07148
files mercurial/configitems.py mercurial/diffutil.py mercurial/help/config.txt tests/test-diff-color.t
diffstat 4 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/configitems.py	Fri Jul 06 12:47:02 2018 -0700
+++ b/mercurial/configitems.py	Sun Jul 08 16:21:26 2018 +0900
@@ -147,6 +147,9 @@
 coreconfigitem('annotate', 'noprefix',
     default=False,
 )
+coreconfigitem('annotate', 'word-diff',
+    default=False,
+)
 coreconfigitem('auth', 'cookiefile',
     default=None,
 )
@@ -399,6 +402,9 @@
 coreconfigitem('diff', 'noprefix',
     default=False,
 )
+coreconfigitem('diff', 'word-diff',
+    default=False,
+)
 coreconfigitem('email', 'bcc',
     default=None,
 )
@@ -512,9 +518,6 @@
 coreconfigitem('experimental', 'evolution.track-operation',
     default=True,
 )
-coreconfigitem('experimental', 'worddiff',
-    default=False,
-)
 coreconfigitem('experimental', 'maxdeltachainspan',
     default=-1,
 )
--- a/mercurial/diffutil.py	Fri Jul 06 12:47:02 2018 -0700
+++ b/mercurial/diffutil.py	Sun Jul 08 16:21:26 2018 +0900
@@ -53,7 +53,6 @@
         '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 @@
         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))
--- a/mercurial/help/config.txt	Fri Jul 06 12:47:02 2018 -0700
+++ b/mercurial/help/config.txt	Sun Jul 08 16:21:26 2018 +0900
@@ -702,6 +702,9 @@
 ``unified``
     Number of lines of context to show.
 
+``word-diff``
+    Highlight changed words.
+
 ``email``
 ---------
 
--- a/tests/test-diff-color.t	Fri Jul 06 12:47:02 2018 -0700
+++ b/tests/test-diff-color.t	Sun Jul 08 16:21:26 2018 +0900
@@ -304,7 +304,7 @@
   > 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 @@
   [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 @@
   > 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]