Mercurial > hg
comparison mercurial/crecord.py @ 36305:a8bca9d0cea0
py3: make sure regex is bytes in crecord.py
# skip-blame because we are just adding b''
Differential Revision: https://phab.mercurial-scm.org/D2336
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 19 Feb 2018 00:15:50 +0530 |
parents | fb2e59e92651 |
children | 3496bffe266d |
comparison
equal
deleted
inserted
replaced
36304:6d6bc544467a | 36305:a8bca9d0cea0 |
---|---|
948 if showwhtspc == True, trailing whitespace of a string is highlighted. | 948 if showwhtspc == True, trailing whitespace of a string is highlighted. |
949 """ | 949 """ |
950 # preprocess the text, converting tabs to spaces | 950 # preprocess the text, converting tabs to spaces |
951 text = text.expandtabs(4) | 951 text = text.expandtabs(4) |
952 # strip \n, and convert control characters to ^[char] representation | 952 # strip \n, and convert control characters to ^[char] representation |
953 text = re.sub(r'[\x00-\x08\x0a-\x1f]', | 953 text = re.sub(br'[\x00-\x08\x0a-\x1f]', |
954 lambda m:'^' + chr(ord(m.group()) + 64), text.strip('\n')) | 954 lambda m:'^' + chr(ord(m.group()) + 64), text.strip('\n')) |
955 | 955 |
956 if pair is not None: | 956 if pair is not None: |
957 colorpair = pair | 957 colorpair = pair |
958 elif pairname is not None: | 958 elif pairname is not None: |