diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3324,7 +3324,8 @@ def help_(ui, name=None, unknowncmd=Fals ('extensioncommands', _('Extension Commands'))): if matches[t]: ui.write('%s:\n\n' % title) - ui.write(minirst.format(minirst.maketable(matches[t], 1))) + rst = ''.join(minirst.maketable(matches[t], 1)) + ui.write(minirst.format(rst)) return if name and name != 'shortlist': diff --git a/mercurial/help.py b/mercurial/help.py --- a/mercurial/help.py +++ b/mercurial/help.py @@ -58,9 +58,9 @@ def optrst(options, verbose): rst = minirst.maketable(data, 1) if multioccur: - rst += _("\n[+] marked option can be specified multiple times\n") + rst.append(_("\n[+] marked option can be specified multiple times\n")) - return rst + return ''.join(rst) # list all option lists def opttext(optlist, width, verbose): diff --git a/mercurial/minirst.py b/mercurial/minirst.py --- a/mercurial/minirst.py +++ b/mercurial/minirst.py @@ -658,7 +658,7 @@ def decorateblocks(blocks, width): return lines def maketable(data, indent=0, header=False): - '''Generate an RST table for the given table data''' + '''Generate an RST table for the given table data as a list of lines''' widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)] indent = ' ' * indent @@ -674,4 +674,4 @@ def maketable(data, indent=0, header=Fal if header and len(data) > 1: out.insert(2, div) out.append(div) - return ''.join(out) + return out diff --git a/tests/test-minirst.py b/tests/test-minirst.py --- a/tests/test-minirst.py +++ b/tests/test-minirst.py @@ -237,7 +237,8 @@ data = [['a', 'b', 'c'], ['1', '2', '3'], ['foo', 'bar', 'baz this list is very very very long man']] -table = minirst.maketable(data, 2, True) +rst = minirst.maketable(data, 2, True) +table = ''.join(rst) print table