PATCH: cache basis inventory in .bzr

Robert Collins robertc at robertcollins.net
Thu Nov 24 23:16:12 GMT 2005


On Thu, 2005-11-24 at 21:09 +0100, Johan Rydberg wrote:
> > The attached patch caches the contents of the basis (last revision)
> > inventory in a control file in .bzr.  This make it possible to get a
> > copy of the basis tree without reading the inventory weave.  This
> will
> > (hopefully) speed up operations such as "bzr status", esp if someone
> > gets a few minutes over to fix the hashcache which seems to be
> broken
> > right now (it never gets written out.)
> 
> Here's an updated version.

> 
> === modified file 'bzrlib/branch.py'
> --- bzrlib/branch.py    
> +++ bzrlib/branch.py     

...


Couple of things: the code for this should be in WorkingTree, not
Branch. (Its a property of the WorkingTree that it is at revision X, and
thus that the cached inventory has value FOO.)

Secondly, there are other operations than commit that change the
last_revision property of a working tree:
pull
push (with rsync)
potentially undo/redo
and currently anything that calls branch.set_revision_history (*)

So, I think that having a method on WorkingTree 'set_last_revision',
which takes care of this, would be a good idea. The data does not need
to be cached in the object, just blatted to disk. This allows the
branch.set_revision_history method to call
self.working_tree().set_last_revision(history[-1]) for now... and we
should ensure that all the current code that expects to change the
working tree does so via the tree, which will remove that temporary
wart.

Cheers,
Rob



-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051125/05ddd006/attachment.pgp 


More information about the bazaar mailing list