Add a basic consistency checker for changes

In the past, Gerrit bugs, lack of transactions, and unreliable NoSQL
backends have at various times produced a bewildering variety of
corrupt states. Similarly, we are not immune from bugs being
introduced in the future.

Add a tool to detect and explain some of these possible states.

Change-Id: Ia91b35b140bf05254877f413003d12cf779b775c
8 files changed