From 7ce60be53e7ffbc1972dd8e98744adf6103eee9e Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 6 Apr 2026 13:02:06 +0100 Subject: [PATCH] vc-hg-working-revision: Return changeset hashes * lisp/vc/vc-hg.el (vc-hg-working-revision): Return changeset hashes instead of revision numbers. Respect vc-use-short-revision. * etc/NEWS: Document the change. --- etc/NEWS | 5 +++++ lisp/vc/vc-hg.el | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index dc21ac8399b..b3a497c351a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3088,6 +3088,11 @@ You can use 'C-u C-x v +' to preview or change the arguments. *** 'C-u C-x v +' and 'C-u C-x v P' for Git have an input history. This was already in place for Mercurial. +--- +*** 'vc-hg-working-revision' now returns changeset hashes. +Previously it returned local revision numbers, but hashes are more +robust for how this function is typically used. + ** Package +++ diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index d671caa23db..398645e5a1e 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -282,7 +282,8 @@ A value of `default' means to use the value of `vc-resolve-conflicts'." (ignore-errors (with-output-to-string (vc-hg-command standard-output 0 nil - "log" "-r" "." "--template" "{rev}")))) + "log" "-r" "." "--template" + (if vc-use-short-revision "{node|short}" "{node}"))))) (defcustom vc-hg-symbolic-revision-styles '(builtin-active-bookmark