Patchwork diff: graduate word-diff option from experimental

login
register
mail settings
Submitter Yuya Nishihara
Date July 8, 2018, 12:26 p.m.
Message ID <be441eb65f09603386f8.1531052777@mimosa>
Download mbox | patch
Permalink /patch/32686/
State Accepted
Headers show

Comments

Yuya Nishihara - July 8, 2018, 12:26 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1531034486 -32400
#      Sun Jul 08 16:21:26 2018 +0900
# 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.

Patch

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]