[PATCH 10 of 10 py3] help: when looking for exclusion kws, convert doc to sysbytes

Augie Fackler raf at durin42.com
Mon May 29 10:32:32 EDT 2017


# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1496001043 14400
#      Sun May 28 15:50:43 2017 -0400
# Node ID 6e1f46fb198dbe5ec45d01a34cea43c541bd7233
# Parent  f1be99397daee2fa8bd9d04cb1296cb7e0260c0d
help: when looking for exclusion kws, convert doc to sysbytes

There's one spot where doc is sometimes a unicode - I haven't figured
out when that happens, but it was easy enough to work around that I
just did so.

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -114,6 +114,8 @@ def indicateomitted(rst, omitted, notomi
 def filtercmd(ui, cmd, kw, doc):
     if not ui.debugflag and cmd.startswith("debug") and kw != "debug":
         return True
+    if doc and not isinstance(doc, bytes):
+        doc = pycompat.sysbytes(doc)
     if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
         return True
     return False
@@ -266,7 +268,8 @@ def makeitemsdoc(ui, topic, doc, marker,
     for name in sorted(items):
         text = (items[name].__doc__ or '').rstrip()
         if (not text
-            or not ui.verbose and any(w in text for w in _exclkeywords)):
+            or not ui.verbose
+            and any(w in pycompat.sysbytes(text) for w in _exclkeywords)):
             continue
         text = gettext(text)
         if dedent:


More information about the Mercurial-devel mailing list