Comment 5 for bug 79336

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 79336] Re: smart_add() relies on private function WorkingTree._write_inventory()

On Thu, 22 Mar 2007 18:04:02 -0400
Aaron Bentley <email address hidden> wrote:
> Jelmer Vernooij wrote:
> > On Wed, 21 Mar 2007 15:57:06 -0000
> > Aaron Bentley <email address hidden> wrote:
> >> WorkingTree._write_inventory was "privatized" after it was already
> >> in use by TreeTransform and smart_add, and no substitute has been
> >> made available.
> >>
> >> I think the bug is that _write_inventory is private.
> > Implementing _write_inventory will be a major pain for bzr-svn, but
> > I can see why it's being used in smart_add() and TreeTransform.
> > Something like it would be required for merge and revert in working
> > copies in bzr-svn anyway.
> >
> > summary "WorkingTree._write_inventory() should be public"
>
> Robert and I have just discussed a possible interface to substitute
> for _write_inventory.
>
> It would be called WorkingTree.apply_inventory_delta(). Its argument
> would be a list of tuples of (old_path, new_path, new_entry). The new
> entry would be a new InventoryEntry of the correct type, which
> whatever updated fields were necessary. The delta would be applied
> as a single operation, not as a sequence. So it would be legal to
> supply:
>
> [('path_a', 'path_b', entry_1), ('path_b', 'path_a', entry_2)]
>
> Even though applying the operations sequentially would result in
> entry_1 being renamed on top of entry_2, this would not happen
> because the delta is considered to be applied atomically.
>
> For WorkingTree2/3, this would just use write_inventory internally.
> For WorkingTree4, I think Robert will write something.
>
> Does this proposed interface make sense for you? Would it be
> reasonably easy to implement on SVN?
Yes, I think that would make it significantly easier. It would still
convert this sequence to a lock
+ a bunch of add/remove/copy operations.

Later on, when we've got our own parser of the .svn/ directory we could
modify the XML directly. That's still some time away though

Cheers,

Jelmer
--
Jelmer Vernooij <email address hidden>
http://samba.org/~jelmer/