PATCH: cache basis inventory in .bzr

John A Meinel john at arbash-meinel.com
Tue Dec 20 04:53:09 GMT 2005


Robert Collins wrote:
> On Mon, 2005-12-19 at 12:55 -0600, John A Meinel wrote:
>> Aaron Bentley wrote:
>>> John A Meinel wrote:
>> ...
>>
>>>>> It makes perfect sense to me to have a
>>>>> remote branch, which has no working tree, still have a basis inventory.
>>> The use case for a working tree basis inventory is to speed up diff,
>>> status, commit, and the like.  What's the use case for a branch basis
>>> inventory?
>> Yeah, I guess I had my thinking off. The basis inventory is well
>> defined, but it isn't useful, because you won't need it for comparison.
>> So I'll rework it to put get_basis_inventory back into WorkingTree.
>>
>> Should get_basis always succeed, even if it isn't cached? That seems
>> generally useful to me.
> 
> Yes. The caching is not part of the contract here IMO.

Done.

> 
>> Also, I wish there was some way to mark that the basis-inventory needed
>> to be updated. get_basis_inventory() shouldn't be deleting or modifying
>> the file (it is a readonly operation, and has to be, because it will be
>> called from other readonly operations).
>> For now, it should be updated after something happens which modifies it
>> (pull/commit).
> 
> uhm, in the working tree we have various caches updated during readonly
> locks - like the hash cache. I think the basis inventory is analogous to
> the hash cache here - it can be atomically updated without corruption.

Done.

> 
>> The other nice thing would be to read just the first line, and make sure
>> it was the right version, before going through the effort of actually
>> parsing the inventory.
>> I can think of a regex that should do a decent job.
>> Is it worth implementing, or is it just a hackish workaround?
> 
> Given the low frequency I'd expect mismatches to occur at : hackish
> premature optimisation.

Not done.

> 
> Rob

I think the branch fits the desired constraints. It maintains a file
.bzr/basis-inventory, which is kept up-to-date upon request. (revno 1481)

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051219/62a3e466/attachment.pgp 


More information about the bazaar mailing list