Show More
@@ -1,161 +1,161 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | # Tests some basic hgwebdir functionality. Tests setting up paths and |
|
3 | 3 | # collection, different forms of 404s and the subdirectory support. |
|
4 | 4 | |
|
5 | 5 | mkdir webdir |
|
6 | 6 | cd webdir |
|
7 | 7 | |
|
8 | 8 | hg init a |
|
9 | 9 | echo a > a/a |
|
10 | 10 | hg --cwd a ci -Ama -d'1 0' |
|
11 | 11 | # create a mercurial queue repository |
|
12 | 12 | hg --cwd a qinit --config extensions.hgext.mq= -c |
|
13 | 13 | |
|
14 | 14 | hg init b |
|
15 | 15 | echo b > b/b |
|
16 | 16 | hg --cwd b ci -Amb -d'2 0' |
|
17 | 17 | |
|
18 | 18 | # create a nested repository |
|
19 | 19 | cd b |
|
20 | 20 | hg init d |
|
21 | 21 | echo d > d/d |
|
22 | 22 | hg --cwd d ci -Amd -d'3 0' |
|
23 | 23 | cd .. |
|
24 | 24 | |
|
25 | 25 | hg init c |
|
26 | 26 | echo c > c/c |
|
27 | 27 | hg --cwd c ci -Amc -d'3 0' |
|
28 | 28 | |
|
29 | 29 | root=`pwd` |
|
30 | 30 | cd .. |
|
31 | 31 | |
|
32 | 32 | |
|
33 | 33 | cat > paths.conf <<EOF |
|
34 | 34 | [paths] |
|
35 | 35 | a=$root/a |
|
36 | 36 | b=$root/b |
|
37 | 37 | EOF |
|
38 | 38 | |
|
39 | 39 | hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \ |
|
40 | 40 | -A access-paths.log -E error-paths-1.log |
|
41 | 41 | cat hg.pid >> $DAEMON_PIDS |
|
42 | 42 | |
|
43 | 43 | echo % should give a 404 - file does not exist |
|
44 | 44 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw' |
|
45 | 45 | |
|
46 | 46 | echo % should succeed |
|
47 | 47 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw' |
|
48 | 48 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw' |
|
49 | 49 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw' |
|
50 | 50 | |
|
51 | 51 | echo % should give a 404 - repo is not published |
|
52 | 52 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw' |
|
53 | 53 | |
|
54 | 54 | echo % atom-log without basedir |
|
55 | 55 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/atom-log' \ |
|
56 |
| grep '<link' | sed 's|//[.a-zA-Z0-9 |
|
|
56 | | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
|
57 | 57 | |
|
58 | 58 | echo % rss-log without basedir |
|
59 | 59 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/rss-log' \ |
|
60 |
| grep '<guid' | sed 's|//[.a-zA-Z0-9 |
|
|
60 | | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
|
61 | 61 | |
|
62 | 62 | cat > paths.conf <<EOF |
|
63 | 63 | [paths] |
|
64 | 64 | t/a/=$root/a |
|
65 | 65 | b=$root/b |
|
66 | 66 | coll=$root/* |
|
67 | 67 | rcoll=$root/** |
|
68 | 68 | EOF |
|
69 | 69 | |
|
70 | 70 | hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ |
|
71 | 71 | -A access-paths.log -E error-paths-2.log |
|
72 | 72 | cat hg.pid >> $DAEMON_PIDS |
|
73 | 73 | |
|
74 | 74 | echo % should succeed, slashy names |
|
75 | 75 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw' |
|
76 | 76 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper' \ |
|
77 | 77 | | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/" |
|
78 | 78 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw' |
|
79 | 79 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw' |
|
80 | 80 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=paper' \ |
|
81 | 81 | | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/" |
|
82 | 82 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \ |
|
83 | 83 | | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//" |
|
84 | 84 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \ |
|
85 | 85 | | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//" |
|
86 | 86 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw' |
|
87 | 87 | # Test [paths] '*' extension |
|
88 | 88 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/?style=raw' |
|
89 | 89 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/a/file/tip/a?style=raw' |
|
90 | 90 | #test [paths] '**' extension |
|
91 | 91 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw' |
|
92 | 92 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/b/d/file/tip/d?style=raw' |
|
93 | 93 | |
|
94 | 94 | |
|
95 | 95 | "$TESTDIR/killdaemons.py" |
|
96 | 96 | cat > paths.conf <<EOF |
|
97 | 97 | [paths] |
|
98 | 98 | t/a = $root/a |
|
99 | 99 | t/b = $root/b |
|
100 | 100 | c = $root/c |
|
101 | 101 | [web] |
|
102 | 102 | descend=false |
|
103 | 103 | EOF |
|
104 | 104 | |
|
105 | 105 | hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ |
|
106 | 106 | -A access-paths.log -E error-paths-3.log |
|
107 | 107 | cat hg.pid >> $DAEMON_PIDS |
|
108 | 108 | echo % test descend = False |
|
109 | 109 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw' |
|
110 | 110 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw' |
|
111 | 111 | |
|
112 | 112 | |
|
113 | 113 | cat > collections.conf <<EOF |
|
114 | 114 | [collections] |
|
115 | 115 | $root=$root |
|
116 | 116 | EOF |
|
117 | 117 | |
|
118 | 118 | hg serve --config web.baseurl=http://hg.example.com:8080/ -p $HGPORT2 -d \ |
|
119 | 119 | --pid-file=hg.pid --webdir-conf collections.conf \ |
|
120 | 120 | -A access-collections.log -E error-collections.log |
|
121 | 121 | cat hg.pid >> $DAEMON_PIDS |
|
122 | 122 | |
|
123 | 123 | echo % collections: should succeed |
|
124 | 124 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw' |
|
125 | 125 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw' |
|
126 | 126 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw' |
|
127 | 127 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw' |
|
128 | 128 | |
|
129 | 129 | echo % atom-log with basedir / |
|
130 | 130 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \ |
|
131 |
| grep '<link' | sed 's|//[.a-zA-Z0-9 |
|
|
131 | | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
|
132 | 132 | |
|
133 | 133 | echo % rss-log with basedir / |
|
134 | 134 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \ |
|
135 |
| grep '<guid' | sed 's|//[.a-zA-Z0-9 |
|
|
135 | | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
|
136 | 136 | |
|
137 | 137 | "$TESTDIR/killdaemons.py" |
|
138 | 138 | |
|
139 | 139 | hg serve --config web.baseurl=http://hg.example.com:8080/foo/ -p $HGPORT2 -d \ |
|
140 | 140 | --pid-file=hg.pid --webdir-conf collections.conf \ |
|
141 | 141 | -A access-collections-2.log -E error-collections-2.log |
|
142 | 142 | cat hg.pid >> $DAEMON_PIDS |
|
143 | 143 | |
|
144 | 144 | echo % atom-log with basedir /foo/ |
|
145 | 145 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \ |
|
146 |
| grep '<link' | sed 's|//[.a-zA-Z0-9 |
|
|
146 | | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
|
147 | 147 | |
|
148 | 148 | echo % rss-log with basedir /foo/ |
|
149 | 149 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \ |
|
150 |
| grep '<guid' | sed 's|//[.a-zA-Z0-9 |
|
|
150 | | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|' | |
|
151 | 151 | |
|
152 | 152 | echo % paths errors 1 |
|
153 | 153 | cat error-paths-1.log |
|
154 | 154 | echo % paths errors 2 |
|
155 | 155 | cat error-paths-2.log |
|
156 | 156 | echo % paths errors 3 |
|
157 | 157 | cat error-paths-3.log |
|
158 | 158 | echo % collections errors |
|
159 | 159 | cat error-collections.log |
|
160 | 160 | echo % collections errors 2 |
|
161 | 161 | cat error-collections-2.log |
General Comments 0
You need to be logged in to leave comments.
Login now