changeset 52568:8986a3a8147a

ui: set the default editor on Windows to notepad.exe It's a pretty basic editor, and not one I'd expect anyone to want to continue using. But it exists on PATH (unlike `vi`), and allows `hg config -e` to open the user config file in order to bootstrap making changes, without fiddling with setting `HGEDITOR` in the environment. Otherwise, attempting this results in a cryptic error: C:\Users\Matt>hg config -e 'vi' is not recognized as an internal or external command, operable program or batch file. abort: edit failed: vi exited with status 1
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 17 Dec 2024 19:21:15 -0500
parents f33f37accb43
children 1dea9d91f476
files mercurial/ui.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Mon Dec 16 10:52:01 2024 -0500
+++ b/mercurial/ui.py	Tue Dec 17 19:21:15 2024 -0500
@@ -2093,6 +2093,9 @@
             # command. Proof: `vi -c ':unknown' -c ':qa'; echo $?` produces 1,
             # while s/vi/vim/ doesn't.
             editor = b'vim'
+        elif pycompat.iswindows:
+            # vi isn't installed by on Windows, while notepad.exe is.
+            editor = b'notepad.exe'
         else:
             editor = b'vi'
         return encoding.environ.get(b"HGEDITOR") or self.config(