[PATCH 1 of 2] update: ignore commands.update.requiredest if HGPLAIN=1

Martin von Zweigbergk martinvonz at google.com
Wed Mar 22 11:47:20 EDT 2017


On Wed, Mar 22, 2017 at 8:33 AM, Martin von Zweigbergk
<martinvonz at google.com> wrote:
> On Wed, Mar 22, 2017 at 6:09 AM, Yuya Nishihara <yuya at tcha.org> wrote:
>> On Tue, 21 Mar 2017 21:27:20 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
>>> # HG changeset patch
>>> # User Martin von Zweigbergk <martinvonz at google.com>
>>> # Date 1490156520 25200
>>> #      Tue Mar 21 21:22:00 2017 -0700
>>> # Node ID 2558f3d814f50681641fff9815d30129de2ab5ad
>>> # Parent  13dc00c233b7e374a6fa0b9846510a94c2615671
>>> update: ignore commands.update.requiredest if HGPLAIN=1
>>>
>>> diff -r 13dc00c233b7 -r 2558f3d814f5 mercurial/commands.py
>>> --- a/mercurial/commands.py   Tue Mar 14 17:43:44 2017 -0700
>>> +++ b/mercurial/commands.py   Tue Mar 21 21:22:00 2017 -0700
>>> @@ -5349,7 +5349,8 @@
>>>      if rev and node:
>>>          raise error.Abort(_("please specify just one revision"))
>>>
>>> -    if ui.configbool('commands', 'update.requiredest', False):
>>> +    if (not ui.plain() and
>>> +        ui.configbool('commands', 'update.requiredest', False)):
>>>          if not node and not rev and not date:
>>>              raise error.Abort(_('you must specify a destination'),
>>>                                hint=_('for example: hg update ".::"'))
>>
>> Perhaps it will be better to handle this kind of HGPLAIN stuff in ui.py
>> like how 'defaults' section is ignored.
>
> Makes sense. I'll just check that "HGPLAIN=1 hg --config
> commands.update.requiredest=1 up" does not fail (I assume HGPLAIN
> should also make it ignore commands.* configs provided via --config).

Looks like my assumption was wrong, in the sense that that's not how
it currently works for the other flags. For example:

$ hg id
facd5b0862f1 tip
$ HGPLAIN=1 hg --config ui.quiet=1 id
facd5b0862f1

So I guess we should stick to that pattern for [commands]. That also
makes sense because it is similar to how HGRCPATH=/dev/null works;
config options can be added onto the otherwise empty config.

I'll just need to update the test case I included in this patch to
actually write the config to file.


More information about the Mercurial-devel mailing list