master fc9af262e0a 1/2: vc-hg-diff: Skip unnecessary call to vc-working-revision

Sean Whitton <[email protected]> Mon, 3 Aug 2026 05:38:52 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit fc9af262e0aa02220971ff1b96994615485efd35
Author: Aaron L. Zeng <[email protected]>
Commit: Sean Whitton <[email protected]>

    vc-hg-diff: Skip unnecessary call to vc-working-revision
    
    * lisp/vc/vc-hg.el (vc-hg-diff): Skip unnecessary call to
    vc-working-revision (bug#81527).
---
 lisp/vc/vc-hg.el | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index acc257dab2f..6916c56c141 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -560,22 +560,18 @@ This requires hg 4.4 or later, for the \"-L\" option of \"hg log\"."
 
 (defun vc-hg-diff (files &optional oldvers newvers buffer async)
   "Get a difference report using hg between two revisions of FILES."
-  (let* ((firstfile (car files))
-         (working (and firstfile (vc-working-revision firstfile 'Hg))))
-    (when (and (not newvers) (member oldvers (list working ".")))
-      (setq oldvers nil))
-    (when (and newvers (not oldvers))
-      (setq oldvers "null"))
-    (apply #'vc-hg-command
-	   (or buffer "*vc-diff*")
-           (if async 'async 1)
-           files "diff"
-           (append
-            (vc-switches 'hg 'diff)
-            (when oldvers
-              (if newvers
-                  (list "-r" oldvers "-r" newvers)
-                (list "-r" oldvers)))))))
+  (when (and newvers (not oldvers))
+    (setq oldvers "null"))
+  (apply #'vc-hg-command
+	 (or buffer "*vc-diff*")
+         (if async 'async 1)
+         files "diff"
+         (append
+          (vc-switches 'hg 'diff)
+          (when oldvers
+            (if newvers
+                (list "-r" oldvers "-r" newvers)
+              (list "-r" oldvers))))))
 
 (defun vc-hg-expanded-log-entry (revision)
   (with-temp-buffer