[Bug 425510] Re: 'bzr mv' should do wildcard expansion on windows
Alexander Belchenko
bialix at ukr.net
Thu Sep 10 10:22:14 BST 2009
Vincent Ladeuil пишет:
>>>>>> "Maritza" == Maritza Mendez <martitzam at gmail.com> writes:
>
> <snip/>
>
> Maritza> I have not added any tests but I have verified
> Maritza> expected operation on both windows and linux.
>
> You certainly did that by typing bzr commands and a couple of
> shell ones to check the results.
>
> Can you show me ?
>
> I'm working on shell-like tests and would be immensely interested
> in addressing your needs here.
>
> Since the topic is also related to quote handling, I mention that
> I had to redefine shlex.split() for the needs of these shell-like
> texts and it's as easy as:
>
> def split(s):
> """Split a command line respecting quotes."""
> scanner = shlex.shlex(s)
> scanner.quotes = '\'"`'
> scanner.whitespace_split = True
> for t in list(scanner):
> # Strip the simple and double quotes since we don't care about them.
> # We leave the backquotes in place though since they have a different
> # semantic.
> if t[0] in ('"', "'") and t[0] == t[-1]:
> yield t[1:-1]
> else:
> yield t
>
> Adding glob expansion there, shouldn't be that hard either.
Vincent, please use my simple test I gave to John with windows paths
into unittest to your split():
In [13]: shlex.split('bzr init C:\\work\\foo\\bar')
Out[13]: ['bzr', 'init', 'C:workfoobar']
It should give on Windows the result as
['bzr', 'init', 'C:\\work\\foo\\bar']
More information about the bazaar
mailing list