Step 3 is probably an hg bug. However `hg parent` was deprecated in
2014, so people may be reluctant to change it. And it would be simpler
for vc-hg-working-revision to call `hg log -r . -T {rev}` (vc-git does
that, so I assume that it works in general on top of fixing the
current issue). `.` means the current revision, see `hg help revset`.
So something like this:
(defun vc-hg-working-revision (file)
"Hg-specific version of `vc-working-revision'."
(ignore-errors
(with-output-to-string
(vc-hg-command standard-output 0 nil
"log" "-r" "." "--template" "{rev}"))))
(another reason to stop using `hg parents` is that during a merge, it
will in most cases print two revisions, so if you annotate a file that
was last changed in revision 123, emacs will likely get 123123 back
and `hg annotate -r 123123` will fail)