doc/gendoc.py
branchstable
changeset 44975 1a4b9b602e54
parent 43673 f0bee3b1b847
child 45830 c102b704edb5
equal deleted inserted replaced
44972:9e5f598fd29b 44975:1a4b9b602e54
    38 )
    38 )
    39 from mercurial.i18n import (
    39 from mercurial.i18n import (
    40     gettext,
    40     gettext,
    41     _,
    41     _,
    42 )
    42 )
       
    43 from mercurial.utils import stringutil
    43 
    44 
    44 table = commands.table
    45 table = commands.table
    45 globalopts = commands.globalopts
    46 globalopts = commands.globalopts
    46 helptable = help.helptable
    47 helptable = help.helptable
    47 loaddoc = help.loaddoc
    48 loaddoc = help.loaddoc
    83         elif (default is not None) and not isinstance(default, bool):
    84         elif (default is not None) and not isinstance(default, bool):
    84             allopts[-1] += b" <%s>" % optlabel
    85             allopts[-1] += b" <%s>" % optlabel
    85         if b'\n' in desc:
    86         if b'\n' in desc:
    86             # only remove line breaks and indentation
    87             # only remove line breaks and indentation
    87             desc = b' '.join(l.lstrip() for l in desc.split(b'\n'))
    88             desc = b' '.join(l.lstrip() for l in desc.split(b'\n'))
    88         desc += default and _(b" (default: %s)") % bytes(default) or b""
    89         if default:
       
    90             default = stringutil.forcebytestr(default)
       
    91             desc += _(b" (default: %s)") % default
    89         yield (b", ".join(allopts), desc)
    92         yield (b", ".join(allopts), desc)
    90 
    93 
    91 
    94 
    92 def get_cmd(cmd, cmdtable):
    95 def get_cmd(cmd, cmdtable):
    93     d = {}
    96     d = {}