# HG changeset patch # User Martin von Zweigbergk # Date 1544823886 28800 # Node ID f6187e60f79232cb647004417bc2aa11091f22d2 # Parent 8604f130eb4358c3b1eb5f3f6fc52415b88a363f help: present boolean arguments as "--[no-]foo" This should make it much more discoverable (we document it in `hg help flags`, but most users don't think to look there). Note that flags that default to None (and not False) will not get this new presentation. We can change the defaults to False later for flags where it makes sense (probably almost all boolean flags). Differential Revision: https://phab.mercurial-scm.org/D5432 diff -r 8604f130eb43 -r f6187e60f792 mercurial/help.py --- a/mercurial/help.py Fri Dec 14 13:33:12 2018 -0800 +++ b/mercurial/help.py Fri Dec 14 13:44:46 2018 -0800 @@ -160,6 +160,8 @@ if shortopt: so = '-' + shortopt lo = '--' + longopt + if isinstance(default, bool): + lo = '--[no-]' + longopt if isinstance(default, fancyopts.customopt): default = default.getdefaultvalue() diff -r 8604f130eb43 -r f6187e60f792 tests/test-extension.t --- a/tests/test-extension.t Fri Dec 14 13:33:12 2018 -0800 +++ b/tests/test-extension.t Fri Dec 14 13:44:46 2018 -0800 @@ -716,7 +716,7 @@ --profile print command execution profile --version output version information and exit -h --help display help and exit - --hidden consider hidden changesets (default: off) + --[no-]hidden consider hidden changesets (default: off) --pager TYPE when to paginate (boolean, always, auto, or never) (default: auto) @@ -755,7 +755,7 @@ --profile print command execution profile --version output version information and exit -h --help display help and exit - --hidden consider hidden changesets (default: off) + --[no-]hidden consider hidden changesets (default: off) --pager TYPE when to paginate (boolean, always, auto, or never) (default: auto) @@ -1043,7 +1043,7 @@ --profile print command execution profile --version output version information and exit -h --help display help and exit - --hidden consider hidden changesets (default: off) + --[no-]hidden consider hidden changesets (default: off) --pager TYPE when to paginate (boolean, always, auto, or never) (default: auto) @@ -1080,7 +1080,7 @@ --profile print command execution profile --version output version information and exit -h --help display help and exit - --hidden consider hidden changesets (default: off) + --[no-]hidden consider hidden changesets (default: off) --pager TYPE when to paginate (boolean, always, auto, or never) (default: auto) @@ -1155,7 +1155,7 @@ --profile print command execution profile --version output version information and exit -h --help display help and exit - --hidden consider hidden changesets (default: off) + --[no-]hidden consider hidden changesets (default: off) --pager TYPE when to paginate (boolean, always, auto, or never) (default: auto) @@ -1191,7 +1191,7 @@ --profile print command execution profile --version output version information and exit -h --help display help and exit - --hidden consider hidden changesets (default: off) + --[no-]hidden consider hidden changesets (default: off) --pager TYPE when to paginate (boolean, always, auto, or never) (default: auto) diff -r 8604f130eb43 -r f6187e60f792 tests/test-fix.t --- a/tests/test-fix.t Fri Dec 14 13:33:12 2018 -0800 +++ b/tests/test-fix.t Fri Dec 14 13:44:46 2018 -0800 @@ -104,12 +104,13 @@ options ([+] can be repeated): - --all fix all non-public non-obsolete revisions (default: off) - --base REV [+] revisions to diff against (overrides automatic selection, - and applies to every revision being fixed) - -r --rev REV [+] revisions to fix - -w --working-dir fix the working directory (default: off) - --whole always fix every line of a file (default: off) + --[no-]all fix all non-public non-obsolete revisions (default: + off) + --base REV [+] revisions to diff against (overrides automatic + selection, and applies to every revision being fixed) + -r --rev REV [+] revisions to fix + -w --[no-]working-dir fix the working directory (default: off) + --[no-]whole always fix every line of a file (default: off) (some details hidden, use --verbose to show complete help) diff -r 8604f130eb43 -r f6187e60f792 tests/test-help.t --- a/tests/test-help.t Fri Dec 14 13:33:12 2018 -0800 +++ b/tests/test-help.t Fri Dec 14 13:44:46 2018 -0800 @@ -440,7 +440,7 @@ --profile print command execution profile --version output version information and exit -h --help display help and exit - --hidden consider hidden changesets (default: off) + --[no-]hidden consider hidden changesets (default: off) --pager TYPE when to paginate (boolean, always, auto, or never) (default: auto) @@ -540,7 +540,7 @@ --profile print command execution profile --version output version information and exit -h --help display help and exit - --hidden consider hidden changesets (default: off) + --[no-]hidden consider hidden changesets (default: off) --pager TYPE when to paginate (boolean, always, auto, or never) (default: auto) @@ -905,8 +905,8 @@ xxxxxxxxxxxxxxxxxxxxxxx (default: 3) -n -- normal desc --newline VALUE line1 line2 - --default-off enable X (default: off) - --default-on enable Y (default: on) + --[no-]default-off enable X (default: off) + --[no-]default-on enable Y (default: on) --callableopt VALUE adds foo --customopt VALUE adds bar --customopt-withdefault VALUE adds bar (default: foo) @@ -2889,7 +2889,7 @@ --help display help and exit - --hidden + --[no-]hidden consider hidden changesets (default: off) --pager TYPE @@ -3093,7 +3093,7 @@ --help display help and exit - --hidden + --[no-]hidden consider hidden changesets (default: off) --pager TYPE diff -r 8604f130eb43 -r f6187e60f792 tests/test-narrow-trackedcmd.t --- a/tests/test-narrow-trackedcmd.t Fri Dec 14 13:33:12 2018 -0800 +++ b/tests/test-narrow-trackedcmd.t Fri Dec 14 13:44:46 2018 -0800 @@ -99,19 +99,20 @@ options ([+] can be repeated): - --addinclude VALUE [+] new paths to include - --removeinclude VALUE [+] old paths to no longer include - --addexclude VALUE [+] new paths to exclude - --import-rules VALUE import narrowspecs from a file - --removeexclude VALUE [+] old paths to no longer exclude - --clear whether to replace the existing narrowspec - (default: off) - --force-delete-local-changes forces deletion of local changes when - narrowing (default: off) - -e --ssh CMD specify ssh command to use - --remotecmd CMD specify hg command to run on the remote side - --insecure do not verify server certificate (ignoring - web.cacerts config) + --addinclude VALUE [+] new paths to include + --removeinclude VALUE [+] old paths to no longer include + --addexclude VALUE [+] new paths to exclude + --import-rules VALUE import narrowspecs from a file + --removeexclude VALUE [+] old paths to no longer exclude + --[no-]clear whether to replace the existing + narrowspec (default: off) + --[no-]force-delete-local-changes forces deletion of local changes when + narrowing (default: off) + -e --ssh CMD specify ssh command to use + --remotecmd CMD specify hg command to run on the remote + side + --insecure do not verify server certificate + (ignoring web.cacerts config) (use 'hg tracked -h' to show more help) [255] diff -r 8604f130eb43 -r f6187e60f792 tests/test-shelve.t --- a/tests/test-shelve.t Fri Dec 14 13:33:12 2018 -0800 +++ b/tests/test-shelve.t Fri Dec 14 13:44:46 2018 -0800 @@ -75,7 +75,7 @@ --cleanup delete all shelved changes --date DATE shelve with the specified commit date -d --delete delete the named shelved change(s) - -e --edit invoke editor on commit messages (default: off) + -e --[no-]edit invoke editor on commit messages (default: off) -l --list list current shelves -m --message TEXT use text as shelve message -n --name NAME use the given name for the shelved commit diff -r 8604f130eb43 -r f6187e60f792 tests/test-uncommit.t --- a/tests/test-uncommit.t Fri Dec 14 13:33:12 2018 -0800 +++ b/tests/test-uncommit.t Fri Dec 14 13:44:46 2018 -0800 @@ -34,7 +34,7 @@ options ([+] can be repeated): - --keep allow an empty commit after uncommiting (default: + --[no-]keep allow an empty commit after uncommiting (default: off) -I --include PATTERN [+] include names matching the given patterns -X --exclude PATTERN [+] exclude names matching the given patterns