From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#63470: [PATCH] Use faster option for running vc-hg status Date: Mon, 22 May 2023 13:58:06 -0400 Message-ID: References: <83h6shbaiv.fsf@gnu.org> <83bkiobwsu.fsf@gnu.org> <83o7mjxk3i.fsf@gnu.org> <83ilcrxjci.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9406"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: dmitry@gutov.dev, 63470@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 22 19:59:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q19oV-0002GI-UT for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 May 2023 19:59:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q19oJ-0002aw-3h; Mon, 22 May 2023 13:59:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q19oE-0002ad-Vb for bug-gnu-emacs@gnu.org; Mon, 22 May 2023 13:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q19oE-0007QI-N3 for bug-gnu-emacs@gnu.org; Mon, 22 May 2023 13:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q19oE-0003ac-Ia for bug-gnu-emacs@gnu.org; Mon, 22 May 2023 13:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 May 2023 17:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63470 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63470-submit@debbugs.gnu.org id=B63470.168477829613733 (code B ref 63470); Mon, 22 May 2023 17:59:02 +0000 Original-Received: (at 63470) by debbugs.gnu.org; 22 May 2023 17:58:16 +0000 Original-Received: from localhost ([127.0.0.1]:36329 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q19nT-0003ZQ-PE for submit@debbugs.gnu.org; Mon, 22 May 2023 13:58:16 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:37015) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q19nP-0003ZA-I3 for 63470@debbugs.gnu.org; Mon, 22 May 2023 13:58:14 -0400 In-Reply-To: <83ilcrxjci.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 17 May 2023 14:55:57 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:262180 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Use-faster-option-for-running-vc-hg-status-Bug-63470.patch >From ff6163fac51759945aa619ca6bf28413be4a53e0 Mon Sep 17 00:00:00 2001 From: Spencer Baugh 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 --=-=-=--