Line ending translation extension

Mike Meyer mwm at mired.org
Tue Sep 8 09:48:36 CDT 2009


On Tue, 08 Sep 2009 10:19:34 -0400
Douglas Philips <dgou at mac.com> wrote:

> On or about 2009 Sep 8, at 8:31 AM, toni arte indited:
> > I only see this kind of hooks as a major annoyance to the end-users.  
> > There should be a way to configure the system to silently do the  
> > 'right thing' (TM).
> Sorry, I disagree. CVS's stoopidities, where it thought it was "doing  
> the right thing", have burned me way too many times for me to want to  
> ever use a system that does that again.

I don't know what CVS did. I've seen systems do it right:

1) When you checked a file into the repo, line endings are converted from
   platform-specific to the SCM's internal format, as part of
   converting them to the internal character encoding.
2) When you checked out a file, line endings are converted to the correct
   form for the platform you're checking them out on, as part of converting
   to the encoding that that platform used.

This works across multiple Unix platforms, Windows, Macs (both pre and
post Apple switching to Unix), BeOS, Amiga's, etc.

This isn't "quietly changing things behind the scenes", any more than
converting a document from ASCII to EBCDIC (or from some IBM Code page
to ISO-Latin-1 or UTF-8 if you don't remember EBCDIC) is. It's pretty
much required to correctly translate the document between two
environments that use different encodings for various characters. That
the two most common environments share encodings with a single
difference makes it possible to replace this process with "hooks" and
other such hacks, but they're still just hacks.

> Mercurial, IMHO, does the correct thing, and provides hooks so that  
> you can customize it.

I, on the other hand, have been burned to many times by systems like
that. A new user shows up, checks things out, loads them into his
"smart" tools that quietly convert alien line endings to the platform
native version, makes a one-line change, and checks in resulting in a
changeset that then includes every line in the file.

     <mike
-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org


More information about the Mercurial mailing list