[MERGE] Improve tests for the behaviour of Tree.iter_changes for missing paths that are only present in one tree, and fix found bugs. (Robert Collins)

Robert Collins robertc at robertcollins.net
Wed Aug 13 08:35:52 BST 2008


On Wed, 2008-08-13 at 17:14 +1000, Andrew Bennetts wrote:
> Robert Collins wrote:
> > This makes the behaviour of missing files that are only in one tree
> > consistent for all our InterTree implementations.
> [...]
> 
> bb:tweak
> 
> > +    def test_only_in_source_and_missing(self):
> > +        tree1 = self.make_branch_and_tree('tree1')
> > +        tree2 = self.make_to_branch_and_tree('tree2')
> > +        tree2.set_root_id(tree1.get_root_id())
> > +        self.build_tree(['tree1/file'])
> > +        tree1.add(['file'], ['file-id'])
> > +        os.unlink('tree1/file')
> > +        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
> > +        root_id = tree1.path2id('')
> > +        if not tree1.path2id('file'):
> > +            # The locked test trees conversion could not preserve the missing
> > +            # file status. This is normal (e.g. InterDirstateTree falls back
> > +            # to InterTree if the basis is not a DirstateRevisionTree, and
> > +            # revision trees cannot have missing files. 
> > +            return
> 
> Hmm, wouldn't raising TestNotApplicable be more appropriate than just returning?

TestNotApplicable, because its an exception, shows up as an error or
failure in a downlevel test runner. That doesn't match what is going on
here. (Or to put it another way, I don't like TestNotApplicable all that
much, because 'raise' and 'not a problem' just don't fit in my head).

-Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080813/c90fba99/attachment.pgp 


More information about the bazaar mailing list