Trac fix for the viewing 
|Reported by:||jemfinch||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
A friend pointed me at http://www.djangoproject.com/multidb-changeset/ and I recognized the issue as one I fixed for my employer's Trac instance recently. I got permission to share the fix, so I've attached the diff to versioncontrol/web_ui/changeset.py in 0.11.1-2.1 (from Ubuntu Jaunty).
I can't say whether it will work as-is in your case (it really depends on how those 21,000 lines are distributed across files) but you can tweak the numbers as necessary to avoid "huge diff" computational issue with this changeset and others in the future.