Show More
@@ -50,6 +50,13 b' def state(ctx, ui):' | |||||
50 | kind = kind[1:] |
|
50 | kind = kind[1:] | |
51 |
|
51 | |||
52 | for pattern, repl in p.items('subpaths'): |
|
52 | for pattern, repl in p.items('subpaths'): | |
|
53 | # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub | |||
|
54 | # does a string decode. | |||
|
55 | repl = repl.encode('string-escape') | |||
|
56 | # However, we still want to allow back references to go | |||
|
57 | # through unharmed, so we turn r'\\1' into r'\1'. Again, | |||
|
58 | # extra escapes are needed because re.sub string decodes. | |||
|
59 | repl = re.sub(r'\\\\([0-9]+)', r'\\\1', repl) | |||
53 | try: |
|
60 | try: | |
54 | src = re.sub(pattern, repl, src, 1) |
|
61 | src = re.sub(pattern, repl, src, 1) | |
55 | except re.error, e: |
|
62 | except re.error, e: |
@@ -13,14 +13,12 b' hg debugsub with no remapping' | |||||
13 |
|
13 | |||
14 | hg debugsub with remapping |
|
14 | hg debugsub with remapping | |
15 |
|
15 | |||
16 |
$ cat > .hg/hgrc |
|
16 | $ echo '[subpaths]' > .hg/hgrc | |
17 | > [subpaths] |
|
17 | $ echo 'http://example.net/lib(.*) = C:\libs\\1-lib\' >> .hg/hgrc | |
18 | > http://example.net = ssh://localhost |
|
|||
19 | > EOF |
|
|||
20 |
|
18 | |||
21 | $ hg debugsub |
|
19 | $ hg debugsub | |
22 | path sub |
|
20 | path sub | |
23 |
source |
|
21 | source C:\libs\foo-lib\ | |
24 | revision |
|
22 | revision | |
25 |
|
23 | |||
26 | test bad subpaths pattern |
|
24 | test bad subpaths pattern |
General Comments 0
You need to be logged in to leave comments.
Login now