Patchwork [2,of,6,V2] py3: convert bool variables to bytes before passing into ui.debug()

login
register
mail settings
Submitter Pulkit Goyal
Date June 2, 2017, 8:46 a.m.
Message ID <9c2175e859f45ed46936.1496393167@workspace>
Download mbox | patch
Permalink /patch/21131/
State Accepted
Headers show

Comments

Pulkit Goyal - June 2, 2017, 8:46 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1496263466 -19800
#      Thu Jun 01 02:14:26 2017 +0530
# Node ID 9c2175e859f45ed46936469a759e6c8b9004a22a
# Parent  754e0b7e0ef3c73971b44e9c3fb76ab27206893a
py3: convert bool variables to bytes before passing into ui.debug()

We can't pass unicodes to ui.debug() and hence we need to convert things to
bytes before passing them.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -807,9 +807,12 @@ 
         ret = copies.mergecopies(repo, wctx, p2, pa)
         copy, movewithdir, diverge, renamedelete, dirmove = ret
 
+    boolbm = pycompat.bytestr(bool(branchmerge))
+    boolf = pycompat.bytestr(bool(force))
+    boolm = pycompat.bytestr(bool(matcher))
     repo.ui.note(_("resolving manifests\n"))
     repo.ui.debug(" branchmerge: %s, force: %s, partial: %s\n"
-                  % (bool(branchmerge), bool(force), bool(matcher)))
+                  % (boolbm, boolf, boolm))
     repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, wctx, p2))
 
     m1, m2, ma = wctx.manifest(), p2.manifest(), pa.manifest()