Mercurial > hg
diff mercurial/cmdutil.py @ 35277:6ba79cf34f5e
patch: add within-line color diff capacity
The `diff' command usually writes deletion in red and insertions in green. This
patch adds within-line colors, to highlight which part of the lines differ.
Lines to compare are decided based on their similarity ratio, as computed by
difflib SequenceMatcher, with an arbitrary threshold (0.7) to decide at which
point two lines are considered entirely different (therefore no inline-diff
required).
The current implementation is kept behind an experimental flag in order to test
the effect on performance. In order to activate it, set inline-color-diff to
true in [experimental].
author | Matthieu Laneuville <matthieu.laneuville@octobus.net> |
---|---|
date | Thu, 26 Oct 2017 00:13:38 +0900 |
parents | c7b45db8f317 |
children | 82ee401135dd |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Thu Sep 22 18:23:58 2016 +0900 +++ b/mercurial/cmdutil.py Thu Oct 26 00:13:38 2017 +0900 @@ -1518,7 +1518,7 @@ width = 80 if not ui.plain(): width = ui.termwidth() - chunks = patch.diff(repo, node1, node2, match, changes, diffopts, + chunks = patch.diff(repo, node1, node2, match, changes, opts=diffopts, prefix=prefix, relroot=relroot, hunksfilterfn=hunksfilterfn) for chunk, label in patch.diffstatui(util.iterlines(chunks), @@ -1526,7 +1526,7 @@ write(chunk, label=label) else: for chunk, label in patch.diffui(repo, node1, node2, match, - changes, diffopts, prefix=prefix, + changes, opts=diffopts, prefix=prefix, relroot=relroot, hunksfilterfn=hunksfilterfn): write(chunk, label=label)