Debian Codegraph @

tests/test-subrepo-paths.t

raw
1 $ hg init outer
2 $ cd outer
3
4 $ echo '[paths]' >> .hg/hgrc
5 $ echo 'default = http://example.net/' >> .hg/hgrc
6
7 hg debugsub with no remapping
8
9 $ echo 'sub = libfoo' > .hgsub
10 $ hg add .hgsub
11
12 $ hg debugsub
13 path sub
14 source libfoo
15 revision
16
17 hg debugsub with remapping
18
19 $ echo '[subpaths]' >> .hg/hgrc
20 $ printf 'http://example.net/lib(.*) = C:\\libs\\\\1-lib\\\n' >> .hg/hgrc
21
22 $ hg debugsub
23 path sub
24 source C:\libs\foo-lib\
25 revision
26
27 test cumulative remapping, the $HGRCPATH file is loaded first
28
29 $ echo '[subpaths]' >> $HGRCPATH
30 $ echo 'libfoo = libbar' >> $HGRCPATH
31 $ hg debugsub
32 path sub
33 source C:\libs\bar-lib\
34 revision
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
51 test bad subpaths pattern
52
53 $ cat > .hg/hgrc <<EOF
54 > [subpaths]
55 > .* = \1
56 > EOF
57 $ hg debugsub
58 abort: bad subrepository pattern in $TESTTMP/outer/.hg/hgrc:2: invalid group reference* (glob)
59 [255]
60
61 $ cd ..