Feature request in 'hg diff'
Thomas Arendsen Hein
thomas at intevation.de
Tue Jan 22 20:57:52 UTC 2008
(only continuing on -devel because of the patch discussion)
* dhruva <dhruvakm at gmail.com> [20080122 11:18]:
> On Jan 20, 2008 10:49 PM, Thomas Arendsen Hein <thomas at intevation.de> wrote:
> > * dhruva <dhruvakm at gmail.com> [20080120 05:20]:
> > > Since I keep working with HG on top of a CVS repo, I keep getting
> > > into EOL differences. I would like to ignore them. Basically, if the
> > > diff is only in EOL, I (and mercurial) would like to treat the file as
> > > not changed.
> > > I am currently using the external diff (GNU diff) with the option
> > > '--strip-trailing-cr' but this does not affect the way mercurial
> > > treats changes. I can use if only to view the changes.
> >
> > +1 on adding this to diff, export, log -p etc.
>
> I have implemented it for 'diff'. With this, I no longer need to have
> an external diff configured for ignoring eol changes. I am sending a
> patch on current crew tip.
Some comments on your code below.
> I am not sure if it is a better idea to have a 'diff' extension.
In general I don't now, but this change should go into core.
> + ('e', 'ignore-eol', None,
> + _('ignore end of line changes')),
For GNU diff compatibility this should be --strip-trailing-cr with
no short option, and it should be available for at least hg export,
too.
> @@ -57,6 +58,8 @@ def wsclean(opts, text):
> text = re.sub('[ \t]+\n', '\n', text)
> if opts.ignoreblanklines:
> text = re.sub('\n+', '', text)
> + if opts.ignoreeol:
> + text = re.sub('\r\n', '\n', text)
Doing what --strip-trailing-cr implies seems better here, otherwise
the CR survives if there are other changes on the same line or
within context range.
GNU diff manpage says: "Strip trailing carriage return on input."
And I think this is the right thing to do.
Thomas
--
thomas at intevation.de - http://intevation.de/~thomas/ - OpenPGP key: 0x5816791A
Intevation GmbH, Osnabrueck - Register: Amtsgericht Osnabrueck, HR B 18998
Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
More information about the Mercurial-devel
mailing list