[MERGE] Graph.heads()

John Arbash Meinel john at arbash-meinel.com
Tue Aug 14 22:58:19 BST 2007

Hash: SHA1

There are a few times when we need to determine the unique heads for a revision
graph. The specific time I'm interested in when determining the last modified
revision of a file (such as during commit).

This also updates the find_previous_heads code to use the new graph
functionality. In theory this could make commit a bit faster, since we don't
need the full ancestry of all file ids (just the bit that might have diverged).
In practice, I would not expect to see much of a benefit because we still have
to read the entire .kndx file. Also, the per file graphs are frequently
relatively small, so there is only a small benefit. (get_ancestry() is
ultimately iterating directly over the dict, rather than multiple calls to

I would expect that it could be better for the pack repository, once Robert has
lazy reading of the text graphs.

The real reason I wrote this is because I want to be using it for a converter,
but I figured we could use it in the normal code as well.

The one thing I would like to add, is to have the VersionedFile code return the
 Graph object (maybe the repository?), rather than creating a Graph on the VF
ourselves. But I don't know what to call it, since VF.get_graph() already
returns a dictionary of all revision_ids.

Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: graph_heads.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20070814/10a3f603/attachment-0001.diff 

More information about the bazaar mailing list