Comment 4 for bug 79336

Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 79336] Re: smart_add() relies on private function WorkingTree._write_inventory()

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

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?

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

iD8DBQFGAv1S0F+nu1YWqI0RAga8AJ9X5eOzEMX1W0ZuxcnuObfB90CcHwCfdahQ
hPLekf63uAClN4MsAFziAt4=
=fNym
-----END PGP SIGNATURE-----