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.
Testing that hghave does not crash when checking features $ "$TESTDIR/hghave" --test-features 2>/dev/null