diff --git a/mercurial/help.py b/mercurial/help.py --- a/mercurial/help.py +++ b/mercurial/help.py @@ -160,6 +160,8 @@ def optrst(header, options, verbose): if shortopt: so = '-' + shortopt lo = '--' + longopt + if isinstance(default, bool): + lo = '--[no-]' + longopt if isinstance(default, fancyopts.customopt): default = default.getdefaultvalue() diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -716,7 +716,7 @@ hide outer repo --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 @@ hide outer repo --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 @@ extension help itself --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 @@ Make sure that single '-v' option shows --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 @@ help options '-v' and '-v -e' should be --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 @@ help options '-v' and '-v -e' should be --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 --git a/tests/test-fix.t b/tests/test-fix.t --- a/tests/test-fix.t +++ b/tests/test-fix.t @@ -104,12 +104,13 @@ Help text for fix. 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 --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -440,7 +440,7 @@ Test short command list with verbose opt --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 @@ Verbose help for add --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 @@ Test command with no help text 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 @@ Dish up an empty repo; serve it cold.