diff options
Diffstat (limited to 'tests/test-hgwebdir.t')
-rw-r--r-- | tests/test-hgwebdir.t | 402 |
1 files changed, 33 insertions, 369 deletions
diff --git a/tests/test-hgwebdir.t b/tests/test-hgwebdir.t index 4e3a58b..f3d43fa 100644 --- a/tests/test-hgwebdir.t +++ b/tests/test-hgwebdir.t @@ -1,10 +1,3 @@ - $ "$TESTDIR/hghave" serve || exit 80 - -hide outer repo and work in dir without '.hg' - $ hg init - $ mkdir dir - $ cd dir - Tests some basic hgwebdir functionality. Tests setting up paths and collection, different forms of 404s and the subdirectory support. @@ -36,36 +29,12 @@ create a nested repository $ hg --cwd c ci -Amc -d'3 0' adding c -create a subdirectory containing repositories and subrepositories - - $ mkdir notrepo - $ cd notrepo - $ hg init e - $ echo e > e/e - $ hg --cwd e ci -Ame -d'4 0' - adding e - $ hg init e/e2 - $ echo e2 > e/e2/e2 - $ hg --cwd e/e2 ci -Ame2 -d '4 0' - adding e2 - $ hg init f - $ echo f > f/f - $ hg --cwd f ci -Amf -d'4 0' - adding f - $ hg init f/f2 - $ echo f2 > f/f2/f2 - $ hg --cwd f/f2 ci -Amf2 -d '4 0' - adding f2 - $ cd .. - create repository without .hg/store $ hg init nostore $ rm -R nostore/.hg/store $ root=`pwd` $ cd .. - -serve $ cat > paths.conf <<EOF > [paths] > a=$root/a @@ -77,7 +46,7 @@ serve should give a 404 - file does not exist - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'a/file/tip/bork?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw' 404 Not Found @@ -86,25 +55,25 @@ should give a 404 - file does not exist should succeed - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw' 200 Script output follows /a/ /b/ - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'a/file/tip/a?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw' 200 Script output follows a - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'b/file/tip/b?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw' 200 Script output follows b should give a 404 - repo is not published - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'c/file/tip/c?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw' 404 Not Found @@ -113,14 +82,14 @@ should give a 404 - repo is not published atom-log without basedir - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'a/atom-log' | grep '<link' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/atom-log' | grep '<link' <link rel="self" href="http://*:$HGPORT/a/atom-log"/> (glob) <link rel="alternate" href="http://*:$HGPORT/a/"/> (glob) <link href="http://*:$HGPORT/a/rev/8580ff50825a"/> (glob) rss-log without basedir - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'a/rss-log' | grep '<guid' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/rss-log' | grep '<guid' <guid isPermaLink="true">http://*:$HGPORT/a/rev/8580ff50825a</guid> (glob) $ cat > paths.conf <<EOF > [paths] @@ -138,7 +107,7 @@ rss-log without basedir should succeed, slashy names - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw' 200 Script output follows @@ -148,36 +117,24 @@ should succeed, slashy names /coll/a/.hg/patches/ /coll/b/ /coll/c/ - /coll/notrepo/e/ - /coll/notrepo/f/ /rcoll/a/ /rcoll/a/.hg/patches/ /rcoll/b/ /rcoll/b/d/ /rcoll/c/ - /rcoll/notrepo/e/ - /rcoll/notrepo/e/e2/ - /rcoll/notrepo/f/ - /rcoll/notrepo/f/f2/ /star/webdir/a/ /star/webdir/a/.hg/patches/ /star/webdir/b/ /star/webdir/c/ - /star/webdir/notrepo/e/ - /star/webdir/notrepo/f/ /starstar/webdir/a/ /starstar/webdir/a/.hg/patches/ /starstar/webdir/b/ /starstar/webdir/b/d/ /starstar/webdir/c/ - /starstar/webdir/notrepo/e/ - /starstar/webdir/notrepo/e/e2/ - /starstar/webdir/notrepo/f/ - /starstar/webdir/notrepo/f/f2/ /astar/ /astar/.hg/patches/ - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '?style=paper' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper' 200 Script output follows <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> @@ -258,22 +215,6 @@ should succeed, slashy names </tr> <tr class="parity0"> - <td><a href="/coll/notrepo/e/?style=paper">coll/notrepo/e</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity1"> - <td><a href="/coll/notrepo/f/?style=paper">coll/notrepo/f</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity0"> <td><a href="/rcoll/a/?style=paper">rcoll/a</a></td> <td>unknown</td> <td>Foo Bar <foo.bar@example.com></td> @@ -314,38 +255,6 @@ should succeed, slashy names </tr> <tr class="parity1"> - <td><a href="/rcoll/notrepo/e/?style=paper">rcoll/notrepo/e</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity0"> - <td><a href="/rcoll/notrepo/e/e2/?style=paper">rcoll/notrepo/e/e2</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity1"> - <td><a href="/rcoll/notrepo/f/?style=paper">rcoll/notrepo/f</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity0"> - <td><a href="/rcoll/notrepo/f/f2/?style=paper">rcoll/notrepo/f/f2</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity1"> <td><a href="/star/webdir/a/?style=paper">star/webdir/a</a></td> <td>unknown</td> <td>Foo Bar <foo.bar@example.com></td> @@ -378,22 +287,6 @@ should succeed, slashy names </tr> <tr class="parity1"> - <td><a href="/star/webdir/notrepo/e/?style=paper">star/webdir/notrepo/e</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity0"> - <td><a href="/star/webdir/notrepo/f/?style=paper">star/webdir/notrepo/f</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity1"> <td><a href="/starstar/webdir/a/?style=paper">starstar/webdir/a</a></td> <td>unknown</td> <td>Foo Bar <foo.bar@example.com></td> @@ -434,38 +327,6 @@ should succeed, slashy names </tr> <tr class="parity0"> - <td><a href="/starstar/webdir/notrepo/e/?style=paper">starstar/webdir/notrepo/e</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity1"> - <td><a href="/starstar/webdir/notrepo/e/e2/?style=paper">starstar/webdir/notrepo/e/e2</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity0"> - <td><a href="/starstar/webdir/notrepo/f/?style=paper">starstar/webdir/notrepo/f</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity1"> - <td><a href="/starstar/webdir/notrepo/f/f2/?style=paper">starstar/webdir/notrepo/f/f2</a></td> - <td>unknown</td> - <td>Foo Bar <foo.bar@example.com></td> - <td class="age">*</td> (glob) - <td class="indexlinks"></td> - </tr> - - <tr class="parity0"> <td><a href="/astar/?style=paper">astar</a></td> <td>unknown</td> <td>Foo Bar <foo.bar@example.com></td> @@ -490,19 +351,19 @@ should succeed, slashy names </body> </html> - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 't?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw' 200 Script output follows /t/a/ - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 't/?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw' 200 Script output follows /t/a/ - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 't/?style=paper' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=paper' 200 Script output follows <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> @@ -551,7 +412,7 @@ should succeed, slashy names </body> </html> - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 't/a?style=atom' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' 200 Script output follows <?xml version="1.0" encoding="ascii"?> @@ -581,7 +442,7 @@ should succeed, slashy names </entry> </feed> - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 't/a/?style=atom' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' 200 Script output follows <?xml version="1.0" encoding="ascii"?> @@ -611,14 +472,14 @@ should succeed, slashy names </entry> </feed> - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 't/a/file/tip/a?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw' 200 Script output follows a Test [paths] '*' extension - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'coll/?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/?style=raw' 200 Script output follows @@ -626,60 +487,15 @@ Test [paths] '*' extension /coll/a/.hg/patches/ /coll/b/ /coll/c/ - /coll/notrepo/e/ - /coll/notrepo/f/ - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'coll/a/file/tip/a?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/a/file/tip/a?style=raw' 200 Script output follows a Test [paths] '**' extension - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/?style=raw' - 200 Script output follows - - - /rcoll/a/ - /rcoll/a/.hg/patches/ - /rcoll/b/ - /rcoll/b/d/ - /rcoll/c/ - /rcoll/notrepo/e/ - /rcoll/notrepo/e/e2/ - /rcoll/notrepo/f/ - /rcoll/notrepo/f/f2/ - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/b/d/file/tip/d?style=raw' - 200 Script output follows - - d - -Test collapse = True - - $ "$TESTDIR/killdaemons.py" - $ cat >> paths.conf <<EOF - > [web] - > collapse=true - > EOF - $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ - > -A access-paths.log -E error-paths-3.log - $ cat hg.pid >> $DAEMON_PIDS - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'coll/?style=raw' - 200 Script output follows - - - /coll/a/ - /coll/a/.hg/patches/ - /coll/b/ - /coll/c/ - /coll/notrepo/ - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'coll/a/file/tip/a?style=raw' - 200 Script output follows - - a - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw' 200 Script output follows @@ -688,97 +504,12 @@ Test collapse = True /rcoll/b/ /rcoll/b/d/ /rcoll/c/ - /rcoll/notrepo/ - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/b/d/file/tip/d?style=raw' - 200 Script output follows - - d - -Test intermediate directories - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/notrepo/?style=raw' - 200 Script output follows - - - /rcoll/notrepo/e/ - /rcoll/notrepo/e/e2/ - /rcoll/notrepo/f/ - /rcoll/notrepo/f/f2/ - - -Test repositories inside intermediate directories - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/notrepo/e/file/tip/e?style=raw' - 200 Script output follows - - e - -Test subrepositories inside intermediate directories - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/notrepo/f/f2/file/tip/f2?style=raw' - 200 Script output follows - - f2 - -Test descend = False - - $ "$TESTDIR/killdaemons.py" - $ cat >> paths.conf <<EOF - > descend=false - > EOF - $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ - > -A access-paths.log -E error-paths-4.log - $ cat hg.pid >> $DAEMON_PIDS - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'coll/?style=raw' - 200 Script output follows - - - /coll/a/ - /coll/b/ - /coll/c/ - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'coll/a/file/tip/a?style=raw' - 200 Script output follows - - a - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/?style=raw' - 200 Script output follows - - - /rcoll/a/ - /rcoll/b/ - /rcoll/c/ - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/b/d/file/tip/d?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/b/d/file/tip/d?style=raw' 200 Script output follows d -Test intermediate directories - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/notrepo/?style=raw' - 200 Script output follows - - - /rcoll/notrepo/e/ - /rcoll/notrepo/f/ - - -Test repositories inside intermediate directories - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/notrepo/e/file/tip/e?style=raw' - 200 Script output follows - - e - -Test subrepositories inside intermediate directories - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 'rcoll/notrepo/f/f2/file/tip/f2?style=raw' - 200 Script output follows - - f2 - Test [paths] '*' in a repo root $ hg id http://localhost:$HGPORT1/astar @@ -790,67 +521,22 @@ Test [paths] '*' in a repo root > t/a = $root/a > t/b = $root/b > c = $root/c - > EOF - $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ - > -A access-paths.log -E error-paths-5.log - $ cat hg.pid >> $DAEMON_PIDS - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '?style=raw' - 200 Script output follows - - - /t/a/ - /t/b/ - /c/ - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 't/?style=raw' - 200 Script output follows - - - /t/a/ - /t/b/ - - -Test collapse = True - - $ "$TESTDIR/killdaemons.py" - $ cat >> paths.conf <<EOF > [web] - > collapse=true + > descend=false > EOF $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ - > -A access-paths.log -E error-paths-6.log + > -A access-paths.log -E error-paths-3.log $ cat hg.pid >> $DAEMON_PIDS - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '?style=raw' - 200 Script output follows - - - /t/ - /c/ - - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 't/?style=raw' - 200 Script output follows - - - /t/a/ - /t/b/ - test descend = False - $ "$TESTDIR/killdaemons.py" - $ cat >> paths.conf <<EOF - > descend=false - > EOF - $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ - > -A access-paths.log -E error-paths-7.log - $ cat hg.pid >> $DAEMON_PIDS - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw' 200 Script output follows /c/ - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 't/?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw' 200 Script output follows @@ -864,12 +550,12 @@ test descend = False > inexistent = $root/inexistent > EOF $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ - > -A access-paths.log -E error-paths-8.log + > -A access-paths.log -E error-paths-4.log $ cat hg.pid >> $DAEMON_PIDS test inexistent and inaccessible repo should be ignored silently - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/' 200 Script output follows <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> @@ -921,7 +607,7 @@ test inexistent and inaccessible repo should be ignored silently collections: should succeed - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw' 200 Script output follows @@ -929,32 +615,30 @@ collections: should succeed /a/.hg/patches/ /b/ /c/ - /notrepo/e/ - /notrepo/f/ - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 'a/file/tip/a?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw' 200 Script output follows a - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 'b/file/tip/b?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw' 200 Script output follows b - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 'c/file/tip/c?style=raw' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw' 200 Script output follows c atom-log with basedir / - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 'a/atom-log' | grep '<link' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' | grep '<link' <link rel="self" href="http://hg.example.com:8080/a/atom-log"/> <link rel="alternate" href="http://hg.example.com:8080/a/"/> <link href="http://hg.example.com:8080/a/rev/8580ff50825a"/> rss-log with basedir / - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 'a/rss-log' | grep '<guid' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' | grep '<guid' <guid isPermaLink="true">http://hg.example.com:8080/a/rev/8580ff50825a</guid> $ "$TESTDIR/killdaemons.py" $ hg serve --config web.baseurl=http://hg.example.com:8080/foo/ -p $HGPORT2 -d \ @@ -964,14 +648,14 @@ rss-log with basedir / atom-log with basedir /foo/ - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 'a/atom-log' | grep '<link' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' | grep '<link' <link rel="self" href="http://hg.example.com:8080/foo/a/atom-log"/> <link rel="alternate" href="http://hg.example.com:8080/foo/a/"/> <link href="http://hg.example.com:8080/foo/a/rev/8580ff50825a"/> rss-log with basedir /foo/ - $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 'a/rss-log' | grep '<guid' + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' | grep '<guid' <guid isPermaLink="true">http://hg.example.com:8080/foo/a/rev/8580ff50825a</guid> paths errors 1 @@ -986,26 +670,6 @@ paths errors 3 $ cat error-paths-3.log -paths errors 4 - - $ cat error-paths-4.log - -paths errors 5 - - $ cat error-paths-5.log - -paths errors 6 - - $ cat error-paths-6.log - -paths errors 7 - - $ cat error-paths-7.log - -paths errors 8 - - $ cat error-paths-8.log - collections errors $ cat error-collections.log |