[PATCH 5 of 8 py3] util: look for empty-sysstr instead of empty-bytesstr in textwrap code

Augie Fackler raf at durin42.com
Sun May 28 16:59:01 EDT 2017


# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1496002663 14400
#      Sun May 28 16:17:43 2017 -0400
# Node ID 41aae794b8504450ed27f89422f586625933abee
# Parent  c5c6c6d5182249fe4ec6daa7ff2e0faf1a3a7e75
util: look for empty-sysstr instead of empty-bytesstr in textwrap code

Fixes behavior on Python 3.

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2310,7 +2310,7 @@ def MBTextWrapper(**kwargs):
 
                 # First chunk on line is whitespace -- drop it, unless this
                 # is the very beginning of the text (i.e. no lines started yet).
-                if self.drop_whitespace and chunks[-1].strip() == '' and lines:
+                if self.drop_whitespace and chunks[-1].strip() == r'' and lines:
                     del chunks[-1]
 
                 while chunks:
@@ -2332,7 +2332,7 @@ def MBTextWrapper(**kwargs):
 
                 # If the last chunk on this line is all whitespace, drop it.
                 if (self.drop_whitespace and
-                    cur_line and cur_line[-1].strip() == ''):
+                    cur_line and cur_line[-1].strip() == r''):
                     del cur_line[-1]
 
                 # Convert current line back to a string and store it in list


More information about the Mercurial-devel mailing list