Patchwork D5444: help: use "yes" and "no" for boolean defaults instead of "on" and "off"

login
register
mail settings
Submitter phabricator
Date Dec. 15, 2018, 11:50 a.m.
Message ID <differential-rev-PHID-DREV-hf5vatgbsy576xoqgnj2-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/37185/
State New
Headers show

Comments

phabricator - Dec. 15, 2018, 11:50 a.m.
av6 created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5444

AFFECTED FILES
  mercurial/help.py
  tests/test-extension.t
  tests/test-fix.t
  tests/test-help.t
  tests/test-narrow-trackedcmd.t
  tests/test-shelve.t
  tests/test-uncommit.t

CHANGE DETAILS




To: av6, durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Dec. 15, 2018, 3:35 p.m.
pulkit added a comment.


  TBH, I think 'on' and 'off' are more appropriate than 'yes' and 'no'.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5444

To: av6, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - Dec. 15, 2018, 6:03 p.m.
av6 added a comment.


  The point of https://phab.mercurial-scm.org/D5430 was to make hg help output more human friendly by replacing `True` and `False` with something less Python-related. In other words, more human-friendly. "Yes" and "no" are way more human-friendly:
  
  - they are one of the most used words, so people naturally expect to see them, and can tell them apart from just "y" or "n" (they are also less ambiguous themselves — just look up how many meanings "on" or "off" has and how many parts of speech can they be),
  - they also work perfectly fine as answers to the flag descriptions (Consider hidden changesets? Yes, please. No, thanks.),
  - and "no" (more precisely, "no-") is the very same thing that users should add to the flags to negate them (not "--off-hidden").

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5444

To: av6, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - Dec. 15, 2018, 7:47 p.m.
martinvonz added a comment.


  Arguments against yes/no:
  
  1. "default: yes/no" can easily be read as "is this a default", which is not quite the same, although it would have the same effect.
  
  2. On/off fits well in sentences like "is --hidden on by default".
  
  I see your arguments too (mostly the last one of them), but I still slightly prefer on/off.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5444

To: av6, durin42, #hg-reviewers
Cc: martinvonz, pulkit, mercurial-devel
Yuya Nishihara - Dec. 16, 2018, 1:46 a.m.
I feel `--no-<thing>` and `--<thing>=off|false` are more natural, and
`(default: %s)` is the latter form.
phabricator - Dec. 16, 2018, 1:48 a.m.
yuja added a comment.


  I feel `--no-<thing>` and `--<thing>=off|false` are more natural, and
  `(default: %s)` is the latter form.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5444

To: av6, durin42, #hg-reviewers
Cc: yuja, martinvonz, pulkit, mercurial-devel

Patch

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -35,7 +35,7 @@ 
   options ([+] can be repeated):
   
       --[no-]keep           allow an empty commit after uncommiting (default:
-                            off)
+                            no)
    -I --include PATTERN [+] include names matching the given patterns
    -X --exclude PATTERN [+] exclude names matching the given patterns
   
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -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 --[no-]edit           invoke editor on commit messages (default: off)
+   -e --[no-]edit           invoke editor on commit messages (default: no)
    -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 --git a/tests/test-narrow-trackedcmd.t b/tests/test-narrow-trackedcmd.t
--- a/tests/test-narrow-trackedcmd.t
+++ b/tests/test-narrow-trackedcmd.t
@@ -105,9 +105,9 @@ 
       --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)
+                                        narrowspec (default: no)
       --[no-]force-delete-local-changes forces deletion of local changes when
-                                        narrowing (default: off)
+                                        narrowing (default: no)
    -e --ssh CMD                         specify ssh command to use
       --remotecmd CMD                   specify hg command to run on the remote
                                         side
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 @@ 
       --profile           print command execution profile
       --version           output version information and exit
    -h --help              display help and exit
-      --[no-]hidden       consider hidden changesets (default: off)
+      --[no-]hidden       consider hidden changesets (default: no)
       --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
-      --[no-]hidden       consider hidden changesets (default: off)
+      --[no-]hidden       consider hidden changesets (default: no)
       --pager TYPE        when to paginate (boolean, always, auto, or never)
                           (default: auto)
 
@@ -809,8 +809,8 @@ 
   >     [(b'', b'longdesc', 3, b'x'*67),
   >     (b'n', b'', None, b'normal desc'),
   >     (b'', b'newline', b'', b'line1\nline2'),
-  >     (b'', b'default-off', False, b'enable X'),
-  >     (b'', b'default-on', True, b'enable Y'),
+  >     (b'', b'default-no', False, b'enable X'),
+  >     (b'', b'default-yes', True, b'enable Y'),
   >     (b'', b'callableopt', func, b'adds foo'),
   >     (b'', b'customopt', customopt(''), b'adds bar'),
   >     (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
@@ -905,8 +905,8 @@ 
                                     xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
    -n --                            normal desc
       --newline VALUE               line1 line2
-      --[no-]default-off            enable X (default: off)
-      --[no-]default-on             enable Y (default: on)
+      --[no-]default-no             enable X (default: no)
+      --[no-]default-yes            enable Y (default: yes)
       --callableopt VALUE           adds foo
       --customopt VALUE             adds bar
       --customopt-withdefault VALUE adds bar (default: foo)
@@ -2890,7 +2890,7 @@ 
   <td>display help and exit</td></tr>
   <tr><td></td>
   <td>--[no-]hidden</td>
-  <td>consider hidden changesets (default: off)</td></tr>
+  <td>consider hidden changesets (default: no)</td></tr>
   <tr><td></td>
   <td>--pager TYPE</td>
   <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
@@ -3094,7 +3094,7 @@ 
   <td>display help and exit</td></tr>
   <tr><td></td>
   <td>--[no-]hidden</td>
-  <td>consider hidden changesets (default: off)</td></tr>
+  <td>consider hidden changesets (default: no)</td></tr>
   <tr><td></td>
   <td>--pager TYPE</td>
   <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -104,13 +104,12 @@ 
   
   options ([+] can be repeated):
   
-      --[no-]all         fix all non-public non-obsolete revisions (default:
-                         off)
+      --[no-]all         fix all non-public non-obsolete revisions (default: no)
       --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)
+   -w --[no-]working-dir fix the working directory (default: no)
+      --[no-]whole       always fix every line of a file (default: no)
   
   (some details hidden, use --verbose to show complete help)
 
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 @@ 
       --profile           print command execution profile
       --version           output version information and exit
    -h --help              display help and exit
-      --[no-]hidden       consider hidden changesets (default: off)
+      --[no-]hidden       consider hidden changesets (default: no)
       --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
-      --[no-]hidden       consider hidden changesets (default: off)
+      --[no-]hidden       consider hidden changesets (default: no)
       --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
-      --[no-]hidden       consider hidden changesets (default: off)
+      --[no-]hidden       consider hidden changesets (default: no)
       --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
-      --[no-]hidden       consider hidden changesets (default: off)
+      --[no-]hidden       consider hidden changesets (default: no)
       --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
-      --[no-]hidden       consider hidden changesets (default: off)
+      --[no-]hidden       consider hidden changesets (default: no)
       --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
-      --[no-]hidden       consider hidden changesets (default: off)
+      --[no-]hidden       consider hidden changesets (default: no)
       --pager TYPE        when to paginate (boolean, always, auto, or never)
                           (default: auto)
 
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -172,7 +172,7 @@ 
             # then convert it to bytes.
             defaultstr = pycompat.bytestr(default)
             if isinstance(default, bool):
-                defaultstr = _("on") if default else _("off")
+                defaultstr = _("yes") if default else _("no")
             desc += _(" (default: %s)") % defaultstr
 
         if isinstance(default, list):