recursive commands?

John Arbash Meinel john at arbash-meinel.com
Thu Aug 6 14:59:01 BST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Adrian Wilkins wrote:
>> From: "Michael B. Trausch" <mbt at zest.trausch.us>
> 
>> I think it is different on Windows, but I think that Python probably
>> emulates sane behavior there.  Someone who knows anything about Python
>> on Win32 would be able to clear that up, I think.
> 
> Bazaar expands globs on some commands via the _maybe_expand_globs method
> on the command class. It uses the Python glob library.
> 
> This of course leads to different behaviour between platforms because
> some commands don't expand globs (e.g. ignore) because they had no need
> to do so, so on Windows, quoting globs is unnecessary. I've got into the
> habit of doing it anyway because I use Linux quite a lot as well now.
> 

It's actually a bit worse than that. Because the windows shell doesn't
expand globs, but *does* expand quotations, we don't have a way to tell
if something is quoted. For example:

bzr ignore *
bzr ignore "*"

In both cases we will get:

sys.argv == ['bzr', 'ignore', '*']

And that means that we will have no way to tell that the user really
meant to supply a pattern versus they really meant to expand the glob.

So we default to one way or the other based on what is the most likely
use case. (add * is expanded, ignore * is not.)

The only thing we *could* do is to look at single quoted strings, since
Windows doesn't do anything with them. For example:

bzr ignore 'foo bar'
becomes

sys.argv = ["bzr", "ignore", "'foo", "bar'"]


Of course, that would then assume that people never use apostrophe's in
their filenames.

Anyway it is generally an ugly mess, and you are far better off figuring
out a good GUI for it. :)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkp64aUACgkQJdeBCYSNAAPTFACeKg1XGaq/s98o08xGVnVAW4ol
41sAoKevUltAnLJsIhT3B2sAsN4KFJQQ
=2mmQ
-----END PGP SIGNATURE-----



More information about the bazaar mailing list