diff options
| author | Spencer Baugh | 2023-10-12 21:06:53 -0400 |
|---|---|---|
| committer | Dmitry Gutov | 2023-10-14 19:57:31 +0300 |
| commit | 64dcdb74172cb77650e8b46fcf08b989963cec17 (patch) | |
| tree | f1ca64be422b7075fa839063af86b3bdb685a64e | |
| parent | 330dd51f8bf154fedde2110675fd606400173e23 (diff) | |
| download | emacs-64dcdb74172cb77650e8b46fcf08b989963cec17.tar.gz emacs-64dcdb74172cb77650e8b46fcf08b989963cec17.zip | |
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)
| -rw-r--r-- | lisp/vc/vc-hg.el | 5 |
1 files 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." | |||
| 216 | 216 | ||
| 217 | (defun vc-hg-state (file) | 217 | (defun vc-hg-state (file) |
| 218 | "Hg-specific version of `vc-state'." | 218 | "Hg-specific version of `vc-state'." |
| 219 | (let ((state (vc-hg-state-fast file))) | 219 | (unless (file-directory-p file) |
| 220 | (if (eq state 'unsupported) (vc-hg-state-slow file) state))) | 220 | (let ((state (vc-hg-state-fast file))) |
| 221 | (if (eq state 'unsupported) (vc-hg-state-slow file) state)))) | ||
| 221 | 222 | ||
| 222 | (defun vc-hg-state-slow (file) | 223 | (defun vc-hg-state-slow (file) |
| 223 | "Determine status of FILE by running hg." | 224 | "Determine status of FILE by running hg." |