Re: Using Meld as a Standalone Compare Library in Webapp?



On 10 July 2010 19:29, Victor Hooi <victorhooi yahoo com> wrote:
> heya,
>
> I'm creating a small Python webapp (probably with Django) that aims to
> compare a number of key server config files against a original "golden
> source" image. There might be quite a few servers (e.g. 20 or so), and each
> would be compared against the main server image, on a number of key files.
>
> I was hunting around for a Javascript or Python library that might be able
> to do it, and I did find jslib:
>
> http://snowtide.com/jsdifflib
>
> However, the output isn't quite as "pretty" as Meld, and also, it doesn't,
> for example, flag changed words in a line.

This is done in a very simple way; after generating the first
file-wide diff, we just re-diff individual 'changed' chunks to get the
inline highlighting.

> I'm wondering how hard it would be to abstract away Meld's compare and
> visual diff engine, to use in a webapp?

It would probably be more effort than writing it yourself. The
prettiness is also quite tied to our GTK/Cairo drawing, and I suspect
that replicating the interactivity in HTML/JS is... difficult.

> Or is there anything in existence
> that does something similar, or any way to do it now?

I'd suggest looking at Review Board (http://www.reviewboard.org/)
which has its own implementation of several bits and pieces of diff
machinery, and is even Django-based. Having said that, you could
probably get something working based on Python's built-in difflib very
quickly (this is more-or-less one of the jsdifflib options).

cheers,
Kai


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]