comparison mercurial/subrepo.py @ 31460:53865692a354

util: wrap s.encode('string_escape') call for future py3 compatibility
author Yuya Nishihara <yuya@tcha.org>
date Wed, 15 Mar 2017 23:06:50 +0900
parents b589f5b953f4
children f97e90fa5ad7
comparison
equal deleted inserted replaced
31459:b3b4c487707c 31460:53865692a354
128 128
129 def remap(src): 129 def remap(src):
130 for pattern, repl in p.items('subpaths'): 130 for pattern, repl in p.items('subpaths'):
131 # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub 131 # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub
132 # does a string decode. 132 # does a string decode.
133 repl = repl.encode('string-escape') 133 repl = util.escapestr(repl)
134 # However, we still want to allow back references to go 134 # However, we still want to allow back references to go
135 # through unharmed, so we turn r'\\1' into r'\1'. Again, 135 # through unharmed, so we turn r'\\1' into r'\1'. Again,
136 # extra escapes are needed because re.sub string decodes. 136 # extra escapes are needed because re.sub string decodes.
137 repl = re.sub(r'\\\\([0-9]+)', r'\\\1', repl) 137 repl = re.sub(r'\\\\([0-9]+)', r'\\\1', repl)
138 try: 138 try: