[attn aaron] WorkingTree._write_inventory/_set_inventory considered harmful
Aaron Bentley
aaron.bentley at utoronto.ca
Fri Jul 28 17:58:40 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
> On Thu, 2006-07-27 at 09:43 -0400, Aaron Bentley wrote:
>>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.
>
>
> So - 'add' - adds a file or dir or symlink that is on disk, with a
> fileid. Is the tree allowed to stat the file at that point? (or can you
> provide a stat and sha1 value ?)
In some cases (e.g. when moving files), I will have an inventory entry
already, so it seems best to provide a way to add an inventory entry
directly. That inventory entry may also have children.
I'm not sure whether I'll always have stat and sha1, but I think it's
possible to provide it.
> 'remove' - remove a file or dir or symlink from the current working
> inventory. Should it remove children ?
Since the purpose of removing an inventory entry may be to add it
somewhere else, it should remove children.
> Do you represent moves as a remove of the entry, then an add of an entry
> with the same id ?
Yes. Doing it this way avoids ordering issues.
> Is lookup 'fileid->path' ?
No, fileid->InventoryEntry. Perhaps we can continue using
self.wt.inventory[file_id] for this.
>>Or alternatively, we can provide a list of files / ids affected by the
>>transform, so you can use that to avoid a full rescan.
>
>
> That might work, though I think mutation is probably better.
I'll add that if we start ever support 'bk edit'-style functionality,
we'll likely want that anyhow. But perhaps YAGNI.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEykJA0F+nu1YWqI0RAheoAJ9WJHmGOi9pgvLK1AaOHsNKTE5MCQCdFOAz
VgibAYmr8OAVB4tmBHWi59g=
=VPq8
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list