Mpaa added a comment.
It depends on how difflib tags the changes.
After the first line, there is no formatting line, so the only thing I can do
is mark it red.
After the second, there is format indication, in this case it indicates that
spaces have been added (which are colored in green but not visible ...)
- Foo bar Pywikipediabot foo bar\n
+ Foo bar Pywikipediabot foo bar\n
? ++ ++ ++ ++\n
- Pywikipediabot foo\n'
+ Pywikipediabot foo\n
? ++\n
In the second case (which you have not reported, I include it here as ref),
final whitespace have been trimmed.
Format information is provided and so a more precise coloring can be done:
- \\03 Pywikipediabot \n', '
? -\n
+ \\03 Pywikipediabot \n
? +\n
- \\03 foo Pywikibot foo\n
? -\n
+ \\03 foo Pywikibot foo\n
? + ++\n
Regarding the tests, the best approach IMO is to write tests for the Hunk
class in diff.py, which is he class in charge of formatting changes.
Do you have any opinion?
Possible improvements can be done on how SequenceMatcher in difflib is used
(parameters, word by word comparison, etc.)
TASK DETAIL
https://phabricator.wikimedia.org/T130572
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Mpaa
Cc: gerritbot, Mpaa, Aklapper, jayvdb, pywikibot-bugs-list, Lewizho99, Mdupont,
Maathavan
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs