Mercurial > hg
view tests/test-mq-guards @ 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 | 717c35d55fb3 |
children | df5d1d571d27 |
line wrap: on
line source
#!/bin/sh echo "[extensions]" >> $HGRCPATH echo "mq=" >> $HGRCPATH hg init hg qinit echo x > x hg ci -Ama hg qnew a.patch echo a > a hg add a hg qrefresh hg qnew b.patch echo b > b hg add b hg qrefresh hg qnew c.patch echo c > c hg add c hg qrefresh hg qpop -a echo % should fail hg qguard does-not-exist.patch +bleh echo % should fail hg qguard +fail hg qpush echo % should guard a.patch hg qguard +a echo % should print +a hg qguard hg qpop echo % should fail hg qpush a.patch hg qguard a.patch echo % should push b.patch hg qpush hg qpop echo % test selection of an empty guard hg qselect "" hg qselect a echo % should push a.patch hg qpush hg qguard -- c.patch -a echo % should print -a hg qguard c.patch echo % should skip c.patch hg qpush -a echo % should display b.patch hg qtop hg qguard -n c.patch echo % should push c.patch hg qpush -a hg qpop -a hg qselect -n echo % should push all hg qpush -a hg qpop -a hg qguard a.patch +1 hg qguard b.patch +2 hg qselect 1 echo % should push a.patch, not b.patch hg qpush hg qpush hg qpop -a hg qselect 2 echo % should push b.patch hg qpush hg qpush -a # Used to be an issue with holes in the patch sequence # So, put one hole on the base and ask for topmost patch. hg qtop hg qpop -a hg qselect 1 2 echo % should push a.patch, b.patch hg qpush hg qpush hg qpop -a hg qguard -- a.patch +1 +2 -3 hg qselect 1 2 3 echo % list patches and guards hg qguard -l echo % list patches and guards with color hg --config extensions.color= qguard -l --color=always echo % list series hg qseries -v echo % list guards hg qselect echo % should push b.patch hg qpush hg qpush -a hg qselect -n --reapply echo % guards in series file: +1 +2 -3 hg qselect -s echo % should show c.patch hg qapplied hg qrename a.patch new.patch echo % should show : echo % new.patch: +1 +2 -3 echo % b.patch: +2 echo % c.patch: unguarded hg qguard -l hg qnew d.patch hg qpop echo % should show new.patch and b.patch as Guarded, c.patch as Applied echo % and d.patch as Unapplied hg qseries -v echo % qseries again, but with color hg --config extensions.color= qseries -v --color=always hg qguard d.patch +2 echo % new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded. hg qseries -v qappunappv() { for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do echo % hg $command hg $command done } hg qpop -a hg qguard -l qappunappv hg qselect 1 qappunappv hg qpush -a qappunappv hg qselect 2 qappunappv for patch in `hg qseries`; do echo % hg qapplied $patch hg qapplied $patch echo % hg qunapplied $patch hg qunapplied $patch done echo % hg qseries -m: only b.patch should be shown echo the guards file was not ignored in the past hg qdelete -k b.patch hg qseries -m echo % hg qseries -m with color hg --config extensions.color= qseries -m --color=always