[MERGE] Minor tree and dirstate code cleanups

Ian Clatworthy ian.clatworthy at internode.on.net
Fri Sep 14 02:59:24 BST 2007


Robert Collins wrote:

> -header line = "#bazaar dirstate flat format 2", NL;
> +header line = "#bazaar dirstate flat format N", NL;
> 
> This is an incorrect change to make. Its not a substitution variable,
> its is the specification for format 2.

But it's up to 3 now. Is 2-> 3 ok with you?
> 
> This hunk:
> -    :return: a set of (path, file ids) for the specified filenames
> +    :return: a set of file ids for the specified filenames
>      """
>      not_versioned = []
>      interesting_ids = set()
> 
> looks suspicious

It does but it's correct. The doc really is wrong.

> What is this:
> @@ -275,7 +274,8 @@
>      def _directory_is_tree_reference(self, relpath):
>          # as a special case, if a directory contains control files
> then 
>          # it's a tree reference, except that the root of the tree is
> not
> -        return relpath and osutils.isdir(self.abspath(relpath) +
> u"/.bzr")
> +        return len(relpath) > 0 and \
> +            osutils.isdir(self.abspath(relpath) + u"/.bzr")
> 
> change for?

I was trying to make it clear that we're testing for 'not root'.

  relpath != ''

would be equally clear or perhaps better. If relpath was 0 (very
unlikely), the test would fail unexpectedly. It's not so much an issue
with Python but this paranoia comes from my Perl days when a directory
called '0' really would be evaluated as False.

I'm happy to back that bit out btw - just explaining why I changed it.

Ian C.



More information about the bazaar mailing list