[PATCH V2 1/2] diff: add the --output option
Ahmed S. Darwish
darwish.07 at gmail.com
Tue Jul 9 18:20:49 CDT 2013
Hi,
On Wed, Jul 10, 2013 at 12:10:20AM +0200, Pierre-Yves David wrote:
>
> On 1 juil. 2013, at 18:25, Ahmed S. Darwish wrote:
>
> > # HG changeset patch
> > # User Ahmed S. Darwish <a.darwish at vireton.com>
> > # Date 1372695210 -7200
> > # Node ID c1aa2fdfc7b7a8fff58b192259dcdf4f74f7ada7
> > # Parent 648d1974b3f328947ee6cf2d00c66815a33cd208
> > diff: add the --output option
> >
> > For all shells which cannot save a command standard output correctly,
> > this option is now introduced.
> >
> > The most common example is Microsoft PowerShell, where the piped
> > output gets corrupted if saved using the standard, unix-like, stdout
> > rediction, '>' operator. By transforming the piped output to a
> > different encoding, PowerShell saves 'hg diff' patch output to a
> > format __not understandable__ by GNU patch and 'hg patch' commands.
>
> Really, that is an impressive level of failure. From the example you
> pasted it seems that line ending get converted.
>
Yes, but the main problem is not about line-endings; it's about the
entire patch encoding getting transformed from ASCII to UTF-16, making
it unappliable by all of our common command-line tools.
> But why are you adding it to diff only ? Output of any Mercurial
> commands can get corrupted. And multiple other commands export
> diff (log -p, export, …) A global setting would make more sense.
>
I don't think shelving code using `hg log -p' is that common, but
I might be wrong. `export' and `cat' already have their own --output
option.
> However, I would be sad to see such flag added when the shell is to
> blame.
I can understand your concern, but for good or bad PowerShell is
now the defacto shell for Windows 7+ machines :-(
The `--output FORMAT' option is already available for several other
commands; I don't think adding it for `hg diff' would break __any__
expectations.
> (question: have you considered patch hg import so it can import
> patch using such line ending ?)
>
`hg import' recognizing UTF16-encoded patches?
>
> Pierre-Yves David
>
Thanks,
--
Darwish
http://darwish.chasingpointers.com
More information about the Mercurial-devel
mailing list