Change execute to raise exception on error

Previously the execute command had been silently ignoring any execution
errors. This lead to some unpredictable behavior as the callers were not
checking for error codes. In order to make this a bit easier, allow
caller to set the expected return code and fail if we get anythong other
than that.

Also, as the git functions in util.py were not being used, remove them
and their associated tests.