LastCommitDoc has repo_id as the beginning of _id, but it is not used when def ls()
queries it. If we simply add it to that LastCommitDoc query, it probably won't work with forks. We need to consider 2 cases: the parent & child repos in a repo forked within Allura, and cloned repos pushed into Allura not using the builtin fork functionality.
Initial research notes: https://sourceforge.net/p/allura/pastebin/4ffc901ab9363c3d4f00004e
Hash e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 (empty file) has 1733 incidents. Repo id seems unique on all of them (not various revisions in the same repo).
forge:tv/4523
Forked repos are showing up with None for the commits when viewing a tree
To ssh://engr.geek.net/forge
a30f7ed..6deb7c7 tv/4523 -> tv/4523
Simplest fix was to run
compute_diffs()
for all commits on every refresh. This will slow down git and hg refreshes until we find a better way, but it works.I tested by forking (manually and with the fork button) a repo with an empty file, and checking that the last commit on the forks was correct after the fork (or push). I also verified that the count of DiffInfoDocs remained constant after multiple refreshes of an unchanged repo (i.e., running
compute_diffs()
for all commits won't create duplicate DiffInfoDocs for those commits)