From: Spencer Baugh via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 74243@debbugs.gnu.org
Subject: bug#74243: [PATCH] Speed up vc-hg-state by treating ignored files as unregistered
Date: Thu, 07 Nov 2024 12:41:47 -0500 [thread overview]
Message-ID: <iered3n54bo.fsf@janestreet.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1562 bytes --]
Tags: patch
The most significant slow component of "hg status" is parsing the
.hgignore file. If we pass -mardc instead of -A to hg status, hg
doesn't list ignored or untracked files, so it skips parsing the
.hgignore. On my large repo, this brings "hg status" from 140ms to
20ms.
For vc-hg-state, the distinction doesn't matter: nothing using the
output of vc-hg-state has significantly different behavior for ignored
files vs unregistered files:
- vc-dir-clean-files and vc-dir-recompute-file-state call vc-hg-state,
but will never see an ignored file anyway since vc-dir shouldn't list
ignored files for hg.
- vc-next-action checks 'ignored, but it's OK to take the
'unregistered path instead; it will either fail when calling hg, or
succeed.
- Other users of vc-state don't differ between 'ignored and
'unregistered
* lisp/vc/vc-hg.el (vc-hg-state-slow): Treat ignored files as
unregistered.
In GNU Emacs 29.2.50 (build 6, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.15.12, Xaw scroll bars) of 2024-11-06 built on
igm-qws-u22796a
Repository revision: 18ed746717c1c80e5cc9d9dc85b6e1f4013a1cec
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Rocky Linux 8.10 (Green Obsidian)
Configured using:
'configure --with-x-toolkit=lucid --without-gpm --without-gconf
--without-selinux --without-imagemagick --with-modules --with-gif=no
--with-tree-sitter --with-native-compilation=aot
PKG_CONFIG_PATH=/usr/local/home/garnish/libtree-sitter/0.22.6-1/lib/pkgconfig/'
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Speed-up-vc-hg-state-by-treating-ignored-files-as-un.patch --]
[-- Type: text/patch, Size: 2338 bytes --]
From 591dd8d7d5e23fd03696f9a536d7f40e77ea2de4 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@janestreet.com>
Date: Thu, 7 Nov 2024 12:28:49 -0500
Subject: [PATCH] Speed up vc-hg-state by treating ignored files as
unregistered
The most significant slow component of "hg status" is parsing the
.hgignore file. If we pass -mardc instead of -A to hg status, hg
doesn't list ignored or untracked files, so it skips parsing the
.hgignore. On my large repo, this brings "hg status" from 140ms to
20ms.
For vc-hg-state, the distinction doesn't matter: nothing using the
output of vc-hg-state has significantly different behavior for ignored
files vs unregistered files:
- vc-dir-clean-files and vc-dir-recompute-file-state call vc-hg-state,
but will never see an ignored file anyway since vc-dir shouldn't list
ignored files for hg.
- vc-next-action checks 'ignored, but it's OK to take the
'unregistered path instead; it will either fail when calling hg, or
succeed.
- Other users of vc-state don't differ between 'ignored and
'unregistered
* lisp/vc/vc-hg.el (vc-hg-state-slow): Treat ignored files as
unregistered.
---
lisp/vc/vc-hg.el | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 856bea66a6f..2dbd1285318 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -245,7 +245,7 @@ vc-hg-state-slow
"--config" "ui.report_untrusted=0"
"--config" "alias.status=status"
"--config" "defaults.status="
- "status" "-A" (file-relative-name file)))
+ "status" "-mardc" (file-relative-name file)))
;; Some problem happened. E.g. We can't find an `hg'
;; executable.
(error nil)))))))
@@ -260,12 +260,12 @@ vc-hg-state-slow
((eq state ?=) 'up-to-date)
((eq state ?A) 'added)
((eq state ?M) 'edited)
- ((eq state ?I) 'ignored)
((eq state ?R) 'removed)
((eq state ?!) 'missing)
- ((eq state ??) 'unregistered)
((eq state ?C) 'up-to-date) ;; Older mercurial versions use this.
- (t 'up-to-date))))))
+ ;; Ignored or untracked files don't show up; they're both
+ ;; treated as unregistered.
+ (t 'unregistered))))))
(defun vc-hg-working-revision (_file)
"Hg-specific version of `vc-working-revision'."
--
2.39.3
next reply other threads:[~2024-11-07 17:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 17:41 Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-11-17 1:03 ` bug#74243: [PATCH] Speed up vc-hg-state by treating ignored files as unregistered Sean Whitton
[not found] ` <ierttc3z71g.fsf@janestreet.com>
2024-11-26 7:52 ` Sean Whitton
2024-11-26 23:26 ` Dmitry Gutov
2024-11-26 23:32 ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-27 0:18 ` Dmitry Gutov
2024-11-29 8:17 ` Sean Whitton
2024-11-29 12:43 ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-29 23:45 ` Sean Whitton
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=iered3n54bo.fsf@janestreet.com \
--to=bug-gnu-emacs@gnu.org \
--cc=74243@debbugs.gnu.org \
--cc=sbaugh@janestreet.com \
/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.