Show More
@@ -74,6 +74,23 b' def state(ctx, ui):' | |||
|
74 | 74 | raise util.Abort(_('missing ] in subrepo source')) |
|
75 | 75 | kind, src = src.split(']', 1) |
|
76 | 76 | kind = kind[1:] |
|
77 | src = src.lstrip() # strip any extra whitespace after ']' | |
|
78 | ||
|
79 | if not util.url(src).isabs(): | |
|
80 | parent = _abssource(ctx._repo, abort=False) | |
|
81 | if parent: | |
|
82 | parent = util.url(parent) | |
|
83 | parent.path = posixpath.join(parent.path or '', src) | |
|
84 | parent.path = posixpath.normpath(parent.path) | |
|
85 | joined = str(parent) | |
|
86 | # Remap the full joined path and use it if it changes, | |
|
87 | # else remap the original source. | |
|
88 | remapped = remap(joined) | |
|
89 | if remapped == joined: | |
|
90 | src = remap(src) | |
|
91 | else: | |
|
92 | src = remapped | |
|
93 | ||
|
77 | 94 | src = remap(src) |
|
78 | 95 | state[path] = (src.strip(), rev.get(path, ''), kind) |
|
79 | 96 |
@@ -1,19 +1,22 b'' | |||
|
1 | 1 | $ hg init outer |
|
2 | 2 | $ cd outer |
|
3 | 3 | |
|
4 | $ echo '[paths]' >> .hg/hgrc | |
|
5 | $ echo 'default = http://example.net/' >> .hg/hgrc | |
|
6 | ||
|
4 | 7 | hg debugsub with no remapping |
|
5 | 8 | |
|
6 |
$ echo 'sub = |
|
|
9 | $ echo 'sub = libfoo' > .hgsub | |
|
7 | 10 | $ hg add .hgsub |
|
8 | 11 | |
|
9 | 12 | $ hg debugsub |
|
10 | 13 | path sub |
|
11 |
source |
|
|
14 | source libfoo | |
|
12 | 15 | revision |
|
13 | 16 | |
|
14 | 17 | hg debugsub with remapping |
|
15 | 18 | |
|
16 | $ echo '[subpaths]' > .hg/hgrc | |
|
19 | $ echo '[subpaths]' >> .hg/hgrc | |
|
17 | 20 | $ printf 'http://example.net/lib(.*) = C:\\libs\\\\1-lib\\\n' >> .hg/hgrc |
|
18 | 21 | |
|
19 | 22 | $ hg debugsub |
@@ -30,6 +33,21 b' test cumulative remapping, the $HGRCPATH' | |||
|
30 | 33 | source C:\libs\bar-lib\ |
|
31 | 34 | revision |
|
32 | 35 | |
|
36 | test absolute source path -- testing with a URL is important since | |
|
37 | standard os.path.join wont treat that as an absolute path | |
|
38 | ||
|
39 | $ echo 'abs = http://example.net/abs' > .hgsub | |
|
40 | $ hg debugsub | |
|
41 | path abs | |
|
42 | source http://example.net/abs | |
|
43 | revision | |
|
44 | ||
|
45 | $ echo 'abs = /abs' > .hgsub | |
|
46 | $ hg debugsub | |
|
47 | path abs | |
|
48 | source /abs | |
|
49 | revision | |
|
50 | ||
|
33 | 51 | test bad subpaths pattern |
|
34 | 52 | |
|
35 | 53 | $ cat > .hg/hgrc <<EOF |
General Comments 0
You need to be logged in to leave comments.
Login now