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.
#require docutils gettext
$ $TESTDIR/check-gendoc zh_CN
checking for parse errors