From: Spencer Baugh <sbaugh@janestreet.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: dmitry@gutov.dev, 63470@debbugs.gnu.org
Subject: bug#63470: [PATCH] Use faster option for running vc-hg status
Date: Mon, 22 May 2023 13:58:06 -0400 [thread overview]
Message-ID: <iero7mc6yfl.fsf@janestreet.com> (raw)
In-Reply-To: <83ilcrxjci.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 17 May 2023 14:55:57 +0300")
[-- Attachment #1: Type: text/plain, Size: 301 bytes --]
A fix to the patch: passing the correct configuration key as an
argument. The old version did nothing... but fortunately it was setting
the configuration key to its default value, so it happened to work.
I've tested now that it works even when commands.status.relative=0 is
set by the user's hgrc.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-faster-option-for-running-vc-hg-status-Bug-63470.patch --]
[-- Type: text/x-patch, Size: 2318 bytes --]
From ff6163fac51759945aa619ca6bf28413be4a53e0 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@janestreet.com>
Date: Fri, 12 May 2023 15:28:06 -0400
Subject: [PATCH] Use faster option for running vc-hg status (Bug#63470)
In modern Mercurial, removing the "re:" "-I" "." options provides a
10x-20x speedup because it allows the Rust implementation of "hg
status" to be used.
* lisp/vc/vc-hg.el (vc-hg--program-version): Add.
(vc-hg-dir-status-files): Use --config commands.status.relative=1 to
make paths relative when available.
---
lisp/vc/vc-hg.el | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 78231a0c954..688fb6e0252 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -1377,17 +1377,28 @@ vc-hg-after-dir-status
;; Follows vc-exec-after.
(declare-function vc-set-async-update "vc-dispatcher" (process-buffer))
+(defvar vc-hg--program-version nil)
+
+(defun vc-hg--program-version ()
+ (or vc-hg--program-version
+ (setq vc-hg--program-version
+ (with-temp-buffer
+ (condition-case _ (vc-hg-command t 0 nil "version")
+ (error "0")
+ (:success
+ (goto-char (point-min))
+ (re-search-forward "Mercurial Distributed SCM (version \\([0-9][0-9.]+\\)")
+ (string-trim-right (match-string 1) "\\.")))))))
+
(defun vc-hg-dir-status-files (dir files update-function)
;; XXX: We can't pass DIR directly to 'hg status' because that
;; returns all ignored files if FILES is non-nil (bug#22481).
(let ((default-directory dir))
- ;; TODO: Use "--config 'status.relative=1'" instead of "re:"
- ;; when we're allowed to depend on Mercurial 4.2+
- ;; (it's a bit faster).
- (vc-hg-command (current-buffer) 'async files
- "status" "re:" "-I" "."
- (concat "-mardu" (if files "i"))
- "-C"))
+ (apply #'vc-hg-command (current-buffer) 'async files
+ "status" (concat "-mardu" (if files "i")) "-C"
+ (if (version<= "4.2" (vc-hg--program-version))
+ '("--config" "commands.status.relative=1")
+ '("re:" "-I" "."))))
(vc-run-delayed
(vc-hg-after-dir-status update-function)))
--
2.30.2
next prev parent reply other threads:[~2023-05-22 17:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 19:28 bug#63470: [PATCH] Use faster option for running vc-hg status Spencer Baugh
2023-05-12 19:43 ` Eli Zaretskii
2023-05-12 19:57 ` Spencer Baugh
2023-05-12 20:10 ` Dmitry Gutov
2023-05-13 5:54 ` Eli Zaretskii
2023-05-16 20:39 ` Spencer Baugh
2023-05-17 11:39 ` Eli Zaretskii
2023-05-17 11:47 ` Spencer Baugh
2023-05-17 11:55 ` Eli Zaretskii
2023-05-22 17:58 ` Spencer Baugh [this message]
2023-05-22 22:33 ` Dmitry Gutov
2023-05-18 23:48 ` Dmitry Gutov
2023-05-19 14:34 ` Spencer Baugh
2023-05-22 22:33 ` Dmitry Gutov
2023-05-13 5:51 ` Eli Zaretskii
2023-05-12 20:06 ` Dmitry Gutov
2023-05-13 5:52 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=iero7mc6yfl.fsf@janestreet.com \
--to=sbaugh@janestreet.com \
--cc=63470@debbugs.gnu.org \
--cc=dmitry@gutov.dev \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.