Mercurial > hg
view tests/test-mq-qnew @ 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 | 92b8c79b34c2 |
children | 0c944b7af564 |
line wrap: on
line source
#!/bin/sh catpatch() { cat $1 | sed -e "s/^\(# Parent \).*/\1/" } echo "[extensions]" >> $HGRCPATH echo "mq=" >> $HGRCPATH runtest() { hg init mq cd mq echo a > a hg ci -Ama echo '% qnew should refuse bad patch names' hg qnew series hg qnew status hg qnew guards hg qnew .hgignore hg qnew .mqfoo hg qnew 'foo#bar' hg qnew 'foo:bar' hg qinit -c echo '% qnew with uncommitted changes' echo a > somefile hg add somefile hg qnew uncommitted.patch hg st hg qseries echo '% qnew implies add' hg -R .hg/patches st echo '% qnew missing' hg qnew missing.patch missing echo '% qnew -m' hg qnew -m 'foo bar' mtest.patch catpatch .hg/patches/mtest.patch echo '% qnew twice' hg qnew first.patch hg qnew first.patch touch ../first.patch hg qimport ../first.patch echo '% qnew -f from a subdirectory' hg qpop -a mkdir d cd d echo b > b hg ci -Am t echo b >> b hg st hg qnew -g -f p catpatch ../.hg/patches/p echo '% qnew -u with no username configured' HGUSER= hg qnew -u blue red catpatch ../.hg/patches/red echo '% fail when trying to import a merge' hg init merge cd merge touch a hg ci -Am null echo a >> a hg ci -m a hg up -r 0 echo b >> a hg ci -m b hg merge -f 1 hg resolve --mark a hg qnew -f merge cd ../../.. rm -r mq } echo '%%% plain headers' echo "[mq]" >> $HGRCPATH echo "plain=true" >> $HGRCPATH mkdir sandbox (cd sandbox ; runtest) rm -r sandbox echo '%%% hg headers' echo "plain=false" >> $HGRCPATH mkdir sandbox (cd sandbox ; runtest) rm -r sandbox exit 0