VC Annotate for Mercurial repositories shows changeset hashes

* lisp/vc/vc-hg.el (vc-hg-annotate-show-revision-numbers): New
option.
(vc-hg-annotate-command): If it's nil, show changeset hashes not
revision numbers by passing "-c" not "-n" to 'hg annotate'.
(vc-hg-annotate-re): Update.
* etc/NEWS: Document the change.
This commit is contained in:
Sean Whitton 2026-04-27 13:23:30 +01:00
parent f293becdd6
commit 91db34868a
2 changed files with 17 additions and 4 deletions

View file

@ -2802,6 +2802,12 @@ To undo this change you can use
This command prints the log of VC changes to the current fileset on
another branch.
---
*** VC Annotate for Mercurial repositories shows changeset hashes.
To restore showing revision numbers instead of changeset hashes,
customize the new option vc-hg-annotate-show-revision-numbers to
non-nil.
+++
*** New commands to handle repositories with multiple working trees.
Some VCS support more than one working tree with the same backing

View file

@ -601,10 +601,17 @@ This requires hg 4.4 or later, for the \"-L\" option of \"hg log\"."
table (lambda () (vc-hg-revision-table files)))))
table))
(defcustom vc-hg-annotate-show-revision-numbers nil
"If non-nil, \\[vc-annotate] shows revision numbers for Hg repositories.
The default when this is nil is to show changeset hashes."
:type 'boolean
:version "31.1")
(defun vc-hg-annotate-command (file buffer &optional revision)
"Execute \"hg annotate\" on FILE, inserting the contents in BUFFER.
Optional arg REVISION is a revision to annotate from."
(apply #'vc-hg-command buffer 'async file "annotate" "-dq" "-n"
(apply #'vc-hg-command buffer 'async file "annotate" "-dq"
(if vc-hg-annotate-show-revision-numbers "-n" "-c")
(append (vc-switches 'hg 'annotate)
(if revision (list (concat "-r" revision))))))
@ -619,9 +626,9 @@ Optional arg REVISION is a revision to annotate from."
;; b56girard 114590 2012-03-13:
(defconst vc-hg-annotate-re
(concat
"^\\(?: *[^ ]+ +\\)?\\([0-9]+\\) " ;User and revision.
"\\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\\)" ;Date.
"\\(?: +\\([^:]+\\)\\)?:")) ;Filename.
"^\\(?: *[^ ]+ +\\)?\\([[:xdigit:]]+\\) " ; User and revision.
"\\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\\)" ; Date.
"\\(?: +\\([^:]+\\)\\)?:")) ; Filename.
(defun vc-hg-annotate-time ()
(when (looking-at vc-hg-annotate-re)