Use hgapi instead of command line wrappers