Subject: bug#44534: [PATCH] Remove extra process call from vc-hg-registered

From: Tom Fitzhenry <[email-masked]>
Date: Mon, 9 Nov 2020 11:54:09 +0000

Prefer calling vc-state (rather than vc-hg-state) to benefit from the
caching in vc-state.

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.
From 676bfaf89ddd8450e395251762a4153556def2f2 Mon Sep 17 00:00:00 2001
From: Tom Fitzhenry <[email-masked]>
Date: Mon, 9 Nov 2020 22:19:10 +1100
Subject: [PATCH] Remove extra process call from vc-hg-registered

Prefer vc-state to benefit from its caching.

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.
---
 lisp/vc/vc-hg.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index cb0657e70a..cacdee2226 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -222,7 +222,7 @@ If `ask', you will be prompted for a branch type."
 (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)
-- 
2.29.2.222.g5d2a92d10f8-goog