interfaces: introduce an interface for dirstate implementations
As usual with adding interface definitions, this describes the way
things are, not the way we'd like things to be. There are some clear
problems in the interface right now (eg ._map leaks in a few places),
but I have plans to clean those up. There are also many missing
docstrings, but again, we'll make a second pass to clean that up.
Differential Revision: https://phab.mercurial-scm.org/D6836