aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2025-08-16 12:40:23 +0100
committerSean Whitton2025-08-16 14:12:04 +0100
commitd4c9f08f26ebd208e1a6d102410ec93b7ff323b6 (patch)
treea0f15efa528baab9e4ec37d3f893e9770746608d
parent78d569e5245e29e271a2d443092dad8f4ccdaf51 (diff)
downloademacs-d4c9f08f26ebd208e1a6d102410ec93b7ff323b6.tar.gz
emacs-d4c9f08f26ebd208e1a6d102410ec93b7ff323b6.zip
vc-test--with-author-identity: Handle Mercurial
* test/lisp/vc/vc-tests/vc-tests.el (vc-hg-global-switches): Declare. (vc-test--with-author-identity): Handle Mercurial.
-rw-r--r--test/lisp/vc/vc-tests/vc-tests.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/lisp/vc/vc-tests/vc-tests.el b/test/lisp/vc/vc-tests/vc-tests.el
index 81789814350..02be0e722e4 100644
--- a/test/lisp/vc/vc-tests/vc-tests.el
+++ b/test/lisp/vc/vc-tests/vc-tests.el
@@ -584,20 +584,26 @@ This checks also `vc-backend' and `vc-responsible-backend'."
584 (ignore-errors 584 (ignore-errors
585 (run-hooks 'vc-test--cleanup-hook)))))) 585 (run-hooks 'vc-test--cleanup-hook))))))
586 586
587(defvar vc-hg-global-switches)
588
587(defmacro vc-test--with-author-identity (backend &rest body) 589(defmacro vc-test--with-author-identity (backend &rest body)
588 (declare (indent 1) (debug t)) 590 (declare (indent 1) (debug t))
589 `(let ((process-environment process-environment)) 591 `(let ((process-environment process-environment)
592 (vc-hg-global-switches vc-hg-global-switches))
590 ;; git tries various approaches to guess a user name and email, 593 ;; git tries various approaches to guess a user name and email,
591 ;; which can fail depending on how the system is configured. 594 ;; which can fail depending on how the system is configured.
592 ;; Eg if the user account has no GECOS, git commit can fail with 595 ;; Eg if the user account has no GECOS, git commit can fail with
593 ;; status 128 "fatal: empty ident name". 596 ;; status 128 "fatal: empty ident name".
594 (when (memq ,backend '(Bzr Git)) 597 (when (memq ,backend '(Bzr Git))
595 (setq process-environment (cons "EMAIL=john@doe.ee" 598 (push "EMAIL=john@doe.ee" process-environment))
596 process-environment)))
597 (when (eq ,backend 'Git) 599 (when (eq ,backend 'Git)
598 (setq process-environment (append '("GIT_AUTHOR_NAME=A" 600 (setq process-environment (append '("GIT_AUTHOR_NAME=A"
599 "GIT_COMMITTER_NAME=C") 601 "GIT_COMMITTER_NAME=C")
600 process-environment))) 602 process-environment)))
603
604 ;; Mercurial fails to autodetect an identity on MS-Windows.
605 (when (eq ,backend 'Hg)
606 (push "--config=ui.username=john@doe.ee" vc-hg-global-switches))
601 ,@body)) 607 ,@body))
602 608
603(declare-function log-edit-done "vc/log-edit") 609(declare-function log-edit-done "vc/log-edit")