Unify diverging commit cache for MRs and Branches
To the best of my knowledge we're calculating diverging commits in both the merge requests (requested by API or WebUI), and the branches view. Both will calculate the diverging commit counts between two hashes. Which might, and probably will, overlap for many cases.
They do not share a cache however, decreasing the hit rate for both. Unifying them under a cache key based on the from and to SHA would allow them both to hit the same cache and maybe further DRY our codebase.
- The MR numbers are calculated & cached in
MergeRequest#diverged_commits_count
- The branch vs HEAD numbers are calculated & cached in
Repository#diverging_commits_count
/cc @godfat @reprazent
Edited by Bob Van Landuyt