Patchwork [1,of,2] hghave: matchoutput needs to use bytes for regexp

login
register
mail settings
Submitter timeless
Date May 5, 2016, 9:13 a.m.
Message ID <b5d88fd58b39e6b96ce1.1462439620@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/14912/
State Superseded
Headers show

Comments

timeless - May 5, 2016, 9:13 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1462439221 0
#      Thu May 05 09:07:01 2016 +0000
# Node ID b5d88fd58b39e6b96ce18a001494113195cfe43c
# Parent  e0e72d67a8cd370218453ca0444e02aadabd56a8
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r b5d88fd58b39
hghave: matchoutput needs to use bytes for regexp

file output is bytes in py3, so we need to convert the regexp to bytes

Patch

diff -r e0e72d67a8cd -r b5d88fd58b39 tests/hghave.py
--- a/tests/hghave.py	Sun Apr 17 13:06:44 2016 +0900
+++ b/tests/hghave.py	Thu May 05 09:07:01 2016 +0000
@@ -90,7 +90,7 @@ 
     """Return the match object if cmd executes successfully and its output
     is matched by the supplied regular expression.
     """
-    r = re.compile(regexp)
+    r = re.compile(regexp.encode('utf-8'))
     try:
         p = subprocess.Popen(
             cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)