[MERGE] Remove the basis_tree parameter to record_iter_changes.

Robert Collins robert.collins at canonical.com
Wed Mar 18 02:01:59 GMT 2009


I'm reasonably happy with this now, its probably not perfect, and it
needs profiling in a CHK environment, but I'd at least like it reviewed
now. (Updated to remove an unused parameter).

Currently commit does the following:
tell CommitBuilder about every entry in a commit being performed.

This is conceptually bad - we cannot ever be faster than full tree
analysis.

So record_iter_changes is a replacement API, unit tested but not used by
commit.py yet, which only gets told about the changes to record. It
automatically takes care of merges by doing inventory deltas between the
basis tree and pending merges, and still uses the tree interface to
obtain the texts of files and symlinks.

Why isn't this used by commit.py yet? Well, for xml based inventories
the dirstate is a much better place to get parent information - its
already there - and accessing inventories isn't that cheap. For CHK
based inventories, its extremely cheap to get a delta between the basis
and all the pending merges, so we only want to use this when the
repository is a CHK based repository (or other repository where it will
be faster than the current code).

The good news is that this is conceptually inventory-free for the
*working tree* - so for a non-merge commit e.g. 'bzr commit NEWS', we do
not need to upcast the entire dirstate to a inventory, iterate the
entire thing, then serialise again, then get the basis inventory from
the repository and diff. Instead we will:
iter_changes the partial dirstate - one entry
transform that into an inventory delta - one entry
create the new inventory in the repository by add_inventory_by_delta -
which for CHK repositories will something like 8-12 IO's.

Anyhow - I'd love a review of this, and tomorrow I'll look at getting
the driver code in commit.py to execute this  based on the repository
(and a environment variable or something for testing). Who knows, it may
be faster even for xml - lots of things have been tuned since the last
major commit optimisation pass.

-Rob

-------------- next part --------------
A non-text attachment was scrubbed...
Name: commit-iterchanges-3805.patch
Type: text/x-patch
Size: 77900 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090318/ee314378/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090318/ee314378/attachment-0001.pgp 


More information about the bazaar mailing list