comparison mercurial/mdiff.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 1d804c22c671
children 2f123f309f61
comparison
equal deleted inserted replaced
35276:205c3c6c1a51 35277:6ba79cf34f5e
65 'ignorewsamount': False, 65 'ignorewsamount': False,
66 'ignorewseol': False, 66 'ignorewseol': False,
67 'ignoreblanklines': False, 67 'ignoreblanklines': False,
68 'upgrade': False, 68 'upgrade': False,
69 'showsimilarity': False, 69 'showsimilarity': False,
70 'worddiff': False,
70 } 71 }
71 72
72 def __init__(self, **opts): 73 def __init__(self, **opts):
73 opts = pycompat.byteskwargs(opts) 74 opts = pycompat.byteskwargs(opts)
74 for k in self.defaults.keys(): 75 for k in self.defaults.keys():