Homestyx hydra

R1:21c4aeb032cd

Improve low-level branch resolution in Mercurial

Summary:
Ref T7100. Ref T7108. Ref T6160. Several issues:

- High load for mercurial repositories with huge numbers of branches (T7108).
- In Mercurial, we resolve refs individually (one `hg` call per ref).
- Each repository update also updates all refs, which requires resolving all of them.
- For repositories with a huge number of branches,
- We don't distinguish between closed branches (a Mercurial-only concept) and open branches (T6160).
Repository: R1 hydra
Commit Date: Apr 27 2015