Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 48500:eaad68294904
status: when extracting arguments from `opts`, use the same default values
Sometimes other code, such as commit when using `commands.commit.post-status`,
calls `commands.status()` without going through the normal dispatch mechanism
that would typically fill in the args to be something besides None. As a
"defense in depth" mechanism for a bug where Mercurial would crash if both
`commands.commit.post-status` and `experimental.directaccess` were enabled,
let's sanitize these values to be identical to the values they would have when
the user invoked this method from the commandline.
Differential Revision: https://phab.mercurial-scm.org/D11884
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Tue, 07 Dec 2021 15:53:55 -0800 |
parents | 38941a28406a |
children | a51c522c0064 |
comparison
equal
deleted
inserted
replaced
48499:c51408b92b88 | 48500:eaad68294904 |
---|---|
6871 | 6871 |
6872 """ | 6872 """ |
6873 | 6873 |
6874 cmdutil.check_at_most_one_arg(opts, 'rev', 'change') | 6874 cmdutil.check_at_most_one_arg(opts, 'rev', 'change') |
6875 opts = pycompat.byteskwargs(opts) | 6875 opts = pycompat.byteskwargs(opts) |
6876 revs = opts.get(b'rev') | 6876 revs = opts.get(b'rev', []) |
6877 change = opts.get(b'change') | 6877 change = opts.get(b'change', b'') |
6878 terse = opts.get(b'terse') | 6878 terse = opts.get(b'terse', _NOTTERSE) |
6879 if terse is _NOTTERSE: | 6879 if terse is _NOTTERSE: |
6880 if revs: | 6880 if revs: |
6881 terse = b'' | 6881 terse = b'' |
6882 else: | 6882 else: |
6883 terse = ui.config(b'commands', b'status.terse') | 6883 terse = ui.config(b'commands', b'status.terse') |