pythonsvndiffpygtkunified-diff

Render Unified Diff with Python


I have a string which contains svn unified diff. My PyGTK app need to show this diff to user, and I want to render it like other diff tools do, or at least have it colorized.

Do you have something to suggest, external tool, library, custom implementation...? I was loking at http://kafka.fr.free.fr/diff2html/ but I prefer to use some library or sth like that, so users don't need to install third party apps.

I want use this for git and mercurial diffs later as well.


Solution

  • You could use difflib to generate diffs, and pygtkscintilla for syntax-highlighting, line-numbering, code-folding, etc.

    If you only want syntax-highlighting (as opposed to all the editor features offered by pygtkscintilla), then you could also look at pygments.