This is an archive of the discontinued Mercurial Phabricator instance.

py3: do .decode(), .encode() dance in runtests.py
AbandonedPublic

Authored by pulkit on Aug 31 2018, 4:53 PM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

shlex.quote() is not happy to work on bytes in Python 3. Let's feed that with
unicodes.

This should make the py3 buildbot green.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Aug 31 2018, 4:53 PM
pulkit updated this revision to Diff 10689.Aug 31 2018, 5:00 PM
yuja added a subscriber: yuja.Aug 31 2018, 8:29 PM
def toggletrace(cmd):
  • quoted = shellquote(cmd.strip()).replace(b'\\', b'\\\\')

+ cmd = cmd.decode('ascii')
+ quoted = shellquote(cmd.strip()).encode('ascii')
+ quoted = quoted.replace(b'\\', b'\\\\')

Perhaps _bytespath/_strpath can be used to avoid possible side effect on
Python 2.

I have an alternative fix in D4444.

pulkit abandoned this revision.Sep 3 2018, 6:12 AM