Loggerhead handling of old revisions

John Arbash Meinel john at arbash-meinel.com
Tue Apr 27 17:05:03 BST 2010


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

I had an idea this morning about one possible way to handle old
revisions in places like the file view.

Some background:

1) Right now the 'files' view shows a directory listing, including the
   last modified version of every file (using a dotted revno)
   This also include directories, whose 'last-modified' is usually just
   the revision they were added. (In the case of emacs, 'libsrc' has
   last-modified of 1)

2) This is inherently a 'whole history' operation, because the revision
   involved is an old-history revision.

3) Currently loggerhead maps URLs based on the dotted revno. Which means
   you get pretty URLs, but means you need to compute the revno for all
   revisions.

My proposal:

1) Allow for using revision-ids rather than revnos when desired. The
   infrastructure may already be there, I haven't dug very deep.

2) We could keep the last-modified revision in the table, but allow for
   a "too-old" horizon, which can also be a config variable. The idea is
   that you could compute the dotted revnos (or have them in a cache :)
   for the last, say 100-1000 mainline revisions.
   (We can already do this via bzrlib api w/ Branch.iter_merge_sorted...
   however, without a cache plugin, it just computes the whole history,
   and then returns a subset.)

   You can cache the subset in loggerhead, though. And it shouldn't
   cause too much memory bloat. (Instead of caching all revisions across
   the whole ancestry, you just cache recent stuff.)

3) For revisions which aren't cached, you give a link titled 'old' which
   points to the revision-id URL.

4) When someone visits a revision-id URL they get a soft/hard redirect
   to the dotted-revno URL.
   This way the user generally only sees the nice URLs, but they only
   have to be computed when they are actually requested.

5) For bonus points, the 'old' link could actually be an AJAX rewrite,
   which looks up the dotted revno, and substitutes it in place. So to
   follow from the 'files' view to the actual revision would then take 2
   clicks. (1-turn "old" to dotted revno, 2-go to dotted revno)

This is a bit of a 'bandage' because dotted revnos aren't O(1). So far,
though, I don't think we've found a better solution.

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

iEYEARECAAYFAkvXCy8ACgkQJdeBCYSNAAMbfwCeL4K4WUvyCSvqZJQZc/Qt4IUR
18MAoL+uQ1mvwUaKqpJfvyvEvwWv6P+b
=8tAG
-----END PGP SIGNATURE-----



More information about the bazaar mailing list