In order to prepare for making the vc mode-line more customizable, here is refactoring that helps to avoid code duplication in vc-hg-mode-line-string, and at the same time makes vc-git-mode-line-string less hackish while keeping it short.