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

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 10 Nov 2020 15:46:02 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
44534: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=44534
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#44534: [PATCH] Remove extra process call from vc-hg-registered
From: Dmitry Gutov <[email-masked]>
To: Tom Fitzhenry <[email-masked]>, [email-masked]
Date: Tue, 10 Nov 2020 17:45:28 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 28.1

On 09.11.2020 13:54, Tom Fitzhenry via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> 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.

Makes sense, thanks! Pushed.

P.S. Next time please try to keep the line width within usual limits, I 
had to fix the following linter errors:

Line longer than 78 characters in commit message
Word longer than 140 characters in commit message
Commit aborted; please see the file CONTRIBUTE

Subject: [PATCH] Remove extra process call from vc-hg-registered
From: Tom Fitzhenry <[email-masked]>
To: [email-masked]
Date: Mon, 9 Nov 2020 11:54:09 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

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