Mercurial > hg
diff mercurial/sshpeer.py @ 38475:67dc32d4e790
cleanup: migrate from re.escape to stringutil.reescape
This has consistent behavior on Python 2.7, 3.6, and 3.7 and has the
benefit of probably being a little faster. Test output changes are
largely because / used to be pointlessly escaped.
Differential Revision: https://phab.mercurial-scm.org/D3842
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 26 Jun 2018 10:36:23 -0400 |
parents | 58bbd14b0c62 |
children | 27391d74aaa2 |
line wrap: on
line diff
--- a/mercurial/sshpeer.py Tue Jun 26 10:33:52 2018 -0400 +++ b/mercurial/sshpeer.py Tue Jun 26 10:36:23 2018 -0400 @@ -22,6 +22,7 @@ ) from .utils import ( procutil, + stringutil, ) def _serverquote(s): @@ -273,7 +274,7 @@ # Assume version 1 of wire protocol by default. protoname = wireprototypes.SSHV1 - reupgraded = re.compile(b'^upgraded %s (.*)$' % re.escape(token)) + reupgraded = re.compile(b'^upgraded %s (.*)$' % stringutil.reescape(token)) lines = ['', 'dummy'] max_noise = 500