Patchwork [2,of,8] util: mark MBTextWrapper as private

login
register
mail settings
Submitter Yuya Nishihara
Date March 22, 2018, 3:01 p.m.
Message ID <8ab5f1228ee081fcef08.1521730913@mimosa>
Download mbox | patch
Permalink /patch/29781/
State Accepted
Headers show

Comments

Yuya Nishihara - March 22, 2018, 3:01 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1521720811 -32400
#      Thu Mar 22 21:13:31 2018 +0900
# Node ID 8ab5f1228ee081fcef083dd026c2be53f4ed6932
# Parent  bd6a3b24449e6e53bd9b4ed1be015d53b4db9cee
util: mark MBTextWrapper as private

Makes porting slightly easier.

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2774,7 +2774,7 @@  def uirepr(s):
     return pycompat.byterepr(pycompat.bytestr(s)).replace(b'\\\\', b'\\')
 
 # delay import of textwrap
-def MBTextWrapper(**kwargs):
+def _MBTextWrapper(**kwargs):
     class tw(textwrap.TextWrapper):
         """
         Extend TextWrapper for width-awareness.
@@ -2873,8 +2873,8 @@  def MBTextWrapper(**kwargs):
 
             return lines
 
-    global MBTextWrapper
-    MBTextWrapper = tw
+    global _MBTextWrapper
+    _MBTextWrapper = tw
     return tw(**kwargs)
 
 def wrap(line, width, initindent='', hangindent=''):
@@ -2888,9 +2888,9 @@  def wrap(line, width, initindent='', han
                     pycompat.sysstr(encoding.encodingmode))
     hangindent = hangindent.decode(pycompat.sysstr(encoding.encoding),
                     pycompat.sysstr(encoding.encodingmode))
-    wrapper = MBTextWrapper(width=width,
-                            initial_indent=initindent,
-                            subsequent_indent=hangindent)
+    wrapper = _MBTextWrapper(width=width,
+                             initial_indent=initindent,
+                             subsequent_indent=hangindent)
     return wrapper.fill(line).encode(pycompat.sysstr(encoding.encoding))
 
 if (pyplatform.python_implementation() == 'CPython' and