Nano is preferred over Mercurial's ui.editor setting because of HGEDITOR
Categories
(Firefox Build System :: MozillaBuild, task)
Tracking
(Not tracked)
People
(Reporter: bryce, Assigned: mhentges)
References
Details
Attachments
(2 files)
I'm still getting nano as my Mercurial editor despite my mercurial.ini config specifying vim because the HGEDITOR env var is set to nano in the v4 prerelease.
STR:
- Install the mozillabuild v4 prerelease.
- Start a shell via the provided
start-shell.bat
- Run
hg config -e
and seteditor = vim
in the[ui]
section. - Run
hg config -e
again (or another hg command).
Actual result:
The editor opened is nano.
Expected result:
The editor opened in vim.
Further info:
- I can get vim selected by unsetting the
HGEDITOR
env var. - I think this is caused by this line and because
HGEDITOR
has high precedence than the config file.
Assignee | ||
Comment 1•3 years ago
|
||
Ah, thanks for the report, that aligns with the mercurial docs.
I'll shuffle it over to our packaged mercurial.ini
file instead.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 2•3 years ago
|
||
As documented in the mercurial docs [1], $HGEDITOR
overrides the
user's mercurial.ini
config. Since MozillaBuild's editor configuration
is supposed to be a convenient //fallback// setting, we should lean on
the "system" mercurial.ini
config file instead, since it's more
override-able.
Unfortunately, though un-documented, $EDITOR
overrides the system
ui.config
setting. So, we have two options:
- Move the 72-char-limit
nano
config to$EDITOR
: this is incorrect
since$EDITOR
may be used in non-VCS-commit contexts. - Unset
$EDITOR
: this isn't ideal because we don't have any other
mechanism for providing system-default git options.
Out of these options, option 1 seems more acceptable to avoid unexpected
behaviour in the future. Besides, using git
in MozillaBuild is already
edge-case-y, so hopefully users opting in to it will also be comfortable
with setting their editor.
Pushed by mhentges@mozilla.com:
https://hg.mozilla.org/mozilla-build/rev/f1f40d18531d
Move hg config to system mercurial.ini instead of env var r=ahochheiden
Assignee | ||
Comment 4•3 years ago
|
||
When writing D140737, I missed a third option that gives us the best of
both worlds:
git
should usenano.exe
by default, but will honour user
configurationhg
should usenano.exe
with our custom configuration (-b -r 72
)
The only way to influence git
in an overridable way was via $EDITOR
,
which would override our only mechanism for configuring hg
.
However, if we set $EDITOR
, but //unset it only when using hg
//,
then everybody wins :)
Updated•2 years ago
|
Description
•