jenkins-bot has submitted this change and it was merged.
Change subject: Improve diff algorithm ......................................................................
Improve diff algorithm
Use format indication for added lines only once.
Bug: T136511 Change-Id: I608f2c97565abe897404af2ccd33dc59e6a4619d --- M pywikibot/diff.py 1 file changed, 4 insertions(+), 0 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/diff.py b/pywikibot/diff.py index 5c86c5d..6ea3acd 100644 --- a/pywikibot/diff.py +++ b/pywikibot/diff.py @@ -125,6 +125,10 @@ continue if line2.startswith('?'): yield self.color_line(line1, line2) + # do not try to reuse line2 as format at next iteration + # if already used for an added line. + if line1.startswith('+'): + line2 = '' continue if line1.startswith('-'): # Color whole line to be removed.
pywikibot-commits@lists.wikimedia.org