historycache - Faster lookup of dotted revision numbers and history graphsΒΆ

Version Not specified
Branch lp:bzr-historycache
Home page https://launchpad.net/bzr-historycache
Owner ian-clatworthy
GNU/Linux Yes
Windows Yes
Mac OS X Yes

HistoryCache Plugin

The historycache plugin caches information about the revision graph of local branches between updates to the tip. It is useful for users working on projects with deep history. Out-of-the-box, no caching is done so this plugin can be safely installed and only enabled for the projects or branches you need it for.

To speed up the lookup of revision-ids in a long mainline and recent revision-ids for non-mainline (“dotted”) revnos (like 200.1.34), add history-cache-revnos = on in branch.conf or locations.conf. For projects with 100K revisions say, some commands can improve from 30-45 seconds (on a typical laptop) to less than a second by doing this. Here are some example commands that benefit:

bzr log -r200.1.34
bzr diff -r25210.1.6
bzr st -r3901.23.10

Furthermore, the merge-sorted graph for a branch can also be cached. Again, this can dramatically improve the speed of commands like log, particularly if multiple levels are displayed. For example, the time required to log all 40K revisions in Bazaar’s trunk drops to under 2 seconds! To enable this, add history-cache-graph = on for the branches you care about in branch.conf or locations.conf.

Here’s how the caching works. When the revno is looked up or the graph is accessed for a branch stored on the local filesystem, the plugin checks for the existence of the relevant cache in .bzr/branch/historycache and loads the data from there if present. Otherwise, the normal logic is invoked and the cache is created at the above location, ready for later bzr runs. If the tip of a branch moves due to a commit, pull, push or update, the cache is marked as stale and ignored or deleted. The information will then be calculated in the normal way and the cache rebuilt. It is always safe to delete the caches by hand if and when you want to.

To cache revision numbers or the graph in all branches, define the relevant setting in bazaar.conf. The storage overhead associated with revision number caching is minor but caching full graphs for every single branch on every single project if probably not what you want, given the disk space consumption that may imply.

If you’re interested in the time required to maintain the caches, see the various trace messages written to .bzr.log.

Previous topic

dns-cache - Cache DNS requests, greatly speeding up urllib.urlopen requests

Next topic

service - Keep bzrlib loaded in memory to decrease command startup time

This Page