Mercurial > hg
view tests/test-convert-svn-source @ 11109:a2bc2f2d77a9
subrepo: normalize path part of URLs so that pulling subrepos from webdir works
For a "all projects at root" repo layout eg:
/main
/sub
Where subrepos are used such that a clone of main has this layout:
./main/
./main/.hgsub
./main/sub/
And the .hgsub content is:
sub = ../sub
This allows a pull from a hgweb where main and sub are exposed
at the root (or same directory level)
The current code doesn't normalize the path component of a pull
url. this results in trying to pull from
http://server.com/hg/main/../sub
Current hgweb implementation doesn't reduce the path component
so this results in a 404 error though everything is setup logically.
This patch adresses this 404 error on the puller side
normalizing the URLs used for pulling sub repos. For this
example, the URL would be reduced to http://server.com/hg/sub
Fix + test
author | Edouard Gomez <ed.gomez@free.fr> |
---|---|
date | Sat, 01 May 2010 23:05:19 +0200 |
parents | c52057614c72 |
children |
line wrap: on
line source
#!/bin/sh "$TESTDIR/hghave" svn svn-bindings || exit 80 fix_path() { tr '\\' / } echo "[extensions]" >> $HGRCPATH echo "convert = " >> $HGRCPATH echo 'graphlog =' >> $HGRCPATH svnadmin create svn-repo svnpath=`pwd | fix_path` # SVN wants all paths to start with a slash. Unfortunately, # Windows ones don't. Handle that. expr "$svnpath" : "\/" > /dev/null if [ $? -ne 0 ]; then svnpath="/$svnpath" fi echo "# now tests that it works with trunk/tags layout, but no branches yet" echo echo % initial svn import mkdir projB cd projB mkdir trunk mkdir tags cd .. svnurl="file://$svnpath/svn-repo/proj%20B" svn import -m "init projB" projB "$svnurl" | fix_path echo % update svn repository svn co "$svnurl"/trunk B | fix_path cd B echo hello > 'letter .txt' svn add 'letter .txt' svn ci -m hello "$TESTDIR/svn-safe-append.py" world 'letter .txt' svn ci -m world svn copy -m "tag v0.1" "$svnurl"/trunk "$svnurl"/tags/v0.1 "$TESTDIR/svn-safe-append.py" 'nice day today!' 'letter .txt' svn ci -m "nice day" cd .. echo % convert to hg once hg convert "$svnurl" B-hg echo % update svn repository again cd B "$TESTDIR/svn-safe-append.py" "see second letter" 'letter .txt' echo "nice to meet you" > letter2.txt svn add letter2.txt svn ci -m "second letter" svn copy -m "tag v0.2" "$svnurl"/trunk "$svnurl"/tags/v0.2 "$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt svn ci -m "work in progress" cd .. ######################################## echo % test incremental conversion hg convert "$svnurl" B-hg cd B-hg hg glog --template '{rev} {desc|firstline} files: {files}\n' hg tags -q cd .. echo % test filemap echo 'include letter2.txt' > filemap hg convert --filemap filemap "$svnurl"/trunk fmap hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n' echo % test stop revision hg convert --rev 1 "$svnurl"/trunk stoprev # Check convert_revision extra-records. # This is also the only place testing more than one extra field # in a revision. hg --cwd stoprev tip --debug | grep extra | sed 's/=.*/=/'