Mercurial > public > mercurial-scm > hg
annotate tests/test-static-http @ 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 | 26abd91d9e84 |
children | 4c94b6d0fb1c |
rev | line source |
---|---|
1111 | 1 #!/bin/sh |
2 | |
4290
347766c2ff86
test-static-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3469
diff
changeset
|
3 cp "$TESTDIR"/printenv.py . |
347766c2ff86
test-static-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3469
diff
changeset
|
4 |
10154
d4a62b6d4a58
run-tests.py: clears http_proxy for all tests
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
7919
diff
changeset
|
5 hg clone http://localhost:$HGPORT/ copy |
7919
3e6206967570
Backed out changeset 490e40816cbd
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7903
diff
changeset
|
6 echo $? |
3469
33b6c8193652
Don't use test -e in tests - sh doesn't like it on Solaris
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3428
diff
changeset
|
7 test -d copy || echo copy: No such file or directory |
1111 | 8 |
9 # This server doesn't do range requests so it's basically only good for | |
10 # one pull | |
11 cat > dumb.py <<EOF | |
5384
e3a0c092b4e2
Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents:
5316
diff
changeset
|
12 import BaseHTTPServer, SimpleHTTPServer, os, signal |
1111 | 13 |
14 def run(server_class=BaseHTTPServer.HTTPServer, | |
15 handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler): | |
5384
e3a0c092b4e2
Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents:
5316
diff
changeset
|
16 server_address = ('localhost', int(os.environ['HGPORT'])) |
1111 | 17 httpd = server_class(server_address, handler_class) |
18 httpd.serve_forever() | |
19 | |
20 signal.signal(signal.SIGTERM, lambda x: sys.exit(0)) | |
21 run() | |
22 EOF | |
23 | |
24 python dumb.py 2>/dev/null & | |
2572
d22d730c96ed
tests: record few more daemon pids to be safe
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2431
diff
changeset
|
25 echo $! >> $DAEMON_PIDS |
1111 | 26 |
27 mkdir remote | |
28 cd remote | |
29 hg init | |
30 echo foo > bar | |
31 hg add bar | |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1923
diff
changeset
|
32 hg commit -m"test" -d "1000000 0" |
1111 | 33 hg tip |
34 | |
35 cd .. | |
36 | |
10398
ace3cf2bc991
tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
10154
diff
changeset
|
37 hg clone static-http://localhost:$HGPORT/remote local | sed -e "s,:$HGPORT/,:\$HGPORT/," |
1111 | 38 |
39 cd local | |
40 hg verify | |
41 cat bar | |
2673
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2572
diff
changeset
|
42 |
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2572
diff
changeset
|
43 cd ../remote |
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2572
diff
changeset
|
44 echo baz > quux |
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2572
diff
changeset
|
45 hg commit -A -mtest2 -d '100000000 0' |
11066
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10398
diff
changeset
|
46 # check for HTTP opener failures when cachefile does not exist |
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10398
diff
changeset
|
47 rm .hg/*.cache |
2673
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2572
diff
changeset
|
48 |
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2572
diff
changeset
|
49 cd ../local |
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2572
diff
changeset
|
50 echo '[hooks]' >> .hg/hgrc |
4290
347766c2ff86
test-static-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3469
diff
changeset
|
51 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc |
10398
ace3cf2bc991
tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
10154
diff
changeset
|
52 hg pull | sed -e "s,:$HGPORT/,:\$HGPORT/," |
1111 | 53 |
7005
7739b61897df
do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents:
6028
diff
changeset
|
54 echo '% trying to push' |
7739b61897df
do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents:
6028
diff
changeset
|
55 hg update |
7739b61897df
do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents:
6028
diff
changeset
|
56 echo more foo >> bar |
7739b61897df
do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents:
6028
diff
changeset
|
57 hg commit -m"test" -d "100000000 0" |
10398
ace3cf2bc991
tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
10154
diff
changeset
|
58 hg push | sed -e "s,:$HGPORT/,:\$HGPORT/," |
7005
7739b61897df
do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents:
6028
diff
changeset
|
59 |
11066
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10398
diff
changeset
|
60 echo '% trying clone -r' |
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10398
diff
changeset
|
61 cd .. |
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10398
diff
changeset
|
62 hg clone -r donotexist static-http://localhost:$HGPORT/remote local0 | sed -e "s,:$HGPORT/,:\$HGPORT/," |
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10398
diff
changeset
|
63 hg clone -r 0 static-http://localhost:$HGPORT/remote local0 | sed -e "s,:$HGPORT/,:\$HGPORT/," |
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10398
diff
changeset
|
64 |
5316
598dae804a5f
Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents:
4290
diff
changeset
|
65 echo '% test with "/" URI (issue 747)' |
598dae804a5f
Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents:
4290
diff
changeset
|
66 hg init |
598dae804a5f
Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents:
4290
diff
changeset
|
67 echo a > a |
598dae804a5f
Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents:
4290
diff
changeset
|
68 hg add a |
598dae804a5f
Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents:
4290
diff
changeset
|
69 hg ci -ma |
598dae804a5f
Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents:
4290
diff
changeset
|
70 |
10398
ace3cf2bc991
tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
10154
diff
changeset
|
71 hg clone static-http://localhost:$HGPORT/ local2 | sed -e "s,:$HGPORT/,:\$HGPORT/," |
5316
598dae804a5f
Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents:
4290
diff
changeset
|
72 |
598dae804a5f
Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents:
4290
diff
changeset
|
73 cd local2 |
598dae804a5f
Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents:
4290
diff
changeset
|
74 hg verify |
598dae804a5f
Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents:
4290
diff
changeset
|
75 cat a |
10398
ace3cf2bc991
tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
10154
diff
changeset
|
76 hg paths | sed -e "s,:$HGPORT/,:\$HGPORT/," |
5316
598dae804a5f
Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents:
4290
diff
changeset
|
77 |
6028
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
78 echo '% test with empty repo (issue965)' |
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
79 cd .. |
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
80 hg init remotempty |
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
81 |
10398
ace3cf2bc991
tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
10154
diff
changeset
|
82 hg clone static-http://localhost:$HGPORT/remotempty local3 | sed -e "s,:$HGPORT/,:\$HGPORT/," |
6028
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
83 |
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
84 cd local3 |
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
85 hg verify |
10398
ace3cf2bc991
tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
10154
diff
changeset
|
86 hg paths | sed -e "s,:$HGPORT/,:\$HGPORT/," |
6028
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
87 |
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
88 echo '% test with non-repo' |
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
89 cd .. |
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
90 mkdir notarepo |
10398
ace3cf2bc991
tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
10154
diff
changeset
|
91 hg clone static-http://localhost:$HGPORT/notarepo local3 2>&1 | sed -e "s,:$HGPORT/,:\$HGPORT/," |
6028
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5384
diff
changeset
|
92 |
1111 | 93 kill $! |