improve suggestion for setting username

Summary:
Update instructions to:

- suggest `--user` instead of `--edit`
- edit config via CLI directly without opening an editor

I also noticed that currently, on Windows, trying to open an
editor to edit a config attempts to use `vi` by default, which fails.

Reviewed By: zzl0

Differential Revision: D41062921

fbshipit-source-id: faac2a897a63939d7fb03d3ab6d11851e951c05f
This commit is contained in:
Michael Bolin 2022-11-07 08:33:48 -08:00 committed by Facebook GitHub Bot
parent c2b84cc9e6
commit 91272802fb
3 changed files with 5 additions and 3 deletions

View File

@ -600,7 +600,9 @@ class ui(object):
if not user:
raise error.Abort(
_("no username supplied"),
hint=_("use '@prog@ config --edit' " "to set your username"),
hint=_(
'use `@prog@ config --user ui.username "First Last <me@example.com>"` to set your username'
),
)
if "\n" in user:
raise error.Abort(_("username %s contains a newline\n") % repr(user))

View File

@ -281,7 +281,7 @@ Modify end of plain file with username unset
$ unset HGUSER
$ hg commit -i --config ui.username= -d '8 0' -m end plain
abort: no username supplied
(use 'hg config --edit' to set your username)
(use `hg config --user ui.username "First Last <me@example.com>"` to set your username)
[255]

View File

@ -49,7 +49,7 @@
$ echo "username = " >> .hg/hgrc
$ hg commit -m commit-1
abort: no username supplied
(use 'hg config --edit' to set your username)
(use `hg config --user ui.username "First Last <me@example.com>"` to set your username)
[255]
# test alternate config var