annotate tests/test-hgwebdir @ 12038:9617803b1acb stable

hgweb: handle exception of misconfigured path on index page If hgweb.config contains wrong path mapping, hgweb causes internal server error on repository index page. This patch changes makeindex() to ignore RepoError, because it looks to be designed to suppress configuration error.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 24 Aug 2010 23:30:51 +0900
parents 8f8a7976f4bc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
1 #!/bin/sh
5580
f429e0e067a8 Fix style nit and add some comments to tests.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5578
diff changeset
2 # Tests some basic hgwebdir functionality. Tests setting up paths and
f429e0e067a8 Fix style nit and add some comments to tests.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5578
diff changeset
3 # collection, different forms of 404s and the subdirectory support.
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
5 mkdir webdir
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
6 cd webdir
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
7
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
8 hg init a
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
9 echo a > a/a
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
10 hg --cwd a ci -Ama -d'1 0'
7523
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
11 # create a mercurial queue repository
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
12 hg --cwd a qinit --config extensions.hgext.mq= -c
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
13
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
14 hg init b
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
15 echo b > b/b
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
16 hg --cwd b ci -Amb -d'2 0'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
17
7523
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
18 # create a nested repository
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
19 cd b
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
20 hg init d
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
21 echo d > d/d
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
22 hg --cwd d ci -Amd -d'3 0'
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
23 cd ..
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
24
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
25 hg init c
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
26 echo c > c/c
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
27 hg --cwd c ci -Amc -d'3 0'
7523
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
28
12038
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
29 # create repository without .hg/store
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
30 hg init nostore
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
31 rm -R nostore/.hg/store
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
32
7494
85dc88630beb util: disable walkrepo() recursive behaviour
Patrick Mezard <pmezard@gmail.com>
parents: 7450
diff changeset
33 root=`pwd`
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
34 cd ..
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
35
9363
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
36
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
37 cat > paths.conf <<EOF
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
38 [paths]
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
39 a=$root/a
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
40 b=$root/b
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
41 EOF
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
42
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
43 hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
5601
8279cb841467 hgwebdir: split out makeindex function, facilitate test failure diagnosis
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5586
diff changeset
44 -A access-paths.log -E error-paths-1.log
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
45 cat hg.pid >> $DAEMON_PIDS
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
46
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
47 echo % should give a 404 - file does not exist
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
48 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
49
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
50 echo % should succeed
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
51 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
52 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
53 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
54
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
55 echo % should give a 404 - repo is not published
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
56 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
57
10674
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
58 echo % atom-log without basedir
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
59 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/atom-log' \
10878
c63a6ddbbf9a test-hgwebdir: correctly include '-' in sed expression.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 10674
diff changeset
60 | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
10674
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
61
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
62 echo % rss-log without basedir
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
63 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/rss-log' \
10878
c63a6ddbbf9a test-hgwebdir: correctly include '-' in sed expression.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 10674
diff changeset
64 | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
9363
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
65
5578
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
66 cat > paths.conf <<EOF
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
67 [paths]
5586
b90b72729a72 hgwebdir: test virtual paths leading or trailing separators are stripped
Patrick Mezard <pmezard@gmail.com>
parents: 5580
diff changeset
68 t/a/=$root/a
5578
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
69 b=$root/b
7450
79d1bb737c16 hgweb: extend [paths] syntax to match repositories recursively (issue852)
Patrick Mezard <pmezard@gmail.com>
parents: 7202
diff changeset
70 coll=$root/*
7523
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
71 rcoll=$root/**
11677
8f8a7976f4bc hgwebdir: allow pure relative globs in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10878
diff changeset
72 star=*
8f8a7976f4bc hgwebdir: allow pure relative globs in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10878
diff changeset
73 starstar=**
5578
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
74 EOF
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
75
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
76 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
5601
8279cb841467 hgwebdir: split out makeindex function, facilitate test failure diagnosis
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5586
diff changeset
77 -A access-paths.log -E error-paths-2.log
5578
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
78 cat hg.pid >> $DAEMON_PIDS
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
79
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
80 echo % should succeed, slashy names
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
81 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
8217
d895158fe8af tests: add tests for styled hgwebdir pages
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7523
diff changeset
82 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper' \
8245
0eade101f762 Don't use sed -r; instead use old-style regexp
Martijn Pieters <mj@zopatista.com>
parents: 8217
diff changeset
83 | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/"
5578
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
84 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
85 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
8217
d895158fe8af tests: add tests for styled hgwebdir pages
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7523
diff changeset
86 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=paper' \
8245
0eade101f762 Don't use sed -r; instead use old-style regexp
Martijn Pieters <mj@zopatista.com>
parents: 8217
diff changeset
87 | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/"
5578
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
88 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
89 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
90 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
91 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
92 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
7450
79d1bb737c16 hgweb: extend [paths] syntax to match repositories recursively (issue852)
Patrick Mezard <pmezard@gmail.com>
parents: 7202
diff changeset
93 # Test [paths] '*' extension
79d1bb737c16 hgweb: extend [paths] syntax to match repositories recursively (issue852)
Patrick Mezard <pmezard@gmail.com>
parents: 7202
diff changeset
94 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/?style=raw'
79d1bb737c16 hgweb: extend [paths] syntax to match repositories recursively (issue852)
Patrick Mezard <pmezard@gmail.com>
parents: 7202
diff changeset
95 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/a/file/tip/a?style=raw'
7523
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
96 #test [paths] '**' extension
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
97 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw'
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
98 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/b/d/file/tip/d?style=raw'
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
99
5578
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
100
9363
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
101 "$TESTDIR/killdaemons.py"
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
102 cat > paths.conf <<EOF
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
103 [paths]
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
104 t/a = $root/a
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
105 t/b = $root/b
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
106 c = $root/c
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
107 [web]
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
108 descend=false
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
109 EOF
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
110
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
111 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
112 -A access-paths.log -E error-paths-3.log
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
113 cat hg.pid >> $DAEMON_PIDS
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
114 echo % test descend = False
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
115 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
116 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
117
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
118
12038
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
119 "$TESTDIR/killdaemons.py"
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
120 cat > paths.conf <<EOF
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
121 [paths]
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
122 nostore = $root/nostore
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
123 inexistent = $root/inexistent
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
124 EOF
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
125
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
126 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
127 -A access-paths.log -E error-paths-4.log
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
128 cat hg.pid >> $DAEMON_PIDS
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
129 echo % test inexistent and inaccessible repo should be ignored silently
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
130 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/'
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
131
9617803b1acb hgweb: handle exception of misconfigured path on index page
Yuya Nishihara <yuya@tcha.org>
parents: 11677
diff changeset
132
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
133 cat > collections.conf <<EOF
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
134 [collections]
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
135 $root=$root
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
136 EOF
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
137
9184
f6eb03027411 Fix issue1679: path reconstruction in hgwebdir was mangling things badly
Bryan O'Sullivan <bos@serpentine.com>
parents: 8245
diff changeset
138 hg serve --config web.baseurl=http://hg.example.com:8080/ -p $HGPORT2 -d \
f6eb03027411 Fix issue1679: path reconstruction in hgwebdir was mangling things badly
Bryan O'Sullivan <bos@serpentine.com>
parents: 8245
diff changeset
139 --pid-file=hg.pid --webdir-conf collections.conf \
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
140 -A access-collections.log -E error-collections.log
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
141 cat hg.pid >> $DAEMON_PIDS
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
142
7523
e60aaae83323 hgweb: recurse down collections only if ** in [paths]
Benoit Allard <benoit@aeteurope.nl>
parents: 7494
diff changeset
143 echo % collections: should succeed
5578
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
144 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
145 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
146 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
147 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'
5601
8279cb841467 hgwebdir: split out makeindex function, facilitate test failure diagnosis
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5586
diff changeset
148
10674
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
149 echo % atom-log with basedir /
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
150 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \
10878
c63a6ddbbf9a test-hgwebdir: correctly include '-' in sed expression.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 10674
diff changeset
151 | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
10674
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
152
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
153 echo % rss-log with basedir /
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
154 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \
10878
c63a6ddbbf9a test-hgwebdir: correctly include '-' in sed expression.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 10674
diff changeset
155 | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
10674
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
156
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
157 "$TESTDIR/killdaemons.py"
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
158
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
159 hg serve --config web.baseurl=http://hg.example.com:8080/foo/ -p $HGPORT2 -d \
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
160 --pid-file=hg.pid --webdir-conf collections.conf \
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
161 -A access-collections-2.log -E error-collections-2.log
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
162 cat hg.pid >> $DAEMON_PIDS
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
163
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
164 echo % atom-log with basedir /foo/
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
165 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \
10878
c63a6ddbbf9a test-hgwebdir: correctly include '-' in sed expression.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 10674
diff changeset
166 | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
10674
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
167
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
168 echo % rss-log with basedir /foo/
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
169 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \
10878
c63a6ddbbf9a test-hgwebdir: correctly include '-' in sed expression.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 10674
diff changeset
170 | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
9363
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
171
5601
8279cb841467 hgwebdir: split out makeindex function, facilitate test failure diagnosis
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5586
diff changeset
172 echo % paths errors 1
8279cb841467 hgwebdir: split out makeindex function, facilitate test failure diagnosis
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5586
diff changeset
173 cat error-paths-1.log
8279cb841467 hgwebdir: split out makeindex function, facilitate test failure diagnosis
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5586
diff changeset
174 echo % paths errors 2
8279cb841467 hgwebdir: split out makeindex function, facilitate test failure diagnosis
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5586
diff changeset
175 cat error-paths-2.log
9363
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
176 echo % paths errors 3
8635b33eaade hgweb: add web.descend configuration variable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9184
diff changeset
177 cat error-paths-3.log
5601
8279cb841467 hgwebdir: split out makeindex function, facilitate test failure diagnosis
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5586
diff changeset
178 echo % collections errors
8279cb841467 hgwebdir: split out makeindex function, facilitate test failure diagnosis
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5586
diff changeset
179 cat error-collections.log
10674
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
180 echo % collections errors 2
6d87c20cd7a8 hgweb: fix broken URLs of RSS/Atom feeds (issue1772)
Yuya Nishihara <yuya@tcha.org>
parents: 9363
diff changeset
181 cat error-collections-2.log