Patchwork [2,of,9] py3: replace "if ispy3" by pycompat.bytestr()

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 3, 2018, 8:36 a.m.
Message ID <ab13ecb04e6665222ad3.1517646973@mimosa>
Download mbox | patch
Permalink /patch/27262/
State Accepted
Headers show

Comments

Yuya Nishihara - Feb. 3, 2018, 8:36 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1517026306 -32400
#      Sat Jan 27 13:11:46 2018 +0900
# Node ID ab13ecb04e6665222ad3e10308dc7c2b84b3138b
# Parent  f4250fa75585535cd97f378d27b4d999d4ccc359
py3: replace "if ispy3" by pycompat.bytestr()

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -821,9 +821,7 @@  def _dispatch(req):
 
         if options['verbose'] or options['debug'] or options['quiet']:
             for opt in ('verbose', 'debug', 'quiet'):
-                val = str(bool(options[opt]))
-                if pycompat.ispy3:
-                    val = val.encode('ascii')
+                val = pycompat.bytestr(bool(options[opt]))
                 for ui_ in uis:
                     ui_.setconfig('ui', opt, val, '--' + opt)