[PATCH 4 of 7 hglib] hglib: make util.cmdbuilder work with bytes (issue4520)

Brett Cannon brett at python.org
Wed Mar 25 19:39:58 CDT 2015


# HG changeset patch
# User Brett Cannon <brett at python.org>
# Date 1427329317 14400
#      Wed Mar 25 20:21:57 2015 -0400
# Node ID 5efe91a4c2d49d74d1104edd50cd5a82003df4b6
# Parent  6d273d0a51aa24f9c837d67b656467f98f98786d
hglib: make util.cmdbuilder work with bytes (issue4520)

diff -r 6d273d0a51aa -r 5efe91a4c2d4 hglib/util.py
--- a/hglib/util.py	Wed Mar 25 20:19:09 2015 -0400
+++ b/hglib/util.py	Wed Mar 25 20:21:57 2015 -0400
@@ -103,7 +103,7 @@
         if val is None:
             continue
 
-        arg = arg.replace(b('_'), b('-'))
+        arg = b(arg).replace(b('_'), b('-'))
         if arg != b('-'):
             if len(arg) == 1:
                 arg = b('-') + arg
@@ -115,10 +115,13 @@
         elif isinstance(val, list):
             for v in val:
                 cmd.append(arg)
-                cmd.append(str(v))
+                cmd.append(v)
+        elif isinstance(val, int):
+            cmd.append(arg)
+            cmd.append(strtobytes(val))
         else:
             cmd.append(arg)
-            cmd.append(str(val))
+            cmd.append(val)
 
     for a in args:
         if a is not None:


More information about the Mercurial-devel mailing list