dirstatemap: move a multiple simple functions in the common class
These are small and simple, lets factor them out.
Differential Revision: https://phab.mercurial-scm.org/D11567