Patchwork [2,of,2] py3: bytes/unicode dance on __doc__ of cmdalias

login
register
mail settings
Submitter Yuya Nishihara
Date March 28, 2018, 1:18 p.m.
Message ID <ae01ece672206c33d821.1522243090@mimosa>
Download mbox | patch
Permalink /patch/29920/
State Accepted
Headers show

Comments

Yuya Nishihara - March 28, 2018, 1:18 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1522242407 -32400
#      Wed Mar 28 22:06:47 2018 +0900
# Node ID ae01ece672206c33d8218df0e4b55104be075fd9
# Parent  34381b51be48dad3a7b53c663aa5f38e8f5913fa
py3: bytes/unicode dance on __doc__ of cmdalias

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -551,7 +551,10 @@  class cmdalias(object):
             # drop prefix in old-style help lines so hg shows the alias
             self.help = self.help[4 + len(cmd):]
 
-        self.__doc__ = cfg.get('doc', fn.__doc__)
+        doc = cfg.get('doc', pycompat.getdoc(fn))
+        if doc is not None:
+            doc = pycompat.sysstr(doc)
+        self.__doc__ = doc
 
     @property
     def args(self):