Line ending translation extension

Dj Gilcrease digitalxero at gmail.com
Sun Sep 6 16:39:02 CDT 2009


On Sat, Sep 5, 2009 at 5:46 PM, Martin Geisler <mg at lazybytes.net> wrote:
> Anyway, for improving win32text or for a new extension -- I'm attaching
> a rough beginning of an extension which will parse a .hgeol file in the
> tip changeset and adds encode/decode filters based on that. The idea is
> that everybody can enable the extension globally since it will only add
> safe filters. One can add a section like this to Mercurial.ini to
> override the native line-ending:

I decided to play with this a bit and changed the tocrlf to;

def tocrlf(s, *args):
    s = s.replace('\r\n', '\n').replace('\r', '\n').replace('\n', '\r\n')
    return s

which was an order of magnitude faster (on a 5mb file) then the regex
version thats in win32text

though I cannot seem to figure out what hook is supposed to point to
reposetup, which based on the content is what actual defined the
encode/decode settings based on the patterns in the hgeol, so  cannot
seem to test it correctly


More information about the Mercurial-devel mailing list