[MERGE][Bug #64783] Fixing check to understand the split-up .bzr format

Aaron Bentley aaron at aaronbentley.com
Tue Mar 25 01:41:58 GMT 2008


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

Daniel Mark Watkins wrote:
> On Fri, 14 Mar 2008 15:53:38 +0000
> John Arbash Meinel <john at arbash-meinel.com> wrote:
>> my only complaint is that your:
>> +    def test_open_containing_tree_branch_or_repository(self):
>>
>> is testing too much in a single test case. I would ask that you split
>> it up into testing each case as a separate test case.
> Fixed in attached.  Also updated to land in 1.4.

bb:tweak

> +    @classmethod
> +    def open_containing_tree_branch_or_repository(klass, location):
> +        """Return the branch, working tree and repo contained by a location.
> +
> +        Returns (tree, branch, repository).
> +        If there is no tree containing the location, tree will be None.
> +        If there is no branch containing the location, branch will be None.
> +        If there is no repository containing the location, repository will be
> +        None.
> +
> +        If no branch, tree or repository is found, a NotVersionedError is
> +        raised.
> +        """
> +        try:
> +            tree, branch, relpath = \
> +                klass.open_containing_tree_or_branch(location)
> +        except errors.NotBranchError:
> +            try:
> +                repo = klass.open_containing(location)[0].find_repository()
> +                return None, None, repo
> +            except (errors.NoRepositoryPresent, errors.NotBranchError):
> +                raise errors.NotVersionedError(location)

^^^ It would be a bit more efficient to call klass.open_containing, and
then call BzrDir._get_tree_branch

> +    def test_open_containing_tree_branch_or_repository_branch_subdir(self):
> +        self.make_branch_and_tree('foo')
> +        os.mkdir('foo/bar') #XXX

^^^ This says either too little or too much.

> +    def test_open_containing_tree_branch_or_repository_repo_subdir(self):
> +        self.make_repository('bar')
> +        os.mkdir('bar/baz') #XXX

^^^ This says either too little or too much.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH6Fhm0F+nu1YWqI0RAlW2AJ0WJhqe6kpIL6Ze5W2TlASsVkosbwCdGd1n
htHCLsnrWX70lIzhSD+YFh0=
=r6x/
-----END PGP SIGNATURE-----



More information about the bazaar mailing list