checkheads: simplify the structure build by preprocessing
All useful data are now gathered in a single dictionnary.
`branchmapsummary` is renamed to `headssummary` and its return value
is greatly simplified.
_updatebranchcache: prevent deleting dict key during iteration
We use dict.keys() to fetch all keys before starting to delete some. Otherwise
python complains that the dictionnary is altered during iteration.
checkheads: extract branchmap preprocessing
The checkheads function is far too complicated. This extract help to explicite
what part of the preprocessing are reused by the actual check.
This the first step toward a wider refactoring.