Overhauled `version_tex.py`.

- Added support for Mercurial repositories.

- Changed how Git repository status is detected to be more robust.

- Changed SVN repository versioning to just use `svnversion(1)`.

- Added the "short" option to `cwd_git_version()` and `cwd_hg_version()`
  to get the conventional short hashes for Git (7 characters) and
  Mercurial (12 characters) repositories respectively.

- Renamed the version macro from `\\jp@revision` to `\\jp@versionid``.