[MERGE] lookup revno by iterating history

John Arbash Meinel john at arbash-meinel.com
Fri Mar 14 21:13:18 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The attached patch changes how RevisionSpec_revno() determines its
revision id. Basically, it iterates from the tip rather than grabbing
the whole history and then pulling out a node.

It turns out to not help 'bzr log' because the log.py code calls
_enumerate_history(). However it makes a big difference for "bzr
revision-info -r -2". On bzr.dev it changes it from 1.4s => 0.2s. Of
course, it also revealed that 'revision-info' wasn't locking its branch,
so revision-info had its own problems.

Regardless, it seems that building the revision_history for bzr.dev
takes about 1s, which is getting pretty long considering we only have 3k
revisions.

So I think this is a step in the right direction, even if there are lots
of other places that will need updating.

This patch also changes Repository.iter_reverse_revision_history() to
use a Graph and to handle ghosts as they come, rather than multiple
calls to get_parents() which was filtering the ghosts. It should make
revision_history() cheaper as well.

In fact, the RevisionSpec change probably slows down 'log' slightly,
since it is still grabbing the Branch.revision_history() which would
otherwise be cached. Though the iter_reverse changes more than
compensate. (In my numbers I save about 400ms. for bzr log --short -r -2).

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH2upuJdeBCYSNAAMRAjfNAJ9oTCNdpBcILmfQGPr1yQ1shFvwagCdFxSe
8dVouFqZmXyKJoTkiN+X2jA=
=TPLa
-----END PGP SIGNATURE-----



More information about the bazaar mailing list