Introduce generator for lefthand branch history
Martin von Gagern
Martin.vGagern at gmx.net
Fri Nov 27 10:08:19 GMT 2009
I'm working on trac-bzr. As Trac was originally designed with svn in
mind, it expects linear histories everywhere. I assume there might be
other tools designed to work either with linear histories exclusively,
or rendering linear histories in some special form.
On the other hand, people might wish to inspect non-mainline commits as
well. The closest thing to a linear history which bzr provides is the
lefthand history. It is currently accessible by the
bzrlib.branch.Branch._lefthand_history method, which generates a list,
starting with the oldest real revision and ending with the argument
I propose that you make that function public and official.
While doing so, you might consider a slight change in semantics. For
trac-bzr, it would often be enough to get a few most recent ancestors,
instead of the whole history starting at the first commit. Therefore you
could turn the function into a generator, yielding revisions of lefthand
ancestors starting at the argument and ending at the initial commit.
This might give a slight performance benefit to some operations. And
reversing order would be simple for callers.
I would also suggest that you specify that for mainline revisions the
function should not be significantly slower than searching the
revision_history of the branch instead. I.e. callers shouldn't have to
check whether their revision is mainline or not, but for formats that
have significantly faster access to mainline history, these formats
should perform the necessary check before they needlessly perform too
It would also be nice to have a linear view of the future of an
arbitrary revision, but I'll first have to formulate this concept and
implement it for trac-bzr, because I don't think there is something like
this in bzrlib right now. Once I've written appropriate code, you can
consider it for inclusion into bzrlib.
For reference, the trac-bzr bug discussing the use of _lefthand_history
Martin von Gagern
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 262 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20091127/e42aea6f/attachment.pgp
More information about the bazaar