loader: add an hg-specific mapping for branching
As discussed in T3352, the branching mechanism of Mercurial is more
featureful than that of Git's. The Snapshot model was not designed
with multiple heads, closed heads, bookmarks, etc. in mind, but with
only branches being "pointers" to (mostly) revisions.
As a workaround for a possible re-design of the Snapshot model (though
nothing of the sort is planned for now), we define a mapping that better
represents Mercurial's branching system.
This allows for handling multiple heads per branch and closed branches,
whose revisions (if not already covered by another branch) would
previously have been lost to the ether. Additionally, bookmarks are now
saved to get a better representation of the projects that do use them.