##// END OF EJS Templates
subrepo: normalize path part of URLs so that pulling subrepos from webdir works...
Edouard Gomez -
r11109:a2bc2f2d default
parent child Browse files
Show More
@@ -0,0 +1,40 b''
1 #!/bin/sh
2
3 echo % Preparing the subrepository 'sub'
4 hg init sub
5 echo sub > sub/sub
6 hg add -R sub
7 hg commit -R sub -m "sub import"
8
9 echo % Preparing the 'main' repo which depends on the subrepo 'sub'
10 hg init main
11 echo main > main/main
12 echo "sub = ../sub" > main/.hgsub
13 hg clone sub main/sub | sed 's/ .*sub/ ...sub/g'
14 hg add -R main
15 hg commit -R main -m "main import"
16
17 echo % Cleaning both repositories, just as a clone -U
18 hg up -C -R sub null
19 hg up -C -R main null
20 rm -rf main/sub
21
22 echo % Serving them both using hgweb
23 printf '[paths]\n/main = main\nsub = sub\n' > webdir.conf
24 hg serve --webdir-conf webdir.conf -a localhost -p $HGPORT \
25 -A /dev/null -E /dev/null --pid-file hg.pid -d
26 cat hg.pid >> $DAEMON_PIDS
27
28 echo % Clone main from hgweb
29 hg clone "http://localhost:$HGPORT/main" cloned | sed 's/ .*sub/ ...sub/g'
30
31 echo % Checking cloned repo ids
32 hg id -R cloned
33 hg id -R cloned/sub
34
35 echo % subrepo debug for 'main' clone
36 hg debugsub -R cloned
37
38 "$TESTDIR/killdaemons.py"
39
40 exit 0
@@ -0,0 +1,33 b''
1 % Preparing the subrepository sub
2 adding sub/sub
3 % Preparing the main repo which depends on the subrepo sub
4 updating to branch default
5 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
6 adding main/.hgsub
7 adding main/main
8 committing subrepository sub
9 % Cleaning both repositories, just as a clone -U
10 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
11 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
12 % Serving them both using hgweb
13 % Clone main from hgweb
14 requesting all changes
15 adding changesets
16 adding manifests
17 adding file changes
18 added 1 changesets with 3 changes to 3 files
19 updating to branch default
20 pulling ...sub
21 requesting all changes
22 adding changesets
23 adding manifests
24 adding file changes
25 added 1 changesets with 1 changes to 1 files
26 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 % Checking cloned repo ids
28 fdfeeb3e979e tip
29 863c1745b441 tip
30 % subrepo debug for main clone
31 path sub
32 source ../sub
33 revision 863c1745b441bd97a8c4a096e87793073f4fb215
@@ -5,7 +5,7 b''
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import errno, os, re, xml.dom.minidom, shutil
8 import errno, os, re, xml.dom.minidom, shutil, urlparse, posixpath
9 from i18n import _
9 from i18n import _
10 import config, util, node, error
10 import config, util, node, error
11 hg = None
11 hg = None
@@ -135,8 +135,12 b' def _abssource(repo, push=False):'
135 if '://' in parent:
135 if '://' in parent:
136 if parent[-1] == '/':
136 if parent[-1] == '/':
137 parent = parent[:-1]
137 parent = parent[:-1]
138 return parent + '/' + source
138 r = urlparse.urlparse(parent + '/' + source)
139 return os.path.join(parent, repo._subsource)
139 r = urlparse.urlunparse((r[0], r[1],
140 posixpath.normpath(r.path),
141 r[3], r[4], r[5]))
142 return r
143 return posixpath.normpath(os.path.join(parent, repo._subsource))
140 if push and repo.ui.config('paths', 'default-push'):
144 if push and repo.ui.config('paths', 'default-push'):
141 return repo.ui.config('paths', 'default-push', repo.root)
145 return repo.ui.config('paths', 'default-push', repo.root)
142 return repo.ui.config('paths', 'default', repo.root)
146 return repo.ui.config('paths', 'default', repo.root)
@@ -275,7 +275,7 b' 2 files updated, 0 files merged, 0 files'
275 [paths]
275 [paths]
276 default = $HGTMP/test-subrepo/sub/mercurial/nested_absolute
276 default = $HGTMP/test-subrepo/sub/mercurial/nested_absolute
277 [paths]
277 [paths]
278 default = $HGTMP/test-subrepo/sub/mercurial/main/../nested_relative
278 default = $HGTMP/test-subrepo/sub/mercurial/nested_relative
279 % issue 1977
279 % issue 1977
280 adding a
280 adding a
281 adding .hgsub
281 adding .hgsub
General Comments 0
You need to be logged in to leave comments. Login now