Mercurial changing to autocrlf?

Martin Geisler mg at aragost.com
Mon May 31 09:50:33 UTC 2010


<toni.arte at nokia.com> writes:

>>> We have one specific problem, which is that we have seen files with
>>> '\r\r\n' as the EOL, and we want the mapping to be as automatic as
>>> possible since we are using this as a part of an automatic sync tool.
>>> Without this change it would fail with the 'inconsistenteol' exception
>>> if it encounters any of those.
>>
>>I'm wondering if we should remove the check in general or perhaps make
>>it configurable? We could have an option to ignore repeated \r and
>>another option option that will ignore inconsistent EOLs.
>
> I was thinking the same. I was playing with the idea of having something
> like:
>
> [eol]
> inconsistenteol = strict|relaxed
>
> on the .hgrc (or .hgeol on the repo), to tell whether the eol
> extension should have strict checking for inconsistent eol use. I just
> wasn't competent enough with Python and the internals of Mercurial to
> implement it.

Yeah, it also confused me for a while how to get the configuration
setting brought over to where it is needed... but it turns out that the
filters are called with an ui argument and so it was easy after all.


I've pushed this changeset

  http://bitbucket.org/mg/hg-eol/changeset/d44293195563

which does two things:

* introduces a eol.skip-inconsistent Boolean setting. If anybody can
  come up with a better/shorter name, then I would love to hear it.

* makes it clear that we are not caring about old Mac files with \r in
  them. We therefore define an EOL to look like '\r*\n' which matches
  both Unix and (broken) Windows line endings.


Please look over the code a final time... after that, I think we can
move this to the hgext dir tonight.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/mercurial/



More information about the Mercurial mailing list