Mercurial > hg
comparison mercurial/subrepoutil.py @ 37084:f0b6fbea00cf
stringutil: bulk-replace call sites to point to new module
This might conflict with other patches floating around, sorry.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 22 Mar 2018 21:56:20 +0900 |
parents | b529e640015d |
children | df4fd29c0854 |
comparison
equal
deleted
inserted
replaced
37083:f99d64e8a4e4 | 37084:f0b6fbea00cf |
---|---|
18 error, | 18 error, |
19 filemerge, | 19 filemerge, |
20 pathutil, | 20 pathutil, |
21 phases, | 21 phases, |
22 util, | 22 util, |
23 ) | |
24 from .utils import ( | |
25 stringutil, | |
23 ) | 26 ) |
24 | 27 |
25 nullstate = ('', '', 'empty') | 28 nullstate = ('', '', 'empty') |
26 | 29 |
27 def state(ctx, ui): | 30 def state(ctx, ui): |
72 | 75 |
73 def remap(src): | 76 def remap(src): |
74 for pattern, repl in p.items('subpaths'): | 77 for pattern, repl in p.items('subpaths'): |
75 # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub | 78 # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub |
76 # does a string decode. | 79 # does a string decode. |
77 repl = util.escapestr(repl) | 80 repl = stringutil.escapestr(repl) |
78 # However, we still want to allow back references to go | 81 # However, we still want to allow back references to go |
79 # through unharmed, so we turn r'\\1' into r'\1'. Again, | 82 # through unharmed, so we turn r'\\1' into r'\1'. Again, |
80 # extra escapes are needed because re.sub string decodes. | 83 # extra escapes are needed because re.sub string decodes. |
81 repl = re.sub(br'\\\\([0-9]+)', br'\\\1', repl) | 84 repl = re.sub(br'\\\\([0-9]+)', br'\\\1', repl) |
82 try: | 85 try: |