##// END OF EJS Templates
hgweb: make paths wildcards expanding in a repo root match repo correctly...
Mads Kiilerich -
r13403:8ed91088 default
parent child Browse files
Show More
@@ -41,16 +41,14 b' def urlrepos(prefix, roothead, paths):'
41 """yield url paths and filesystem paths from a list of repo paths
41 """yield url paths and filesystem paths from a list of repo paths
42
42
43 >>> list(urlrepos('hg', '/opt', ['/opt/r', '/opt/r/r', '/opt']))
43 >>> list(urlrepos('hg', '/opt', ['/opt/r', '/opt/r/r', '/opt']))
44 [('hg/r', '/opt/r'), ('hg/r/r', '/opt/r/r'), ('hg/', '/opt')]
44 [('hg/r', '/opt/r'), ('hg/r/r', '/opt/r/r'), ('hg', '/opt')]
45 >>> list(urlrepos('', '/opt', ['/opt/r', '/opt/r/r', '/opt']))
45 >>> list(urlrepos('', '/opt', ['/opt/r', '/opt/r/r', '/opt']))
46 [('r', '/opt/r'), ('r/r', '/opt/r/r'), ('', '/opt')]
46 [('r', '/opt/r'), ('r/r', '/opt/r/r'), ('', '/opt')]
47 """
47 """
48 for path in paths:
48 for path in paths:
49 path = os.path.normpath(path)
49 path = os.path.normpath(path)
50 name = util.pconvert(path[len(roothead):]).strip('/')
50 yield (prefix + '/' +
51 if prefix:
51 util.pconvert(path[len(roothead):]).lstrip('/')).strip('/'), path
52 name = prefix + '/' + name
53 yield name, path
54
52
55 class hgwebdir(object):
53 class hgwebdir(object):
56 refreshinterval = 20
54 refreshinterval = 20
@@ -99,6 +99,7 b' rss-log without basedir'
99 > rcoll=$root/**
99 > rcoll=$root/**
100 > star=*
100 > star=*
101 > starstar=**
101 > starstar=**
102 > astar=webdir/a/*
102 > EOF
103 > EOF
103 $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
104 $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
104 > -A access-paths.log -E error-paths-2.log
105 > -A access-paths.log -E error-paths-2.log
@@ -130,6 +131,8 b' should succeed, slashy names'
130 /starstar/webdir/b/
131 /starstar/webdir/b/
131 /starstar/webdir/b/d/
132 /starstar/webdir/b/d/
132 /starstar/webdir/c/
133 /starstar/webdir/c/
134 /astar/
135 /astar/.hg/patches/
133
136
134 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper'
137 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper'
135 200 Script output follows
138 200 Script output follows
@@ -322,6 +325,22 b' should succeed, slashy names'
322 <td class="indexlinks"></td>
325 <td class="indexlinks"></td>
323 </tr>
326 </tr>
324
327
328 <tr class="parity0">
329 <td><a href="/astar/?style=paper">astar</a></td>
330 <td>unknown</td>
331 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
332 <td class="age">* ago</td> (glob)
333 <td class="indexlinks"></td>
334 </tr>
335
336 <tr class="parity1">
337 <td><a href="/astar/.hg/patches/?style=paper">astar/.hg/patches</a></td>
338 <td>unknown</td>
339 <td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td>
340 <td class="age">* ago</td> (glob)
341 <td class="indexlinks"></td>
342 </tr>
343
325 </table>
344 </table>
326 </div>
345 </div>
327 </div>
346 </div>
@@ -470,7 +489,7 b" Test [paths] '*' extension"
470
489
471 a
490 a
472
491
473 est [paths] '**' extension
492 Test [paths] '**' extension
474
493
475 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw'
494 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw'
476 200 Script output follows
495 200 Script output follows
@@ -486,6 +505,12 b" est [paths] '**' extension"
486 200 Script output follows
505 200 Script output follows
487
506
488 d
507 d
508
509 Test [paths] '*' in a repo root
510
511 $ hg id http://localhost:$HGPORT1/astar
512 8580ff50825a
513
489 $ "$TESTDIR/killdaemons.py"
514 $ "$TESTDIR/killdaemons.py"
490 $ cat > paths.conf <<EOF
515 $ cat > paths.conf <<EOF
491 > [paths]
516 > [paths]
General Comments 0
You need to be logged in to leave comments. Login now