Rebased html_diagram

This is https://github.com/mhagger/git-imerge/pull/14 with fixups folded in.