hg: raise Abort on invalid path
Currently, some os.path functions when opening repositories may
raise an uncaught TypeError or ValueError if the path is invalid.
Let's catch these exceptions and turn them into an Abort for
convenience.
Differential Revision: https://phab.mercurial-scm.org/D5772
To run the tests, do:
cd tests/
python run-tests.py
See https://mercurial-scm.org/wiki/WritingTests for
more information on writing tests.