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
--- 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(