an option to print slash instead of backslash for stat

Christian Boos cboos at neuf.fr
Wed Jun 6 07:01:36 UTC 2007


Alexis S. L. Carvalho wrote:
> ...
> Help me understand the problem:
>
> - what's the problem with using backslashes on windows?
>   

Having 'hg status' output paths containing backslashes is a major 
nuisance when you work in a bash.exe shell and like to copy/paste the 
paths. You have to enclose them in single quote pairs first, or when 
building short scripts, you have to pipe the output first through a sed 
-e 's,\\,/,g' filter.

> - would every windows user want to use slashes?
>   

You need them for the same reason as above when working in a straight 
cmd.exe shell.

> - many other commands (add, remove, commit, ...) may also print paths
>   with backslashes.  Is status special, or is it just the most common
>   one?
>   

The most common one.

> - do you (almost) always want slashes, or are there still many cases
>   where you want backslashes?  I.e. do you always specify --slash
>   (either on the command line or in the [defaults] section of hgrc)?
>   

I would use it in the [defaults] section of hgrc.
But I suspect that using backslashes internally is also the reason that 
makes it very hard (at least for me) to deal with .hgignore patterns on 
Windows.

> I'm not completely opposed to this (running tests with pysh would
> probably benefit A LOT from something like this), but I think a "slash"
> option in the [ui] section would be better - maybe always using slashes
> would be even better, but I don't think all users would be happy if we
> do that...
>
> And it looks like it wouldn't be too hard to add this setting...
>   

It would be great if the situation would be addressed. A long time ago, 
I/someone suggested that we use only slashes internally (that would 
simplify a lot the code in some places, and python is happy with slashes 
on Windows, afaict) and use 'backslashes' only at the ui level, if needed.

-- Christian



More information about the Mercurial mailing list