test-commandserver: split helper functions to new hgclient module
This prepares for porting test-commandserver.py to .t test.
Though command-server test needs many Python codes, .t test will be more
readable than .py test thanks to inlined output.
To run the tests, do:
cd tests/
python run-tests.py
See http://mercurial.selenic.com/wiki/WritingTests for
more information on writing tests.