Prefer vc-state to benefit from its caching (bug#44534)
This same technique is used in vc-git.el,
per commit 2018-06-28 "Remove extra process call from vc-git-find-file-hook"
93c41ce6aa64b14fc9bd7bdd0d909915a79191cd.
* lisp/vc/vc-hg.el (vc-hg-registered): Use vc-state rather than vc-hg-state.
(defun vc-hg-registered (file)
"Return non-nil if FILE is registered with hg."
(when (vc-hg-root file) ; short cut
- (let ((state (vc-hg-state file))) ; expensive
+ (let ((state (vc-state file 'Hg))) ; expensive
(and state (not (memq state '(ignored unregistered)))))))
(defun vc-hg-state (file)