[MERGE] Unit tests for win32 glob expansion

Martin Pool mbp at sourcefrog.net
Tue Jul 17 05:36:06 BST 2007


On 7/17/07, Kuno Meyer <kuno.meyer at gmx.ch> wrote:
> On 16.07.2007 15:08, Alexander Belchenko wrote:

> > I wonder, should we do normalization from '\\' to '/' as in osutils.py codebase?

Possibly, though probably not quite as part of globbing - there might
be non-globbed parameters that also want this done.

> >
> > [µ]
>
> I'm not familiar enough with the Bazaar code base to judge whether this
> normalization would have a benefit, or would just be redundant, or even
> counterproductive. I had the impression that internally bazaar converts
> everything to '/'.
>
> However, please take into account that win32utils.glob_expand() just
> gets invoked for the "add" command, and all other commands have to cope
> with direct user input. I'm wondering why the implementation is this
> way, as there are a lot of shortcomings: The command "bzr rm *.txt" for
> example returns with the error message "*.txt does not exist", even
> after "bzr add some.txt".

There's no strong reason why it's that way; it just hasn't been
addressed yet, and I'm happy that you're working on it.  I think what
we probably want is to mark some arguments as being filenames, or
possible globs.  The Command base class should be responsible for
expanding them.  It can then do the expansion consistently between
Windows and Unix - it would normally be inactive on Unix, but enabled
when run from the test suite.

> My intention was to move the the win32 glob expansion down to the
> beginning of run_bzr as soon as this patch was accepted. Then we would
> have a quite similar behaviour as under Linux for /all/ commands. If it
> makes sense to perform path normalisation there as well (either to '/'
> or to '\\'), then we should implement it. The only issue I see with that
> solution is, that the behaviour of "bzr ignore *.pyc" potentially would
> not be understood by Windows users.
>
> Let me know what you think, and whether I should continue without
> waiting for the current patch to be applied.

As Alexander says, expansion needs to be done only for selected
commands or arguments, but that should not be too hard.

-- 
Martin



More information about the bazaar mailing list