[MERGE] Fix for poor bzr rm * performance in trunk

Ian Clatworthy ian.clatworthy at internode.on.net
Wed May 6 08:23:05 BST 2009


Johan Walles wrote:
> Here's an updated patch with the following new changes in it:
> * Existing unit test updated.
> * The resulting test failure fixed.
> * Updated the NEWS file.

Thanks. This is really close now IMO.

bb:tweak

I'd like 2 changes made:

1. As we're not actually fixing a logic bug, I'd like the
   NEWS item added (alphabetically) under Improvements instead of Bugs.

2. I think we can simplify this code further ...

> +    for path in sorted_paths:
> +        if len(search_paths) == 0:
> +            # Result is empty, add first path
> +            search_paths.append(path)
> +            continue
> +        if not is_inside(search_paths[-1], path):
> +            # This path is unique, add it
> +            search_paths.append(path)
> +            continue

into something like ...

search_paths = [sorted_paths[0]]
for path in sorted_paths[1:]:
    if not is_inside(search_paths[-1], path):
        ...

You don't need the closing continue either. Oh, and as the above code
I'm proposing assumes that there is at least 1 item in sorted_paths, we
need a test right at the top of the routine something like ...

  if not paths:
      return set()

Make sense?

Ian C.



More information about the bazaar mailing list