[attn aaron] WorkingTree._write_inventory/_set_inventory considered harmful
aaron.bentley at utoronto.ca
Thu Jul 27 14:43:47 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Robert Collins wrote:
> Hi Aaron,
> I note that TreeTransform uses private tree interfaces to update the
> working inventory.
You mean Tree._write_inventory?
I can and will make this work with dirstate, but its
> going to be relatively inefficient I suspect (compared to mutating the
> data we have as we do operations - for example, after setting a file in
> the transform, we could fstat it to get the stat value and put that
> straight into the dirstate.
Until we're in TreeTransform.apply(), all of the operations are subject
to change. Storing the data in the dirstate before then would mean
having to keep the TreeTransform and the dirstate data in sync.
> IIRC the reason you do this is so that you dont have an inventory that
> violates the invariants of an inventory, during the transform?
No, it was for performance. All of the WorkingTree inventory
opererations (e.g. WorkingTree.add) write to disk, and I want to perform
a bunch of operations without hitting disk every time.
> I think it would make sense to extend the working tree interface to
> allow all the operations TT needs to do to be done via it (efficiently),
> which would allow us to manage the dirstate data and not force a rescan
> at the end of the merge.
Pardon? What is a rescan, and doesn't dirstate include all the
inventory stuff already?
If it is more efficient to express these updates as changes to the
inventory, rather than as replacement of the inventory, that's fine
with me. We'd need an interface that allowed us to perform a bunch of
operations without hitting disk. The changes would still be performed
in TreeTransform.apply, then.
The operations needed are add, remove and lookup.
Or alternatively, we can provide a list of files / ids affected by the
transform, so you can use that to avoid a full rescan.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the bazaar