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

Yuya Nishihara yuya at tcha.org
Wed Mar 28 09:18:10 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at 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

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):


More information about the Mercurial-devel mailing list