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

login
register
mail settings
Submitter Augie Fackler
Date May 28, 2017, 8:59 p.m.
Message ID <41aae794b8504450ed27.1496005141@imladris.local>
Download mbox | patch
Permalink /patch/21001/
State Accepted
Headers show

Comments

Augie Fackler - May 28, 2017, 8:59 p.m.
# HG changeset patch
# User Augie Fackler <raf@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.

Patch

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