Another MSYS puzzle
Adrian Buehlmann
adrian at cadifra.com
Sun Jun 10 22:27:00 UTC 2012
On 2012-06-11 00:17, Adrian Buehlmann wrote:
> Encountered on test-walk.t:
>
> What do you think is MSYS handing to Mercurial with the command below?
>
> $ hg debugwalk -I 'relpath:../beans'
>
> Answer:
>
> The value of the include option we get is: 'relpath;..\beans' (!)
>
> Note that (a) ':' -> ';' and (b) slash -> backslash.
>
> That's because MSYS thinks the argument is colon-separated list of POSIX
> paths that needs to be converted to a Windows list of paths:
>
> http://www.mingw.org/wiki/Posix_path_conversion
>
> On Windows, the path sep is ';'.
>
> Effect: Test fails.
>
> Wanted: Idea how to handle this.
For the adventurous who would like to play with test-walk.t, I recommend
to apply:
debugwalk: observe ui.slash config option
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2371,11 +2371,14 @@
items = list(repo.walk(m))
if not items:
return
+ f = lambda fn: fn
+ if ui.configbool('ui', 'slash') and os.sep != '/':
+ f = lambda fn: util.normpath(fn)
fmt = 'f %%-%ds %%-%ds %%s' % (
max([len(abs) for abs in items]),
max([len(m.rel(abs)) for abs in items]))
for abs in items:
- line = fmt % (abs, m.rel(abs), m.exact(abs) and 'exact' or '')
+ line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
ui.write("%s\n" % line.rstrip())
@command('debugwireargs',
More information about the Mercurial-devel
mailing list