emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 64dcdb74172 1/2: Optimize vc-hg-state for directories


From: Dmitry Gutov
Subject: master 64dcdb74172 1/2: Optimize vc-hg-state for directories
Date: Sat, 14 Oct 2023 13:01:44 -0400 (EDT)

branch: master
commit 64dcdb74172cb77650e8b46fcf08b989963cec17
Author: Spencer Baugh <sbaugh@catern.com>
Commit: Dmitry Gutov <dmitry@gutov.dev>

    Optimize vc-hg-state for directories
    
    Directories are never tracked in hg, so it's pointless to run
    vc-hg-state on them.  And, in fact, our implementation previously
    would list all the files contained in the directory and then parse
    that in Emacs, which is very slow in large repos.
    
    Let's just use the knowledge that directories aren't tracked in hg,
    and skip running hg entirely.
    
    * lisp/vc/vc-hg.el (vc-hg-state): Return nil for
    directories.  (Bug#66364)
---
 lisp/vc/vc-hg.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index c3e563a1f10..f2ee9ef35e4 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -216,8 +216,9 @@ If `ask', you will be prompted for a branch type."
 
 (defun vc-hg-state (file)
   "Hg-specific version of `vc-state'."
-  (let ((state (vc-hg-state-fast file)))
-    (if (eq state 'unsupported) (vc-hg-state-slow file) state)))
+  (unless (file-directory-p file)
+    (let ((state (vc-hg-state-fast file)))
+      (if (eq state 'unsupported) (vc-hg-state-slow file) state))))
 
 (defun vc-hg-state-slow (file)
   "Determine status of FILE by running hg."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]