[MERGE][0.16][bug #111127] Properly handle 'a/' and 'a-b' directories

John Arbash Meinel john at arbash-meinel.com
Mon Apr 30 18:21:21 BST 2007

Hash: SHA1

It turns out that our path iterator code has some problems when we have
paths with '-' in them. This is because "a/b" sorts after "a-X", but
('a', 'b') sorts before ('a-X',).

And since dirstate is maintained in the former sorting, we have to make
sure our iteration takes that into account.

The attached bundle adds a test for intertree, and fixes it by using
".split('/')" when appropriate.

I've thought about the performance impact, but we currently use "path !=
block" as a first trap. Which means that we are fortunate to compare
just the string paths, and only if they don't match do we do the .split().

Which means that we aren't calling .split() for every filename, only for
ones which don't match. So the only time you would have overhead is if
you had a directory with 1000 unknown files.

We could improve things a little bit by caching the split value and
reseting whenever we iterate to the next. But then you have to say "if X
is None: X = foo.split()" and have a "X = None" whenever you increment
an iterator. So I think there would be no real gain for a lot of extra code.

This is yet another dirstate regression, so it would be good to get it
into 0.16. I'm not sure it requires an 0.16rc3. But if we get it
quickly, maybe it is worth it.


PS> I'll probably have another dirstate regression fix in an hour or so,
so maybe with both of them it is worth 0.16rc3.
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mixed_names_111127.patch
Type: text/x-patch
Size: 13427 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070430/7db946cf/attachment-0001.bin 

More information about the bazaar mailing list