Converting binary<->textual - what to do (hooks?, extension?, custom merge?)

Matt Mackall mpm at selenic.com
Wed Feb 6 10:03:28 CST 2008


On Wed, 2008-02-06 at 13:49 +0100, Marcin Kasperski wrote:
> Well, the not-so-rare (I think) scenario.
> 
> There is some app which uses custom binary format to save the files.
> But this app is also able to export/import to/from textual readable
> format.
> 
>   (typical example - exporting some document, spreadsheet
>    etc to the XML format, not-so-rare one - bare unzipping
>    compressed XML used by some app, my own use case - exporting
>    binary chess database to PGN, etc)
> 
> In such a situation it is really tempting to version-control the
> exported (textual) version instead of native binary. For at least
> three reasons:
> 
> - normal merge is possible,
> - save is usually more compact,
> - in multiplatform cases it happens that textual format is portable
>   while binary one is not
> 
> So - is it possible to have mercurial automatically convert the
> data format? And what is the best approach?

See the encode/decode sections of the hgrc manpage.

But in general, you'd be better off doing this with a Makefile..

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial mailing list