ui: provide official way to reset internal state per command
This will allow us to clear in-memory password storage per runcommand().
I've updated commandserver to call resetstate() of both ui and repo.ui because
they may have different states in theory.
To run the tests, do:
cd tests/
python run-tests.py
See https://mercurial-scm.org/wiki/WritingTests for
more information on writing tests.