[RFC] Inventory.__delitem__ considered harmful

Martin Pool mbp at canonical.com
Thu Sep 7 13:32:13 BST 2006

On  7 Sep 2006, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:
> Robert Collins wrote:
> > Inventory.__delitem__ is rather dangerous at the moment: it breaks the
> > inventory invariant that all the parents of an entry are present in the
> > inventory.
> > 
> > I'd like to just remove it with extreme prejuidice - any objections?
> TreeTransform uses it: see TreeTransform._apply_removals.  Can we just
> fix it so it doesn't violate that invariant?  

I suspect Robert wanted to get rid of it as a general move towards
hiding the mutable inventory inside the working tree -- so code will say
WorkingTree.unversion rather than del Inventory[].

> I can't think of a better
> way to express the functionality TreeTransform needs than del
> inventory[file_id].

I'm somewhat less keen than I once was on making objects support
collection protocols if they're not really collections, rather than
having Inventory.remove().


More information about the bazaar mailing list