Adding cached repository support to TracMercurial
|Reported by:||Owned by:|
I'm using TracMercurial with a fairly large repository which contains a few hundreds revisions including Linux kernel. It works well, but the only painful point is seeing the timeline. It takes more than 10~15 seconds to load.
I have inspected what the problem is, and noticed that the current TracMercurial plugin does not implement cached repository, though it is scheduled for the future. I know that, and the intention of this ticket is to inform you some considerations when you continue on it. (Maybe you smart guys know this problem already. :)
Anyway I tried to implement it by myself, and noticed that the database schema of Trac itself must be changed to handle "merge changeset"s correctly.
In the mercurial plugin, MercurialChangeset class has the method
get_changes. It retrieves the modified/deleted/added files in a changeset and they are used in resync process in Trac's repository cache.
Let's suppose there is a changeset 10, which is a merge changeset of 8 with file a, b, c and 9 with file b. In the changeset 10,
get_changes returns the file b twice, and causes IntegrityError when resync.
One possible workaround is to limit the number of same files returned in
get_changes to 1, e.g.)
edits = edits[:1].
But, ultimately, Trac's database schema should be able to handle such cases by adding 'parent changeset' into the primary keys of its